This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gh_ conversion between C strings and Scheme objects


Westley A Sherman <wsherman@umich.edu> writes:

> I've been looking into using Guile as the method for selecting atoms in a
> small molecular graphics program I'm writing. I was thinking I would
> provide a window with a very simple text editor for entering and
> evaluating Guile expressions. I wrote the text editor in C so I need to be
> able to "convert" C strings to SCM objects and vice versa. I could use the
> following functions but I'm wondering if there are either gh_ functions
> which do the same thing or there's another better way?

gh_str20scm(char *str) will do C->scheme 
(gh_str2scm(char *str, int length) if you want to specify the length).

gh_scm2chars(SCM obj, char *m) will go from scheme->c (malloc's a new
string if m==NULL).

-- 
Greg