summaryrefslogtreecommitdiff
path: root/libguile/modules.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2001-11-20 22:45:24 +0000
committerMarius Vollmer <mvo@zagadka.de>2001-11-20 22:45:24 +0000
commiteb880cef297dff7e97304d4af422bf20bbd68e5b (patch)
tree36332208ae1f56579bd6767594cbd35499567adc /libguile/modules.c
parent19a35d19d9a1cb3b2ff4e5a572837ee22175d3ae (diff)
downloadguile-eb880cef297dff7e97304d4af422bf20bbd68e5b.tar.gz
(scm_c_export): Do nothing when the first argument is
already the terminating NULL. Thanks to Han-Wen Nienhuys!
Diffstat (limited to 'libguile/modules.c')
-rw-r--r--libguile/modules.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/libguile/modules.c b/libguile/modules.c
index 554b9f141..e88ff73ea 100644
--- a/libguile/modules.c
+++ b/libguile/modules.c
@@ -176,24 +176,41 @@ scm_c_use_module (const char *name)
static SCM module_export_x_var;
+
+
+/*
+ @code{scm_c_export}(@var{name-list})
+
+ @code{scm_c_export} exports the named bindings from the current
+ module, making them visible to users of the module. This function
+ takes a list of string arguments, terminated by NULL, e.g.
+
+ @example
+ scm_c_export ("add-double-record", "bamboozle-money", NULL);
+ @end example
+*/
+
void
scm_c_export (const char *name, ...)
{
- va_list ap;
- SCM names = scm_cons (scm_str2symbol (name), SCM_EOL);
- SCM *tail = SCM_CDRLOC (names);
- va_start (ap, name);
- while (1)
+ if (name)
{
- const char *n = va_arg (ap, const char *);
- if (n == NULL)
- break;
- *tail = scm_cons (scm_str2symbol (n), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
+ va_list ap;
+ SCM names = scm_cons (scm_str2symbol (name), SCM_EOL);
+ SCM *tail = SCM_CDRLOC (names);
+ va_start (ap, name);
+ while (1)
+ {
+ const char *n = va_arg (ap, const char *);
+ if (n == NULL)
+ break;
+ *tail = scm_cons (scm_str2symbol (n), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
+ va_end (ap);
+ scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
+ scm_current_module (), names);
}
- va_end (ap);
- scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
- scm_current_module (), names);
}
/* Environments */