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

PATCH: 3.1.5-pws-5 + compcall: dynamic fix up



The makelistctl() call from compctl.c to handle compcall needs the
same treatment as other calls between the compctl and zle libraries.
I've also added an incompfunc test, is that correct?  It's doubly
useful because it should also ensure that makecomplistctlptr() has
been defined by loading zle.

--- Src/Zle/comp1.c.sven3	Thu Jan 28 15:12:03 1999
+++ Src/Zle/comp1.c	Thu Jan 28 15:15:15 1999
@@ -66,6 +66,8 @@
 /**/
 void (*makecomplistcallptr) _((Compctl));
 
+/**/
+void (*makecomplistctlptr) _((int));
 
 /* Hash table for completion info for commands */
  
--- Src/Zle/compctl.c.sven3	Thu Jan 28 15:12:04 1999
+++ Src/Zle/compctl.c	Thu Jan 28 15:13:06 1999
@@ -1804,8 +1804,12 @@
 static int
 bin_compcall(char *name, char **argv, char *ops, int func)
 {
-    makecomplistctl((ops['T'] ? 0 : CFN_FIRST) |
-		    (ops['D'] ? 0 : CFN_DEFAULT));
+    if (incompfunc != 1) {
+	zerrnam(name, "can only be called from completion function", NULL, 0);
+	return 1;
+    }
+    makecomplistctlptr((ops['T'] ? 0 : CFN_FIRST) |
+		       (ops['D'] ? 0 : CFN_DEFAULT));
     return 0;
 }
 
--- Src/Zle/zle_main.c.sven3	Thu Jan 28 15:13:36 1999
+++ Src/Zle/zle_main.c	Thu Jan 28 15:14:12 1999
@@ -877,6 +877,7 @@
     comp_strptr = comp_str;
     getcpatptr = getcpat;
     makecomplistcallptr = makecomplistcall;
+    makecomplistctlptr = makecomplistctl;
 
     /* initialise the thingies */
     init_thingies();
@@ -944,6 +945,7 @@
     comp_strptr = NULL;
     getcpatptr = NULL;
     makecomplistcallptr = NULL;
+    makecomplistctlptr = NULL;
 
     return 0;
 }

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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