# New Ticket Created by Scott Walters # Please include the string: [perl #15317] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=15317 >
When a KEY * key datastructure is passed to a keyed method in array.pmc, and key->next is true...: array.pmc will recurse into the keyed lookup method of the PMC that it contains, passing it key->next. This implements the recursive indexing behavior as described in PDD08. -scott -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/30940/25927/407316/array.pmc.diff
Index: parrot/classes/array.pmc =================================================================== RCS file: /cvs/public/parrot/classes/array.pmc,v retrieving revision 1.27 diff -u -r1.27 array.pmc --- parrot/classes/array.pmc 13 Jul 2002 17:07:25 -0000 1.27 +++ parrot/classes/array.pmc 22 Jul 2002 08:22:39 -0000 @@ -162,7 +162,13 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - return value->vtable->get_integer(INTERP, value); + + if(key->next != NULL) { + return value->vtable->get_integer_keyed(INTERP, value, key->next); + } + else { + return value->vtable->get_integer(INTERP, value); + } } INTVAL get_integer_keyed_int (INTVAL* key) { @@ -204,7 +210,13 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - return value->vtable->get_number(INTERP, value); + + if(key->next != NULL) { + return value->vtable->get_number_keyed(INTERP, value, key->next); + } + else { + return value->vtable->get_number(INTERP, value); + } } FLOATVAL get_number_keyed_int (INTVAL* key) { @@ -247,7 +259,13 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - return value->vtable->get_bignum(INTERP, value); + + if(key->next != NULL) { + return value->vtable->get_bignum_keyed(INTERP, value, key->next); + } + else { + return value->vtable->get_bignum(INTERP, value); + } } BIGNUM* get_bignum_keyed_int (INTVAL* key) { @@ -289,7 +307,13 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - return value->vtable->get_string(INTERP, value); + + if(key->next != NULL) { + return value->vtable->get_string_keyed(INTERP, value, key->next); + } + else { + return value->vtable->get_string(INTERP, value); + } } STRING* get_string_keyed_int (INTVAL * key) { @@ -331,7 +355,13 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - return value->vtable->get_bool(INTERP, value); + + if(key->next != NULL) { + return value->vtable->get_bool_keyed(INTERP, value, key->next); + } + else { + return value->vtable->get_bool(INTERP, value); + } } INTVAL get_bool_keyed_int (INTVAL* key) { @@ -374,7 +404,13 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - return value->vtable->elements(INTERP, value); + + if(key->next != NULL) { + return value->vtable->elements_keyed(INTERP, value, key->next); + } + else { + return value->vtable->elements(INTERP, value); + } } INTVAL elements_keyed_int (INTVAL* key) { @@ -412,8 +448,14 @@ } value = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - /* XXX - should this be value->get_pmc? */ - return value; + + if(key->next != NULL) { + return value->vtable->get_pmc_keyed(INTERP, value, key->next); + } + else { + /* XXX - should this be value->get_pmc? */ + return value; + } } PMC* get_pmc_keyed_int (INTVAL* key) { @@ -488,7 +530,13 @@ } mypmc = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - mypmc->vtable->set_integer_native(INTERP, mypmc, value); + + if(key->next != NULL) { + mypmc->vtable->set_integer_keyed(INTERP, mypmc, key->next, value); + } + else { + mypmc->vtable->set_integer_native(INTERP, mypmc, value); + } } void set_integer_keyed_int (INTVAL* key, INTVAL value) { @@ -544,7 +592,12 @@ } mypmc = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - mypmc->vtable->set_number_native(INTERP, mypmc, value); + if(key->next != NULL) { + mypmc->vtable->set_number_keyed(INTERP, mypmc, key->next, value); + } + else { + mypmc->vtable->set_number_native(INTERP, mypmc, value); + } } void set_number_keyed_int (INTVAL * key, FLOATVAL value) { @@ -582,7 +635,12 @@ } mypmc = ((PMC**)(((Buffer *)SELF->data)->bufstart))[ix]; - mypmc->vtable->set_string_native(INTERP, mypmc, value); + if(key->next != NULL) { + mypmc->vtable->set_string_keyed(INTERP, mypmc, key->next, value); + } + else { + mypmc->vtable->set_string_native(INTERP, mypmc, value); + } } void set_string_keyed_int (INTVAL * key, STRING * value) {