In anticipation of the upcoming merge of leo-ctx5 to trunk, i was
trying to get tcl working there.
Given the tcl:
set b(c) 2
puts [array exists b]
I get the error:
wrong # args: should be "array exists arrayName"
From languages/tcl/lib/commands/array.pir, the Tcl::&array sub seems
fine, and then calls:
scommand:
.return subcommand_proc(is_array,the_array,array_name,argv)
Where the subcommand in this case is _Tcl\0Builtins\0array::exists
(same file) which starts with:
.sub "exists"
.param int is_array
.param pmc the_array
.param string array_name
.param pmc argv
.local int argc
argc = argv
if argc goto bad_args
But it looks like the PMC args are getting *switched* somehow.
looking at the stack trace below starting just before the tailcall:
900 set_args PMC_C[244] (4), I15, P15, S15, P13 - , I15=1,
P15=TclArray=PMC(0xfc7530), S15="b", P13=ResizablePMCArray=PMC(0xfc72d8)
906 tailcall P14 - P14=Sub=PMC(0xe9fc80 pc:940)
946 set I15, P15 - I15=1, P15=TclArray=PMC(0xfc7530)
949 if I15, 8 - I15=1,
957 set S15, "wrong # args: should" - S15="b",
960 set_returns PMC_C[253] (2), 1, S15 - , , S15="wrong #
args: should"
964 returncc
wrong # args: should be "array exists arrayName"
The code is saying "set argc to the size of the fourth parameter",
but what I'm getting is the size of P15, which is the *second*
parameter.
I tried reproducing this with a smaller test case, but was unable to
do so.
Regards.