mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
This PR corrects #168 for indexed arrays having more than one level. Turns out ksh was only keeping track of the subscript number for assignment in lvalue's nosub variable. By saving the actual subscript reference, the result can be assigned to its proper destination instead of putting the result into the last looked value or subscript location. src/cmd/ksh93/include/streval.h: struct lval: - Create a new pointer named sub to hold the reference that nosub describes. src/cmd/ksh93/sh/arith.c: arith(): - Adjust LOOKUP: for lvalue ARITH_ASSIGNOP operations on indexed arrays to save the np of the destination subscript for later use. - Adjust ASSIGN: to act when lvalue's nosub > 0 which happens as the last step in the arithmetic parsing loop for assignment operations. Only indexed arrays will have a nosub value > 0. All others have a nosub of 0 unless they are involved in a unary operation (++, --) which sets nosub to -1. All said in the context of assignment operations like (( arr[0][1] += 1 )). src/cmd/ksh93/sh/streval.c: - Initialize the new sub pointer to 0. src/cmd/ksh93/tests/arrays2.sh: - Created a few multidimensional indexed array tests for assignment operations like += as an example. Resolves: https://github.com/ksh93/ksh/issues/168 |
||
---|---|---|
.. | ||
builtin | ||
INIT | ||
ksh93 | ||
Mamfile |