From: Matt Wette <matt.wette@gmail.com>
To: Catonano <catonano@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: type friction C <-> scheme
Date: Sun, 11 Jun 2017 11:01:40 -0700 [thread overview]
Message-ID: <8D9D11EA-92C0-4129-80D3-1962A3AC383B@gmail.com> (raw)
In-Reply-To: <CAJ98PDwUA483QdtADZqafwKOmBE992e9FjQ0yctSyOd2zxTPbg@mail.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)
;; "freexl_open_info"
;; extern int freexl_open_info(const char *path, const void **xls_handle);
(define freexl_open_info
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_open_info")
(list '* '*))))
(lambda (path xls_handle)
(let ((~path (identity path))
(~xls_handle (identity xls_handle)))
(f ~path ~xls_handle)))))
(export freexl_open_info)
;; "freexl_close"
;; extern int freexl_close(const void *xls_handle);
(define freexl_close
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_close")
(list '*))))
(lambda (xls_handle)
(let ((~xls_handle (identity xls_handle)))
(f ~xls_handle)))))
(export freexl_close)
;; "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)
;; "freexl_get_worksheet_name"
;; extern int freexl_get_worksheet_name(const void *xls_handle, unsigned short
;; sheet_index, const char **string);
(define freexl_get_worksheet_name
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_get_worksheet_name")
(list '* ffi:unsigned-short '*))))
(lambda (xls_handle sheet_index string)
(let ((~xls_handle (identity xls_handle))
(~string (identity string)))
(f ~xls_handle sheet_index ~string)))))
(export freexl_get_worksheet_name)
;; "freexl_select_active_worksheet"
;; extern int freexl_select_active_worksheet(const void *xls_handle,
;; unsigned short sheet_index);
(define freexl_select_active_worksheet
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_select_active_worksheet")
(list '* ffi:unsigned-short))))
(lambda (xls_handle sheet_index)
(let ((~xls_handle (identity xls_handle)))
(f ~xls_handle sheet_index)))))
(export freexl_select_active_worksheet)
;; "freexl_get_active_worksheet"
;; extern int freexl_get_active_worksheet(const void *xls_handle,
;; unsigned short *sheet_index);
(define freexl_get_active_worksheet
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_get_active_worksheet")
(list '* '*))))
(lambda (xls_handle sheet_index)
(let ((~xls_handle (identity xls_handle))
(~sheet_index (identity sheet_index)))
(f ~xls_handle ~sheet_index)))))
(export freexl_get_active_worksheet)
;; "freexl_worksheet_dimensions"
;; extern int freexl_worksheet_dimensions(const void *xls_handle, unsigned int
;; *rows, unsigned short *columns);
(define freexl_worksheet_dimensions
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_worksheet_dimensions")
(list '* '* '*))))
(lambda (xls_handle rows columns)
(let ((~xls_handle (identity xls_handle))
(~rows (identity rows))
(~columns (identity columns)))
(f ~xls_handle ~rows ~columns)))))
(export freexl_worksheet_dimensions)
;; "freexl_get_SST_string"
;; extern int freexl_get_SST_string(const void *xls_handle, unsigned short
;; string_index, const char **string);
(define freexl_get_SST_string
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_get_SST_string")
(list '* ffi:unsigned-short '*))))
(lambda (xls_handle string_index string)
(let ((~xls_handle (identity xls_handle))
(~string (identity string)))
(f ~xls_handle string_index ~string)))))
(export freexl_get_SST_string)
;; "freexl_get_FAT_entry"
;; extern int freexl_get_FAT_entry(const void *xls_handle, unsigned int
;; sector_index, unsigned int *next_sector_index);
(define freexl_get_FAT_entry
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_get_FAT_entry")
(list '* ffi:unsigned-int '*))))
(lambda (xls_handle sector_index next_sector_index)
(let ((~xls_handle (identity xls_handle))
(~next_sector_index (identity next_sector_index)))
(f ~xls_handle sector_index ~next_sector_index)))))
(export freexl_get_FAT_entry)
;; "freexl_get_cell_value"
;; extern int freexl_get_cell_value(const void *xls_handle, unsigned int row,
;; unsigned short column, FreeXL_CellValue *value);
(define freexl_get_cell_value
(let ((f (ffi:pointer->procedure
ffi:int
(lib-func "freexl_get_cell_value")
(list '* ffi:unsigned-int ffi:unsigned-short '*))))
(lambda (xls_handle row column value)
(let ((~xls_handle (identity xls_handle))
(~value (unwrap-FreeXL_CellValue* value)))
(f ~xls_handle row column ~value)))))
(export freexl_get_cell_value)
;; --- last line ---
next prev parent reply other threads:[~2017-06-11 18:01 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 [this message]
2017-06-11 18:20 ` Catonano
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=8D9D11EA-92C0-4129-80D3-1962A3AC383B@gmail.com \
--to=matt.wette@gmail.com \
--cc=catonano@gmail.com \
--cc=guile-user@gnu.org \
/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).