mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-01 06:20:55 +01:00
20605: Use separate structure with get/set/unset methods fro parameters.
Separate justification width of parameters from base/precision.
This commit is contained in:
parent
ddc186f3f6
commit
69b4b8bdde
22 changed files with 1042 additions and 819 deletions
|
|
@ -165,9 +165,7 @@ createtihash()
|
|||
return NULL;
|
||||
|
||||
pm->level = pm->old ? locallevel : 0;
|
||||
pm->gets.hfn = hashgetfn;
|
||||
pm->sets.hfn = hashsetfn;
|
||||
pm->unsetfn = stdunsetfn;
|
||||
pm->gsu.h = &stdhash_gsu;
|
||||
pm->u.hash = ht = newhashtable(7, terminfo_nam, NULL);
|
||||
|
||||
ht->hash = hasher;
|
||||
|
|
@ -201,42 +199,32 @@ getterminfo(UNUSED(HashTable ht), char *name)
|
|||
|
||||
unmetafy(name, &len);
|
||||
|
||||
pm = (Param) zhalloc(sizeof(struct param));
|
||||
pm = (Param) hcalloc(sizeof(struct param));
|
||||
pm->nam = dupstring(name);
|
||||
pm->flags = PM_READONLY;
|
||||
pm->unsetfn = NULL;
|
||||
pm->ct = 0;
|
||||
pm->env = NULL;
|
||||
pm->ename = NULL;
|
||||
pm->old = NULL;
|
||||
pm->level = 0;
|
||||
|
||||
if (((num = tigetnum(name)) != -1) && (num != -2)) {
|
||||
pm->u.val = num;
|
||||
pm->flags |= PM_INTEGER;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->gsu.i = &nullsetinteger_gsu;
|
||||
}
|
||||
else if ((num = tigetflag(name)) != -1) {
|
||||
pm->u.str = num ? dupstring("yes") : dupstring("no");
|
||||
pm->flags |= PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->gsu.s = &nullsetscalar_gsu;
|
||||
}
|
||||
else if ((tistr = (char *)tigetstr(name)) != NULL && tistr != (char *)-1)
|
||||
{
|
||||
pm->u.str = dupstring(tistr);
|
||||
pm->flags |= PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->gsu.s = &nullsetscalar_gsu;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* zwarn("no such capability: %s", name, 0); */
|
||||
pm->u.str = dupstring("");
|
||||
pm->flags |= PM_UNSET;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->gsu.s = &nullsetscalar_gsu;
|
||||
}
|
||||
return (HashNode) pm;
|
||||
}
|
||||
|
|
@ -319,16 +307,10 @@ scanterminfo(UNUSED(HashTable ht), ScanFunc func, int flags)
|
|||
"slength", NULL};
|
||||
#endif
|
||||
|
||||
pm = (Param) zhalloc(sizeof(struct param));
|
||||
pm->unsetfn = NULL;
|
||||
pm->ct = 0;
|
||||
pm->env = NULL;
|
||||
pm->ename = NULL;
|
||||
pm->old = NULL;
|
||||
|
||||
pm = (Param) hcalloc(sizeof(struct param));
|
||||
|
||||
pm->flags = PM_READONLY | PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->gsu.s = &nullsetscalar_gsu;
|
||||
|
||||
for (capname = (char **)boolnames; *capname; capname++) {
|
||||
if ((num = tigetflag(*capname)) != -1) {
|
||||
|
|
@ -339,8 +321,7 @@ scanterminfo(UNUSED(HashTable ht), ScanFunc func, int flags)
|
|||
}
|
||||
|
||||
pm->flags = PM_READONLY | PM_INTEGER;
|
||||
pm->sets.ifn = NULL;
|
||||
pm->gets.ifn = intgetfn;
|
||||
pm->gsu.i = &nullsetinteger_gsu;
|
||||
|
||||
for (capname = (char **)numnames; *capname; capname++) {
|
||||
if (((num = tigetnum(*capname)) != -1) && (num != -2)) {
|
||||
|
|
@ -351,8 +332,7 @@ scanterminfo(UNUSED(HashTable ht), ScanFunc func, int flags)
|
|||
}
|
||||
|
||||
pm->flags = PM_READONLY | PM_SCALAR;
|
||||
pm->sets.cfn = NULL;
|
||||
pm->gets.cfn = strgetfn;
|
||||
pm->gsu.s = &nullsetscalar_gsu;
|
||||
|
||||
for (capname = (char **)strnames; *capname; capname++) {
|
||||
if ((tistr = (char *)tigetstr(*capname)) != NULL &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue