Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: module non-loading



I wrote:

> This patch tries to make modules behave the same independent of the
> way they are made available: linked in or dynamically loaded.

Two small additions/fixes:

- In a static shell, trying to load an unknown module should produce a 
  error message.
- bltinmods.list should contain #ifdef-DYNAMICs for the sake of static 
  shells (so that the autoload stuff for not linked-in modules isn't
  added by them).

The zshxmods.h stuff (the #ifdef stuff in init.c) looks ok, btw. But
it looks like shooting sparrows with cannons (is this a proverb in
English, too?). All the mess could be replaced with just the variable
definitions and a bit of setup code that just look if the zle module
is available (by looking if the bindkey builtin is made autoloaded
from a module named zle or something). Or we just make one of the
scripts look out for the zle module on the fly. Hm.

Bye
 Sven

diff -u oldsrc/mkbltnmlst.sh Src/mkbltnmlst.sh
--- oldsrc/mkbltnmlst.sh	Wed Nov 24 17:07:10 1999
+++ Src/mkbltnmlst.sh	Thu Nov 25 09:08:26 1999
@@ -20,7 +20,16 @@
 exec > $1
 
 for x_mod in $x_mods; do
-    echo "/* non-linked-in known module \`$x_mod' */"
+    case "$bin_mods" in
+    *" $x_mod "*)
+        echo "/* linked-in known module \`$x_mod' */"
+	linked=yes
+	;;
+    *)
+        echo "#ifdef DYNAMIC"
+        echo "/* non-linked-in known module \`$x_mod' */"
+	linked=no
+    esac
     eval "loc=\$loc_$x_mod"
     unset moddeps autobins autoinfixconds autoprefixconds autoparams
     unset automathfuncs
@@ -43,6 +52,7 @@
     for dep in $moddeps; do
 	echo "    add_dep(\"$x_mod\", \"$dep\");"
     done
+    test "x$linked" = xno && echo "#endif"
 done
 
 echo
diff -u oldsrc/module.c Src/module.c
--- oldsrc/module.c	Wed Nov 24 17:06:24 1999
+++ Src/module.c	Thu Nov 25 09:28:14 1999
@@ -444,6 +444,8 @@
 static void *
 do_load_module(char const *name)
 {
+    zerr("failed to load module: %s", name, 0);
+
     return NULL;
 }
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author