Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: 3.1.5-pws-17: Reorganize zmodload options
- X-seq: zsh-workers 6196
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: 3.1.5-pws-17: Reorganize zmodload options
- Date: Mon, 3 May 1999 02:34:14 -0700
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
The biggest chunk of this is rearranging the doc. The actual content of the
documentation has changed very little, just reindented and shuffled around.
The code patches:
* Add the -b option for autoloading/unloading builtins (this is still the
default if only -a is given, for compatibilty)
* Require the -a or -u options when using -b or -c or -p
* Warn (and do nothing) if more than one of -b and -c and -p is given
* Emit -ab or -ac or -ap when listing with -L
* Remove the mysterious/obsolete -C handling
I also changed the "reporter" script to output the -ac and -ap listings.
Index: Doc/Zsh/builtins.yo
===================================================================
--- builtins.yo 1999/04/30 05:53:10 1.19
+++ builtins.yo 1999/04/30 18:38:31
@@ -1169,30 +1169,26 @@
findex(zmodload)
cindex(modules, loading)
cindex(loading modules)
-xitem(tt(zmodload) [ tt(-iL) ] [ var(name) ... ])
-xitem(tt(zmodload) tt(-u) [ tt(-i) ] var(name) ...)
-xitem(tt(zmodload) tt(-d) [ tt(-L) ] [ var(name) [ var(dep) ... ] ])
-xitem(tt(zmodload) tt(-du) var(name) [ var(dep) ... ])
-xitem(tt(zmodload) tt(-a) [ tt(-iL) ] [ var(name) [ var(builtin) ... ] ])
-xitem(tt(zmodload) tt(-au) [ tt(-i) ] var(builtin) ...)
-xitem(tt(zmodload) tt(-c) [ tt(-iI) ] var(name) [ var(cond) ... ])
-xitem(tt(zmodload) tt(-cu) [ tt(-iI) ] var(cond) ...)
-xitem(tt(zmodload) tt(-c) [ tt(-IL) ])
-xitem(tt(zmodload) tt(-p) [ tt(-i) ] var(name) [ var(parameter) ... ])
-xitem(tt(zmodload) tt(-pu) [ tt(-i) ] var(parameter) ... ])
-item(tt(zmodload) tt(-p) [ tt(-L) ])(
+xitem(tt(zmodload) [ tt(-dL) ] [ ... ])
+xitem(tt(zmodload) [ tt(-a) [ tt(-bcp) [ tt(-I) ] ] ] [ tt(-iL) ] ...)
+item(tt(zmodload) tt(-u) [ tt(-abcdp) [ tt(-I) ] ] [ tt(-iL) ] ...)(
tt(zmodload) performs operations relating to zsh's loadable modules.
This feature is not available on all operating systems,
or on all installations on a particular operating system.
-In the simplest case,
-tt(zmodload) loads a binary module. The module must be in a file with a
-name consisting of the specified var(name) followed by a standard suffix,
-usually `tt(.so)'. If this can't be found, the var(name) is tried without
-the suffix.
-If the module to be loaded is already loaded and the tt(-i)
-option is given, the duplicate module is ignored. Otherwise
-tt(zmodload) prints an error message.
+Without arguments all currently loaded binary modules are printed.
+The tt(-L) option causes this list to be in the form of a series of
+tt(zmodload) commands. Forms with arguments are:
+
+startitem()
+xitem(tt(zmodload) [ tt(-i) ] var(name) ... )
+item(tt(zmodload) tt(-u) [ tt(-i) ] var(name) ...)(
+In the simplest case, tt(zmodload) loads a binary module. The module must
+be in a file with a name consisting of the specified var(name) followed by
+a standard suffix, usually `tt(.so)'. If this can't be found, the
+var(name) is tried without the suffix. If the module to be loaded is
+already loaded and the tt(-i) option is given, the duplicate module is
+ignored. Otherwise tt(zmodload) prints an error message.
The var(name)d module is searched for in the same way a command is, using
tt($module_path) instead of tt($path). If var(name) contains a `tt(/)',
@@ -1209,55 +1205,66 @@
Each module has a boot and a cleanup function. The module
will not be loaded if its boot function fails. Similarly a module
can only be unloaded if its cleanup function runs successfully.
-
-Without arguments all currently loaded binary modules are printed.
-The tt(-L) option causes this list to be in the form of a series of
-tt(zmodload) commands.
-
-The tt(-d) option can be used to specify module dependencies.
-This operation is idempotent regardless of the tt(-i) option.
-The modules named in the second and subsequent arguments will be
-loaded before the module named in the first argument.
-
-With tt(-d) and one
-argument, all dependencies for that module are listed. With tt(-d) and no
-arguments, all module dependencies are listed.
-This listing is by default in a Makefile-like format.
-The tt(-L) option changes this format to a list of
-tt(zmodload -d) commands.
-
-If tt(-d) and tt(-u) are both used, dependencies are removed.
-This operation is idempotent regardless of the tt(-i) option.
-If only one argument is given, all dependencies for that module are removed.
-
-The tt(-a) option defines autoloaded builtins. It defines the
-specified var(builtin)s. When any of those builtins is called, the module
-specified in the first argument is loaded. If only one argument is given,
-one builtin is defined, with the same name as the module.
-tt(-i) suppresses the error if the builtin is already defined or
-autoloaded, regardless of which module it came from.
-
-With tt(-a) and no arguments, all
-autoloaded builtins are listed, with the module name (if different)
-shown in parentheses after the builtin name. The tt(-L) option changes
-this format to a list of tt(zmodload -a) commands.
-
-If tt(-a) is used
-together with the tt(-u) option it removes builtins defined with
-tt(zmodload -a). This is only possible if the builtin is not yet
-loaded. tt(-i) suppresses the error if the builtin is already
+)
+xitem(tt(zmodload) tt(-d) [ tt(-L) ] [ var(name) ])
+xitem(tt(zmodload) tt(-d) var(name) var(dep) ...)
+item(tt(zmodload) tt(-ud) var(name) [ var(dep) ... ])(
+The tt(-d) option can be used to specify module dependencies. The modules
+named in the second and subsequent arguments will be loaded before the
+module named in the first argument.
+
+With tt(-d) and one argument, all dependencies for that module are listed.
+With tt(-d) and no arguments, all module dependencies are listed. This
+listing is by default in a Makefile-like format. The tt(-L) option
+changes this format to a list of tt(zmodload -d) commands.
+
+If tt(-d) and tt(-u) are both used, dependencies are removed. If only one
+argument is given, all dependencies for that module are removed.
+)
+xitem(tt(zmodload) tt(-ab) [ tt(-L) ])
+xitem(tt(zmodload) tt(-ab) [ tt(-i) ] var(name) [ var(builtin) ... ])
+item(tt(zmodload) tt(-ub) [ tt(-i) ] var(builtin) ...)(
+The tt(-ab) option defines autoloaded builtins. It defines the specified
+var(builtin)s. When any of those builtins is called, the module specified
+in the first argument is loaded. If only the var(name) is given, one
+builtin is defined, with the same name as the module. tt(-i) suppresses
+the error if the builtin is already defined or autoloaded, regardless of
+which module it came from.
+
+With tt(-ab) and no arguments, all autoloaded builtins are listed, with the
+module name (if different) shown in parentheses after the builtin name.
+The tt(-L) option changes this format to a list of tt(zmodload -a)
+commands.
+
+If tt(-b) is used together with the tt(-u) option, it removes builtins
+previously defined with tt(-ab). This is only possible if the builtin is
+not yet loaded. tt(-i) suppresses the error if the builtin is already
removed (or never existed).
-
-The tt(-c) option is used to define autoloaded condition codes. The
+)
+xitem(tt(zmodload) tt(-ac) [ tt(-IL) ])
+xitem(tt(zmodload) tt(-ac) [ tt(-iI) ] var(name) [ var(cond) ... ])
+item(tt(zmodload) tt(-uc) [ tt(-iI) ] var(cond) ...)(
+The tt(-ac) option is used to define autoloaded condition codes. The
var(cond) strings give the names of the conditions defined by the
module. The optional tt(-I) option is used to define infix condition
names. Without this option prefix condition names are defined.
-Together with the tt(-u) option definitions for autoloaded conditions
-are removed. If given no condition names all defined names are listed
-(as a series of tt(zmodload) commands if the tt(-L) option is given).
+If given no condition names, all defined names are listed (as a series of
+tt(zmodload) commands if the tt(-L) option is given).
-The tt(-p) option is like the tt(-c) option, but makes tt(zmodload)
-work on autoloaded parameters instead of condition codes.
+The tt(-uc) option removes definitions for autoloaded conditions.
+)
+xitem(tt(zmodload) tt(-ap) [ tt(-L) ])
+xitem(tt(zmodload) tt(-ap) [ tt(-i) ] var(name) [ var(parameter) ... ])
+item(tt(zmodload) tt(-up) [ tt(-i) ] var(parameter) ...)(
+The tt(-p) option is like the tt(-b) and tt(-c) options, but makes
+tt(zmodload) work on autoloaded parameters instead.
+)
+xitem(tt(zmodload) tt(-a) [ tt(-L) ])
+xitem(tt(zmodload) tt(-a) [ tt(-i) ] var(name) [ var(builtin) ... ])
+item(tt(zmodload) tt(-ua) [ tt(-i) ] var(builtin) ...)(
+Equivalent to tt(-ab) and tt(-ub).
+)
+enditem()
)
enditem()
Index: Src/builtin.c
===================================================================
--- builtin.c 1999/04/30 05:53:23 1.25
+++ builtin.c 1999/04/30 10:15:35
@@ -120,7 +120,7 @@
BUILTIN("which", 0, bin_whence, 0, -1, 0, "ampsw", "c"),
#ifdef DYNAMIC
- BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "LaudicIp", NULL),
+ BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "ILabcdipu", NULL),
#endif
};
Index: Src/module.c
===================================================================
--- module.c 1999/04/30 05:53:25 1.12
+++ module.c 1999/04/30 10:18:59
@@ -664,7 +664,7 @@
if(bn->flags & BINF_ADDED)
return;
if(printflags & PRINT_LIST) {
- fputs("zmodload -a ", stdout);
+ fputs("zmodload -ab ", stdout);
if(bn->optstr[0] == '-')
fputs("-- ", stdout);
quotedzputs(bn->optstr, stdout);
@@ -687,7 +687,12 @@
int
bin_zmodload(char *nam, char **args, char *ops, int func)
{
- if(ops['d'] && ops['a']) {
+ if ((ops['b'] || ops['c'] || ops['p']) && !(ops['a'] || ops['u'])) {
+ zwarnnam(nam, "-b, -c, and -p must be combined with -a or -u",
+ NULL, 0);
+ return 1;
+ }
+ if (ops['d'] && ops['a']) {
zwarnnam(nam, "-d cannot be combined with -a", NULL, 0);
return 1;
}
@@ -695,16 +700,20 @@
zwarnnam(nam, "what do you want to unload?", NULL, 0);
return 1;
}
- if(ops['d'])
+ if (ops['d'])
return bin_zmodload_dep(nam, args, ops);
- else if(ops['a'])
+ else if ((ops['a'] || ops['b']) && !(ops['c'] || ops['p']))
return bin_zmodload_auto(nam, args, ops);
- else if (ops['c'] || ops['C'])
+ else if (ops['c'] && !(ops['b'] || ops['p']))
return bin_zmodload_cond(nam, args, ops);
- else if (ops['p'])
+ else if (ops['p'] && !(ops['b'] || ops['c']))
return bin_zmodload_param(nam, args, ops);
- else
+ else if (!(ops['a'] || ops['b'] || ops['c'] || ops['p']))
return bin_zmodload_load(nam, args, ops);
+ else
+ zwarnnam(nam, "use only one of -b, -c, or -p", NULL, 0);
+
+ return 1;
}
/**/
@@ -865,7 +874,7 @@
for (p = condtab; p; p = p->next) {
if (p->module) {
if (ops['L']) {
- fputs("zmodload -c", stdout);
+ fputs("zmodload -ac", stdout);
if (p->flags & CONDF_INFIX)
putchar('I');
printf(" %s %s\n", p->module, p->name);
@@ -908,7 +917,7 @@
if (pm->flags & PM_AUTOLOAD) {
if (lon)
- printf("zmodload -p %s %s\n", pm->u.str, pm->nam);
+ printf("zmodload -ap %s %s\n", pm->u.str, pm->nam);
else
printf("%s (%s)\n", pm->nam, pm->u.str);
}
Index: Util/reporter
===================================================================
--- reporter 1998/10/30 15:57:17 1.1.1.2
+++ reporter 1999/04/30 18:08:25
@@ -302,7 +302,11 @@
echo
zmodload -d -L
echo
- zmodload -a -L
+ zmodload -ab -L
+ echo
+ zmodload -ac -L
+ echo
+ zmodload -ap -L
echo
zmodload -L
else
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author