From e0b26186f1d3c1a3a580eb7e8a8199c25536f4e6 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Tue, 26 Oct 1999 15:36:10 +0000 Subject: manual/8424 --- Src/Zle/zle_main.c | 135 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 113 insertions(+), 22 deletions(-) (limited to 'Src/Zle/zle_main.c') 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; } -- cgit 1.4.1