Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: 3.1.5 + associative arrays under ksh emulation
- X-seq: zsh-workers 4641
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: PATCH: 3.1.5 + associative arrays under ksh emulation
- Date: Sun, 15 Nov 1998 12:47:21 -0800
- In-reply-to: <m3zp9v597a.fsf@xxxxxxxxxxxxxxxxx>
- References: <9811111358.AA51361@xxxxxxxxxxxxxxxxx> <vb1znanvcm.fsf@xxxxxxxxxxxxxxx> <m3iugmj8y8.fsf@xxxxxxxxxxxxxxxxx> <981111125236.ZM3587@xxxxxxxxxxxxxxxxxxxxxxx> <m3d86t7235.fsf@xxxxxxxxxxxxxxxxx> <981112012358.ZM9722@xxxxxxxxxxxxxxxxxxxxxxx> <m367ck7907.fsf@xxxxxxxxxxxxxxxxx> <981112173201.ZM13829@xxxxxxxxxxxxxxxxxxxxxxx> <m3zp9v597a.fsf@xxxxxxxxxxxxxxxxx>
On Nov 13, 8:55pm, Timothy Writer wrote:
} Subject: Re: PATCH: 3.1.5 - sample associative array implementation
}
} In ksh93, $arrayname is a synonym for ${arrayname[0]}. This appears to be
} true for indexed arrays _and_ associative arrays.
Index: Src/params.c
===================================================================
--- params.c 1998/11/12 09:21:35 1.8
+++ params.c 1998/11/15 20:39:19
@@ -1055,6 +1055,13 @@
switch(PM_TYPE(v->pm->flags)) {
case PM_HASHED:
+ /* (!v->isarr) should be impossible unless emulating ksh */
+ if (!v->isarr && emulation == EMULATE_KSH) {
+ s = dupstring("[0]");
+ if (getindex(&s, v) == 0)
+ s = getstrvalue(v);
+ LASTALLOC_RETURN s;
+ } /* else fall through */
case PM_ARRAY:
ss = getvaluearr(v);
if (v->isarr)
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author