1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-29 08:20:20 +02:00

* Make the creation of bindings more straightforward.

This commit is contained in:
Dirk Herrmann 2000-12-12 14:07:06 +00:00
parent ba3932579c
commit a3fc3be99d
4 changed files with 14 additions and 10 deletions

View file

@ -1,3 +1,11 @@
2000-12-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
* hooks.c (scm_create_hook), script.c
(scm_compile_shell_switches), snarf.h (SCM_VCELL,
SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT): Create
a binding in one go (instead of first creating a vcell and then
setting its cdr).
2000-12-12 Dirk Herrmann <D.Herrmann@tu-bs.de> 2000-12-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
* hash.[ch] (scm_string_hash), symbols.[ch] (scm_string_hash): * hash.[ch] (scm_string_hash), symbols.[ch] (scm_string_hash):

View file

@ -200,9 +200,8 @@ SCM_SYMBOL (symbol_name, "name");
SCM SCM
scm_create_hook (const char* name, int n_args) scm_create_hook (const char* name, int n_args)
{ {
SCM vcell = scm_sysintern0 (name);
SCM hook = make_hook (SCM_MAKINUM (n_args), "scm_create_hook"); SCM hook = make_hook (SCM_MAKINUM (n_args), "scm_create_hook");
SCM_SETCDR (vcell, hook); scm_sysintern (name, hook);
scm_set_object_property_x (hook, symbol_name, scm_makfrom0str (name)); scm_set_object_property_x (hook, symbol_name, scm_makfrom0str (name));
scm_protect_object (hook); scm_protect_object (hook);
return hook; return hook;

View file

@ -578,10 +578,7 @@ scm_compile_shell_switches (int argc, char **argv)
scm_set_program_arguments (argc ? argc - i : 0, argv + i, argv0); scm_set_program_arguments (argc ? argc - i : 0, argv + i, argv0);
/* If the --emacs switch was set, now is when we process it. */ /* If the --emacs switch was set, now is when we process it. */
{ scm_sysintern ("use-emacs-interface", SCM_BOOL (use_emacs_interface));
SCM vcell = scm_sysintern0_no_module_lookup ("use-emacs-interface");
SCM_SETCDR (vcell, SCM_BOOL(use_emacs_interface));
}
/* Handle the `-e' switch, if it was specified. */ /* Handle the `-e' switch, if it was specified. */
if (!SCM_NULLP (entry_point)) if (!SCM_NULLP (entry_point))

View file

@ -169,19 +169,19 @@ SCM_SNARF_INIT(c_name = scm_permanent_object (scm_c_make_keyword (scheme_name)))
#define SCM_VCELL(c_name, scheme_name) \ #define SCM_VCELL(c_name, scheme_name) \
SCM_SNARF_HERE(static SCM c_name) \ SCM_SNARF_HERE(static SCM c_name) \
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_intern0 (scheme_name)); SCM_SETCDR (c_name, SCM_BOOL_F)) SCM_SNARF_INIT(c_name = scm_permanent_object (scm_sysintern (scheme_name, SCM_BOOL_F));)
#define SCM_GLOBAL_VCELL(c_name, scheme_name) \ #define SCM_GLOBAL_VCELL(c_name, scheme_name) \
SCM_SNARF_HERE(SCM c_name) \ SCM_SNARF_HERE(SCM c_name) \
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_intern0 (scheme_name)); SCM_SETCDR (c_name, SCM_BOOL_F)) SCM_SNARF_INIT(c_name = scm_permanent_object (scm_sysintern (scheme_name, SCM_BOOL_F));)
#define SCM_VCELL_INIT(c_name, scheme_name, init_val) \ #define SCM_VCELL_INIT(c_name, scheme_name, init_val) \
SCM_SNARF_HERE(static SCM c_name) \ SCM_SNARF_HERE(static SCM c_name) \
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_intern0 (scheme_name)); SCM_SETCDR (c_name, init_val)) SCM_SNARF_INIT(c_name = scm_permanent_object (scm_sysintern (scheme_name, init_val));)
#define SCM_GLOBAL_VCELL_INIT(c_name, scheme_name, init_val) \ #define SCM_GLOBAL_VCELL_INIT(c_name, scheme_name, init_val) \
SCM_SNARF_HERE(SCM c_name) \ SCM_SNARF_HERE(SCM c_name) \
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_intern0 (scheme_name)); SCM_SETCDR (c_name, init_val)) SCM_SNARF_INIT(c_name = scm_permanent_object (scm_sysintern (scheme_name, init_val));)
#define SCM_CONST_LONG(c_name, scheme_name,value) \ #define SCM_CONST_LONG(c_name, scheme_name,value) \
SCM_VCELL_INIT(c_name, scheme_name, scm_long2num(value)) SCM_VCELL_INIT(c_name, scheme_name, scm_long2num(value))