summaryrefslogtreecommitdiff
path: root/Etc/zsh-development-guide
diff options
context:
space:
mode:
Diffstat (limited to 'Etc/zsh-development-guide')
-rw-r--r--Etc/zsh-development-guide33
1 files changed, 18 insertions, 15 deletions
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index e8c292cfd..bdabe17d8 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -223,9 +223,6 @@ C coding style
* Do not use space between the function name and the opening parenthesis.
Use space after if/for/while. Use space after type casts.
-* Do not use (unsigned char) casts since some compilers do not handle
- them properly. Use the provided STOUC(X) macro instead.
-
* If you use emacs 19.30 or newer you can put the following line to your
~/.emacs file to make these formatting rules the default:
@@ -243,7 +240,7 @@ C coding style
There must be an empty line, a line with "/**/", a line with the
type of the function, and finally the name of the function with typed
arguments. These lines must not be indented. The script generating
- function prototypes and the ansi2knr program depend on this format.
+ function prototypes depends on this format.
* Variable declarations must similarly be preceded by a
line containing only "/**/", for the prototype generation script.
@@ -374,8 +371,8 @@ particular they can be called before or after `boot_'.
The function named `boot_' should register function wrappers, hooks and
anything that will be visible to the user that is not handled by features_
and enables_ (so features should not be turned on here). It will be called
-after the `setup_'-function, and also after the initial set of features
-have been set by calls to `features_' and `enables_'.
+after the initial set of features have been set by calls to `features_'
+and `enables_'.
The function named `cleanup_', is called when the user tries to unload
a module and should de-register all features and hooks. A call
@@ -615,7 +612,7 @@ For defining parameters, a module can call `createparam()' directly or
use a table to describe them, e.g.:
static struct paramdef patab[] = {
- PARAMDEF("foo", PM_INTEGER, NULL, get_foo, set_foo, unset_foo),
+ PARAMDEF("foo", PM_INTEGER, NULL, foo_gsu),
INTPARAMDEF("exint", &intparam),
STRPARAMDEF("exstr", &strparam),
ARRPARAMDEF("exarr", &arrparam),
@@ -627,17 +624,23 @@ There are four macros used:
- the name of the parameter
- the parameter flags to set for it (from the PM_* flags defined
in zsh.h)
- - optionally a pointer to a variable holding the value of the
- parameter
- - three functions that will be used to get the value of the
- parameter, store a value in the parameter, and unset the
- parameter
+ - optionally a pointer to the value of the parameter
+ - a GSU pointer to the three functions that will be used to get
+ the value of the parameter, store a value in the parameter,
+ and unset the parameter
- the other macros provide simple ways to define the most common
types of parameters; they get the name of the parameter and a
pointer to a variable holding the value as arguments; they are
- used to define integer-, scalar-, and array-parameters, so the
- variables whose addresses are given should be of type `long',
- `char *', and `char **', respectively
+ used to define integer-, scalar-, and array-parameters, so for
+ those macros the pointer to the parameter value should be the
+ address of a variable of type `long', `char *',or `char **',
+ respectively, pointing in turn to the desired value.
+ - Parameters used in a module that don't have special behaviour
+ shouldn't be declared in this way, instead they should just be
+ created in `boot_' with the standard parameter functions.
+
+GSU (get, set, unset) structures are defined in Src/zsh.h for each of
+the parameter types scalar, integer, float, array, and hash.
For a description of how to write functions for getting or setting the
value of parameters, or how to write a function to unset a parameter,