From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: autoloaded parameters
Date: Thu, 29 Apr 1999 12:00:39 +0200 (MET DST) [thread overview]
Message-ID: <199904291000.MAA20123@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Wed, 28 Apr 1999 11:51:11 +0200 (MET DST)
I wrote:
> - To avoid having a `local' with the name of a parameter that will
> be autoloaded trigger the loading of the module, I had to change
> calls like `paramtab->getnode()' to `gethashnode2(paramtab,...)'
> in some places. This is ugly. Maybe we should keep a second
> pointer to the real paramtab and do this only if
> `paramtab == realparamtab'. Any comments?
The patch below makes this change.
[This might have caused problems once we have special associative
arrays that use a hashtable with their own functions. In that case the
normal hashtable.c-function would have been called instead of the one
defined in the table.]
Did anyone find the time to try this?
Bye
Sven
diff -u os/builtin.c Src/builtin.c
--- os/builtin.c Wed Apr 28 16:24:08 1999
+++ Src/builtin.c Thu Apr 29 11:52:32 1999
@@ -1793,7 +1793,9 @@
continue;
}
if (!typeset_single(name, asg->name,
- (Param)gethashnode2(paramtab, asg->name),
+ (Param) (paramtab == realparamtab ?
+ gethashnode2(paramtab, asg->name) :
+ paramtab->getnode(paramtab, asg->name)),
func, on, off, roff, asg->value, NULL))
returnval = 1;
}
@@ -1974,7 +1976,9 @@
}
*ss = 0;
}
- pm = (Param) gethashnode2(paramtab, s);
+ pm = (Param) (paramtab == realparamtab ?
+ gethashnode2(paramtab, s) :
+ paramtab->getnode(paramtab, s));
if (!pm)
returnval = 1;
else if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
diff -u os/params.c Src/params.c
--- os/params.c Wed Apr 28 16:24:11 1999
+++ Src/params.c Thu Apr 29 11:51:04 1999
@@ -255,7 +255,7 @@
/* hash table containing the parameters */
/**/
-HashTable paramtab;
+HashTable paramtab, realparamtab;
/**/
HashTable
@@ -419,7 +419,7 @@
char buf[50], *str, *iname;
int num_env;
- paramtab = newparamtable(151, "paramtab");
+ paramtab = realparamtab = newparamtable(151, "paramtab");
/* Add the special parameters to the hash table */
for (ip = special_params; ip->nam; ip++)
@@ -559,7 +559,9 @@
Param pm, oldpm;
if (name != nulstring) {
- oldpm = (Param) gethashnode2(paramtab, name);
+ oldpm = (Param) (paramtab == realparamtab ?
+ gethashnode2(paramtab, name) :
+ paramtab->getnode(paramtab, name));
if (oldpm && oldpm->level == locallevel) {
if (!(oldpm->flags & PM_UNSET) || (oldpm->flags & PM_SPECIAL)) {
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-04-29 10:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-29 10:00 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-04-28 9:51 Sven Wischnowsky
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=199904291000.MAA20123@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/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).