guile-user
[Top][All Lists]
Advanced

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

Re: No gh_set_x()?


From: Steven G. Johnson
Subject: Re: No gh_set_x()?
Date: Mon, 16 Jul 2001 22:33:40 -0400 (EDT)

If it's useful, here is some code I wrote to do set! from C...it worked in
Guile 1.3, although I haven't tested it recently.  One can probably come
up with something cleaner.

static SCM my_symbol_set_x(char *name, SCM v)
{
     /* code swiped from scm_symbol_value0 and scm_symbol_set_x */
     SCM symbol = scm_intern_obarray_soft(name, strlen (name),
                                          scm_symhash, 0);
     SCM vcell = scm_sym2vcell (SCM_CAR (symbol),
                                SCM_CDR (scm_top_level_lookup_closure_var),
                                SCM_BOOL_F);
     if (SCM_FALSEP (vcell))
          return SCM_UNDEFINED;
     SCM_SETCDR (vcell, v);
     return SCM_UNSPECIFIED;
}

In Guile 1.1 and Guile 1.2 I used scm_symbol_set_x(SCM_BOOL_F, var,
value), but this stopped working in Guile 1.3 because of the module system
(which will hopefully be documented someday); I couldn't figure out what
to pass for the first parameter.

Steven





reply via email to

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