From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Update PARAMDEF in zsh-development-guide
Date: Tue, 31 Jan 2023 17:16:07 -0800 [thread overview]
Message-ID: <CAH+w=7bSBmuDSJCYc_dDvuZR6GzxA3tXD2aALtxmq5PNG20PYw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 136 bytes --]
Noticed while noodling with a new module that the description of the
PARAMDEF macro predated the introduction of the "gsu" union. Wow.
[-- Attachment #2: zdevg.txt --]
[-- Type: text/plain, Size: 1741 bytes --]
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index 565b0b1d9..da6932003 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -612,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),
@@ -626,9 +626,9 @@ There are four macros used:
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
+ - 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
@@ -636,6 +636,9 @@ There are four macros used:
variables whose addresses are given should be of type `long',
`char *', and `char **', respectively
+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,
see the description of the following functions in the `params.c' file:
reply other threads:[~2023-02-01 1:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7bSBmuDSJCYc_dDvuZR6GzxA3tXD2aALtxmq5PNG20PYw@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).