From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.devel Subject: Re: ffi-helper: status Date: Mon, 10 Jul 2017 19:49:12 -0700 Message-ID: <4B3AF9A3-C690-465C-AE54-D6E4DBA066FB@gmail.com> References: <0EB36A0A-DB92-4007-8906-3C8953045E69@gmail.com> <30D395AD-3130-469D-AF9A-67F735852ACB@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1499741369 12808 195.159.176.226 (11 Jul 2017 02:49:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Jul 2017 02:49:29 +0000 (UTC) Cc: guile-devel To: Matt Wette Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 11 04:49:25 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUlEq-00034B-9Z for guile-devel@m.gmane.org; Tue, 11 Jul 2017 04:49:24 +0200 Original-Received: from localhost ([::1]:43855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUlEv-0004lY-N5 for guile-devel@m.gmane.org; Mon, 10 Jul 2017 22:49:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUlEo-0004lD-54 for guile-devel@gnu.org; Mon, 10 Jul 2017 22:49:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUlEl-0004ZM-1l for guile-devel@gnu.org; Mon, 10 Jul 2017 22:49:22 -0400 Original-Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]:33938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUlEk-0004Y3-SN for guile-devel@gnu.org; Mon, 10 Jul 2017 22:49:18 -0400 Original-Received: by mail-pg0-x22a.google.com with SMTP id t186so59149483pgb.1 for ; Mon, 10 Jul 2017 19:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oCu0oTtbl8vAMXGJqTqPzre7liweFCG+89CE095hkPs=; b=Fr6I6nf+ri99JnYjfVHdT3cexo2XPc+nKWoFBxv0//sFGkScrP8zOvdVsOcGthsOVx TItRV6FnH0dmDeiwgMIBxNeElBpiuNP6opgCzf/WZzwxFHCUy4sNmf0qPfWJe6sqUsbI T5KUdJSOHxIftdN7wvkvbSE5B//NEs68HVBLqi7DfBw+aReGU8M+iu+R/5ydWTDHxSbh AUjEPw7FdwT4nMfl0+5DAIr5/dhWHMDF5T3E4K828xGgJ6kqFUQ5jMirxF+tynxlNe66 GO+pq8zvOCGj5zODPmXz4s3aQp2VJnGFHJoh1hHEGCfB5rViLcGQHe6fS5lCrypHG1BR wy1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oCu0oTtbl8vAMXGJqTqPzre7liweFCG+89CE095hkPs=; b=W7nOBNU0IJ5QvJDFbH919S02cczey6JYS5PLcQSK09M2ApAA0DS153zcul8O8yBCts xN+fTtbbKi9XyYlDIdrNl/MrcW13pU1/I1RnYTDZLrtAV5sQPRcFl9C+O4rYHOPXPZUJ U/LVxDMxZJdVp2qfnfizEkncKk5g831+xoxvnYEI4nIgvUPEBgT9/5FaK25LO1TqLf/n k7Qvrp4ivIlCgv86HwsrQZdpb64Z9BfGGwPs86WdhNdflAU3qWkJT2uSuO/KuSfQ5qRK PsbQvduYuzeoRtwanN71TZAswri3t+A6cPh6abYCAwADR+oeCqurKJD2ubTM+9JLsknk eQGw== X-Gm-Message-State: AIVw113b7KzkfUPSuYX8G7ZSC0o/gx5R0obl4XJeSkl7r7HHAoJzEWNB fKsXll20nNKxhA== X-Received: by 10.98.216.193 with SMTP id e184mr47109808pfg.46.1499741355909; Mon, 10 Jul 2017 19:49:15 -0700 (PDT) Original-Received: from nautilus.championbroadband.com (216-165-236-44.championbroadband.com. [216.165.236.44]) by smtp.gmail.com with ESMTPSA id d70sm33136320pga.49.2017.07.10.19.49.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 19:49:14 -0700 (PDT) In-Reply-To: <30D395AD-3130-469D-AF9A-67F735852ACB@gmail.com> X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22a X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19245 Archived-At: > On Jul 7, 2017, at 5:31 PM, Matt Wette wrote: >=20 >=20 >> On Jul 7, 2017, at 5:18 PM, Matt Wette wrote: >> However, the above generates 397 FFI declarations into a cairo.scm = file which is about 6000 lines long. I=E2=80=99m not=20 >> sure if I want to start testing this code or start converting = suggestions and have guile-users do some testing. =20 >=20 > That is, for this example, I no longer run into declarations which my = code says =E2=80=9Cfailed,=E2=80=9D indicating that it didn=E2=80=99t = know what to do with the declaration. >=20 > I already notice that the function types converters should be called = =E2=80=9Cunwrap=E2=80=9D and that they should be called by the procedure = interface. I am going to start playing with cairo_set_user_data to see = if passed procedures work.=20 Another working demo: mwette$ guile exam.d/cairo02.scm d1 called with ((abc . 123) (def . 456)) mwette$ cat exam.d/cairo02.scm ;; exam.d/cairo02.scm (use-modules (cairo cairo)) ; auto-generated from cairo.h = etc (use-modules (ffi-help-rt)) ; pointer-to (use-modules (system foreign)) ; string->pointer, pointer<->scm (define srf (cairo_svg_surface_create (string->pointer "abc.svg") 200.0 = 200.0)) (define cr (cairo_create srf)) ;; typedef struct _cairo_user_data_key { ;; int unused; ;; } cairo_user_data_key_t; ;; ;; typedef void (*cairo_destroy_func_t)(void *data); ;; ;; cairo_status_t cairo_set_user_data(cairo_t *cr, const = cairo_user_data_key_t ;; *key, void *user_data, cairo_destroy_func_t destroy); (define k1 (make-cairo_user_data_key_t)) ; make a key (define v1 '((abc . 123) (def . 456))) ; make some data (define (d1 data) ; callback (simple-format #t "d1 called with ~S\n" (pointer->scm data))) =20 (cairo_set_user_data cr (pointer-to k1) (scm->pointer v1) d1) (cairo_destroy cr) (cairo_surface_destroy srf) ;; --- last line ---