Clinton A. Pierce <[EMAIL PROTECTED]> wrote:

> And actually, on further consideration, .const isn't what I want
> either.

You are looking vor .sym/.local:

.local PerlHash BASICARR
.sub _main
        BASICARR = new PerlHash
        .arg "value"
        .arg "x"
        call _DIMENSION
        .arg "x"
        call _ARR_LOOKUP
        .local string res
        .result res
        print res
        end
.end
.sub _DIMENSION         # void DIMENSION(string array)
         saveall
         .param string key
         .param string value
         BASICARR[key] = value
         restoreall
         ret
.end
.sub _ARR_LOOKUP                # string ARR_LOOKUP(string key)
         saveall
         .param string key
         $S0 = BASICARR[key]
         .return $S0
         restoreall
         ret
.end

This is similar to yours, except, I used a PerlHash (you seem to like
store/retrieve strings).

This works with this patch to imcc (identifiers where not considered as
array/hash keys):

--- ../parrot/languages/imcc/pbc.c      Wed May 14 17:37:08 2003
+++ languages/imcc/pbc.c        Wed May 28 18:36:34 2003
@@ -615,6 +615,7 @@
         if (r->reg)
             r = r->reg;
         switch (r->type) {
+            case VTIDENTIFIER:       /* P[S0] */
             case VTPASM:       /* P[S0] */
             case VTREG:        /* P[S0] */
                 if (r->set == 'I')

leo

Reply via email to