From: Catonano <catonano@gmail.com>
To: Matt Wette <matt.wette@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: type friction C <-> scheme
Date: Sun, 11 Jun 2017 20:20:24 +0200 [thread overview]
Message-ID: <CAJ98PDx4ap=iRJM26NmNjGS9tG28F2gLFJX=Xk_dRge8k3FPYQ@mail.gmail.com> (raw)
In-Reply-To: <8D9D11EA-92C0-4129-80D3-1962A3AC383B@gmail.com>
Matt,
thank you for spending some time on this
2017-06-11 20:01 GMT+02:00 Matt Wette <matt.wette@gmail.com>:
>
> > On Jun 9, 2017, at 1:36 PM, Catonano <catonano@gmail.com> wrote:
> >
> > Here we go again
> >
> > After successfully wrapping freexl_open, I can't do the same with
> > freexl_get_info
>
> Note that my fyi-helper is not working yet, but here is the current output
> if I feed it freexl.h
>
> ;;
> ;; auto-generated by ffi-help.scm
> ;;
>
> (define-module (freexl)
> #:use-module (ffi-help)
> #:use-module ((system foreign) #:prefix ffi:)
> #:use-module ((bytestructures guile) #:prefix bs:)
> )
> (define bs:struct bs:bs:struct)
>
> (define lib-link (dynamic-link #f))
> (define (lib-func name) (dynamic-func name lib-link))
>
> ;; (struct . "FreeXL_CellValue_str")
> ;; ... failed.
>
> ;; "FreeXL_CellValue"
>
> ;; typedef struct FreeXL_CellValue_str FreeXL_CellValue;
> (define-std-pointer-wrapper FreeXL_CellValue*)
>
> ;; "freexl_version"
>
> ;; extern const char *freexl_version(void);
> (define freexl_version
> (let ((f (ffi:pointer->procedure
> '*
> (lib-func "freexl_version")
> (list))))
> (lambda () (let () (identity (f))))))
> (export freexl_version)
>
> ;; "freexl_open"
>
> ;; extern int freexl_open(const char *path, const void **xls_handle);
> (define freexl_open
> (let ((f (ffi:pointer->procedure
> ffi:int
> (lib-func "freexl_open")
> (list '* '*))))
> (lambda (path xls_handle)
> (let ((~path (identity path))
> (~xls_handle (identity xls_handle)))
> (f ~path ~xls_handle)))))
> (export freexl_open)
>
Ok, my version of fffreexl_open does work
>
> ;; "freexl_open_info"
>
> ;; extern int freexl_open_info(const char *path, const void **xls_handle);
> (define freexl_open_info
>
> ;; "freexl_close"
>
> ;; extern int freexl_close(const void *xls_handle);
> (define freexl_close
>
I didn't attempt ffrexxl_open_info and frexxl_close yet
>
> ;; "freexl_get_info"
>
> ;; extern int freexl_get_info(const void *xls_handle, unsigned short what,
> ;; unsigned int *info);
> (define freexl_get_info
> (let ((f (ffi:pointer->procedure
> ffi:int
> (lib-func "freexl_get_info")
> (list '* ffi:unsigned-short '*))))
> (lambda (xls_handle what info)
> (let ((~xls_handle (identity xls_handle))
> (~info (identity info)))
> (f ~xls_handle what ~info)))))
> (export freexl_get_info)
>
this doesn't seem so different from what I did
I shoul try to call this one iin the REPL and see what happens
Thanks, I'll let you know
next prev parent reply other threads:[~2017-06-11 18:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 20:36 type friction C <-> scheme Catonano
2017-06-09 20:52 ` Mike Gran
2017-06-09 21:33 ` Catonano
2017-06-09 20:56 ` Matt Wette
2017-06-09 21:39 ` Catonano
2017-06-09 22:33 ` Matt Wette
2017-06-10 6:26 ` Catonano
2017-06-11 5:50 ` Mark H Weaver
2017-06-11 13:07 ` Matt Wette
2017-06-11 17:15 ` Catonano
2017-06-11 18:01 ` Matt Wette
2017-06-11 18:20 ` Catonano [this message]
2017-06-12 8:00 ` David Pirotte
2017-06-12 12:45 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJ98PDx4ap=iRJM26NmNjGS9tG28F2gLFJX=Xk_dRge8k3FPYQ@mail.gmail.com' \
--to=catonano@gmail.com \
--cc=guile-user@gnu.org \
--cc=matt.wette@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).