This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: Accessing Scheme lists in C?
- To: ian dot pointer at btinternet dot com
- Subject: Re: Accessing Scheme lists in C?
- From: Rob Browning <rlb at cs dot utexas dot edu>
- Date: 26 Aug 2000 20:05:05 -0500
- Cc: guile at sources dot redhat dot com
- References: <XFMail.000825193542.ian.pointer@btinternet.com>
Ian Pointer <ian.pointer@btinternet.com> writes:
> Sorry if this seems to be a silly query, but I've decided to use guile as a
> scripting language to a little computer game I'm writing, and I was wondering
> just how a C function can access the contents of a list passed to it. I can't
> find anything suitable in gh.h, and the documentation I can find is rather
> vague on the subject. Thanks...
If you haven't seen it already, check out the guile-ref info pages
(not the guile info pages). If you've already included gh.h, you
should have access to many C level functions mirroring their scheme
counterparts. i.e.
- Function: SCM gh_list (SCM l0, SCM l1, ... , SCM_UNDEFINED)
- Function: SCM gh_set_car (SCM OBJ, SCM VAL)
- Function: SCM gh_set_cdr (SCM OBJ, SCM VAL)
- Function: SCM gh_car (SCM OBJ)
- Function: SCM gh_cdr (SCM OBJ)
- Function: SCM gh_c[ad][ad][ad][ad]r (SCM OBJ)
- Function: SCM gh_set_car_x(SCM PAIR, SCM VALUE)
- Function: SCM gh_set_cdr_x(SCM PAIR, SCM VALUE)
- Function: unsigned long gh_length (SCM LS)
- Function: SCM gh_append (SCM ARGS)
- Function: SCM gh_append2 (SCM L1, SCM L2)
- Function: SCM gh_append3 (SCM L1, SCM L2, L3)
- Function: SCM gh_append4 (SCM L1, SCM L2, L3, L4)
etc.
Hope this helps.
--
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930