diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-05-02 15:19:50 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-05-02 15:19:50 +0000 |
commit | 53d36e795b26a945048e7a87a1a91224f8e1663a (patch) | |
tree | aee8b11f48f2af1aceacd4a279f1d4b1de6ebfa6 /Src/params.c | |
parent | 206237c8ec4b7619d9e70a75004cd1ae1066b0a0 (diff) | |
download | zsh-53d36e795b26a945048e7a87a1a91224f8e1663a.tar.gz zsh-53d36e795b26a945048e7a87a1a91224f8e1663a.tar.xz zsh-53d36e795b26a945048e7a87a1a91224f8e1663a.zip |
zsh-3.1.5-pws-17 dot-zsh-199905041932
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/Src/params.c b/Src/params.c index dbc6ce8d8..d60f91990 100644 --- a/Src/params.c +++ b/Src/params.c @@ -255,7 +255,11 @@ static Param argvparam; /* hash table containing the parameters */ /**/ -HashTable paramtab; +HashTable paramtab, realparamtab; + +#ifndef DYNAMIC +#define getparamnode gethashnode2 +#endif /* DYNAMIC */ /**/ HashTable @@ -267,8 +271,8 @@ newparamtable(int size, char const *name) ht->emptytable = emptyhashtable; ht->filltable = NULL; ht->addnode = addhashnode; - ht->getnode = gethashnode2; - ht->getnode2 = gethashnode2; + ht->getnode = getparamnode; + ht->getnode2 = getparamnode; ht->removenode = removehashnode; ht->disablenode = NULL; ht->enablenode = NULL; @@ -278,6 +282,25 @@ newparamtable(int size, char const *name) return ht; } +#ifdef DYNAMIC +/**/ +static HashNode +getparamnode(HashTable ht, char *nam) +{ + HashNode hn = gethashnode2(ht, nam); + Param pm = (Param) hn; + + if (pm && pm->u.str && (pm->flags & PM_AUTOLOAD)) { + char *mn = dupstring(pm->u.str); + + if (!load_module(mn)) + return NULL; + hn = gethashnode2(ht, nam); + } + return hn; +} +#endif /* DYNAMIC */ + /* Copy a parameter hash table */ static HashTable outtable; @@ -402,7 +425,7 @@ createparamtable(void) 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++) @@ -542,7 +565,9 @@ createparam(char *name, int flags) Param pm, oldpm; if (name != nulstring) { - oldpm = (Param) paramtab->getnode(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)) { @@ -2703,6 +2728,8 @@ printparamnode(HashNode hn, int printflags) /* Print the attributes of the parameter */ if (printflags & PRINT_TYPE) { + if (p->flags & PM_AUTOLOAD) + printf("undefined "); if (p->flags & PM_INTEGER) printf("integer "); else if (p->flags & PM_ARRAY) @@ -2736,6 +2763,11 @@ printparamnode(HashNode hn, int printflags) } quotedzputs(p->nam, stdout); + + if (p->flags & PM_AUTOLOAD) { + putchar('\n'); + return; + } if (printflags & PRINT_KV_PAIR) putchar(' '); else |