1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30:24 +02:00

manual:9047

This commit is contained in:
Tanaka Akira 1999-12-15 21:29:55 +00:00
parent b9c19b15a6
commit 03e230cc54
83 changed files with 396 additions and 449 deletions

View file

@ -489,7 +489,7 @@ _cvs_extract_file_entries () {
(( $+functions[_cvs_extract_modifiedfile_entries] )) || (( $+functions[_cvs_extract_modifiedfile_entries] )) ||
_cvs_extract_modifiedfile_entries () { _cvs_extract_modifiedfile_entries () {
if zstyle -t ":completion${curcontext}:cvs" disable-stat || if zstyle -t ":completion${curcontext}:cvs" disable-stat ||
! { zmodload -e zsh/stat || zmodload zsh/stat }; then ! { zmodload -e stat || zmodload stat }; then
_cvs_extract_file_entries _cvs_extract_file_entries
return return
fi fi

View file

@ -172,7 +172,7 @@ Zsh/modlist.yo: $(MODDOCSRC)
modules=`echo '' $(MODDOCSRC) '' | sed 's| Zsh/mod_| |g;s|\.yo | |g'`; \ modules=`echo '' $(MODDOCSRC) '' | sed 's| Zsh/mod_| |g;s|\.yo | |g'`; \
echo "startitem()"; \ echo "startitem()"; \
for mod in $$modules; do \ for mod in $$modules; do \
echo "item(tt(zsh/$$mod))("; \ echo "item(tt($$mod))("; \
sed -n '1d;/^!MOD!)$$/q;p' < $(sdir)/Zsh/mod_$${mod}.yo; \ sed -n '1d;/^!MOD!)$$/q;p' < $(sdir)/Zsh/mod_$${mod}.yo; \
echo ")"; \ echo ")"; \
done; \ done; \
@ -182,8 +182,8 @@ Zsh/modlist.yo: $(MODDOCSRC)
echo "endmenu()"; \ echo "endmenu()"; \
set '' $$modules; \ set '' $$modules; \
while test ".$$2" != .; do \ while test ".$$2" != .; do \
echo "texinode(The zsh/$$2 Module)($${3+The $$3 Module})($${1:+The $$1 Module})(Zsh Modules)"; \ echo "texinode(The $$2 Module)($${3+The $$3 Module})($${1:+The $$1 Module})(Zsh Modules)"; \
echo "sect(The zsh/$$2 Module)"; \ echo "sect(The $$2 Module)"; \
echo "includefile(Zsh/mod_$${2}.yo)"; \ echo "includefile(Zsh/mod_$${2}.yo)"; \
shift; \ shift; \
done \ done \
@ -193,7 +193,7 @@ Zsh/modmenu.yo: $(MODDOCSRC)
( \ ( \
modules=`echo '' $(MODDOCSRC) '' | sed 's| Zsh/mod_| |g;s|\.yo | |g'`; \ modules=`echo '' $(MODDOCSRC) '' | sed 's| Zsh/mod_| |g;s|\.yo | |g'`; \
for mod in $$modules; do \ for mod in $$modules; do \
echo "menu(The zsh/$$mod Module)"; \ echo "menu(The $$mod Module)"; \
done \ done \
) > $(sdir)/Zsh/modmenu.yo ) > $(sdir)/Zsh/modmenu.yo

View file

@ -1303,15 +1303,16 @@ xitem(tt(zmodload) [ tt(-i) ] var(name) ... )
item(tt(zmodload) tt(-u) [ 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 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 be in a file with a name consisting of the specified var(name) followed by
a standard suffix, usually `tt(.so)'. a standard suffix, usually `tt(.so)'. If this can't be found, the
If the module to be loaded is 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 already loaded and the tt(-i) option is given, the duplicate module is
ignored. Otherwise tt(zmodload) prints an error message. ignored. Otherwise tt(zmodload) prints an error message.
The var(name)d module is searched for in the same way a command is, using The var(name)d module is searched for in the same way a command is, using
tt($module_path) instead of tt($path). However, the path search is tt($module_path) instead of tt($path). If var(name) contains a `tt(/)',
performed even when the module name contains a `tt(/)', which it usually does. it will be used as-is, and a path search will be performed otherwise.
There is no way to prevent the path search. This behaviour can be modified by the tt(PATH_DIRS) option.
cindex(PATH_DIRS, use of)
With tt(-u), tt(zmodload) unloads modules. The same var(name) With tt(-u), tt(zmodload) unloads modules. The same var(name)
must be given that was given when the module was loaded, but it is not must be given that was given when the module was loaded, but it is not

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets. Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets.
!MOD!) !MOD!)
The tt(zsh/cap) module is used for manipulating POSIX.1e (POSIX.6) capability The tt(cap) module is used for manipulating POSIX.1e (POSIX.6) capability
sets. If the operating system does not support this interface, the sets. If the operating system does not support this interface, the
builtins defined by this module will do nothing. builtins defined by this module will do nothing.
The builtins in this module are: The builtins in this module are:

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
A builtin that can clone a running shell onto another terminal. A builtin that can clone a running shell onto another terminal.
!MOD!) !MOD!)
The tt(zsh/clone) module makes available one builtin command: The tt(clone) module makes available one builtin command:
startitem() startitem()
findex(clone) findex(clone)

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
The tt(compctl) builtin for controlling completion. The tt(compctl) builtin for controlling completion.
!MOD!) !MOD!)
The tt(zsh/compctl) module makes available two builtin commands. tt(compctl), The tt(compctl) module makes available two builtin commands. tt(compctl),
is the old, deprecated way to control completions for ZLE. See is the old, deprecated way to control completions for ZLE. See
ifzman(zmanref(zshcompctl))\ ifzman(zmanref(zshcompctl))\
ifnzman(noderef(Programmable Completion Using compctl))\ ifnzman(noderef(Programmable Completion Using compctl))\

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
The basic completion code. The basic completion code.
!MOD!) !MOD!)
The tt(zsh/complete) module makes available several builtin commands which The tt(complete) module makes available several builtin commands which
can be used in user-defined completion widgets, see can be used in user-defined completion widgets, see
ifzman(zmanref(zshcompwid))\ ifzman(zmanref(zshcompwid))\
ifnzman(noderef(Completion Widgets))\ ifnzman(noderef(Completion Widgets))\

View file

@ -3,15 +3,15 @@ Completion listing extensions.
!MOD!) !MOD!)
cindex(completion, listing) cindex(completion, listing)
cindex(completion, coloured listings) cindex(completion, coloured listings)
The tt(zsh/complist) module offers two extensions to completion listings: The tt(complist) module offers two extensions to completion listings:
the ability to highlight matches in such a list and a different the ability to highlight matches in such a list and a different
style of menu-completion. style of menu-completion.
Whenever one of the parameters tt(ZLS_COLORS) or tt(ZLS_COLOURS) is set Whenever one of the parameters tt(ZLS_COLORS) or tt(ZLS_COLOURS) is set
and the tt(zsh/complist) module is loaded or linked into the shell, and the tt(complist) module is loaded or linked into the shell,
completion lists will be colored. Note, however, that tt(complist) will completion lists will be colored. Note, however, that tt(complist) will
not automatically be loaded if it is not linked in: on systems with not automatically be loaded if it is not linked in: on systems with
dynamic loading, `tt(zmodload zsh/complist)' is required. dynamic loading, `tt(zmodload complist)' is required.
subsect(Parameters) subsect(Parameters)
vindex(ZLS_COLORS) vindex(ZLS_COLORS)
@ -130,7 +130,7 @@ subsect(Menu selection)
cindex(completion, selecting by cursor) cindex(completion, selecting by cursor)
vindex(SELECTMIN) vindex(SELECTMIN)
tindex(menu-select) tindex(menu-select)
The tt(zsh/complist) module also offers an alternative style of selecting The tt(complist) module also offers an alternative style of selecting
matches from a list, called menu-selection, which can be used if the matches from a list, called menu-selection, which can be used if the
shell is set up to return to the last prompt after showing a shell is set up to return to the last prompt after showing a
completion list (see the tt(ALWAYS_LAST_PROMPT) option in completion list (see the tt(ALWAYS_LAST_PROMPT) option in
@ -211,4 +211,4 @@ continue with normal menu-completion one can call
indent(tt(bindkey -M menuselect '^M' send-break)) indent(tt(bindkey -M menuselect '^M' send-break))
after loading the tt(zsh/complist) module. after loading the tt(complist) module.

View file

@ -3,7 +3,7 @@ A module with utility builtins needed for the shell function based
completion system. completion system.
!MOD!) !MOD!)
cindex(completion, utility) cindex(completion, utility)
The tt(zsh/computil) module adds several builtin commands that are used by The tt(computil) module adds several builtin commands that are used by
some of the completion functions in the shell function based some of the completion functions in the shell function based
completions system (see completions system (see
ifzman(zmanref(zshcompsys))\ ifzman(zmanref(zshcompsys))\

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
A ZLE function duplicating EMACS' tt(zap-to-char). A ZLE function duplicating EMACS' tt(zap-to-char).
!MOD!) !MOD!)
The tt(zsh/deltochar) module makes available two ZLE functions: The tt(deltochar) module makes available two ZLE functions:
startitem() startitem()
tindex(delete-to-char) tindex(delete-to-char)

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
An example of how to write a module. An example of how to write a module.
!MOD!) !MOD!)
The tt(zsh/example) module makes available one builtin command: The tt(example) module makes available one builtin command:
startitem() startitem()
findex(example) findex(example)

