[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] foreign record and names

From: felix winkelmann
Subject: Re: [Chicken-users] foreign record and names
Date: Tue, 15 Nov 2005 17:19:14 +0100

On 11/13/05, Pupeno <address@hidden> wrote:
> Hello,
> Is there any way to define how the selectors and setters are going to be
> called in a foreign record ? XEvent-sent_event is... well, not nice.

I have added a declaration construct to `define-foreign-record', so you
would want to do something like that:

(require-for-syntax 'srfi-13)

(define-foreign-record Some_Struct
  (rename: (compose string-downcase (cut string-translate <> "_" "-")))
  (constructor: make-some-struct)
  (destructor: free-some-struct)
  (int xCoord)
  (int yCoord) )

Which would generate:

(make-some-struct)              --> C-POINTER
(free-some-struct C-POINTER)

(some-struct-xcoord C-POINTER)  --> NUMBER
(some-struct-ycoord C-POINTER)  --> NUMBER

(some-struct-xcoord-set! C-POINTER NUMBER)
(some-struct-ycoord-set! C-POINTER NUMBER)

Attached a new version of `define-foreign-record'. Alternatively,
you can use the current darcs version (2.212).


Attachment: frecord.scm
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]