I've added a key.pmc. Why would we need a key.pmc one might ask. Well it will be used when assigning keys through init_pmc(PMC *).
Example: asm code new P0, PerlArray[2] // array with size 2 will call new_keyed_integer which inturn constructs a key PMC to store its keyes pmc_new_sized_pmc(....., PMC *p) Aldo Calpini ( alias dada on irc ) had a couple of good arguments why having a key.pmc. I just want this patch in because i need it for my soon to come matrix.pmc. Those ops included in this patch RELIES HEAVILY on my earlier pmc.c patch that added a pmc_new_sized_pmc function. /Josef Höök
diff -urN parrot.orig/MANIFEST parrot/MANIFEST --- parrot.orig/MANIFEST Thu Jul 18 00:37:54 2002 +++ parrot/MANIFEST Thu Jul 18 00:44:52 2002 @@ -28,6 +28,7 @@ classes/perlnum.pmc classes/perlstring.pmc classes/perlundef.pmc +classes/key.pmc classes/pmc2c.pl config/auto/byteorder.pl config/auto/byteorder/test_c.in diff -urN parrot.orig/assemble.pl parrot/assemble.pl --- parrot.orig/assemble.pl Thu Jul 18 00:37:54 2002 +++ parrot/assemble.pl Thu Jul 18 15:25:27 2002 @@ -127,17 +127,18 @@ # XXX Must be generated from the enum in include/parrot/pmc.h # bless $self,$class; - $self->{constants}{Array} = 0; - $self->{constants}{PerlUndef} = 1; - $self->{constants}{PerlInt} = 2; - $self->{constants}{PerlNum} = 3; - $self->{constants}{PerlString} = 4; - $self->{constants}{PerlArray} = 5; - $self->{constants}{PerlHash} = 6; - $self->{constants}{Pointer} = 7; - $self->{constants}{IntQueue} = 8; - $self->{constants}{Sub} = 9; - $self->{constants}{Coroutine} = 10; + $self->{constants}{Key} = 0; + $self->{constants}{Array} = 1; + $self->{constants}{PerlUndef} = 2; + $self->{constants}{PerlInt} = 3; + $self->{constants}{PerlNum} = 4; + $self->{constants}{PerlString} = 5; + $self->{constants}{PerlArray} = 6; + $self->{constants}{PerlHash} = 7; + $self->{constants}{Pointer} = 8; + $self->{constants}{IntQueue} = 9; + $self->{constants}{Sub} = 10; + $self->{constants}{Coroutine} = 11; $self; } diff -urN parrot.orig/classes/key.pmc parrot/classes/key.pmc --- parrot.orig/classes/key.pmc Thu Jan 1 01:00:00 1970 +++ parrot/classes/key.pmc Thu Jul 18 16:11:17 2002 @@ -0,0 +1,902 @@ +/* Key.pmc + * Copyright: (When this is determined...it will go here) + * CVS Info + * $Id: key.pmc,v 1.2 2002/07/18 14:09:14 joh Exp joh $ + * Overview: + * These are the vtable functions for the Key base class + * Data Structure and Algorithms: + * History: + * Notes: + * References: + */ + +#include "parrot/parrot.h" + +pmclass Key { + + void init () { + SELF->data = NULL; + + } + + void init_pmc (PMC* initializer) { + if((initializer->vtable->type(INTERP, SELF)) == enum_class_Key) { + SELF->data = initializer->data; + } + } + + void morph (INTVAL type) { + } + + PMC* mark (PMC* tail) { + return NULL; + } + + void destroy () { + } + + INTVAL type () { + return enum_class_Key; + } + + INTVAL type_keyed (KEY* key) { + return 0; + } + + INTVAL type_keyed_int (INTVAL* key) { + return 0; + } + + UINTVAL subtype (INTVAL type) { + return 0; + } + + UINTVAL subtype_keyed (KEY* key, INTVAL type) { + return 0; + } + + UINTVAL subtype_keyed_int (INTVAL* key, INTVAL type) { + return 0; + } + + STRING* name () { + return whoami; + } + + STRING* name_keyed (KEY* key) { + return NULL; + } + + STRING* name_keyed_int (INTVAL* key) { + return NULL; + } + + PMC* clone () { + PMC *dest; + dest = pmc_new(INTERP, enum_class_Key); + dest->data=SELF->data; + return dest; + } + + PMC* clone_keyed (KEY* key) { + // As we are a key just copy the data + PMC *dest; + dest = pmc_new(INTERP, enum_class_Key); + dest->data=SELF->data; + return dest; + } + + PMC* clone_keyed_int (INTVAL* key) { + return NULL; + } + + PMC* find_method (STRING* method_name) { + return NULL; + } + + PMC* find_method_keyed (KEY* key, STRING* method_name) { + return NULL; + } + + PMC* find_method_keyed_int (INTVAL* key, STRING* method_name) { + return NULL; + } + + INTVAL get_integer () { + // need changes + INTVAL retval; + if(((KEY *)SELF->data)) { + retval = ((KEY*)SELF->data)->atom.val.int_val; + } + return retval; + } + + INTVAL get_integer_keyed (KEY* key) { + return 0; + } + + INTVAL get_integer_keyed_int (INTVAL* key) { + return 0; + } + + FLOATVAL get_number () { + return 0; + } + + FLOATVAL get_number_keyed (KEY* key) { + return 0; + } + + FLOATVAL get_number_keyed_int (INTVAL* key) { + return 0; + } + + BIGNUM* get_bignum () { + return NULL; + } + + BIGNUM* get_bignum_keyed (KEY* key) { + return NULL; + } + + BIGNUM* get_bignum_keyed_int (INTVAL* key) { + return NULL; + } + + STRING* get_string () { + return NULL; + } + + STRING* get_string_keyed (KEY* key) { + return NULL; + } + + STRING* get_string_keyed_int (INTVAL* key) { + return NULL; + } + + INTVAL get_bool () { + return 0; + } + + INTVAL get_bool_keyed (KEY* key) { + return 0; + } + + INTVAL get_bool_keyed_int (INTVAL* key) { + return 0; + } + + INTVAL elements () { + return 0; + } + + INTVAL elements_keyed (KEY* key) { + return 0; + } + + INTVAL elements_keyed_int (INTVAL* key) { + return 0; + } + + PMC* get_pmc () { + // GET KEY + return NULL; + } + + PMC* get_pmc_keyed (KEY* key) { + return NULL; + } + + PMC* get_pmc_keyed_int (INTVAL* key) { + return NULL; + } + + INTVAL is_same (PMC* value) { + return 0; + } + + INTVAL is_same_keyed (KEY* key, PMC* value, KEY* value_key) { + return 0; + } + + INTVAL is_same_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + return 0; + } + + void set_integer (PMC* value) { + } + + void set_integer_native (INTVAL value) { + } + + void set_integer_same (PMC* value) { + } + + void set_integer_keyed (KEY* key, INTVAL value) { + // we skip value and only store the key + SELF->data = key; + } + + void set_integer_keyed_int (INTVAL* key, INTVAL value) { + } + + void set_number (PMC* value) { + } + + void set_number_native (FLOATVAL value) { + } + + void set_number_same (PMC* value) { + } + + void set_number_keyed (KEY* key, FLOATVAL value) { + } + + void set_number_keyed_int (INTVAL* key, FLOATVAL value) { + } + + void set_bignum (PMC* value) { + } + + void set_bignum_native (BIGNUM* value) { + } + + void set_bignum_same (PMC* value) { + } + + void set_bignum_keyed (KEY* key, BIGNUM* value) { + } + + void set_bignum_keyed_int (INTVAL* key, BIGNUM* value) { + } + + void set_string (PMC* value) { + } + + void set_string_native (STRING* value) { + } + + void set_string_unicode (STRING* value) { + } + + void set_string_other (STRING* value) { + } + + void set_string_same (PMC* value) { + } + + void set_string_keyed (KEY* key, STRING* value) { + } + + void set_string_keyed_int (INTVAL* key, STRING* value) { + } + + void set_pmc (PMC* value) { + } + + void set_pmc_keyed (KEY* key, PMC* value, KEY* value_key) { + } + + void set_pmc_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + } + + void set_same (PMC* value) { + } + + void set_same_keyed (KEY* key, PMC* value, KEY* value_key) { + } + + void set_same_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + } + + INTVAL pop_integer () { + return 0; + } + + INTVAL pop_integer_keyed (KEY* key) { + return 0; + } + + INTVAL pop_integer_keyed_int (INTVAL* key) { + return 0; + } + + FLOATVAL pop_float () { + return 0; + } + + FLOATVAL pop_float_keyed (KEY* key) { + return 0; + } + + FLOATVAL pop_float_keyed_int (INTVAL* key) { + return 0; + } + + BIGNUM* pop_bignum () { + return NULL; + } + + BIGNUM* pop_bignum_keyed (KEY* key) { + return NULL; + } + + BIGNUM* pop_bignum_keyed_int (INTVAL* key) { + return NULL; + } + + STRING* pop_string () { + return NULL; + } + + STRING* pop_string_keyed (KEY* key) { + return NULL; + } + + STRING* pop_string_keyed_int (INTVAL* key) { + return NULL; + } + + PMC* pop_pmc () { + return NULL; + } + + PMC* pop_pmc_keyed (KEY* key) { + return NULL; + } + + PMC* pop_pmc_keyed_int (INTVAL* key) { + return NULL; + } + + void push_integer (INTVAL value) { + } + + void push_integer_keyed (KEY* key, INTVAL value) { + } + + void push_integer_keyed_int (INTVAL* key, INTVAL value) { + } + + void push_float (FLOATVAL value) { + } + + void push_float_keyed (KEY* key, FLOATVAL value) { + } + + void push_float_keyed_int (INTVAL* key, FLOATVAL value) { + } + + void push_bignum (BIGNUM* value) { + } + + void push_bignum_keyed (KEY* key, BIGNUM* value) { + } + + void push_bignum_keyed_int (INTVAL* key, BIGNUM* value) { + } + + void push_string (STRING* value) { + } + + void push_string_keyed (KEY* key, STRING* value) { + } + + void push_string_keyed_int (INTVAL* key, STRING* value) { + } + + void push_pmc (PMC* value) { + } + + void push_pmc_keyed (KEY* key, PMC* value, KEY* value_key) { + } + + void push_pmc_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + } + + INTVAL shift_integer () { + return 0; + } + + INTVAL shift_integer_keyed (KEY* key) { + return 0; + } + + INTVAL shift_integer_keyed_int (INTVAL* key) { + return 0; + } + + FLOATVAL shift_float () { + return 0; + } + + FLOATVAL shift_float_keyed (KEY* key) { + return 0; + } + + FLOATVAL shift_float_keyed_int (INTVAL* key) { + return 0; + } + + BIGNUM* shift_bignum () { + return NULL; + } + + BIGNUM* shift_bignum_keyed (KEY* key) { + return NULL; + } + + BIGNUM* shift_bignum_keyed_int (INTVAL* key) { + return NULL; + } + + STRING* shift_string () { + return NULL; + } + + STRING* shift_string_keyed (KEY* key) { + return NULL; + } + + STRING* shift_string_keyed_int (INTVAL* key) { + return NULL; + } + + PMC* shift_pmc () { + return NULL; + } + + PMC* shift_pmc_keyed (KEY* key) { + return NULL; + } + + PMC* shift_pmc_keyed_int (INTVAL* key) { + return NULL; + } + + void unshift_integer (INTVAL value) { + } + + void unshift_integer_keyed (KEY* key, INTVAL value) { + } + + void unshift_integer_keyed_int (INTVAL* key, INTVAL value) { + } + + void unshift_float (FLOATVAL value) { + } + + void unshift_float_keyed (KEY* key, FLOATVAL value) { + } + + void unshift_float_keyed_int (INTVAL* key, FLOATVAL value) { + } + + void unshift_bignum (BIGNUM* value) { + } + + void unshift_bignum_keyed (KEY* key, BIGNUM* value) { + } + + void unshift_bignum_keyed_int (INTVAL* key, BIGNUM* value) { + } + + void unshift_string (STRING* value) { + } + + void unshift_string_keyed (KEY* key, STRING* value) { + } + + void unshift_string_keyed_int (INTVAL* key, STRING* value) { + } + + void unshift_pmc (PMC* value) { + } + + void unshift_pmc_keyed (KEY* key, PMC* value, KEY* value_key) { + } + + void unshift_pmc_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + } + + void add (PMC* value, PMC* dest) { + } + + void add_int (INTVAL value, PMC* dest) { + } + + void add_bignum (BIGNUM* value, PMC* dest) { + } + + void add_float (FLOATVAL value, PMC* dest) { + } + + void add_same (PMC* value, PMC* dest) { + } + + void add_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* dest_key) { + } + + void add_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void subtract (PMC* value, PMC* dest) { + } + + void subtract_int (INTVAL value, PMC* dest) { + } + + void subtract_bignum (BIGNUM* value, PMC* dest) { + } + + void subtract_float (FLOATVAL value, PMC* dest) { + } + + void subtract_same (PMC* value, PMC* dest) { + } + + void subtract_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void subtract_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void multiply (PMC* value, PMC* dest) { + } + + void multiply_int (INTVAL value, PMC* dest) { + } + + void multiply_bignum (BIGNUM* value, PMC* dest) { + } + + void multiply_float (FLOATVAL value, PMC* dest) { + } + + void multiply_same (PMC* value, PMC* dest) { + } + + void multiply_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void multiply_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void divide (PMC* value, PMC* dest) { + } + + void divide_int (INTVAL value, PMC* dest) { + } + + void divide_bignum (BIGNUM* value, PMC* dest) { + } + + void divide_float (FLOATVAL value, PMC* dest) { + } + + void divide_same (PMC* value, PMC* dest) { + } + + void divide_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void divide_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void modulus (PMC* value, PMC* dest) { + } + + void modulus_int (INTVAL value, PMC* dest) { + } + + void modulus_bignum (BIGNUM* value, PMC* dest) { + } + + void modulus_float (FLOATVAL value, PMC* dest) { + } + + void modulus_same (PMC* value, PMC* dest) { + } + + void modulus_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void modulus_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void neg (PMC* dest) { + } + + void neg_keyed (KEY* key, PMC* dest, KEY* dest_key) { + } + + void neg_keyed_int (INTVAL* key, PMC* dest, INTVAL* dest_key) { + } + + void bitwise_or (PMC* value, PMC* dest) { + } + + void bitwise_or_int (INTVAL value, PMC* dest) { + } + + void bitwise_or_same (PMC* value, PMC* dest) { + } + + void bitwise_or_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void bitwise_or_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void bitwise_and (PMC* value, PMC* dest) { + } + + void bitwise_and_int (INTVAL value, PMC* dest) { + } + + void bitwise_and_same (PMC* value, PMC* dest) { + } + + void bitwise_and_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void bitwise_and_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + void bitwise_xor (PMC* value, PMC* dest) { + } + + void bitwise_xor_int (INTVAL value, PMC* dest) { + } + + void bitwise_xor_same (PMC* value, PMC* dest) { + } + + void bitwise_xor_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void bitwise_xor_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + void bitwise_not (PMC* dest) { + } + + void bitwise_not_keyed (KEY* key, PMC* dest, KEY* dest_key) { + } + + void bitwise_not_keyed_int (INTVAL* key, PMC* dest, INTVAL* dest_key) { + } + + void bitwise_shl (PMC* value, PMC* dest) { + } + + void bitwise_shl_int (INTVAL value, PMC* dest) { + } + + void bitwise_shl_same (PMC* value, PMC* dest) { + } + + void bitwise_shl_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void bitwise_shl_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + void bitwise_shr (PMC* value, PMC* dest) { + } + + void bitwise_shr_int (INTVAL value, PMC* dest) { + } + + void bitwise_shr_same (PMC* value, PMC* dest) { + } + + void bitwise_shr_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void bitwise_shr_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + void concatenate (PMC* value, PMC* dest) { + } + + void concatenate_native (STRING* value, PMC* dest) { + } + + void concatenate_unicode (STRING* value, PMC* dest) { + } + + void concatenate_other (STRING* value, PMC* dest) { + } + + void concatenate_same (PMC* value, PMC* dest) { + } + + void concatenate_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void concatenate_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + INTVAL is_equal (PMC* value) { + return 0; + } + + INTVAL is_equal_keyed (KEY* key, PMC* value, KEY* value_key) { + return 0; + } + + INTVAL is_equal_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + return 0; + } + + INTVAL cmp (PMC* value) { + return 0; + } + + INTVAL cmp_keyed (KEY* key, PMC* value, KEY* value_key) { + return 0; + } + + INTVAL cmp_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + return 0; + } + + INTVAL cmp_num (PMC* value) { + return 0; + } + + INTVAL cmp_num_keyed (KEY* key, PMC* value, KEY* value_key) { + return 0; + } + + INTVAL cmp_num_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + return 0; + } + + INTVAL cmp_string (PMC* value) { + return 0; + } + + INTVAL cmp_string_keyed (KEY* key, PMC* value, KEY* value_key) { + return 0; + } + + INTVAL cmp_string_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key) { + return 0; + } + + void logical_or (PMC* value, PMC* dest) { + } + + void logical_or_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void logical_or_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void logical_and (PMC* value, PMC* dest) { + } + + void logical_and_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void logical_and_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + void logical_xor (PMC* value, PMC* dest) { + } + + void logical_xor_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void logical_xor_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* +dest, INTVAL* dest_key) { + } + + void logical_not (PMC* dest) { + } + + void logical_not_keyed (KEY* key, PMC* dest, KEY* dest_key) { + } + + void logical_not_keyed_int (INTVAL* key, PMC* dest, INTVAL* dest_key) { + } + + void repeat (PMC* value, PMC* dest) { + } + + void repeat_int (INTVAL value, PMC* dest) { + } + + void repeat_keyed (KEY* key, PMC* value, KEY* value_key, PMC* dest, KEY* +dest_key) { + } + + void repeat_keyed_int (INTVAL* key, PMC* value, INTVAL* value_key, PMC* dest, +INTVAL* dest_key) { + } + + void repeat_int_keyed (KEY* key, INTVAL value, PMC* dest, KEY* dest_key) { + } + + void repeat_int_keyed_int (INTVAL* key, INTVAL value, PMC* dest, INTVAL* +dest_key) { + } + + void increment () { + } + + void increment_keyed (KEY* key) { + } + + void increment_keyed_int (INTVAL* key) { + } + + void decrement () { + } + + void decrement_keyed (KEY* key) { + } + + void decrement_keyed_int (INTVAL* key) { + } + + INTVAL exists_keyed (KEY* key) { + return 0; + } + + INTVAL exists_keyed_int (INTVAL* key) { + return 0; + } + + INTVAL defined () { + return 0; + } + + INTVAL defined_keyed (KEY* key) { + return 0; + } + + INTVAL defined_keyed_int (INTVAL* key) { + return 0; + } + + void delete_keyed (KEY* key) { + } + + void delete_keyed_int (INTVAL* key) { + } + + KEY* nextkey_keyed (KEY* key) { + + // ADD SOME CODE HERE + return NULL; + } + + KEY* nextkey_keyed_int (INTVAL* key) { + + // ADD SOME CODE HERE + return NULL; + } + + void substr (INTVAL offset, INTVAL length, PMC* dest) { + } + + void substr_keyed (KEY* key, INTVAL offset, INTVAL length, PMC* dest, KEY* +dest_key) { + } + + void substr_keyed_int (INTVAL* key, INTVAL offset, INTVAL length, PMC* dest, +INTVAL* dest_key) { + } + + STRING* substr_str (INTVAL offset, INTVAL length) { + + return NULL; + } + + STRING* substr_str_keyed (KEY* key, INTVAL offset, INTVAL length) { + return NULL; + } + + STRING* substr_str_keyed_int (INTVAL* key, INTVAL offset, INTVAL length) { + return NULL; + } + +} diff -urN parrot.orig/core.ops parrot/core.ops --- parrot.orig/core.ops Thu Jul 18 00:37:54 2002 +++ parrot/core.ops Thu Jul 18 16:13:32 2002 @@ -3920,6 +3920,61 @@ goto NEXT(); } +/*JOH*/ + + +=item B<new_keyed_integer>(out PMC, in INT, in INT ) + +Added support for keys, this one is used when doing + +new P0, .PerlArray[2] + +also note that we use init_pmc call here + +=cut + +op new_keyed_integer(out PMC, in INT, in INT) { + KEY key; + PMC* newpmc; + PMC* new_key_pmc; + MAKE_KEY(key, $3, enum_key_string, int_val); + new_key_pmc = pmc_new(interpreter, enum_class_Key); + new_key_pmc->vtable->set_integer_keyed(interpreter, new_key_pmc, &key, 0); + newpmc = pmc_new_sized_pmc(interpreter, $2, new_key_pmc); + $1 = newpmc; + goto NEXT(); + +} + + +=item B<new_keyed_integer>(out PMC, in INT, in INT, in INT) + +Added support for keys, this one is used when doing + +new P0, Matrix[4][4] + +also note that we use init_pmc call here + +=cut + +op new_keyed_integer(out PMC, in INT, in INT, in INT) { + KEY key; + KEY key2; + PMC* newpmc; + PMC* new_key_pmc; + MAKE_KEY(key, $3, enum_key_string, int_val); + MAKE_KEY(key2, $4, enum_key_string, int_val); + key.next = &key2; + new_key_pmc = pmc_new(interpreter, enum_class_Key); + new_key_pmc->vtable->set_integer_keyed(interpreter, new_key_pmc, &key, 0); + newpmc = pmc_new_sized_pmc(interpreter, $2, new_key_pmc); + $1 = newpmc; + goto NEXT(); + +} + + + =item B<destroy>(in PMC) Destroy the PMC. diff -urN parrot.orig/global_setup.c parrot/global_setup.c --- parrot.orig/global_setup.c Thu Jul 18 00:37:54 2002 +++ parrot/global_setup.c Thu Jul 18 16:21:59 2002 @@ -21,6 +21,7 @@ string_init(); /* Set up the string subsystem */ /* Call base vtable class constructor methods! */ + Parrot_Key_class_init(enum_class_Key); Parrot_Array_class_init(enum_class_Array); Parrot_PerlUndef_class_init(enum_class_PerlUndef); Parrot_PerlInt_class_init(enum_class_PerlInt); @@ -46,13 +47,24 @@ /* Now start filling the hash */ /* Array */ + key->atom.val.string_val = (STRING*)Parrot_base_vtables[enum_class_Array].name(NULL, NULL); + key->atom.type = enum_key_string; Parrot_base_classname_hash->vtable->set_integer_keyed(NULL, Parrot_base_classname_hash, key, enum_class_Array); + + key->atom.val.string_val = + (STRING*)Parrot_base_vtables[enum_class_Key].name(NULL, + NULL); + key->atom.type = enum_key_string; + Parrot_base_classname_hash->vtable->set_integer_keyed(NULL, + Parrot_base_classname_hash, +key, enum_class_Key); + + key->atom.val.string_val = (STRING*) Parrot_base_vtables[enum_class_PerlUndef].name(NULL, NULL); key->atom.type = enum_key_string; diff -urN parrot.orig/include/parrot/global_setup.h parrot/include/parrot/global_setup.h --- parrot.orig/include/parrot/global_setup.h Thu Jul 18 00:37:54 2002 +++ parrot/include/parrot/global_setup.h Thu Jul 18 16:25:15 2002 @@ -18,6 +18,7 @@ /* Needed because this might get compiled before pmcs have been built */ void Parrot_PerlUndef_class_init(INTVAL); +void Parrot_Key_class_init(INTVAL); void Parrot_PerlInt_class_init(INTVAL); void Parrot_PerlNum_class_init(INTVAL); void Parrot_PerlString_class_init(INTVAL);