Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: string range between 1 and 0.



On Mon, 19 Jul 1999, Bart Schaefer wrote:
> The difficulty with doing this is that C arrays are indexed from 0.  So
> when zsh uses 1-based indices, it has to decrement them before indexing
> into the internal representation of the value.  This decrement is done
> at parse time (unless the value is already zero), so that thereafter the
> same code can be used for ksh and zsh arrays.

Sounds to me like a good fix would be to change the parse code to
turn ksh arrays into zsh arrays (incrementing non-negative numbers)
OR to turn the values into an internal representation of offset and
length at parse time (though you may have to leave -1 unchanged if
you don't know the length).  This way, the C code would be able to
handle the more flexible indexing values properly (the zsh values)
without affecting ksh compatibility.

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author