[Top][All Lists]

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

Re: C structures

From: Kjetil S. Matheussen
Subject: Re: C structures
Date: Wed, 4 Jan 2006 13:10:23 -0800 (PST)

Leonardo Lopes Pereira:

I would like to know if is there any way to convert C structs to any type of 
Guile data.

SND has some neat features for doing that:


(load-from-path "eval-c.scm")

(define-ec-struct <test>
  <int> data
  <int-*> datas
  <something-else-*> somethingelse)

(define test (<test> #:data 1
                     #:datas '(2 3 4)))

(-> test data)

(-> test data 5)

(-> test data)

(-> test datas)
(2 3 4)

(-> test datas '(9 2 3 4))

(-> test datas)
(9 2 3 4)

I think there are direct support for chars, floats, ints, floats, doubles, strings and SCMs. Everything else is treated as pointers.


reply via email to

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