about summary refs log tree commit diff
path: root/Src/Zle/zle_main.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-26 15:36:10 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-26 15:36:10 +0000
commite0b26186f1d3c1a3a580eb7e8a8199c25536f4e6 (patch)
treee4247c2507fa1a135740a3cd02e7405cbdbfa69a /Src/Zle/zle_main.c
parent56f338eb8bfd4bcdbf14b495ff8a34425c3527d4 (diff)
downloadzsh-e0b26186f1d3c1a3a580eb7e8a8199c25536f4e6.tar.gz
zsh-e0b26186f1d3c1a3a580eb7e8a8199c25536f4e6.tar.xz
zsh-e0b26186f1d3c1a3a580eb7e8a8199c25536f4e6.zip
manual/8424
Diffstat (limited to 'Src/Zle/zle_main.c')
-rw-r--r--Src/Zle/zle_main.c135
1 files changed, 113 insertions, 22 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index d7ffbe259..56ecd02ba 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -30,6 +30,70 @@
 #include "zle.mdh"
 #include "zle_main.pro"
 
+/* Defined by the complete module, called in zle_tricky.c. */
+
+/**/
+void (*makecompparamsptr) _((void));
+
+/**/
+void (*comp_setunsetptr) _((int, int, int, int));
+
+/* != 0 if in a shell function called from completion, such that read -[cl]  *
+ * will work (i.e., the line is metafied, and the above word arrays are OK). */
+
+/**/
+int incompctlfunc;
+
+/* != 0 if we are in a new style completion function */
+
+/**/
+int incompfunc;
+
+/* Global matcher. */
+
+/**/
+Cmlist cmatcher;
+
+/* global variables for shell parameters in new style completion */
+
+/**/
+zlong compcurrent,
+      compmatcher,
+      compmatchertot,
+      complistmax,
+      complistlines;
+
+/**/
+char **compwords,
+     *compprefix,
+     *compsuffix,
+     *compiprefix,
+     *compisuffix,
+     *compqiprefix,
+     *compqisuffix,
+     *compmatcherstr,
+     *compcontext,
+     *compparameter,
+     *compredirect,
+     *compquote,
+     *compquoting,
+     *comprestore,
+     *complist,
+     *compforcelist,
+     *compinsert,
+     *compexact,
+     *compexactstr,
+     *comppatmatch,
+     *comppatinsert,
+     *complastprompt,
+     *comptoend,
+     *compoldlist,
+     *compoldins,
+     *compvared;
+
+/**/
+Param *comprpms, *compkpms;
+
 /* != 0 if we're done editing */
 
 /**/
@@ -961,6 +1025,9 @@ struct hookdef zlehooks[] = {
     HOOKDEF("list_matches", ilistmatches, 0),
     HOOKDEF("insert_match", NULL, HOOKF_ALL),
     HOOKDEF("menu_start", NULL, HOOKF_ALL),
+    HOOKDEF("compctl_make", NULL, 0),
+    HOOKDEF("compctl_before", NULL, 0),
+    HOOKDEF("compctl_after", NULL, 0),
 };
 
 /**/
@@ -974,17 +1041,6 @@ setup_zle(Module m)
     spaceinlineptr = spaceinline;
     zlereadptr = zleread;
 
-    addmatchesptr = addmatches;
-    comp_strptr = comp_str;
-    getcpatptr = getcpat;
-    makecomplistcallptr = makecomplistcall;
-    makecomplistctlptr = makecomplistctl;
-    num_matchesptr = num_matches;
-    list_linesptr = list_lines;
-    comp_listptr = comp_list;
-    unambig_dataptr = unambig_data;
-    set_comp_sepptr = set_comp_sep;
-
     getkeyptr = getkey;
 
     /* initialise the thingies */
@@ -1001,6 +1057,23 @@ setup_zle(Module m)
 
     varedarg = NULL;
 
+    incompfunc = incompctlfunc = 0;
+
+    comprpms = compkpms = NULL;
+    compwords = NULL;
+    compprefix = compsuffix = compiprefix = compisuffix = 
+	compqiprefix = compqisuffix = compmatcherstr = 
+	compcontext = compparameter = compredirect = compquote =
+	compquoting = comprestore = complist = compinsert =
+	compexact = compexactstr = comppatmatch = comppatinsert =
+	compforcelist = complastprompt = comptoend = 
+	compoldlist = compoldins = compvared = NULL;
+
+    clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *));
+
+    makecompparamsptr = NULL;
+    comp_setunsetptr = NULL;
+
     return 0;
 }
 
@@ -1057,19 +1130,37 @@ finish_zle(Module m)
     spaceinlineptr = noop_function_int;
     zlereadptr = fallback_zleread;
 
-    addmatchesptr = NULL;
-    comp_strptr = NULL;
-    getcpatptr = NULL;
-    makecomplistcallptr = NULL;
-    makecomplistctlptr = NULL;
-    num_matchesptr = NULL;
-    list_linesptr = NULL;
-    comp_listptr = NULL;
-    unambig_dataptr = NULL;
-    set_comp_sepptr = NULL;
-
     getkeyptr = NULL;
 
+    freearray(compwords);
+    zsfree(compprefix);
+    zsfree(compsuffix);
+    zsfree(compiprefix);
+    zsfree(compisuffix);
+    zsfree(compqiprefix);
+    zsfree(compqisuffix);
+    zsfree(compmatcherstr);
+    zsfree(compcontext);
+    zsfree(compparameter);
+    zsfree(compredirect);
+    zsfree(compquote);
+    zsfree(compquoting);
+    zsfree(comprestore);
+    zsfree(complist);
+    zsfree(compforcelist);
+    zsfree(compinsert);
+    zsfree(compexact);
+    zsfree(compexactstr);
+    zsfree(comppatmatch);
+    zsfree(comppatinsert);
+    zsfree(complastprompt);
+    zsfree(comptoend);
+    zsfree(compoldlist);
+    zsfree(compoldins);
+    zsfree(compvared);
+
+    zfree(clwords, clwsize * sizeof(char *));
+
     return 0;
 }