[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guile/guile-core/libguile extensions.c
From: |
Marius Vollmer |
Subject: |
guile/guile-core/libguile extensions.c |
Date: |
Mon, 04 Jun 2001 15:16:28 -0700 |
CVSROOT: /cvs
Module name: guile
Changes by: Marius Vollmer <address@hidden> 01/06/04 15:16:28
Modified files:
guile-core/libguile: extensions.c
Log message:
(scm_c_register_extension): Allow NULL as library
name.
(load_extension): Ignore NULL library names when comparing.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/extensions.c.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: guile/guile-core/libguile/extensions.c
diff -u guile/guile-core/libguile/extensions.c:1.2
guile/guile-core/libguile/extensions.c:1.3
--- guile/guile-core/libguile/extensions.c:1.2 Wed May 23 17:50:44 2001
+++ guile/guile-core/libguile/extensions.c Mon Jun 4 15:16:27 2001
@@ -59,13 +59,25 @@
static extension_t *registered_extensions;
+/* Register a LIB/INIT pair for use by `scm_load_extension'. LIB is
+ allowed to be NULL and then only INIT is used to identify the
+ registered entry. This is useful when you don't know the library
+ name (which isn't really relevant anyway in a completely linked
+ program) and you are sure that INIT is unique (which it must be for
+ static linking). Hmm, given this reasoning, what use is LIB
+ anyway?
+*/
+
void
scm_c_register_extension (const char *lib, const char *init,
void (*func) (void *), void *data)
{
extension_t *ext = scm_must_malloc (sizeof(extension_t),
"scm_register_extension");
- ext->lib = scm_must_strdup (lib);
+ if (lib)
+ ext->lib = scm_must_strdup (lib);
+ else
+ ext->lib = NULL;
ext->init = scm_must_strdup (init);
ext->func = func;
ext->data = data;
@@ -82,7 +94,7 @@
extension_t *ext;
for (ext = registered_extensions; ext; ext = ext->next)
- if (!strcmp (ext->lib, SCM_STRING_CHARS (lib))
+ if ((ext->lib == NULL || !strcmp (ext->lib, SCM_STRING_CHARS (lib)))
&& !strcmp (ext->init, SCM_STRING_CHARS (init)))
{
ext->func (ext->data);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- guile/guile-core/libguile extensions.c,
Marius Vollmer <=