summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-07-28 13:49:03 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-07-28 13:49:03 -0700
commit6fd8872d58f18fd144840b05412820994740880f (patch)
tree8f8e33833e65fe21d18563021aa1a49d2e891c5d
parent96cc9e0424913ec5ed897a705dec901540366e52 (diff)
downloadzsh-6fd8872d58f18fd144840b05412820994740880f.tar.gz
zsh-6fd8872d58f18fd144840b05412820994740880f.zip
35947: update discussion of module wrappers, some examples
-rw-r--r--ChangeLog5
-rw-r--r--Etc/zsh-development-guide37
2 files changed, 35 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a5085fba..de28c4bac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-28 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 35947: Etc/zsh-development-guide: update discussion of module
+ wrappers, some examples
+
2015-07-27 Barton E. Schaefer <schaefer@zsh.org>
* 35937: Functions/Misc/zargs: wait for process IDs instead of
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index 4d6cefd1e..cbbc798d3 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -751,7 +751,7 @@ the other things that can be defined by modules:
/**/
int
- boot_foo(Module m)
+ boot_(Module m)
{
int ret;
@@ -761,7 +761,7 @@ the other things that can be defined by modules:
...
/**/
int
- cleanup_foo(Module m)
+ cleanup_(Module m)
{
deletehookdefs(m->nam, foohooks, sizeof(foohooks)/sizeof(*foohooks));
...
@@ -802,14 +802,37 @@ The definition is simple:
};
The macro `WRAPDEF(...)' gets the C-function as its only argument.
-This function should be defined like:
+The `boot_()' function must install wrappers by calling `addwrapper()'
+like so:
+
+ /**/
+ int
+ boot_(Module m)
+ {
+ int ret;
+
+ ret = addwrapper(m, wrapper);
+ ...
+ }
+
+The `cleanup_()' function should then remove the wrappers again:
+
+ /**/
+ int
+ cleanup_(Module m)
+ {
+ deletewrapper(m, wrapper);
+ ...
+ }
+
+The wrapper function should be defined like:
/**/
static int
- ex_wrapper(List list, FuncWrap w, char *name)
+ ex_wrapper(Eprog prog, FuncWrap w, char *name)
{
...
- runshfunc(list, w, name);
+ runshfunc(prog, w, name);
...
return 0;
}
@@ -828,11 +851,11 @@ finished:
/**/
static int
- ex_wrapper(List list, FuncWrap w, char *name)
+ ex_wrapper(Eprog prog, FuncWrap w, char *name)
{
if (wrapper_need_to_run) {
...
- runshfunc(list, w, name);
+ runshfunc(prog, w, name);
...
return 0;
}