From a3fc3be99d9d2725be75f59d55a4f8d58a1d0792 Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Tue, 12 Dec 2000 14:07:06 +0000 Subject: [PATCH] * Make the creation of bindings more straightforward. --- libguile/ChangeLog | 8 ++++++++ libguile/hooks.c | 3 +-- libguile/script.c | 5 +---- libguile/snarf.h | 8 ++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 9485de2cc..090653efa 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,11 @@ +2000-12-12 Dirk Herrmann + + * 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 * hash.[ch] (scm_string_hash), symbols.[ch] (scm_string_hash): diff --git a/libguile/hooks.c b/libguile/hooks.c index 57fce99a6..47437f7e9 100644 --- a/libguile/hooks.c +++ b/libguile/hooks.c @@ -200,9 +200,8 @@ SCM_SYMBOL (symbol_name, "name"); SCM 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_SETCDR (vcell, hook); + scm_sysintern (name, hook); scm_set_object_property_x (hook, symbol_name, scm_makfrom0str (name)); scm_protect_object (hook); return hook; diff --git a/libguile/script.c b/libguile/script.c index e031991d4..7bbc51aec 100644 --- a/libguile/script.c +++ b/libguile/script.c @@ -578,10 +578,7 @@ scm_compile_shell_switches (int argc, char **argv) scm_set_program_arguments (argc ? argc - i : 0, argv + i, argv0); /* If the --emacs switch was set, now is when we process it. */ - { - SCM vcell = scm_sysintern0_no_module_lookup ("use-emacs-interface"); - SCM_SETCDR (vcell, SCM_BOOL(use_emacs_interface)); - } + scm_sysintern ("use-emacs-interface", SCM_BOOL (use_emacs_interface)); /* Handle the `-e' switch, if it was specified. */ if (!SCM_NULLP (entry_point)) diff --git a/libguile/snarf.h b/libguile/snarf.h index e3d2d331d..436454427 100644 --- a/libguile/snarf.h +++ b/libguile/snarf.h @@ -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) \ 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) \ 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) \ 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) \ 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) \ SCM_VCELL_INIT(c_name, scheme_name, scm_long2num(value))