Hi!
----
Another "typeset -m" issue... the following example doesn't work if
function "sortar" is declared using "function sortar" instead of
"sortar():
-- snip --
compound c=(
compound -a ar=(
( float i=4 )
( float i=7 )
( float i=2 )
( float i=1 )
( float i=24 )
( float i=-1 )
)
)
function sortar
#sortar()
{
nameref ar=$1
integer i
integer -r i_max=${#ar[@]}
bool swapped=true
while $swapped ; do
swapped=false
for (( i=1 ; i < i_max ; i++ )) ; do
if (( ar[i].i > ar[i-1].i )) ; then
typeset -m "tmp=ar[i-1]"
typeset -m "ar[i-1]=ar[i]"
typeset -m "ar[i]=tmp"
swapped=true
fi
done
done
return 0
}
# main
set -o nounset
sortar c.ar
print -v c
-- snip --
AFAIK the demo should print...
-- snip --
(
typeset -C -a ar=(
[0]=(
typeset -l -E i=24
)
[1]=(
typeset -l -E i=7
)
[2]=(
typeset -l -E i=4
)
[3]=(
typeset -l -E i=2
)
[4]=(
typeset -l -E i=1
)
[5]=(
typeset -l -E i=-1
)
)
)
-- snip --
... but ast-ksh.2013-04-09 on SuSE 12.2/AMD64/64bit prints this:
-- snip --
$ ksh sortc.sh
sortc.sh[38]: sortar: line 24: ar[i-1].i : parameter not set
(
typeset -C -a ar=(
[0]=(
typeset -l -E i=7
)
[2]=(
typeset -l -E i=2
)
[3]=(
typeset -l -E i=1
)
[4]=(
typeset -l -E i=24
)
[5]=(
typeset -l -E i=-1
)
)
)
-- snip --
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [email protected]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers