From b0c5f09169ac31855ebf0e93772bb57b9635b380 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 28 May 2007 22:57:39 +0000 Subject: see 23479: add initial features support for modules --- Src/Zle/complete.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'Src/Zle/complete.c') diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c index a73d3cf14..aac760a92 100644 --- a/Src/Zle/complete.c +++ b/Src/Zle/complete.c @@ -1467,6 +1467,14 @@ struct hookdef comphooks[] = { HOOKDEF("comp_list_matches", ilistmatches, 0), }; +static struct features module_features = { + bintab, sizeof(bintab)/sizeof(*bintab), + cotab, sizeof(cotab)/sizeof(*cotab), + NULL, 0, + NULL, 0, + 0 +}; + /**/ int setup_(UNUSED(Module m)) @@ -1490,6 +1498,21 @@ setup_(UNUSED(Module m)) return 0; } +/**/ +int +features_(Module m, char ***features) +{ + *features = featuresarray(m->nam, &module_features); + return 0; +} + +/**/ +int +enables_(Module m, int **enables) +{ + return handlefeatures(m->nam, &module_features, enables); +} + /**/ int boot_(Module m) @@ -1502,11 +1525,7 @@ boot_(Module m) addhookfunc("list_matches", (Hookfn) list_matches); addhookfunc("invalidate_list", (Hookfn) invalidate_list); addhookdefs(m->nam, comphooks, sizeof(comphooks)/sizeof(*comphooks)); - if (!(addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)) | - addconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab)) | - !addwrapper(m, wrapper))) - return 1; - return 0; + return addwrapper(m, wrapper); } /**/ @@ -1521,10 +1540,8 @@ cleanup_(Module m) deletehookfunc("list_matches", (Hookfn) list_matches); deletehookfunc("invalidate_list", (Hookfn) invalidate_list); deletehookdefs(m->nam, comphooks, sizeof(comphooks)/sizeof(*comphooks)); - deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); - deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab)); deletewrapper(m, wrapper); - return 0; + return seteatureenables(m->nam, &module_features, NULL); } /**/ -- cgit v1.2.3