View file

@ -2,7 +2,7 @@ COMMENT(!MOD!
Some basic file manipulation commands as builtins. Some basic file manipulation commands as builtins.
!MOD!) !MOD!)
cindex(files, manipulating) cindex(files, manipulating)
The tt(zsh/files) module makes some standard commands available as builtins: The tt(files) module makes some standard commands available as builtins:
startitem() startitem()
findex(chgrp) findex(chgrp)

View file

@ -2,7 +2,7 @@ COMMENT(!MOD!
Access to external files via a special associative array. Access to external files via a special associative array.
!MOD!) !MOD!)
cindex(parameter, file access via) cindex(parameter, file access via)
The tt(zsh/mapfile) module provides one special associative array parameter of The tt(mapfile) module provides one special associative array parameter of
the same name. the same name.
startitem() startitem()

View file

@ -3,8 +3,7 @@ Standard scientific functions for use in mathematical evaluations.
!MOD!) !MOD!)
cindex(functions, mathematical) cindex(functions, mathematical)
cindex(mathematical functions) cindex(mathematical functions)
The tt(zsh/mathfunc) module provides standard The tt(mathfunc) module provides standard mathematical functions for use when
mathematical functions for use when
evaluating mathematical formulae. The syntax agrees with normal C and evaluating mathematical formulae. The syntax agrees with normal C and
FORTRAN conventions, for example, FORTRAN conventions, for example,

View file

@ -2,7 +2,7 @@ COMMENT(!MOD!
Access to internal hash tables via special associative arrays. Access to internal hash tables via special associative arrays.
!MOD!) !MOD!)
cindex(parameters, special) cindex(parameters, special)
The tt(zsh/parameter) module gives access to some of the internal hash The tt(parameter) module gives access to some of the internal hash
tables used by the shell by defining some special parameters. tables used by the shell by defining some special parameters.
startitem() startitem()

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
A builtin that provides a timed execution facility within the shell. A builtin that provides a timed execution facility within the shell.
!MOD!) !MOD!)
The tt(zsh/sched) module makes available one builtin command: The tt(sched) module makes available one builtin command:
startitem() startitem()
findex(sched) findex(sched)

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
A builtin command interface to the tt(stat) system call. A builtin command interface to the tt(stat) system call.
!MOD!) !MOD!)
The tt(zsh/stat) module makes available one builtin command: The tt(stat) module makes available one builtin command:
startitem() startitem()
findex(stat) findex(stat)

View file

@ -1,14 +1,14 @@
COMMENT(!MOD! COMMENT(!MOD!
A builtin FTP client. A builtin FTP client.
!MOD!) !MOD!)
The tt(zsh/zftp) module makes available one builtin command: The tt(zftp) module makes available one builtin command:
startitem() startitem()
findex(zftp) findex(zftp)
cindex(FTP) cindex(FTP)
cindex(files, transferring) cindex(files, transferring)
item(tt(zftp) var(subcommand) [ var(args) ])( item(tt(zftp) var(subcommand) [ var(args) ])(
The tt(zsh/zftp) module is a client for FTP (file transfer protocol). It The tt(zftp) module is a client for FTP (file transfer protocol). It
is implemented as a builtin to allow full use of shell command line is implemented as a builtin to allow full use of shell command line
editing, file I/O, and job control mechanisms. Often, users will editing, file I/O, and job control mechanisms. Often, users will
access it via shell functions providing a more powerful interface; a set is access it via shell functions providing a more powerful interface; a set is
@ -84,7 +84,7 @@ are deleted. In that case, calling tt(open) with no arguments will
cause an error. cause an error.
The list of parameters is not deleted after a tt(close), however it The list of parameters is not deleted after a tt(close), however it
will be deleted if the tt(zsh/zftp) module is unloaded. will be deleted if the tt(zftp) module is unloaded.
For example, For example,

View file

@ -1,7 +1,7 @@
COMMENT(!MOD! COMMENT(!MOD!
The Zsh Line Editor, including the tt(bindkey) and tt(vared) builtins. The Zsh Line Editor, including the tt(bindkey) and tt(vared) builtins.
!MOD!) !MOD!)
The tt(zsh/zle) module contains the Zsh Line Editor. See The tt(zle) module contains the Zsh Line Editor. See
ifzman(zmanref(zshzle))\ ifzman(zmanref(zshzle))\
ifnzman(noderef(Zsh Line Editor))\ ifnzman(noderef(Zsh Line Editor))\
. It also contains three related builtin commands: . It also contains three related builtin commands:

View file

@ -2,7 +2,7 @@ COMMENT(!MOD!
Access to internals of the Zsh Line Editor via parameters. Access to internals of the Zsh Line Editor via parameters.
!MOD!) !MOD!)
cindex(parameters, special) cindex(parameters, special)
The tt(zsh/zleparameter) module defines two special parameters that can be The tt(zleparameter) module defines two special parameters that can be
used to access internal information of the Zsh Line Editor (see used to access internal information of the Zsh Line Editor (see
ifzman(zmanref(zshzle))\ ifzman(zmanref(zshzle))\
ifnzman(noderef(Zsh Line Editor))\ ifnzman(noderef(Zsh Line Editor))\

View file

@ -3,7 +3,7 @@ Some utility builtins, e.g. the one for supporting configuration via
styles. styles.
!MOD!) !MOD!)
cindex(builtins, utility) cindex(builtins, utility)
The tt(zsh/zutil) module only adds some builtins: The tt(zutil) module only adds some builtins:
startitem() startitem()
xitem(tt(zstyle) [ tt(-L) ]) xitem(tt(zstyle) [ tt(-L) ])

View file

@ -6,7 +6,6 @@ Some optional parts of zsh are in modules, separate from the core
of the shell. Each of these modules may be linked in to the of the shell. Each of these modules may be linked in to the
shell at build time, shell at build time,
or can be dynamically linked while the shell is running or can be dynamically linked while the shell is running
if the installation supports this feature. The modules that if the installation supports this feature. The modules available are:
are bundled with the zsh distribution are:
includefile(Zsh/modlist.yo) includefile(Zsh/modlist.yo)

View file

@ -758,7 +758,8 @@ Thus if `tt(/usr/local/bin)' is in the user's path, and he types
(assuming it exists). (assuming it exists).
Commands explicitly beginning with `tt(/)', `tt(./)' or `tt(../)' Commands explicitly beginning with `tt(/)', `tt(./)' or `tt(../)'
are not subject to the path search. are not subject to the path search.
This also applies to the tt(.) builtin. This also applies to the tt(.) builtin,
and to searches for modules performed by the tt(zmodload) builtin.
) )
pindex(POSIX_BUILTINS) pindex(POSIX_BUILTINS)
item(tt(POSIX_BUILTINS) <K> <S>)( item(tt(POSIX_BUILTINS) <K> <S>)(

View file

@ -29,6 +29,8 @@ itemiz(using the tt(ARGV0) parameter to override tt(argv[0]) for external
commands) commands)
itemiz(turning off restricted mode with tt(set +r) or tt(unsetopt itemiz(turning off restricted mode with tt(set +r) or tt(unsetopt
RESTRICTED)) RESTRICTED))
itemiz(specifying modules to be loaded with an explicitly given
pathname containing slashes)
enditemize() enditemize()
These restrictions are enforced after processing the startup files. The These restrictions are enforced after processing the startup files. The

View file

@ -21,7 +21,7 @@ ifnzman(\
noderef(The zftp Module) noderef(The zftp Module)
), must be available in the ), must be available in the
version of tt(zsh) installed at your site. If the shell is configured to version of tt(zsh) installed at your site. If the shell is configured to
load new commands at run time, it probably is: typing `tt(zmodload zsh/zftp)' load new commands at run time, it probably is: typing `tt(zmodload zftp)'
will make sure (if that runs silently, it has worked). If this is not the will make sure (if that runs silently, it has worked). If this is not the
case, it is possible tt(zftp) was linked into the shell anyway: to test case, it is possible tt(zftp) was linked into the shell anyway: to test
this, type `tt(which zftp)' and if tt(zftp) is available you will get the this, type `tt(which zftp)' and if tt(zftp) is available you will get the

View file

@ -147,26 +147,16 @@ C coding style
groups of statements in the interests of clarity. There should never groups of statements in the interests of clarity. There should never
be two consecutive blank lines. be two consecutive blank lines.
* Each .c file *must* #include the .mdh header for the module it is a
part of and then its own .pro file (for local prototypes). It may
also #include other system headers. It *must not* #include any other
module's headers or any other .pro files.
Modules Modules
------- -------
Modules have hierarchical names. Name segments are separated by `/', and Modules are described by a file named `foo.mdd' for a module
each segment consists of alphanumerics plus `_'. Relative names are never `foo'. This file is actually a shell script that will sourced when zsh
used; the naming hierarchy is strictly for organisational convenience. is build. To describe the module it can/should set the following shell
variables:
Each module is described by a file with a name ending in `.mdd' somewhere
under the Src directory. This file is actually a shell script that will
sourced when zsh is build. To describe the module it can/should set the
following shell variables:
- name name of the module
- moddeps modules on which this module depends (default none) - moddeps modules on which this module depends (default none)
- nozshdep non-empty indicates no dependence on the `zsh/main' pseudo-module - nozshdep non-empty indicates no dependence on the `zsh' pseudo-module
- alwayslink if non-empty, always link the module into the executable - alwayslink if non-empty, always link the module into the executable
- autobins builtins defined by the module, for autoloading - autobins builtins defined by the module, for autoloading
- autoinfixconds infix condition codes defined by the module, for - autoinfixconds infix condition codes defined by the module, for
@ -180,25 +170,25 @@ following shell variables:
- hdrdeps extra headers on which the .mdh depends (default none) - hdrdeps extra headers on which the .mdh depends (default none)
- otherincs extra headers that are included indirectly (default none) - otherincs extra headers that are included indirectly (default none)
Be sure to put the values in quotes. For further enlightenment have a look Be sure to put the values in quotes. For further enlightenment have a
at the `mkmakemod.sh' script in the Src directory of the distribution. look at the `mkmakemod.sh' script in the Src directory of the
distribution.
Modules have to define four functions which will be called automatically Modules have to define four functions which will be called automatically
by the zsh core. The first one, named `setup_', should set up any data by the zsh core. The first one, named `setup_foo' for a module named
needed in the module, at least any data other modules may be interested `foo', should set up any data needed in the module, at least any data
in. The second one, named `boot_', should register all builtins, other modules may be interested in. The second one, named `boot_foo',
conditional codes, and function wrappers (i.e. anything that will be should register all builtins, conditional codes, and function wrappers
visible to the user) and will be called after the `setup_'-function. (i.e. anything that will be visible to the user) and will be called
after the `setup'-function.
The third one, named `cleanup_', is called when the user tries to unload The third one, named `cleanup_foo' for module `foo' is called when the
a module and should de-register the builtins etc. The last function, user tries to unload a module and should de-register the builtins
`finish_' is called when the module is actually unloaded and should etc. The last function, `finish_foo' is called when the module is
finalize all the data initialized in the `setup_'-function. actually unloaded and should finalize all the data initialized in the
`setup'-function.
In short, the `cleanup_'-function should undo what the `boot_'-function In short, the `cleanup'-function should undo what the `boot'-function
did, and the `finish_'-function should undo what the `setup_'-function did, and the `finish'-function should undo what the `setup'-function
did. did.
All of these functions should return zero if they succeeded and All of these functions should return zero if they succeeded and
non-zero otherwise. non-zero otherwise.
@ -798,20 +788,3 @@ Documentation
All the above should appear on their own, separated by newlines from the All the above should appear on their own, separated by newlines from the
surrounding text. No extra newlines after the opening or before the surrounding text. No extra newlines after the opening or before the
closing parenthesis are required. closing parenthesis are required.
Module names
------------
Modules have hierarchical names. Name segments are separated by `/', and
each segment consists of alphanumerics plus `_'. Relative names are never
used; the naming hierarchy is strictly for organisational convenience.
Top-level name segments should be organisational identifiers, assigned
by the Zsh Development Group and recorded here:
top-level identifier organisation
-------------------- ------------
x_* reserved for private experimental use
zsh The Zsh Development Group (contact: <coordinator@zsh.org>)
Below the top level, naming authority is delegated.

View file

@ -1,7 +1,7 @@
# zls () { # zls () {
# simple internal ls using the stat module # simple internal ls using the stat module
zmodload -i zsh/stat || return 1 zmodload -i stat || return 1
emulate -R zsh emulate -R zsh
setopt localoptions setopt localoptions

View file

@ -1,6 +1,6 @@
emulate -L zsh emulate -L zsh
[[ $1 = -n ]] || zmodload -e zsh/zftp || zmodload -ia zsh/zftp [[ $1 = -n ]] || zmodload -e zftp || zmodload -ia zftp
if [[ ${+zfconfig} = 0 ]]; then if [[ ${+zfconfig} = 0 ]]; then
typeset -gA zfconfig typeset -gA zfconfig

View file

@ -625,21 +625,21 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_rlimits(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_rlimits(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_rlimits(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -647,7 +647,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_rlimits(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/rlimits
autobins="limit ulimit unlimit" autobins="limit ulimit unlimit"
objects="rlimits.o" objects="rlimits.o"

View file

@ -185,14 +185,14 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_sched(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_sched(Module m)
{ {
if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab))) if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
return 1; return 1;
@ -202,7 +202,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_sched(Module m)
{ {
struct schedcmd *sch, *schn; struct schedcmd *sch, *schn;
@ -218,7 +218,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_sched(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/sched
autobins="sched" autobins="sched"
objects="sched.o" objects="sched.o"

View file

@ -128,7 +128,20 @@ install.modules: install.modules-here
uninstall.modules: uninstall.modules-here uninstall.modules: uninstall.modules-here
install.bin-here uninstall.bin-here: install.bin-here uninstall.bin-here:
install.modules-here uninstall.modules-here:
install.modules-here:
modules='$(MODULES)'; \
if test -n "$$modules"; then $(sdir_top)/mkinstalldirs $(DESTDIR)$(MODDIR); fi; \
for mod in $$modules; do \
$(INSTALL_PROGRAM) $$mod $(DESTDIR)$(MODDIR)/$$mod; \
done
uninstall.modules-here:
modules='$(MODULES)'; for mod in $$modules; do \
if test -f $(DESTDIR)$(MODDIR)/$$mod; then \
rm -f $(DESTDIR)$(MODDIR)/$$mod; \
else :; fi; \
done
# ========== DEPENDENCIES FOR CLEANUP ========== # ========== DEPENDENCIES FOR CLEANUP ==========

View file

@ -124,21 +124,21 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_cap(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_cap(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_cap(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -146,7 +146,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_cap(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/cap
autobins="cap getcap setcap" autobins="cap getcap setcap"
objects="cap.o" objects="cap.o"

View file

@ -98,21 +98,21 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_clone(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_clone(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_clone(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -120,7 +120,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_clone(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/clone
autobins="clone" autobins="clone"
objects="clone.o" objects="clone.o"

View file

@ -159,7 +159,7 @@ ex_wrapper(List list, FuncWrap w, char *name)
} }
/* /*
* boot_ is executed when the module is loaded. * boot_example is executed when the module is loaded.
*/ */
static struct builtin bintab[] = { static struct builtin bintab[] = {
@ -188,7 +188,7 @@ static struct funcwrap wrapper[] = {
/**/ /**/
int int
setup_(Module m) setup_example(Module m)
{ {
printf("The example module has now been set up.\n"); printf("The example module has now been set up.\n");
fflush(stdout); fflush(stdout);
@ -197,7 +197,7 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_example(Module m)
{ {
intparam = 42; intparam = 42;
strparam = ztrdup("example"); strparam = ztrdup("example");
@ -214,7 +214,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_example(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab)); deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
@ -226,7 +226,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_example(Module m)
{ {
printf("Thank you for using the example module. Have a nice day.\n"); printf("Thank you for using the example module. Have a nice day.\n");
fflush(stdout); fflush(stdout);

View file

@ -1,5 +1,3 @@
name=zsh/example
autobins="example" autobins="example"
autoinfixconds="ex" autoinfixconds="ex"

View file

@ -714,21 +714,21 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_files(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_files(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_files(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -736,7 +736,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_files(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/files
autobins="chgrp chown ln mkdir mv rm rmdir sync" autobins="chgrp chown ln mkdir mv rm rmdir sync"
objects="files.o" objects="files.o"

View file

@ -329,14 +329,14 @@ scanpmmapfile(HashTable ht, ScanFunc func, int flags)
/**/ /**/
int int
setup_(Module m) setup_mapfile(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_mapfile(Module m)
{ {
/* Create the special associative array. */ /* Create the special associative array. */
@ -348,7 +348,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_mapfile(Module m)
{ {
Param pm; Param pm;
@ -364,7 +364,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_mapfile(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/mapfile
autoparams="mapfile" autoparams="mapfile"
objects="mapfile.o" objects="mapfile.o"

View file

@ -450,21 +450,21 @@ math_func(char *name, int argc, mnumber *argv, int id)
/**/ /**/
int int
setup_(Module m) setup_mathfunc(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_mathfunc(Module m)
{ {
return !addmathfuncs(m->nam, mftab, sizeof(mftab)/sizeof(*mftab)); return !addmathfuncs(m->nam, mftab, sizeof(mftab)/sizeof(*mftab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_mathfunc(Module m)
{ {
deletemathfuncs(m->nam, mftab, sizeof(mftab)/sizeof(*mftab)); deletemathfuncs(m->nam, mftab, sizeof(mftab)/sizeof(*mftab));
return 0; return 0;
@ -472,7 +472,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_mathfunc(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/mathfunc
autobins="mathfunc" autobins="mathfunc"
objects="mathfunc.o" objects="mathfunc.o"

View file

@ -1940,7 +1940,7 @@ static struct funcwrap wrapper[] = {
/**/ /**/
int int
setup_(Module m) setup_parameter(Module m)
{ {
incleanup = 0; incleanup = 0;
@ -1949,7 +1949,7 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_parameter(Module m)
{ {
/* Create the special associative arrays. /* Create the special associative arrays.
* As an example for autoloaded parameters, this is probably a bad * As an example for autoloaded parameters, this is probably a bad
@ -1987,7 +1987,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_parameter(Module m)
{ {
Param pm; Param pm;
struct pardef *def; struct pardef *def;
@ -2009,7 +2009,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_parameter(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/parameter
autoparams="parameters commands functions dis_functions funcstack builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases" autoparams="parameters commands functions dis_functions funcstack builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases"
objects="parameter.o" objects="parameter.o"

View file

@ -590,21 +590,21 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_stat(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_stat(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_stat(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -612,7 +612,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_stat(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/stat
autobins="stat" autobins="stat"
objects="stat.o" objects="stat.o"

View file

@ -3201,14 +3201,14 @@ bin_zftp(char *name, char **args, char *ops, int func)
/**/ /**/
int int
setup_(Module m) setup_zftp(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_zftp(Module m)
{ {
int ret; int ret;
if ((ret = addbuiltins(m->nam, bintab, if ((ret = addbuiltins(m->nam, bintab,
@ -3232,7 +3232,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_zftp(Module m)
{ {
/* /*
* There are various parameters hanging around, but they're * There are various parameters hanging around, but they're
@ -3260,7 +3260,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_zftp(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/zftp
autobins="zftp" autobins="zftp"
objects="zftp.o" objects="zftp.o"

View file

@ -291,14 +291,14 @@ static struct funcwrap wrapper[] = {
/**/ /**/
int int
setup_(Module m) setup_zprof(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_zprof(Module m)
{ {
calls = NULL; calls = NULL;
ncalls = 0; ncalls = 0;
@ -311,7 +311,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_zprof(Module m)
{ {
freepfuncs(calls); freepfuncs(calls);
freeparcs(arcs); freeparcs(arcs);
@ -322,7 +322,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_zprof(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/zprof
autobins="zprof" autobins="zprof"
objects="zprof.o" objects="zprof.o"

View file

@ -729,7 +729,7 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_zutil(Module m)
{ {
zstyles = NULL; zstyles = NULL;
@ -738,14 +738,14 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_zutil(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_zutil(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -753,7 +753,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_zutil(Module m)
{ {
freestypat(zstyles); freestypat(zstyles);

View file

@ -1,5 +1,3 @@
name=zsh/zutil
objects="zutil.o" objects="zutil.o"
autobins="zformat zstyle" autobins="zformat zstyle"

View file

@ -145,7 +145,7 @@ int permmnum, permgnum, lastpermmnum, lastpermgnum;
/**/ /**/
mod_export int nmatches; mod_export int nmatches;
/**/ /**/
int smatches; mod_export int smatches;
/* != 0 if only explanation strings should be printed */ /* != 0 if only explanation strings should be printed */

View file

@ -3732,7 +3732,7 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_compctl(Module m)
{ {
compctlreadptr = compctlread; compctlreadptr = compctlread;
createcompctltable(); createcompctltable();
@ -3752,7 +3752,7 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_compctl(Module m)
{ {
addhookfunc("compctl_make", (Hookfn) ccmakehookfn); addhookfunc("compctl_make", (Hookfn) ccmakehookfn);
addhookfunc("compctl_before", (Hookfn) ccbeforehookfn); addhookfunc("compctl_before", (Hookfn) ccbeforehookfn);
@ -3762,7 +3762,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_compctl(Module m)
{ {
deletehookfunc("compctl_make", (Hookfn) ccmakehookfn); deletehookfunc("compctl_make", (Hookfn) ccmakehookfn);
deletehookfunc("compctl_before", (Hookfn) ccbeforehookfn); deletehookfunc("compctl_before", (Hookfn) ccbeforehookfn);
@ -3773,7 +3773,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_compctl(Module m)
{ {
deletehashtable(compctltab); deletehashtable(compctltab);

View file

@ -1,6 +1,4 @@
name=zsh/compctl moddeps="complete zle"
moddeps="zsh/complete zsh/zle"
autobins="compctl" autobins="compctl"

View file

@ -1350,7 +1350,7 @@ struct hookdef comphooks[] = {
/**/ /**/
int int
setup_(Module m) setup_complete(Module m)
{ {
hasperm = 0; hasperm = 0;
@ -1371,7 +1371,7 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_complete(Module m)
{ {
addhookfunc("complete", (Hookfn) do_completion); addhookfunc("complete", (Hookfn) do_completion);
addhookfunc("before_complete", (Hookfn) before_complete); addhookfunc("before_complete", (Hookfn) before_complete);
@ -1391,7 +1391,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_complete(Module m)
{ {
deletehookfunc("complete", (Hookfn) do_completion); deletehookfunc("complete", (Hookfn) do_completion);
deletehookfunc("before_complete", (Hookfn) before_complete); deletehookfunc("before_complete", (Hookfn) before_complete);
@ -1410,7 +1410,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_complete(Module m)
{ {
if (compwords) if (compwords)
freearray(compwords); freearray(compwords);

View file

@ -1,8 +1,6 @@
name=zsh/complete moddeps="zle"
moddeps="zsh/zle" autobins="compgen compadd compset"
autobins="compadd compset"
autoprefixconds="prefix suffix between after" autoprefixconds="prefix suffix between after"

View file

@ -1196,14 +1196,14 @@ menuselect(char **args)
/**/ /**/
int int
setup_(Module m) setup_complist(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_complist(Module m)
{ {
mtab = NULL; mtab = NULL;
mgtab = NULL; mgtab = NULL;
@ -1237,7 +1237,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_complist(Module m)
{ {
free(mtab); free(mtab);
free(mgtab); free(mgtab);
@ -1251,7 +1251,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_complist(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/complist moddeps="complete zle"
moddeps="zsh/complete zsh/zle"
objects="complist.o" objects="complist.o"

View file

@ -1491,7 +1491,7 @@ calclist(int showall)
} }
/**/ /**/
int asklist(void) mod_export int asklist(void)
{ {
/* Set the cursor below the prompt. */ /* Set the cursor below the prompt. */
trashzle(); trashzle();

View file

@ -2444,7 +2444,7 @@ static struct builtin bintab[] = {
/**/ /**/
int int
setup_(Module m) setup_computil(Module m)
{ {
memset(cadef_cache, 0, sizeof(cadef_cache)); memset(cadef_cache, 0, sizeof(cadef_cache));
memset(cvdef_cache, 0, sizeof(cvdef_cache)); memset(cvdef_cache, 0, sizeof(cvdef_cache));
@ -2458,14 +2458,14 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_computil(Module m)
{ {
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_computil(Module m)
{ {
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0; return 0;
@ -2473,7 +2473,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_computil(Module m)
{ {
int i; int i;

View file

@ -1,6 +1,4 @@
name=zsh/computil moddeps="complete zle"
moddeps="zsh/complete zsh/zle"
objects="computil.o" objects="computil.o"

View file

@ -75,14 +75,14 @@ deltochar(char **args)
/**/ /**/
int int
setup_(Module m) setup_deltochar(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_deltochar(Module m)
{ {
w_deletetochar = addzlefunction("delete-to-char", deltochar, w_deletetochar = addzlefunction("delete-to-char", deltochar,
ZLE_KILL | ZLE_KEEPSUFFIX); ZLE_KILL | ZLE_KEEPSUFFIX);
@ -100,7 +100,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_deltochar(Module m)
{ {
deletezlefunction(w_deletetochar); deletezlefunction(w_deletetochar);
deletezlefunction(w_zaptochar); deletezlefunction(w_zaptochar);
@ -109,7 +109,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_deltochar(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,5 +1,3 @@
name=zsh/deltochar moddeps="zle"
moddeps="zsh/zle"
objects="deltochar.o" objects="deltochar.o"

View file

@ -1,5 +1,3 @@
name=zsh/zle
autobins="bindkey vared zle" autobins="bindkey vared zle"
objects="zle_bindings.o zle_hist.o zle_keymap.o zle_main.o \ objects="zle_bindings.o zle_hist.o zle_keymap.o zle_main.o \

View file

@ -1003,7 +1003,7 @@ mod_export struct hookdef zlehooks[] = {
/**/ /**/
int int
setup_(Module m) setup_zle(Module m)
{ {
/* Set up editor entry points */ /* Set up editor entry points */
trashzleptr = trashzle; trashzleptr = trashzle;
@ -1036,7 +1036,7 @@ setup_(Module m)
/**/ /**/
int int
boot_(Module m) boot_zle(Module m)
{ {
addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
addhookdefs(m->nam, zlehooks, sizeof(zlehooks)/sizeof(*zlehooks)); addhookdefs(m->nam, zlehooks, sizeof(zlehooks)/sizeof(*zlehooks));
@ -1045,7 +1045,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_zle(Module m)
{ {
if(zleactive) { if(zleactive) {
zerrnam(m->nam, "can't unload the zle module while zle is active", zerrnam(m->nam, "can't unload the zle module while zle is active",
@ -1059,7 +1059,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_zle(Module m)
{ {
int i; int i;

View file

@ -49,7 +49,7 @@
/* Hashtable of thingies. Enabled nodes are those that refer to widgets. */ /* Hashtable of thingies. Enabled nodes are those that refer to widgets. */
/**/ /**/
HashTable thingytab; mod_export HashTable thingytab;
/**********************************/ /**********************************/
/* hashtable management functions */ /* hashtable management functions */
@ -546,7 +546,7 @@ bin_zle_complete(char *name, char **args, char *ops, char func)
Thingy t; Thingy t;
Widget w, cw; Widget w, cw;
if (!require_module(name, "zsh/complete", 0, 0)) { if (!require_module(name, "complete", 0, 0)) {
zerrnam(name, "can't load complete module", NULL, 0); zerrnam(name, "can't load complete module", NULL, 0);
return 1; return 1;
} }

View file

@ -334,7 +334,7 @@ mod_export int insubscr;
/* Parameter pointer for completing keys of an assoc array. */ /* Parameter pointer for completing keys of an assoc array. */
/**/ /**/
Param keypm; mod_export Param keypm;
/* 1 if we are completing in a quoted string (or inside `...`) */ /* 1 if we are completing in a quoted string (or inside `...`) */

View file

@ -198,14 +198,14 @@ static struct pardef partab[] = {
/**/ /**/
int int
setup_(Module m) setup_zleparameter(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_zleparameter(Module m)
{ {
struct pardef *def; struct pardef *def;
@ -232,7 +232,7 @@ boot_(Module m)
/**/ /**/
int int
cleanup_(Module m) cleanup_zleparameter(Module m)
{ {
Param pm; Param pm;
struct pardef *def; struct pardef *def;
@ -249,7 +249,7 @@ cleanup_(Module m)
/**/ /**/
int int
finish_(Module m) finish_zleparameter(Module m)
{ {
return 0; return 0;
} }

View file

@ -1,6 +1,4 @@
name=zsh/zleparameter moddeps="zle"
moddeps="zsh/zle"
autoparams="widgets keymaps" autoparams="widgets keymaps"

View file

@ -943,7 +943,7 @@ init_bltinmods(void)
#include "bltinmods.list" #include "bltinmods.list"
load_module("zsh/main"); load_module("zsh");
} }
/**/ /**/
@ -965,7 +965,7 @@ noop_function_int(int nothing)
* avoid wasting space with the fallback functions. No other source * * avoid wasting space with the fallback functions. No other source *
* file needs to know which modules are linked in. */ * file needs to know which modules are linked in. */
#ifdef LINKED_XMOD_zshQszle #ifdef LINKED_XMOD_zle
/**/ /**/
mod_export ZleVoidFn trashzleptr = noop_function; mod_export ZleVoidFn trashzleptr = noop_function;
@ -978,26 +978,26 @@ mod_export ZleVoidIntFn spaceinlineptr = noop_function_int;
/**/ /**/
mod_export ZleReadFn zlereadptr = autoload_zleread; mod_export ZleReadFn zlereadptr = autoload_zleread;
#else /* !LINKED_XMOD_zshQszle */ #else /* !LINKED_XMOD_zle */
mod_export ZleVoidFn trashzleptr = noop_function; mod_export ZleVoidFn trashzleptr = noop_function;
mod_export ZleVoidFn gotwordptr = noop_function; mod_export ZleVoidFn gotwordptr = noop_function;
mod_export ZleVoidFn refreshptr = noop_function; mod_export ZleVoidFn refreshptr = noop_function;
mod_export ZleVoidIntFn spaceinlineptr = noop_function_int; mod_export ZleVoidIntFn spaceinlineptr = noop_function_int;
# ifdef UNLINKED_XMOD_zshQszle # ifdef UNLINKED_XMOD_zle
mod_export ZleReadFn zlereadptr = autoload_zleread; mod_export ZleReadFn zlereadptr = autoload_zleread;
# else /* !UNLINKED_XMOD_zshQszle */ # else /* !UNLINKED_XMOD_zle */
mod_export ZleReadFn zlereadptr = fallback_zleread; mod_export ZleReadFn zlereadptr = fallback_zleread;
# endif /* !UNLINKED_XMOD_zshQszle */ # endif /* !UNLINKED_XMOD_zle */
#endif /* !LINKED_XMOD_zshQszle */ #endif /* !LINKED_XMOD_zle */
/**/ /**/
unsigned char * unsigned char *
autoload_zleread(char *lp, char *rp, int ha) autoload_zleread(char *lp, char *rp, int ha)
{ {
zlereadptr = fallback_zleread; zlereadptr = fallback_zleread;
load_module("zsh/zle"); load_module("zle");
return zleread(lp, rp, ha); return zleread(lp, rp, ha);
} }

View file

@ -109,6 +109,15 @@ BEGIN {
gsub(/@>/, ")", dcltor) gsub(/@>/, ")", dcltor)
gsub(/@!/, ",", dcltor) gsub(/@!/, ",", dcltor)
# If this is a module boot/cleanup function, conditionally rename it.
if(" " dtype " " ~ / int / && dcltor ~ / *@\+(boot|cleanup|setup|finish)_[_0-9A-Za-z]+@- *_\(\( *Module +[_0-9A-Za-z]+ *\)\) */) {
modtype = dnam
sub(/_.*$/, "", modtype)
printf "%s# if defined(DYNAMIC_NAME_CLASH_OK) && defined(MODULE)\n", locality
printf "%s# define " dnam " " modtype "_\n", locality
printf "%s# endif\n", locality
}
# If this is exported, add it to the exported symbol list. # If this is exported, add it to the exported symbol list.
if(exported) if(exported)
printf "X%s\n", dnam printf "X%s\n", dnam

View file

@ -11,7 +11,7 @@ test "x$srcdir" = "x" && srcdir=.
MODBINS=${MODBINS-modules-bltin} MODBINS=${MODBINS-modules-bltin}
XMODCF=${XMODCF-$srcdir/xmods.conf} XMODCF=${XMODCF-$srcdir/xmods.conf}
bin_mods=" zsh/main "`sed 's/^/ /;s/$/ /' $MODBINS` bin_mods=" zsh "`sed 's/^/ /;s/$/ /' $MODBINS`
x_mods=`cat $XMODCF` x_mods=`cat $XMODCF`
. ./modules.index . ./modules.index
@ -20,7 +20,6 @@ trap "rm -f $1; exit 1" 1 2 15
exec > $1 exec > $1
for x_mod in $x_mods; do for x_mod in $x_mods; do
q_x_mod=`echo $x_mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
case "$bin_mods" in case "$bin_mods" in
*" $x_mod "*) *" $x_mod "*)
echo "/* linked-in known module \`$x_mod' */" echo "/* linked-in known module \`$x_mod' */"
@ -31,10 +30,10 @@ for x_mod in $x_mods; do
echo "/* non-linked-in known module \`$x_mod' */" echo "/* non-linked-in known module \`$x_mod' */"
linked=no linked=no
esac esac
eval "modfile=\$modfile_$q_x_mod" eval "loc=\$loc_$x_mod"
unset moddeps autobins autoinfixconds autoprefixconds autoparams unset moddeps autobins autoinfixconds autoprefixconds autoparams
unset automathfuncs unset automathfuncs
. $srcdir/../$modfile . $srcdir/../$loc/${x_mod}.mdd
for bin in $autobins; do for bin in $autobins; do
echo " add_autobin(\"$bin\", \"$x_mod\");" echo " add_autobin(\"$bin\", \"$x_mod\");"
done done
@ -59,11 +58,10 @@ done
echo echo
done_mods=" " done_mods=" "
for bin_mod in $bin_mods; do for bin_mod in $bin_mods; do
q_bin_mod=`echo $bin_mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
echo "/* linked-in module \`$bin_mod' */" echo "/* linked-in module \`$bin_mod' */"
eval "modfile=\$modfile_$q_bin_mod" eval "loc=\$loc_$bin_mod"
unset moddeps unset moddeps
. $srcdir/../$modfile . $srcdir/../$loc/${bin_mod}.mdd
for dep in $moddeps; do for dep in $moddeps; do
case $done_mods in case $done_mods in
*" $dep "*) *" $dep "*)
@ -74,14 +72,14 @@ for bin_mod in $bin_mods; do
esac esac
done done
echo " {" echo " {"
echo " extern int setup_${q_bin_mod} _((Module));" echo " extern int setup_${bin_mod} _((Module));"
echo " extern int boot_${q_bin_mod} _((Module));" echo " extern int boot_${bin_mod} _((Module));"
echo " extern int cleanup_${q_bin_mod} _((Module));" echo " extern int cleanup_${bin_mod} _((Module));"
echo " extern int finish_${q_bin_mod} _((Module));" echo " extern int finish_${bin_mod} _((Module));"
echo echo
echo " register_module(\"$bin_mod\"," echo " register_module(\"$bin_mod\","
echo " setup_${q_bin_mod}, boot_${q_bin_mod}," echo " setup_${bin_mod}, boot_${bin_mod},"
echo " cleanup_${q_bin_mod}, finish_${q_bin_mod});" echo " cleanup_${bin_mod}, finish_${bin_mod});"
echo " }" echo " }"
done_mods="$done_mods$bin_mod " done_mods="$done_mods$bin_mod "
done done

View file

@ -17,9 +17,8 @@
# defines one module. The .mdd file is actually a shell script, which will # defines one module. The .mdd file is actually a shell script, which will
# be sourced. It may define the following shell variables: # be sourced. It may define the following shell variables:
# #
# name name of this module
# moddeps modules on which this module depends (default none) # moddeps modules on which this module depends (default none)
# nozshdep non-empty indicates no dependence on the `zsh/main' pseudo-module # nozshdep non-empty indicates no dependence on the `zsh' pseudo-module
# alwayslink if non-empty, always link the module into the executable # alwayslink if non-empty, always link the module into the executable
# autobins builtins defined by the module, for autoloading # autobins builtins defined by the module, for autoloading
# autoinfixconds infix condition codes defined by the module, for # autoinfixconds infix condition codes defined by the module, for
@ -104,14 +103,14 @@ if $first_stage; then
echo echo
. Src/modules.index . Src/modules.index
bin_mods=" zsh/main "`sed 's/^/ /;s/$/ /' Src/modules-bltin` bin_mods=" zsh "`sed 's/^/ /;s/$/ /' Src/modules-bltin`
if grep '%@D@%D%' config.status >/dev/null; then if grep '%@D@%D%' config.status >/dev/null; then
is_dynamic=true is_dynamic=true
else else
is_dynamic=false is_dynamic=false
fi fi
here_mddnames= here_modules=
all_subdirs= all_subdirs=
all_modobjs= all_modobjs=
all_modules= all_modules=
@ -120,31 +119,30 @@ if $first_stage; then
all_proto= all_proto=
lastsub=// lastsub=//
for module in $module_list; do for module in $module_list; do
q_module=`echo $module | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'` eval "loc=\$loc_$module"
eval "modfile=\$modfile_$q_module" case $loc in
case $modfile in $the_subdir)
$the_subdir/$lastsub/*) ;; here_modules="$here_modules $module"
$the_subdir/*/*)
lastsub=`echo $modfile | sed 's,^'$the_subdir'/,,;s,/[^/]*$,,'`
all_subdirs="$all_subdirs $lastsub"
;;
$the_subdir/*)
mddname=`echo $modfile | sed 's,^.*/,,;s,\.mdd$,,'`
here_mddnames="$here_mddnames $mddname"
build=$is_dynamic build=$is_dynamic
case $is_dynamic@$bin_mods in case $is_dynamic@$bin_mods in
*" $module "*) *" $module "*)
build=true build=true
all_modobjs="$all_modobjs modobjs.${mddname}" ;; all_modobjs="$all_modobjs modobjs.${module}" ;;
true@*) true@*)
all_modules="$all_modules ${mddname}.\$(DL_EXT)" ;; all_modules="$all_modules ${module}.\$(DL_EXT)" ;;
esac esac
all_mdds="$all_mdds ${mddname}.mdd" all_mdds="$all_mdds ${module}.mdd"
$build && all_mdhs="$all_mdhs ${mddname}.mdh" $build && all_mdhs="$all_mdhs ${module}.mdh"
$build && all_proto="$all_proto proto.${mddname}" $build && all_proto="$all_proto proto.${module}"
;;
$lastsub | $lastsub/*) ;;
$the_subdir/*)
all_subdirs="$all_subdirs $loc"
lastsub=$loc
;; ;;
esac esac
done done
all_subdirs=`echo "$all_subdirs" | sed "s' $the_subdir/' 'g"`
echo "MODOBJS =$all_modobjs" echo "MODOBJS =$all_modobjs"
echo "MODULES =$all_modules" echo "MODULES =$all_modules"
echo "MDDS =$all_mdds" echo "MDDS =$all_mdds"
@ -171,41 +169,39 @@ if $first_stage; then
other_mdhs= other_mdhs=
remote_mdhs= remote_mdhs=
for mddname in $here_mddnames; do for module in $here_modules; do
unset name moddeps nozshdep alwayslink hasexport unset moddeps nozshdep alwayslink hasexport
unset autobins autoinfixconds autoprefixconds autoparams automathfuncs unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
unset objects proto headers hdrdeps otherincs unset objects proto headers hdrdeps otherincs
. $top_srcdir/$the_subdir/${mddname}.mdd . $top_srcdir/$the_subdir/${module}.mdd
q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
test -n "${moddeps+set}" || moddeps= test -n "${moddeps+set}" || moddeps=
test -n "$nozshdep" || moddeps="$moddeps zsh/main" test -n "$nozshdep" || moddeps="$moddeps zsh"
test -n "${proto+set}" || test -n "${proto+set}" ||
proto=`echo $objects '' | sed 's,\.o ,.syms ,g'` proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'` dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
modhdeps= modhdeps=
imports= imports=
q_moddeps= depimports=
for dep in $moddeps; do for dep in $moddeps; do
q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'` eval "loc=\$loc_$dep"
q_moddeps="$q_moddeps $q_dep" imports="$imports \$(IMPOPT)\$(dir_top)/$loc/$dep.export"
eval "depfile=\$modfile_$q_dep" test "$loc" = "$the_subdir" &&
eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'` depimports="$depimports $dep.export"
imports="$imports \$(IMPOPT)\$(dir_top)/$loc/${depbase}.export"
case $the_subdir in case $the_subdir in
$loc) $loc)
mdh="${depbase}.mdh" mdh="${dep}.mdh"
;; ;;
$loc/*) $loc/*)
mdh="\$(dir_top)/$loc/${depbase}.mdh" mdh="\$(dir_top)/$loc/${dep}.mdh"
case "$other_mdhs " in case "$other_mdhs " in
*" $mdh "*) ;; *" $mdh "*) ;;
*) other_mdhs="$other_mdhs $mdh" ;; *) other_mdhs="$other_mdhs $mdh" ;;
esac esac
;; ;;
*) *)
mdh="\$(dir_top)/$loc/${depbase}.mdh" mdh="\$(dir_top)/$loc/${dep}.mdh"
case "$remote_mdhs " in case "$remote_mdhs " in
*" $mdh "*) ;; *" $mdh "*) ;;
*) remote_mdhs="$remote_mdhs $mdh" ;; *) remote_mdhs="$remote_mdhs $mdh" ;;
@ -215,91 +211,64 @@ if $first_stage; then
modhdeps="$modhdeps $mdh" modhdeps="$modhdeps $mdh"
done done
echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####" echo "##### ===== DEPENDENCIES GENERATED FROM ${module}.mdd ===== #####"
echo echo
echo "MODOBJS_${mddname} = $objects" echo "MODOBJS_${module} = $objects"
echo "MODDOBJS_${mddname} = $dobjects \$(@E@NTRYOBJ)" echo "MODDOBJS_${module} = $dobjects \$(@E@NTRYOBJ)"
echo "SYMS_${mddname} = $proto" echo "SYMS_${module} = $proto"
echo "EPRO_${mddname} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'` echo "EPRO_${module} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs" echo "INCS_${module} = \$(EPRO_${module}) $otherincs"
echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export" echo "EXPIMP_${module} = $imports \$(EXPOPT)$module.export"
echo "NXPIMP_${mddname} =" echo "NXPIMP_${module} ="
echo echo
echo "proto.${mddname}: \$(EPRO_${mddname})" echo "proto.${module}: \$(EPRO_${module})"
echo "\$(SYMS_${mddname}): \$(PROTODEPS)" echo "\$(SYMS_${module}): \$(PROTODEPS)"
echo echo
echo "${mddname}.export: \$(SYMS_${mddname})" echo "${module}.export: \$(SYMS_${module})"
echo " ( echo '#!'; cat \$(SYMS_${mddname}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$@" echo " ( echo '#!'; cat \$(SYMS_${module}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$@"
echo echo
echo "modobjs.${mddname}: \$(MODOBJS_${mddname})" echo "modobjs.${module}: \$(MODOBJS_${module})"
echo " echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp" echo " echo '' \$(MODOBJS_${module}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
echo echo
if test -z "$alwayslink"; then if test -z "$alwayslink"; then
case " $all_modules" in *" ${mddname}."*) echo "${module}.\$(DL_EXT): \$(MODDOBJS_${module}) ${module}.export $depimports"
echo "install.modules-here: install.modules.${mddname}"
echo "uninstall.modules-here: uninstall.modules.${mddname}"
echo
;; esac
instsubdir=`echo $name | sed 's,^,/,;s,/[^/]*$,,'`
echo "install.modules.${mddname}: ${mddname}.\$(DL_EXT)"
echo " \$(sdir_top)/mkinstalldirs \$(DESTDIR)\$(MODDIR)${instsubdir}"
echo " \$(INSTALL_PROGRAM) ${mddname}.\$(DL_EXT) \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
echo
echo "uninstall.modules.${mddname}:"
echo " rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
echo
echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export"
echo ' rm -f $@' echo ' rm -f $@'
echo " \$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(LIBS)" echo " \$(DLLINK) \$(@E@XPIMP_$module) \$(@E@NTRYOPT) \$(MODDOBJS_${module}) \$(LIBS)"
echo echo
fi fi
echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})" echo "${module}.mdhi: ${module}.mdhs \$(INCS_${module})"
echo " @test -f \$@ || echo 'do not delete this file' > \$@" echo " @test -f \$@ || echo 'do not delete this file' > \$@"
echo echo
echo "${mddname}.mdhs: ${mddname}.mdd" echo "${module}.mdhs: ${module}.mdd"
echo " @\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp" echo " @\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${module}.mdh.tmp"
echo " @if cmp -s ${mddname}.mdh ${mddname}.mdh.tmp; then \\" echo " @if cmp -s ${module}.mdh ${module}.mdh.tmp; then \\"
echo " rm -f ${mddname}.mdh.tmp; \\" echo " rm -f ${module}.mdh.tmp; \\"
echo " echo \"\\\`${mddname}.mdh' is up to date.\"; \\" echo " echo \"\\\`${module}.mdh' is up to date.\"; \\"
echo " else \\" echo " else \\"
echo " mv -f ${mddname}.mdh.tmp ${mddname}.mdh; \\" echo " mv -f ${module}.mdh.tmp ${module}.mdh; \\"
echo " echo \"Updated \\\`${mddname}.mdh'.\"; \\" echo " echo \"Updated \\\`${module}.mdh'.\"; \\"
echo " fi" echo " fi"
echo " echo 'timestamp for ${mddname}.mdh against ${mddname}.mdd' > \$@" echo " echo 'timestamp for ${module}.mdh against ${module}.mdd' > \$@"
echo echo
echo "${mddname}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${mddname}.mdhi" echo "${module}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${module}.mdhi"
echo " @\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp" echo " @\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${module}.mdh.tmp"
echo " @mv -f ${mddname}.mdh.tmp ${mddname}.mdh" echo " @mv -f ${module}.mdh.tmp ${module}.mdh"
echo " @echo \"Updated \\\`${mddname}.mdh'.\"" echo " @echo \"Updated \\\`${module}.mdh'.\""
echo echo
echo "${mddname}.mdh.tmp:" echo "${module}.mdh.tmp:"
echo " @( \\" echo " @( \\"
echo " echo '#ifndef have_${q_name}_module'; \\" echo " echo '#ifndef have_${module}_module'; \\"
echo " echo '#define have_${q_name}_module'; \\" echo " echo '#define have_${module}_module'; \\"
echo " echo; \\" echo " echo; \\"
echo " echo '# ifndef IMPORTING_MODULE_${q_name}'; \\" if test -n "$moddeps"; then
echo " if test @SHORTBOOTNAMES@ = yes; then \\"
echo " echo '# ifndef MODULE'; \\"
echo " fi; \\"
echo " echo '# define boot_ boot_${q_name}'; \\"
echo " echo '# define cleanup_ cleanup_${q_name}'; \\"
echo " echo '# define setup_ setup_${q_name}'; \\"
echo " echo '# define finish_ finish_${q_name}'; \\"
echo " if test @SHORTBOOTNAMES@ = yes; then \\"
echo " echo '# endif /* !MODULE */'; \\"
echo " fi; \\"
echo " echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
echo " echo; \\"
if test -n "$moddeps"; then (
set x $q_moddeps
echo " echo '/* Module dependencies */'; \\" echo " echo '/* Module dependencies */'; \\"
for hdep in $modhdeps; do echo " for mod in $modhdeps; do \\"
shift echo " echo '# define USING_MODULE'; \\"
echo " echo '# define IMPORTING_MODULE_${1} 1'; \\" echo " echo '# include \"'\$\$mod'\"'; \\"
echo " echo '# include \"${hdep}\"'; \\" echo " done; \\"
done echo " echo '# undef USING_MODULE'; \\"
echo " echo; \\" echo " echo; \\"
) fi fi
if test -n "$headers"; then if test -n "$headers"; then
echo " echo '/* Extra headers for this module */'; \\" echo " echo '/* Extra headers for this module */'; \\"
echo " for hdr in $headers; do \\" echo " for hdr in $headers; do \\"
@ -312,18 +281,18 @@ if $first_stage; then
echo " echo; \\" echo " echo; \\"
fi fi
if test -n "$proto"; then if test -n "$proto"; then
echo " for epro in \$(EPRO_${mddname}); do \\" echo " for epro in \$(EPRO_${module}); do \\"
echo " echo '# include \"'\$\$epro'\"'; \\" echo " echo '# include \"'\$\$epro'\"'; \\"
echo " done; \\" echo " done; \\"
echo " echo; \\" echo " echo; \\"
fi fi
echo " echo '#endif /* !have_${q_name}_module */'; \\" echo " echo '#endif /* !have_${module}_module */'; \\"
echo " ) > \$@" echo " ) > \$@"
echo echo
echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh" echo "\$(MODOBJS_${module}) \$(MODDOBJS_${module}): ${module}.mdh"
sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \ sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
-e 's/^ *: *<< *\\Make *$//; /^Make$/d' \ -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
< $top_srcdir/$the_subdir/${mddname}.mdd < $top_srcdir/$the_subdir/${module}.mdd
echo echo
done done

View file

@ -13,25 +13,28 @@ while test $# -ne 0; do
dir=$1 dir=$1
shift shift
( set $dir/*.mdd; test -f $1 ) || continue ( set $dir/*.mdd; test -f $1 ) || continue
for modfile in $dir/*.mdd; do dosubs=false
name=`( . $modfile; echo $name )` for mod in `echo '' $dir/*.mdd '' | sed 's, [^ ]*/, ,g;s,\.mdd , ,g'`; do
case "$name" in *[!/_0-9A-Za-z]* | /* | */ | *//*) case `echo "$mod@ $module_list " | sed 's,^.*[^_0-9A-Za-z].*@,@@,'` in
echo >&2 "WARNING: illegally named module \`$name' in $modfile" @@*)
echo >&2 " (ignoring it)" echo >&2 "WARNING: illegally named module \`$mod' in $dir"
continue echo >&2 " (ignoring it)"
;; esac ;;
q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'` *@*" $mod "*)
case " $module_list " in *" $name "*) eval "loc=\$loc_$mod"
eval "omodfile=\$modfile_$q_name" echo >&2 "WARNING: module \`$mod' (in $loc) duplicated in $dir"
echo >&2 "WARNING: module \`$name' (in $omodfile) duplicated in $modfile" echo >&2 " (ignoring duplicate)"
echo >&2 " (ignoring duplicate)" dosubs=true
continue ;;
;; esac *)
module_list="$module_list$name " module_list="$module_list$mod "
echo "modfile_$q_name=$modfile" echo "loc_$mod=$dir"
eval "modfile_$q_name=\$modfile" eval "loc_$mod=\$dir"
dosubs=true
;;
esac
done done
set `echo $dir/*/. '' | sed 's,/\. , ,g'` "$@" $dosubs && set `echo $dir/*/. '' | sed 's,/\. , ,g'` "$@"
done done
echo echo

View file

@ -36,34 +36,34 @@
LinkList linkedmodules; LinkList linkedmodules;
/* The `zsh/main' module contains all the base code that can't actually be * /* The `zsh' module contains all the base code that can't actually be built *
* built as a separate module. It is initialised by main(), so there's * * as a separate module. It is initialised by main(), so there's nothing *
* nothing for the boot function to do. */ * for the boot function to do. */
/**/ /**/
int int
setup_(Module m) setup_zsh(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
boot_(Module m) boot_zsh(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
cleanup_(Module m) cleanup_zsh(Module m)
{ {
return 0; return 0;
} }
/**/ /**/
int int
finish_(Module m) finish_zsh(Module m)
{ {
return 0; return 0;
} }
@ -358,14 +358,22 @@ hpux_dlsym(void *handle, char *name)
#ifdef DLSYM_NEEDS_UNDERSCORE #ifdef DLSYM_NEEDS_UNDERSCORE
# define STR_SETUP "_setup_" # define STR_SETUP "_setup_"
# define STR_SETUP_S "_setup_%s"
# define STR_BOOT "_boot_" # define STR_BOOT "_boot_"
# define STR_BOOT_S "_boot_%s"
# define STR_CLEANUP "_cleanup_" # define STR_CLEANUP "_cleanup_"
# define STR_CLEANUP_S "_cleanup_%s"
# define STR_FINISH "_finish_" # define STR_FINISH "_finish_"
# define STR_FINISH_S "_finish_%s"
#else /* !DLSYM_NEEDS_UNDERSCORE */ #else /* !DLSYM_NEEDS_UNDERSCORE */
# define STR_SETUP "setup_" # define STR_SETUP "setup_"
# define STR_SETUP_S "setup_%s"
# define STR_BOOT "boot_" # define STR_BOOT "boot_"
# define STR_BOOT_S "boot_%s"
# define STR_CLEANUP "cleanup_" # define STR_CLEANUP "cleanup_"
# define STR_CLEANUP_S "cleanup_%s"
# define STR_FINISH "finish_" # define STR_FINISH "finish_"
# define STR_FINISH_S "finish_%s"
#endif /* !DLSYM_NEEDS_UNDERSCORE */ #endif /* !DLSYM_NEEDS_UNDERSCORE */
/**/ /**/
@ -387,11 +395,21 @@ try_load_module(char const *name)
void *ret = NULL; void *ret = NULL;
int l; int l;
l = 1 + strlen(name) + 1 + strlen(DL_EXT); if (strchr(name, '/')) {
ret = dlopen(unmeta(name), RTLD_LAZY | RTLD_GLOBAL);
if (ret ||
unset(PATHDIRS) ||
(*name == '/') ||
(*name == '.' && name[1] == '/') ||
(*name == '.' && name[1] == '.' && name[2] == '/'))
return ret;
}
l = strlen(name) + 1;
for (pp = module_path; !ret && *pp; pp++) { for (pp = module_path; !ret && *pp; pp++) {
if (l + (**pp ? strlen(*pp) : 1) > PATH_MAX) if (l + (**pp ? strlen(*pp) : 1) > PATH_MAX)
continue; continue;
sprintf(buf, "%s/%s.%s", **pp ? *pp : ".", name, DL_EXT); sprintf(buf, "%s/%s", **pp ? *pp : ".", name);
ret = dlopen(unmeta(buf), RTLD_LAZY | RTLD_GLOBAL); ret = dlopen(unmeta(buf), RTLD_LAZY | RTLD_GLOBAL);
} }
@ -402,9 +420,15 @@ try_load_module(char const *name)
static void * static void *
do_load_module(char const *name) do_load_module(char const *name)
{ {
void *ret; void *ret = NULL;
char buf[PATH_MAX + 1];
ret = try_load_module(name); if (strlen(name) + strlen(DL_EXT) < PATH_MAX) {
sprintf(buf, "%s.%s", name, DL_EXT);
ret = try_load_module(buf);
}
if (!ret)
ret = try_load_module(name);
if (!ret) { if (!ret) {
int waserr = errflag; int waserr = errflag;
zerr("failed to load module: %s", name, 0); zerr("failed to load module: %s", name, 0);
@ -481,39 +505,37 @@ dyn_finish_module(Module m)
#else #else
static Module_func static Module_func
module_func(Module m, char *name) module_func(Module m, char *name, char *name_s)
{ {
char *s, *t;
#ifndef DYNAMIC_NAME_CLASH_OK
char buf[PATH_MAX + 1];
#endif
Module_func fn;
s = strrchr(m->nam, '/');
if (s)
s = dupstring(++s);
else
s = m->nam;
if ((t = strrchr(s, '.')))
*t = '\0';
#ifdef DYNAMIC_NAME_CLASH_OK #ifdef DYNAMIC_NAME_CLASH_OK
return (Module_func) dlsym(m->u.handle, name); fn = (Module_func) dlsym(m->u.handle, name);
#else /* !DYNAMIC_NAME_CLASH_OK */ #else /* !DYNAMIC_NAME_CLASH_OK */
VARARR(char, buf, strlen(name) + strlen(m->nam)*2 + 1); if (strlen(s) + 6 > PATH_MAX)
char const *p; return NULL;
char *q; sprintf(buf, name_s, s);
strcpy(buf, name); fn = (Module_func) dlsym(m->u.handle, buf);
q = strchr(buf, 0);
for(p = m->nam; *p; p++) {
if(*p == '/') {
*q++ = 'Q';
*q++ = 's';
} else if(*p == '_') {
*q++ = 'Q';
*q++ = 'u';
} else if(*p == 'Q') {
*q++ = 'Q';
*q++ = 'q';
} else
*q++ = *p;
}
*q = 0;
return (Module_func) dlsym(m->u.handle, buf);
#endif /* !DYNAMIC_NAME_CLASH_OK */ #endif /* !DYNAMIC_NAME_CLASH_OK */
return fn;
} }
/**/ /**/
static int static int
dyn_setup_module(Module m) dyn_setup_module(Module m)
{ {
Module_func fn = module_func(m, STR_SETUP); Module_func fn = module_func(m, STR_SETUP, STR_SETUP_S);
if (fn) if (fn)
return fn(m); return fn(m);
@ -525,7 +547,7 @@ dyn_setup_module(Module m)
static int static int
dyn_boot_module(Module m) dyn_boot_module(Module m)
{ {
Module_func fn = module_func(m, STR_BOOT); Module_func fn = module_func(m, STR_BOOT, STR_BOOT_S);
if(fn) if(fn)
return fn(m); return fn(m);
@ -537,7 +559,7 @@ dyn_boot_module(Module m)
static int static int
dyn_cleanup_module(Module m) dyn_cleanup_module(Module m)
{ {
Module_func fn = module_func(m, STR_CLEANUP); Module_func fn = module_func(m, STR_CLEANUP, STR_CLEANUP_S);
if(fn) if(fn)
return fn(m); return fn(m);
@ -552,7 +574,7 @@ dyn_cleanup_module(Module m)
static int static int
dyn_finish_module(Module m) dyn_finish_module(Module m)
{ {
Module_func fn = module_func(m, STR_FINISH); Module_func fn = module_func(m, STR_FINISH, STR_FINISH_S);
int r; int r;
if (fn) if (fn)
@ -634,22 +656,6 @@ finish_module(Module m)
/**/ /**/
#endif /* !DYNAMIC */ #endif /* !DYNAMIC */
/**/
static int
modname_ok(char const *p)
{
do {
if(*p != '_' && !ialnum(*p))
return 0;
do {
p++;
} while(*p == '_' || ialnum(*p));
if(!*p)
return 1;
} while(*p++ == '/');
return 0;
}
/**/ /**/
int int
load_module(char const *name) load_module(char const *name)
@ -660,10 +666,6 @@ load_module(char const *name)
LinkNode node, n; LinkNode node, n;
int set; int set;
if (!modname_ok(name)) {
zerr("invalid module name `%s'", name, 0);
return 0;
}
if (!(node = find_module(name))) { if (!(node = find_module(name))) {
if (!(linked = module_linked(name)) && if (!(linked = module_linked(name)) &&
!(handle = do_load_module(name))) !(handle = do_load_module(name)))
@ -776,6 +778,9 @@ require_module(char *nam, char *module, int res, int test)
zwarnnam(nam, "module %s already loaded.", module, 0); zwarnnam(nam, "module %s already loaded.", module, 0);
return 0; return 0;
} }
} else if (res && isset(RESTRICTED) && strchr(module, '/')) {
zwarnnam(nam, "%s: restricted", module, 0);
return 0;
} else } else
return load_module(module); return load_module(module);
@ -979,8 +984,13 @@ bin_zmodload_dep(char *nam, char **args, char *ops)
int ret = 0; int ret = 0;
char *tnam = *args++; char *tnam = *args++;
for(; *args; args++) for(; *args; args++) {
add_dep(tnam, *args); if(isset(RESTRICTED) && strchr(*args, '/')) {
zwarnnam(nam, "%s: restricted", *args, 0);
ret = 1;
} else
add_dep(tnam, *args);
}
return ret; return ret;
} }
} }
@ -1015,6 +1025,10 @@ bin_zmodload_auto(char *nam, char **args, char *ops)
/* add autoloaded builtins */ /* add autoloaded builtins */
char *modnam; char *modnam;
modnam = *args++; modnam = *args++;
if(isset(RESTRICTED) && strchr(modnam, '/')) {
zwarnnam(nam, "%s: restricted", modnam, 0);
return 1;
}
do { do {
char *bnam = *args ? *args++ : modnam; char *bnam = *args ? *args++ : modnam;
if (strchr(bnam, '/')) { if (strchr(bnam, '/')) {
@ -1078,6 +1092,10 @@ bin_zmodload_cond(char *nam, char **args, char *ops)
char *modnam; char *modnam;
modnam = *args++; modnam = *args++;
if(isset(RESTRICTED) && strchr(modnam, '/')) {
zwarnnam(nam, "%s: restricted", modnam, 0);
return 1;
}
do { do {
char *cnam = *args ? *args++ : modnam; char *cnam = *args ? *args++ : modnam;
if (strchr(cnam, '/')) { if (strchr(cnam, '/')) {
@ -1134,6 +1152,10 @@ bin_zmodload_math(char *nam, char **args, char *ops)
char *modnam; char *modnam;
modnam = *args++; modnam = *args++;
if(isset(RESTRICTED) && strchr(modnam, '/')) {
zwarnnam(nam, "%s: restricted", modnam, 0);
return 1;
}
do { do {
char *fnam = *args ? *args++ : modnam; char *fnam = *args ? *args++ : modnam;
if (strchr(fnam, '/')) { if (strchr(fnam, '/')) {
@ -1193,6 +1215,10 @@ bin_zmodload_param(char *nam, char **args, char *ops)
char *modnam; char *modnam;
modnam = *args++; modnam = *args++;
if(isset(RESTRICTED) && strchr(modnam, '/')) {
zwarnnam(nam, "%s: restricted", modnam, 0);
return 1;
}
do { do {
char *pnam = *args ? *args++ : modnam; char *pnam = *args ? *args++ : modnam;
if (strchr(pnam, '/')) { if (strchr(pnam, '/')) {

View file

@ -1,10 +1,10 @@
zsh/rlimits rlimits
zsh/zle zle
zsh/complete complete
zsh/compctl compctl
zsh/sched sched
zsh/complist complist
zsh/zutil zutil
zsh/computil computil
zsh/parameter parameter
zsh/zleparameter zleparameter

View file

@ -1,5 +1,3 @@
name=zsh/main
nozshdep=1 nozshdep=1
alwayslink=1 alwayslink=1
@ -63,15 +61,18 @@ zshxmods.h: modules-bltin xmods.conf
@( \ @( \
binmods=`sed 's/^/ /;s/$$/ /' modules-bltin`; \ binmods=`sed 's/^/ /;s/$$/ /' modules-bltin`; \
for mod in `cat $(sdir_src)/xmods.conf`; do \ for mod in `cat $(sdir_src)/xmods.conf`; do \
q_mod=`echo $$mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`; \
case $$binmods in \ case $$binmods in \
*" $$mod "*) \ *" $$mod "*) \
echo "#define LINKED_XMOD_$$q_mod 1" ;; \ echo "#define LINKED_XMOD_$$mod 1" ;; \
*) echo "#ifdef DYNAMIC"; \ *) echo "#ifdef DYNAMIC"; \
echo "# define UNLINKED_XMOD_$$q_mod 1"; \ echo "# define UNLINKED_XMOD_$$mod 1"; \
echo "#endif" ;; \ echo "#endif" ;; \
esac; \ esac; \
done \ done; \
echo; \
for mod in $$binmods; do \
echo "int boot_$$mod _((Module));"; \
done; \
) > $@ ) > $@
clean-here: clean.zsh clean-here: clean.zsh

View file

@ -24,7 +24,7 @@ emulate -R zsh
# We need to be able to save and restore the options used in the test. # We need to be able to save and restore the options used in the test.
# We use the $options variable of the parameter module for this. # We use the $options variable of the parameter module for this.
zmodload -i zsh/parameter zmodload -i parameter
# Note that both the following are regular arrays, since we only use them # Note that both the following are regular arrays, since we only use them
# in whole array assignments to/from $options. # in whole array assignments to/from $options.

View file

@ -1525,13 +1525,6 @@ else
E=N E=N
fi fi
if test "x$zsh_cv_sys_dynamic_clash_ok" = xyes; then
SHORTBOOTNAMES=yes
else
SHORTBOOTNAMES=no
fi
AC_SUBST(SHORTBOOTNAMES)
AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT")dnl AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT")dnl
AC_SUBST(D)dnl AC_SUBST(D)dnl
AC_SUBST(DL_EXT)dnl AC_SUBST(DL_EXT)dnl