# New Ticket Created by Matt Fowles
# Please include the string: [perl #30245]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=30245 >
All~
This patch adds Resizable*Array pmcs as the counterparts to Fixed*Array
pmcs. It does so by inheriting from them, so the Fixed ones are changed
too.
This includes the patch from Nicholas Clark [perl #30241]
t/pmc/fixedfloatarray.t SEGV on x86 Linux.
Tests are included.
One important note. This is a really simple implementation. One might
want to do something like size doubling or something smart, but this
doesn't do that.
Matt
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.672
diff -u -r1.672 MANIFEST
--- MANIFEST 12 Jun 2004 15:53:56 -0000 1.672
+++ MANIFEST 13 Jun 2004 07:33:19 -0000
@@ -82,6 +82,11 @@
classes/pointer.pmc []
classes/random.pmc []
classes/ref.pmc []
+classes/resizablebooleanarray.pmc []
+classes/resizablefloatarray.pmc []
+classes/resizableintegerarray.pmc []
+classes/resizablepmcarray.pmc []
+classes/resizablestringarray.pmc []
classes/retcontinuation.pmc []
classes/sarray.pmc []
classes/scalar.pmc []
@@ -2734,6 +2739,11 @@
t/pmc/pmc.t []
t/pmc/prop.t []
t/pmc/ref.t []
+t/pmc/resizablebooleanarray.t []
+t/pmc/resizablefloatarray.t []
+t/pmc/resizableintegerarray.t []
+t/pmc/resizablepmcarray.t []
+t/pmc/resizablestringarray.t []
t/pmc/sarray.t []
t/pmc/scratchpad.t []
t/pmc/signal.t []
Index: classes/fixedbooleanarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedbooleanarray.pmc,v
retrieving revision 1.1
diff -u -r1.1 fixedbooleanarray.pmc
--- classes/fixedbooleanarray.pmc 12 Jun 2004 15:54:00 -0000 1.1
+++ classes/fixedbooleanarray.pmc 13 Jun 2004 07:33:19 -0000
@@ -112,7 +112,7 @@
*/
INTVAL get_bool () {
- INTVAL size = DYNSELF.elements();
+ INTVAL size = DYNDYNSELF.elements();
return (INTVAL)(size != 0);
}
@@ -139,7 +139,7 @@
*/
INTVAL get_integer () {
- return DYNSELF.elements();
+ return DYNDYNSELF.elements();
}
@@ -176,7 +176,7 @@
INTVAL get_integer_keyed (PMC* key) {
/* simple int keys only */
INTVAL k = key_integer(INTERP, key);
- return SELF.get_integer_keyed_int(k);
+ return DYNSELF.get_integer_keyed_int(k);
}
@@ -191,7 +191,7 @@
*/
FLOATVAL get_number_keyed_int (INTVAL key) {
- return (FLOATVAL)SELF.get_integer_keyed_int(key);
+ return (FLOATVAL)DYNSELF.get_integer_keyed_int(key);
}
/*
@@ -206,7 +206,7 @@
FLOATVAL get_number_keyed (PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_number_keyed_int(k);
+ return DYNSELF.get_number_keyed_int(k);
}
/*
@@ -221,7 +221,7 @@
STRING* get_string_keyed_int (INTVAL key) {
PMC *temp;
- temp = SELF.get_pmc_keyed_int(key);
+ temp = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_string(INTERP, temp);
}
@@ -237,7 +237,7 @@
STRING* get_string_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_string_keyed_int(k);
+ return DYNSELF.get_string_keyed_int(k);
}
@@ -256,7 +256,7 @@
INTVAL val;
ret = pmc_new(INTERP, enum_class_Boolean);
- val = SELF.get_integer_keyed_int(key);
+ val = DYNSELF.get_integer_keyed_int(key);
VTABLE_set_integer_native(INTERP, ret, val);
return ret;
}
@@ -273,7 +273,7 @@
PMC* get_pmc_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_pmc_keyed_int(k);
+ return DYNSELF.get_pmc_keyed_int(k);
}
/*
@@ -327,7 +327,7 @@
void set_integer_keyed (PMC *key, INTVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_integer_keyed_int(k, value);
+ DYNSELF.set_integer_keyed_int(k, value);
}
/*
@@ -342,7 +342,7 @@
*/
void set_number_keyed_int (INTVAL key, FLOATVAL value) {
- SELF.set_integer_keyed_int(key, (INTVAL)(value != 0.0));
+ DYNSELF.set_integer_keyed_int(key, (INTVAL)(value != 0.0));
}
/*
@@ -359,7 +359,7 @@
void set_number_keyed(PMC *key, FLOATVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_number_keyed_int(k, value);
+ DYNSELF.set_number_keyed_int(k, value);
}
/*
@@ -379,7 +379,7 @@
tempPMC = pmc_new(INTERP, enum_class_Boolean);
VTABLE_set_string_native(INTERP, tempPMC, value);
tempInt = VTABLE_get_integer(INTERP, tempPMC);
- SELF.set_integer_keyed_int(key, tempInt);
+ DYNSELF.set_integer_keyed_int(key, tempInt);
}
/*
@@ -396,7 +396,7 @@
void set_string_keyed(PMC *key, STRING* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_string_keyed_int(k, value);
+ DYNSELF.set_string_keyed_int(k, value);
}
/*
@@ -413,7 +413,7 @@
INTVAL tempInt;
tempInt = VTABLE_get_integer(INTERP, src);
- SELF.set_integer_keyed_int(key, tempInt);
+ DYNSELF.set_integer_keyed_int(key, tempInt);
}
/*
@@ -430,7 +430,7 @@
void set_pmc_keyed(PMC *key, PMC* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_pmc_keyed_int(k, value);
+ DYNSELF.set_pmc_keyed_int(k, value);
}
}
Index: classes/fixedfloatarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedfloatarray.pmc,v
retrieving revision 1.1
diff -u -r1.1 fixedfloatarray.pmc
--- classes/fixedfloatarray.pmc 12 Jun 2004 15:54:00 -0000 1.1
+++ classes/fixedfloatarray.pmc 13 Jun 2004 07:33:19 -0000
@@ -112,7 +112,7 @@
*/
INTVAL get_bool () {
- INTVAL size = DYNSELF.elements();
+ INTVAL size = DYNDYNSELF.elements();
return (INTVAL)(size != 0);
}
@@ -139,7 +139,7 @@
*/
INTVAL get_integer () {
- return DYNSELF.elements();
+ return DYNDYNSELF.elements();
}
@@ -154,7 +154,7 @@
*/
INTVAL get_integer_keyed_int (INTVAL key) {
- return (INTVAL)SELF.get_number_keyed_int(key);
+ return (INTVAL)DYNSELF.get_number_keyed_int(key);
}
/*
@@ -170,7 +170,7 @@
INTVAL get_integer_keyed (PMC* key) {
/* simple int keys only */
INTVAL k = key_integer(INTERP, key);
- return SELF.get_integer_keyed_int(k);
+ return DYNSELF.get_integer_keyed_int(k);
}
@@ -206,7 +206,7 @@
FLOATVAL get_number_keyed (PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_number_keyed_int(k);
+ return DYNSELF.get_number_keyed_int(k);
}
/*
@@ -221,7 +221,7 @@
STRING* get_string_keyed_int (INTVAL key) {
PMC *temp;
- temp = SELF.get_pmc_keyed_int(key);
+ temp = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_string(INTERP, temp);
}
@@ -237,7 +237,7 @@
STRING* get_string_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_string_keyed_int(k);
+ return DYNSELF.get_string_keyed_int(k);
}
@@ -256,7 +256,7 @@
FLOATVAL val;
ret = pmc_new(INTERP, enum_class_Float);
- val = SELF.get_number_keyed_int(key);
+ val = DYNSELF.get_number_keyed_int(key);
VTABLE_set_number_native(INTERP, ret, val);
return ret;
}
@@ -273,7 +273,7 @@
PMC* get_pmc_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_pmc_keyed_int(k);
+ return DYNSELF.get_pmc_keyed_int(k);
}
/*
@@ -290,7 +290,7 @@
if (PMC_int_val(SELF) || size < 1)
internal_exception(OUT_OF_BOUNDS, "FixedFloatArray: Can't resize!\n");
PMC_int_val(SELF) = size;
- PMC_data(SELF) = mem_sys_allocate(size * sizeof(INTVAL));
+ PMC_data(SELF) = mem_sys_allocate(size * sizeof(FLOATVAL));
PObj_active_destroy_SET(SELF);
}
@@ -305,7 +305,7 @@
*/
void set_integer_keyed_int (INTVAL key, INTVAL value) {
- SELF.set_number_keyed_int(key, (FLOATVAL)value);
+ DYNSELF.set_number_keyed_int(key, (FLOATVAL)value);
}
/*
@@ -321,7 +321,7 @@
void set_integer_keyed (PMC *key, INTVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_integer_keyed_int(k, value);
+ DYNSELF.set_integer_keyed_int(k, value);
}
/*
@@ -359,7 +359,7 @@
void set_number_keyed(PMC *key, FLOATVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_number_keyed_int(k, value);
+ DYNSELF.set_number_keyed_int(k, value);
}
/*
@@ -379,7 +379,7 @@
tempPMC = pmc_new(INTERP, enum_class_Float);
VTABLE_set_string_native(INTERP, tempPMC, value);
tempNum = VTABLE_get_number(INTERP, tempPMC);
- SELF.set_number_keyed_int(key, tempNum);
+ DYNSELF.set_number_keyed_int(key, tempNum);
}
/*
@@ -396,7 +396,7 @@
void set_string_keyed(PMC *key, STRING* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_string_keyed_int(k, value);
+ DYNSELF.set_string_keyed_int(k, value);
}
/*
@@ -412,7 +412,7 @@
void set_pmc_keyed_int (INTVAL key, PMC* src) {
FLOATVAL tempNum;
tempNum = VTABLE_get_number(INTERP, src);
- SELF.set_number_keyed_int(key, tempNum);
+ DYNSELF.set_number_keyed_int(key, tempNum);
}
/*
@@ -429,7 +429,7 @@
void set_pmc_keyed(PMC *key, PMC* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_pmc_keyed_int(k, value);
+ DYNSELF.set_pmc_keyed_int(k, value);
}
}
Index: classes/fixedintegerarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedintegerarray.pmc,v
retrieving revision 1.1
diff -u -r1.1 fixedintegerarray.pmc
--- classes/fixedintegerarray.pmc 12 Jun 2004 15:54:00 -0000 1.1
+++ classes/fixedintegerarray.pmc 13 Jun 2004 07:33:19 -0000
@@ -112,7 +112,7 @@
*/
INTVAL get_bool () {
- INTVAL size = DYNSELF.elements();
+ INTVAL size = DYNDYNSELF.elements();
return (INTVAL)(size != 0);
}
@@ -139,7 +139,7 @@
*/
INTVAL get_integer () {
- return DYNSELF.elements();
+ return DYNDYNSELF.elements();
}
@@ -176,7 +176,7 @@
INTVAL get_integer_keyed (PMC* key) {
/* simple int keys only */
INTVAL k = key_integer(INTERP, key);
- return SELF.get_integer_keyed_int(k);
+ return DYNSELF.get_integer_keyed_int(k);
}
@@ -191,7 +191,7 @@
*/
FLOATVAL get_number_keyed_int (INTVAL key) {
- return (FLOATVAL)SELF.get_integer_keyed_int(key);
+ return (FLOATVAL)DYNSELF.get_integer_keyed_int(key);
}
/*
@@ -206,7 +206,7 @@
FLOATVAL get_number_keyed (PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_number_keyed_int(k);
+ return DYNSELF.get_number_keyed_int(k);
}
/*
@@ -221,7 +221,7 @@
STRING* get_string_keyed_int (INTVAL key) {
PMC *temp;
- temp = SELF.get_pmc_keyed_int(key);
+ temp = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_string(INTERP, temp);
}
@@ -237,7 +237,7 @@
STRING* get_string_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_string_keyed_int(k);
+ return DYNSELF.get_string_keyed_int(k);
}
@@ -256,7 +256,7 @@
INTVAL val;
ret = pmc_new(INTERP, enum_class_Integer);
- val = SELF.get_integer_keyed_int(key);
+ val = DYNSELF.get_integer_keyed_int(key);
VTABLE_set_integer_native(INTERP, ret, val);
return ret;
}
@@ -273,7 +273,7 @@
PMC* get_pmc_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_pmc_keyed_int(k);
+ return DYNSELF.get_pmc_keyed_int(k);
}
/*
@@ -327,7 +327,7 @@
void set_integer_keyed (PMC *key, INTVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_integer_keyed_int(k, value);
+ DYNSELF.set_integer_keyed_int(k, value);
}
/*
@@ -342,7 +342,7 @@
*/
void set_number_keyed_int (INTVAL key, FLOATVAL value) {
- SELF.set_integer_keyed_int(key, (INTVAL)value);
+ DYNSELF.set_integer_keyed_int(key, (INTVAL)value);
}
/*
@@ -359,7 +359,7 @@
void set_number_keyed(PMC *key, FLOATVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_number_keyed_int(k, value);
+ DYNSELF.set_number_keyed_int(k, value);
}
/*
@@ -379,7 +379,7 @@
tempPMC = pmc_new(INTERP, enum_class_Integer);
VTABLE_set_string_native(INTERP, tempPMC, value);
tempInt = VTABLE_get_integer(INTERP, tempPMC);
- SELF.set_integer_keyed_int(key, tempInt);
+ DYNSELF.set_integer_keyed_int(key, tempInt);
}
/*
@@ -396,7 +396,7 @@
void set_string_keyed(PMC *key, STRING* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_string_keyed_int(k, value);
+ DYNSELF.set_string_keyed_int(k, value);
}
/*
@@ -413,7 +413,7 @@
INTVAL tempInt;
tempInt = VTABLE_get_integer(INTERP, src);
- SELF.set_integer_keyed_int(key, tempInt);
+ DYNSELF.set_integer_keyed_int(key, tempInt);
}
/*
@@ -430,7 +430,7 @@
void set_pmc_keyed(PMC *key, PMC* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_pmc_keyed_int(k, value);
+ DYNSELF.set_pmc_keyed_int(k, value);
}
}
Index: classes/fixedpmcarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedpmcarray.pmc,v
retrieving revision 1.1
diff -u -r1.1 fixedpmcarray.pmc
--- classes/fixedpmcarray.pmc 12 Jun 2004 15:54:00 -0000 1.1
+++ classes/fixedpmcarray.pmc 13 Jun 2004 07:33:19 -0000
@@ -137,7 +137,7 @@
*/
INTVAL get_bool () {
- INTVAL size = DYNSELF.elements();
+ INTVAL size = DYNDYNSELF.elements();
return (INTVAL)(size != 0);
}
@@ -164,7 +164,7 @@
*/
INTVAL get_integer () {
- return DYNSELF.elements();
+ return DYNDYNSELF.elements();
}
@@ -179,7 +179,7 @@
*/
INTVAL get_integer_keyed_int (INTVAL key) {
- PMC *tempPMC = SELF.get_pmc_keyed_int(key);
+ PMC *tempPMC = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_integer(INTERP, tempPMC);
}
@@ -196,7 +196,7 @@
INTVAL get_integer_keyed (PMC* key) {
/* simple int keys only */
INTVAL k = key_integer(INTERP, key);
- return SELF.get_integer_keyed_int(k);
+ return DYNSELF.get_integer_keyed_int(k);
}
@@ -211,7 +211,7 @@
*/
FLOATVAL get_number_keyed_int (INTVAL key) {
- PMC *tempPMC = SELF.get_pmc_keyed_int(key);
+ PMC *tempPMC = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_number(INTERP, tempPMC);
}
@@ -227,7 +227,7 @@
FLOATVAL get_number_keyed (PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_number_keyed_int(k);
+ return DYNSELF.get_number_keyed_int(k);
}
/*
@@ -241,7 +241,7 @@
*/
STRING* get_string_keyed_int (INTVAL key) {
- PMC *tempPMC = SELF.get_pmc_keyed_int(key);
+ PMC *tempPMC = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_string(INTERP, tempPMC);
}
@@ -257,7 +257,7 @@
STRING* get_string_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_string_keyed_int(k);
+ return DYNSELF.get_string_keyed_int(k);
}
@@ -293,7 +293,7 @@
PMC* get_pmc_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_pmc_keyed_int(k);
+ return DYNSELF.get_pmc_keyed_int(k);
}
/*
@@ -335,7 +335,7 @@
val = pmc_new(INTERP, enum_class_Integer);
VTABLE_set_integer_native(INTERP, val, value);
- SELF.set_pmc_keyed_int(key, val);
+ DYNSELF.set_pmc_keyed_int(key, val);
}
/*
@@ -351,7 +351,7 @@
void set_integer_keyed (PMC *key, INTVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_integer_keyed_int(k, value);
+ DYNSELF.set_integer_keyed_int(k, value);
}
/*
@@ -370,7 +370,7 @@
val = pmc_new(INTERP, enum_class_Float);
VTABLE_set_number_native(INTERP, val, value);
- SELF.set_pmc_keyed_int(key, val);
+ DYNSELF.set_pmc_keyed_int(key, val);
}
/*
@@ -387,7 +387,7 @@
void set_number_keyed(PMC *key, FLOATVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_number_keyed_int(k, value);
+ DYNSELF.set_number_keyed_int(k, value);
}
/*
@@ -405,7 +405,7 @@
val = pmc_new(INTERP, enum_class_PerlString);
VTABLE_set_string_native(INTERP, val, value);
- SELF.set_pmc_keyed_int(key, val);
+ DYNSELF.set_pmc_keyed_int(key, val);
}
/*
@@ -422,7 +422,7 @@
void set_string_keyed(PMC *key, STRING* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_string_keyed_int(k, value);
+ DYNSELF.set_string_keyed_int(k, value);
}
/*
@@ -459,7 +459,7 @@
void set_pmc_keyed(PMC *key, PMC* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_pmc_keyed_int(k, value);
+ DYNSELF.set_pmc_keyed_int(k, value);
}
}
Index: classes/fixedstringarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedstringarray.pmc,v
retrieving revision 1.1
diff -u -r1.1 fixedstringarray.pmc
--- classes/fixedstringarray.pmc 12 Jun 2004 15:54:00 -0000 1.1
+++ classes/fixedstringarray.pmc 13 Jun 2004 07:33:19 -0000
@@ -136,7 +136,7 @@
*/
INTVAL get_bool () {
- INTVAL size = DYNSELF.elements();
+ INTVAL size = DYNDYNSELF.elements();
return (INTVAL)(size != 0);
}
@@ -163,7 +163,7 @@
*/
INTVAL get_integer () {
- return DYNSELF.elements();
+ return DYNDYNSELF.elements();
}
@@ -178,7 +178,7 @@
*/
INTVAL get_integer_keyed_int (INTVAL key) {
- PMC *tempPMC = SELF.get_pmc_keyed_int(key);
+ PMC *tempPMC = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_integer(INTERP, tempPMC);
}
@@ -195,7 +195,7 @@
INTVAL get_integer_keyed (PMC* key) {
/* simple int keys only */
INTVAL k = key_integer(INTERP, key);
- return SELF.get_integer_keyed_int(k);
+ return DYNSELF.get_integer_keyed_int(k);
}
@@ -210,7 +210,7 @@
*/
FLOATVAL get_number_keyed_int (INTVAL key) {
- PMC *tempPMC = SELF.get_pmc_keyed_int(key);
+ PMC *tempPMC = DYNSELF.get_pmc_keyed_int(key);
return VTABLE_get_number(INTERP, tempPMC);
}
@@ -226,7 +226,7 @@
FLOATVAL get_number_keyed (PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_number_keyed_int(k);
+ return DYNSELF.get_number_keyed_int(k);
}
/*
@@ -261,7 +261,7 @@
STRING* get_string_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_string_keyed_int(k);
+ return DYNSELF.get_string_keyed_int(k);
}
@@ -280,7 +280,7 @@
STRING *val;
ret = pmc_new(INTERP, enum_class_PerlString);
- val = SELF.get_string_keyed_int(key);
+ val = DYNSELF.get_string_keyed_int(key);
VTABLE_set_string_native(INTERP, ret, val);
return ret;
}
@@ -297,7 +297,7 @@
PMC* get_pmc_keyed(PMC* key) {
INTVAL k = key_integer(INTERP, key);
- return SELF.get_pmc_keyed_int(k);
+ return DYNSELF.get_pmc_keyed_int(k);
}
/*
@@ -335,7 +335,7 @@
ret = pmc_new(INTERP, enum_class_PerlString);
VTABLE_set_integer_native(INTERP, ret, value);
val = VTABLE_get_string(INTERP, ret);
- SELF.set_string_keyed_int(key, val);
+ DYNSELF.set_string_keyed_int(key, val);
}
/*
@@ -351,7 +351,7 @@
void set_integer_keyed (PMC *key, INTVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_integer_keyed_int(k, value);
+ DYNSELF.set_integer_keyed_int(k, value);
}
/*
@@ -372,7 +372,7 @@
ret = pmc_new(INTERP, enum_class_PerlString);
VTABLE_set_number_native(INTERP, ret, value);
val = VTABLE_get_string(INTERP, ret);
- SELF.set_string_keyed_int(key, val);
+ DYNSELF.set_string_keyed_int(key, val);
}
/*
@@ -389,7 +389,7 @@
void set_number_keyed(PMC *key, FLOATVAL value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_number_keyed_int(k, value);
+ DYNSELF.set_number_keyed_int(k, value);
}
/*
@@ -426,7 +426,7 @@
void set_string_keyed(PMC *key, STRING* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_string_keyed_int(k, value);
+ DYNSELF.set_string_keyed_int(k, value);
}
/*
@@ -443,7 +443,7 @@
STRING *temp;
temp = VTABLE_get_string(INTERP, src);
- SELF.set_string_keyed_int(key, temp);
+ DYNSELF.set_string_keyed_int(key, temp);
}
/*
@@ -460,7 +460,7 @@
void set_pmc_keyed(PMC *key, PMC* value) {
INTVAL k;
k = key_integer(INTERP, key);
- SELF.set_pmc_keyed_int(k, value);
+ DYNSELF.set_pmc_keyed_int(k, value);
}
}
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./classes/resizableintegerarray.pmc 2004-06-13 01:30:53.000000000 -0400
@@ -0,0 +1,114 @@
+/*
+Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+$Id: resizableintegerarray.pmc,v 1.1 2004/06/12 15:54:00 dan Exp $
+
+=head1 NAME
+
+classes/resizableintegerarray.pmc - resizable size array for integers only
+
+=head1 DESCRIPTION
+
+This class, ResizableIntegerArray, implements an array of resizable size, which stored INTVALs,
+it uses Integer PMCs for all of the conversions
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+pmclass ResizableIntegerArray extends FixedIntegerArray need_ext does array {
+
+/*
+
+=item C<INTVAL get_integer_keyed_int(INTVAL key)>
+
+Returns the integer value of the element at index C<key>.
+
+=cut
+
+*/
+
+ INTVAL get_integer_keyed_int (INTVAL key) {
+ INTVAL *data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableIntegerArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (INTVAL *)PMC_data(SELF);
+ return data[key];
+ }
+
+/*
+
+=item C<void set_integer_native(INTVAL size)>
+
+Resizes the array to C<size> elements.
+
+=cut
+
+*/
+
+ void set_integer_native (INTVAL size) {
+ if (size < 0)
+ internal_exception(OUT_OF_BOUNDS, "ResizableIntegerArray: Can't resize!\n");
+ PMC_int_val(SELF) = size;
+ PMC_data(SELF) = mem_sys_realloc(PMC_data(SELF), size*sizeof(INTVAL));
+ PObj_active_destroy_SET(SELF);
+ }
+
+/*
+
+=item C<void set_integer_keyed_int(INTVAL key, INTVAL value)>
+
+Sets the integer value of the element at index C<key> to C<value>.
+
+=cut
+
+*/
+
+ void set_integer_keyed_int (INTVAL key, INTVAL value) {
+ INTVAL *data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableIntegerArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (INTVAL*)PMC_data(SELF);
+ data[key] = value;
+ }
+
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<docs/pdds/pdd03_calling_conventions.pod>.
+
+=head1 HISTORY
+
+Initial version 2004.06.11 by Matt Fowles
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./classes/resizablepmcarray.pmc 2004-06-13 01:58:52.000000000 -0400
@@ -0,0 +1,129 @@
+/*
+Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+$Id: resizablepmcarray.pmc,v 1.1 2004/06/12 15:54:00 dan Exp $
+
+=head1 NAME
+
+classes/resizablepmcarray.pmc - resizable size array for PMCs only
+
+=head1 DESCRIPTION
+
+This class, ResizablePMCArray, implements an array of resizable size, which stores PMCs,
+it puts things into Integer, Float, or String PMCs as appropriate
+TODO currently this uses PerlString instead of String PMCs.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+pmclass ResizablePMCArray extends FixedPMCArray need_ext does array {
+
+
+/*
+
+=item C<PMC *get_pmc_keyed_int(INTVAL key)>
+
+Returns the PMC value of the element at index C<key>.
+
+=cut
+
+*/
+
+ PMC* get_pmc_keyed_int (INTVAL key) {
+ PMC **data;
+ PMC *res;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizablePMCArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (PMC **)PMC_data(SELF);
+ if(data[key] == PMCNULL)
+ data[key] = pmc_new(INTERP, enum_class_Undef);
+ return data[key];
+ }
+
+
+/*
+
+=item C<void set_integer_native(INTVAL size)>
+
+Resizes the array to C<size> elements.
+
+=cut
+
+*/
+
+ void set_integer_native (INTVAL size) {
+ int i;
+ PMC **data;
+
+ if (size < 0)
+ internal_exception(OUT_OF_BOUNDS, "ResizablePMCArray: Can't resize!\n");
+
+ data = (PMC**)mem_sys_realloc(PMC_data(SELF), size*sizeof(PMC*));
+ for(i = PMC_int_val(SELF); i < size; i++)
+ data[i] = PMCNULL;
+
+ PMC_int_val(SELF) = size;
+ PMC_data(SELF) = data;
+ PObj_custom_mark_destroy_SETALL(SELF);
+ }
+
+
+/*
+
+=item C<void set_pmc_keyed_int(INTVAL key, PMC *src)>
+
+Sets the PMC value of the element at index C<key> to C<*src>.
+
+=cut
+
+*/
+
+ void set_pmc_keyed_int (INTVAL key, PMC* src) {
+ PMC **data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizablePMCArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (PMC**)PMC_data(SELF);
+ data[key] = src;
+ }
+
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<docs/pdds/pdd03_calling_conventions.pod>.
+
+=head1 HISTORY
+
+Initial version 2004.06.11 by Matt Fowles
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./classes/resizablestringarray.pmc 2004-06-13 01:56:15.000000000 -0400
@@ -0,0 +1,123 @@
+/*
+Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+$Id: resizablestringarray.pmc,v 1.1 2004/06/12 15:54:00 dan Exp $
+
+=head1 NAME
+
+classes/resizablestringarray.pmc - resizable size array for strings only
+
+=head1 DESCRIPTION
+
+This class, ResizableStringArray, implements an array of resizable size, which stored STRING*
+TODO: it uses PerlString's internally to perform conversion, but it should use String PMCs
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+pmclass ResizableStringArray extends FixedStringArray need_ext does array {
+
+/*
+
+=item C<STRING *get_string_keyed_int(INTVAL key)>
+
+Returns the Parrot string value of the element at index C<key>.
+
+=cut
+
+*/
+
+ STRING* get_string_keyed_int (INTVAL key) {
+ STRING **data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableStringArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (STRING **)PMC_data(SELF);
+ return data[key];
+ }
+
+/*
+
+=item C<void set_integer_native(INTVAL size)>
+
+Resizes the array to C<size> elements.
+
+=cut
+
+*/
+
+ void set_integer_native (INTVAL size) {
+ int i;
+ STRING **data;
+ if (size < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableStringArray: Can't resize!\n");
+
+ data = mem_sys_realloc(PMC_data(SELF), size*sizeof(STRING*));
+ for(i = PMC_int_val(SELF); i < size; i++)
+ data[i] = NULL;
+
+ PMC_int_val(SELF) = size;
+ PMC_data(SELF) = data;
+ PObj_custom_mark_destroy_SETALL(SELF);
+ }
+
+
+/*
+
+=item C<void set_string_keyed_int(INTVAL key, STRING *value)>
+
+Sets the Parrot string value of the element at index C<key> to C<value>.
+
+=cut
+
+*/
+
+ void set_string_keyed_int (INTVAL key, STRING* value) {
+ STRING **data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableStringArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (STRING**)PMC_data(SELF);
+ data[key] = value;
+ }
+
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<docs/pdds/pdd03_calling_conventions.pod>.
+
+=head1 HISTORY
+
+Initial version 2004.06.11 by Matt Fowles
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./classes/resizablefloatarray.pmc 2004-06-13 01:18:05.000000000 -0400
@@ -0,0 +1,117 @@
+/*
+Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+$Id: resizablefloatarray.pmc,v 1.1 2004/06/12 15:54:00 dan Exp $
+
+=head1 NAME
+
+classes/resizablefloatarray.pmc - resizable size array for floating point numbers only
+
+=head1 DESCRIPTION
+
+This class, ResizableFloatArray, implements an array of resizable size, which stored FLOATVALs,
+it uses Float PMCs to do all necessary conversions
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+pmclass ResizableFloatArray extends FixedFloatArray need_ext does array {
+
+
+/*
+
+=item C<FLOATVAL get_number_keyed_int(INTVAL key)>
+
+Returns the floating-point value of the element at index C<key>.
+
+=cut
+
+*/
+
+ FLOATVAL get_number_keyed_int (INTVAL key) {
+ FLOATVAL *data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableFloatArray: index out of bounds!\n");
+ if (key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (FLOATVAL *)PMC_data(SELF);
+ return data[key];
+ }
+
+
+/*
+
+=item C<void set_integer_native(INTVAL size)>
+
+Resizes the array to C<size> elements.
+
+=cut
+
+*/
+
+ void set_integer_native (INTVAL size) {
+ if (size < 0)
+ internal_exception(OUT_OF_BOUNDS, "ResizableFloatArray: Can't resize!\n");
+ PMC_int_val(SELF) = size;
+ PMC_data(SELF) = mem_sys_realloc(PMC_data(SELF), size*sizeof(FLOATVAL));
+ PObj_active_destroy_SET(SELF);
+ }
+
+/*
+
+=item C<void set_number_keyed_int(INTVAL key, FLOATVAL value)>
+
+Sets the floating-point value of the element at index C<key> to
+C<value>.
+
+=cut
+
+*/
+
+ void set_number_keyed_int (INTVAL key, FLOATVAL value) {
+ FLOATVAL *data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableFloatArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (FLOATVAL*)PMC_data(SELF);
+ data[key] = value;
+ }
+
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<docs/pdds/pdd03_calling_conventions.pod>.
+
+=head1 HISTORY
+
+Initial version 2004.06.11 by Matt Fowles
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./classes/resizablebooleanarray.pmc 2004-06-13 01:15:39.000000000 -0400
@@ -0,0 +1,118 @@
+/*
+Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+$Id: resizablebooleanarray.pmc,v 1.1 2004/06/12 15:54:00 dan Exp $
+
+=head1 NAME
+
+classes/resizablebooleanarray.pmc - resizable size array for booleans only
+
+=head1 DESCRIPTION
+
+This class, ResizableBooleanArray, implements an array of resizable size, which stores booleans,
+it uses Boolean PMCs for all of the conversions
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+pmclass ResizableBooleanArray extends FixedBooleanArray need_ext does array {
+
+/*
+
+=item C<INTVAL get_integer_keyed_int(INTVAL key)>
+
+Returns the integer value of the element at index C<key>.
+
+=cut
+
+*/
+
+ INTVAL get_integer_keyed_int (INTVAL key) {
+ INTVAL *data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableBooleanArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (INTVAL *)PMC_data(SELF);
+ return data[key];
+ }
+
+
+/*
+
+=item C<void set_integer_native(INTVAL size)>
+
+Resizes the array to C<size> elements.
+
+=cut
+
+*/
+
+ void set_integer_native (INTVAL size) {
+
+ if (size < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableBooleanArray: Can't resize!\n");
+
+ PMC_int_val(SELF) = size;
+ PMC_data(SELF) = mem_sys_realloc(PMC_data(SELF), size*sizeof(INTVAL));
+ PObj_active_destroy_SET(SELF);
+ }
+
+/*
+
+=item C<void set_integer_keyed_int(INTVAL key, INTVAL value)>
+
+Sets the integer value of the element at index C<key> to C<value>.
+
+=cut
+
+*/
+
+ void set_integer_keyed_int (INTVAL key, INTVAL value) {
+ INTVAL *data;
+ if (key < 0)
+ internal_exception(OUT_OF_BOUNDS,
+ "ResizableBooleanArray: index out of bounds!\n");
+ if(key >= PMC_int_val(SELF))
+ DYNSELF.set_integer_native(key+1);
+
+ data = (INTVAL*)PMC_data(SELF);
+ data[key] = (value != 0);
+ }
+
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<docs/pdds/pdd03_calling_conventions.pod>.
+
+=head1 HISTORY
+
+Initial version 2004.06.11 by Matt Fowles
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./t/pmc/resizablebooleanarray.t 2004-06-12 16:16:51.000000000 -0400
@@ -0,0 +1,287 @@
+#! perl -w
+# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+# $Id: resizablebooleanarray.t,v 1.1 2004/06/12 15:54:03 dan Exp $
+
+=head1 NAME
+
+t/pmc/resizablebooleanarray.t - ResizableBooleanArray PMC
+
+=head1 SYNOPSIS
+
+ % perl t/pmc/ResizableBooleanArray.t
+
+=head1 DESCRIPTION
+
+Tests C<ResizableBooleanArray> PMC. Checks size, sets various elements, including
+out-of-bounds test. Checks INT and PMC keys.
+
+=cut
+
+use Parrot::Test tests => 7;
+use Test::More;
+
+my $fp_equality_macro = <<'ENDOFMACRO';
+.macro fp_eq ( J, K, L )
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ gt N2, 0.000001, .$FPEQNOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPEQNOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+.macro fp_ne( J,K,L)
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ lt N2, 0.000001, .$FPNENOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPNENOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+ENDOFMACRO
+
+output_is(<<'CODE', <<'OUTPUT', "Setting array size");
+ new P0, .ResizableBooleanArray
+
+ set I0,P0
+ eq I0,0,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0,1
+ set I0,P0
+ eq I0,1,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0,5
+ set I0,P0
+ eq I0,5,OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ set P0,50
+ set I0,P0
+ eq I0,50,OK_4
+ print "not "
+OK_4: print "ok 4\n"
+
+ set P0,7
+ set I0,P0
+ eq I0,7,OK_5
+ print "not "
+OK_5: print "ok 5\n"
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting first element");
+ new P0, .ResizableBooleanArray
+ set P0, 1
+
+ set P0[0],-7
+ set I0,P0[0]
+ eq I0,1,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[0],3.7
+ set N0,P0[0]
+ eq N0,1.0,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[0],"17"
+ set S0,P0[0]
+ eq S0,"1",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting second element");
+ new P0, .ResizableBooleanArray
+ set P0, 2
+
+ set P0[1], -7
+ set I0, P0[1]
+ eq I0,1,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[1], 3.7
+ set N0, P0[1]
+ eq N0,1.0,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[1],"17"
+ set S0, P0[1]
+ eq S0,"1",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+# TODO: Rewrite these properly when we have exceptions
+
+output_is(<<'CODE', <<'OUTPUT', "Setting out-of-bounds elements");
+ new P0, .ResizableBooleanArray
+
+ set P0[1], -7
+ set I0, P0[1]
+ eq I0,1,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[0], 3.7
+ set N0, P0[0]
+ eq N0,1.0,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[5],"17"
+ set S0, P0[5]
+ eq S0,"1",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements");
+ new P0, .ResizableBooleanArray
+ set P0, 1
+
+ set I0, P0[1]
+ print "ok 1\n"
+ end
+CODE
+ok 1
+OUTPUT
+
+
+output_is(<<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableBooleanArray
+ new P1, .Key
+
+ set P1, 0
+ set P0[P1], 25
+
+ set P1, 1
+ set P0[P1], 2.5
+
+ set P1, 2
+ set P0[P1], "17"
+
+ set I0, P0[0]
+ eq I0, 1, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set N0, P0[1]
+ .fp_eq(N0, 1.0, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set S0, P0[2]
+ eq S0, "1", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableBooleanArray
+
+ set P0[25], 125
+ set P0[128], 10.2
+ set P0[513], "17"
+ new P1, .PerlInt
+ set P1, 123456
+ set P0[1023], P1
+
+ new P2, .Key
+ set P2, 25
+ set I0, P0[P2]
+ eq I0, 1, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set P2, 128
+ set N0, P0[P2]
+ .fp_eq(N0, 1.0, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set P2, 513
+ set S0, P0[P2]
+ eq S0, "1", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ set P2, 1023
+ set P3, P0[P2]
+ set I1, P3
+ eq I1, 1, OK4
+ print "not "
+OK4: print "ok 4\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+OUTPUT
+
+1;
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./t/pmc/resizableintegerarray.t 2004-06-13 01:47:47.000000000 -0400
@@ -0,0 +1,271 @@
+#! perl -w
+# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+# $Id: resizableintegerarray.t,v 1.1 2004/06/12 15:54:03 dan Exp $
+
+=head1 NAME
+
+t/pmc/resizableintegerarray.t - ResizableIntegerArray PMC
+
+=head1 SYNOPSIS
+
+ % perl t/pmc/ResizableIntegerArray.t
+
+=head1 DESCRIPTION
+
+Tests C<ResizableIntegerArray> PMC. Checks size, sets various elements, including
+out-of-bounds test. Checks INT and PMC keys.
+
+=cut
+
+use Parrot::Test tests => 7;
+use Test::More;
+
+my $fp_equality_macro = <<'ENDOFMACRO';
+.macro fp_eq ( J, K, L )
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ gt N2, 0.000001, .$FPEQNOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPEQNOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+.macro fp_ne( J,K,L)
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ lt N2, 0.000001, .$FPNENOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPNENOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+ENDOFMACRO
+
+output_is(<<'CODE', <<'OUTPUT', "Setting array size");
+ new P0,.ResizableIntegerArray
+
+ set I0,P0
+ eq I0,0,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0,1
+ set I0,P0
+ eq I0,1,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0,5
+ set I0,P0
+ eq I0,5,OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ set P0,9
+ set I0,P0
+ eq I0,9,OK_4
+ print "not "
+OK_4: print "ok 4\n"
+
+ set P0,7
+ set I0,P0
+ eq I0,7,OK_5
+ print "not "
+OK_5: print "ok 5\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting first element");
+ new P0, .ResizableIntegerArray
+ set P0, 1
+
+ set P0[0],-7
+ set I0,P0[0]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[0],3.7
+ set N0,P0[0]
+ eq N0,3.0,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[0],"17"
+ set S0,P0[0]
+ eq S0,"17",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting second element");
+ new P0, .ResizableIntegerArray
+
+ set P0[1], -7
+ set I0, P0[1]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[1], 3.7
+ set N0, P0[1]
+ eq N0,3.0,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[1],"17"
+ set S0, P0[1]
+ eq S0,"17",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+# TODO: Rewrite these properly when we have exceptions
+
+output_is(<<'CODE', <<'OUTPUT', "Setting out-of-bounds elements");
+ new P0, .ResizableIntegerArray
+ set P0, 1
+
+ set P0[1], -7
+ print "ok 1\n"
+
+ end
+CODE
+ok 1
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements");
+ new P0, .ResizableIntegerArray
+ set P0, 1
+
+ set I0, P0[1]
+ print "ok 1\n"
+ end
+CODE
+ok 1
+OUTPUT
+
+
+output_is(<<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableIntegerArray
+ new P1, .Key
+
+ set P1, 0
+ set P0[P1], 25
+
+ set P1, 1
+ set P0[P1], 2.5
+
+ set P1, 2
+ set P0[P1], "17"
+
+ set I0, P0[0]
+ eq I0, 25, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set N0, P0[1]
+ .fp_eq(N0, 2.0, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set S0, P0[2]
+ eq S0, "17", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableIntegerArray
+
+ set P0[25], 125
+ set P0[128], 10.2
+ set P0[513], "17"
+ new P1, .PerlInt
+ set P1, 123456
+ set P0[1023], P1
+
+ new P2, .Key
+ set P2, 25
+ set I0, P0[P2]
+ eq I0, 125, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set P2, 128
+ set N0, P0[P2]
+ .fp_eq(N0, 10.0, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set P2, 513
+ set S0, P0[P2]
+ eq S0, "17", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ set P2, 1023
+ set P3, P0[P2]
+ set I1, P3
+ eq I1, 123456, OK4
+ print "not "
+OK4: print "ok 4\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+OUTPUT
+
+1;
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./t/pmc/resizablestringarray.t 2004-06-12 16:40:02.000000000 -0400
@@ -0,0 +1,272 @@
+#! perl -w
+# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+# $Id: resizablestringarray.t,v 1.1 2004/06/12 15:54:03 dan Exp $
+
+=head1 NAME
+
+t/pmc/resizablestringarray.t - ResizableStringArray PMC
+
+=head1 SYNOPSIS
+
+ % perl t/pmc/ResizableStringArray.t
+
+=head1 DESCRIPTION
+
+Tests C<ResizableStringArray> PMC. Checks size, sets various elements, including
+out-of-bounds test. Checks INT and PMC keys.
+
+=cut
+
+use Parrot::Test tests => 7;
+use Test::More;
+
+my $fp_equality_macro = <<'ENDOFMACRO';
+.macro fp_eq ( J, K, L )
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ gt N2, 0.000001, .$FPEQNOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPEQNOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+.macro fp_ne( J,K,L)
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ lt N2, 0.000001, .$FPNENOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPNENOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+ENDOFMACRO
+
+output_is(<<'CODE', <<'OUTPUT', "Setting array size");
+ new P0,.ResizableStringArray
+
+ set I0,P0
+ eq I0,0,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0,1
+ set I0,P0
+ eq I0,1,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0,5
+ set I0,P0
+ eq I0,5,OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ set P0,9
+ set I0,P0
+ eq I0,9,OK_4
+ print "not "
+OK_4: print "ok 4\n"
+
+ set P0,7
+ set I0,P0
+ eq I0,7,OK_5
+ print "not "
+OK_5: print "ok 5\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting first element");
+ new P0, .ResizableStringArray
+ set P0, 1
+
+ set P0[0],-7
+ set I0,P0[0]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[0],3.7
+ set N0,P0[0]
+ eq N0,3.7,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[0],"muwhahaha"
+ set S0,P0[0]
+ eq S0,"muwhahaha",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting second element");
+ new P0, .ResizableStringArray
+ set P0, 2
+
+ set P0[1], -7
+ set I0, P0[1]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[1], 3.7
+ set N0, P0[1]
+ eq N0,3.7,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[1],"purple"
+ set S0, P0[1]
+ eq S0,"purple",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+# TODO: Rewrite these properly when we have exceptions
+
+output_is(<<'CODE', <<'OUTPUT', "Setting out-of-bounds elements");
+ new P0, .ResizableStringArray
+ set P0, 1
+
+ set P0[1], -7
+ print "ok 1\n"
+
+ end
+CODE
+ok 1
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements");
+ new P0, .ResizableStringArray
+ set P0, 1
+
+ set I0, P0[1]
+ print "ok 1\n"
+ end
+CODE
+ok 1
+OUTPUT
+
+
+output_is(<<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableStringArray
+ new P1, .Key
+
+ set P1, 0
+ set P0[P1], 25
+
+ set P1, 1
+ set P0[P1], 2.5
+
+ set P1, 2
+ set P0[P1], "bleep"
+
+ set I0, P0[0]
+ eq I0, 25, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set N0, P0[1]
+ .fp_eq(N0, 2.5, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set S0, P0[2]
+ eq S0, "bleep", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableStringArray
+
+ set P0[25], 125
+ set P0[128], 10.2
+ set P0[513], "cow"
+ new P1, .PerlInt
+ set P1, 123456
+ set P0[1023], P1
+
+ new P2, .Key
+ set P2, 25
+ set I0, P0[P2]
+ eq I0, 125, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set P2, 128
+ set N0, P0[P2]
+ .fp_eq(N0, 10.2, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set P2, 513
+ set S0, P0[P2]
+ eq S0, "cow", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ set P2, 1023
+ set P3, P0[P2]
+ set I1, P3
+ eq I1, 123456, OK4
+ print "not "
+OK4: print "ok 4\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+OUTPUT
+
+1;
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./t/pmc/resizablefloatarray.t 2004-06-12 16:18:18.000000000 -0400
@@ -0,0 +1,271 @@
+#! perl -w
+# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+# $Id: resizablefloatarray.t,v 1.1 2004/06/12 15:54:03 dan Exp $
+
+=head1 NAME
+
+t/pmc/resizablefloatarray.t - ResizableFloatArray PMC
+
+=head1 SYNOPSIS
+
+ % perl t/pmc/resizablefloatarray.t
+
+=head1 DESCRIPTION
+
+Tests C<ResizableFloatArray> PMC. Checks size, sets various elements, including
+out-of-bounds test. Checks INT and PMC keys.
+
+=cut
+
+use Parrot::Test tests => 7;
+use Test::More;
+
+my $fp_equality_macro = <<'ENDOFMACRO';
+.macro fp_eq ( J, K, L )
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ gt N2, 0.000001, .$FPEQNOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPEQNOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+.macro fp_ne( J,K,L)
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ lt N2, 0.000001, .$FPNENOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPNENOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+ENDOFMACRO
+
+output_is(<<'CODE', <<'OUTPUT', "Setting array size");
+ new P0,.ResizableFloatArray
+
+ set I0,P0
+ eq I0,0,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0,1
+ set I0,P0
+ eq I0,1,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0,5
+ set I0,P0
+ eq I0,5,OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ set P0,9
+ set I0,P0
+ eq I0,9,OK_4
+ print "not "
+OK_4: print "ok 4\n"
+
+ set P0,7
+ set I0,P0
+ eq I0,7,OK_5
+ print "not "
+OK_5: print "ok 5\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting first element");
+ new P0, .ResizableFloatArray
+ set P0, 1
+
+ set P0[0],-7
+ set I0,P0[0]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[0],3.7
+ set N0,P0[0]
+ eq N0,3.7,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[0],"17.2"
+ set S0,P0[0]
+ eq S0,"17.2",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting second element");
+ new P0, .ResizableFloatArray
+
+ set P0[1], -7
+ set I0, P0[1]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[1], 3.7
+ set N0, P0[1]
+ eq N0,3.7,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[1],"17.1"
+ set S0, P0[1]
+ eq S0,"17.1",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+# TODO: Rewrite these properly when we have exceptions
+
+output_is(<<'CODE', <<'OUTPUT', "Setting out-of-bounds elements");
+ new P0, .ResizableFloatArray
+ set P0, 1
+
+ set P0[1], -7
+ print "ok 1\n"
+
+ end
+CODE
+ok 1
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements");
+ new P0, .ResizableFloatArray
+ set P0, 1
+
+ set I0, P0[1]
+ print "ok 1\n"
+ end
+CODE
+ok 1
+OUTPUT
+
+
+output_is(<<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableFloatArray
+ new P1, .Key
+
+ set P1, 0
+ set P0[P1], 25
+
+ set P1, 1
+ set P0[P1], 2.5
+
+ set P1, 2
+ set P0[P1], "17.32"
+
+ set I0, P0[0]
+ eq I0, 25, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set N0, P0[1]
+ .fp_eq(N0, 2.5, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set S0, P0[2]
+ eq S0, "17.32", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizableFloatArray
+
+ set P0[25], 125
+ set P0[128], 10.2
+ set P0[513], "17.3"
+ new P1, .PerlInt
+ set P1, 123456
+ set P0[1023], P1
+
+ new P2, .Key
+ set P2, 25
+ set I0, P0[P2]
+ eq I0, 125, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set P2, 128
+ set N0, P0[P2]
+ .fp_eq(N0, 10.2, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set P2, 513
+ set S0, P0[P2]
+ eq S0, "17.3", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ set P2, 1023
+ set P3, P0[P2]
+ set I1, P3
+ eq I1, 123456, OK4
+ print "not "
+OK4: print "ok 4\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+OUTPUT
+
+1;
--- /dev/null 2004-06-04 22:24:38.000000000 -0400
+++ ./t/pmc/resizablepmcarray.t 2004-06-12 16:36:45.000000000 -0400
@@ -0,0 +1,270 @@
+#! perl -w
+# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+# $Id: resizablepmcarray.t,v 1.1 2004/06/12 15:54:03 dan Exp $
+
+=head1 NAME
+
+t/pmc/resizablepmcarray.t - ResizablePMCArray PMC
+
+=head1 SYNOPSIS
+
+ % perl t/pmc/ResizablePMCArray.t
+
+=head1 DESCRIPTION
+
+Tests C<ResizablePMCArray> PMC. Checks size, sets various elements, including
+out-of-bounds test. Checks INT and PMC keys.
+
+=cut
+
+use Parrot::Test tests => 7;
+use Test::More;
+
+my $fp_equality_macro = <<'ENDOFMACRO';
+.macro fp_eq ( J, K, L )
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ gt N2, 0.000001, .$FPEQNOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPEQNOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+.macro fp_ne( J,K,L)
+ save N0
+ save N1
+ save N2
+
+ set N0, .J
+ set N1, .K
+ sub N2, N1,N0
+ abs N2, N2
+ lt N2, 0.000001, .$FPNENOK
+
+ restore N2
+ restore N1
+ restore N0
+ branch .L
+.local $FPNENOK:
+ restore N2
+ restore N1
+ restore N0
+.endm
+ENDOFMACRO
+
+output_is(<<'CODE', <<'OUTPUT', "Setting array size");
+ new P0,.ResizablePMCArray
+
+ set I0,P0
+ eq I0,0,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0,1
+ set I0,P0
+ eq I0,1,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0,5
+ set I0,P0
+ eq I0,5,OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ set P0,9
+ set I0,P0
+ eq I0,9,OK_4
+ print "not "
+OK_4: print "ok 4\n"
+
+ set P0,7
+ set I0,P0
+ eq I0,7,OK_5
+ print "not "
+OK_5: print "ok 5\n"
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting first element");
+ new P0, .ResizablePMCArray
+ set P0, 1
+
+ set P0[0],-7
+ set I0,P0[0]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[0],3.7
+ set N0,P0[0]
+ eq N0,3.7,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[0],"muwhahaha"
+ set S0,P0[0]
+ eq S0,"muwhahaha",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Setting second element");
+ new P0, .ResizablePMCArray
+
+ set P0[1], -7
+ set I0, P0[1]
+ eq I0,-7,OK_1
+ print "not "
+OK_1: print "ok 1\n"
+
+ set P0[1], 3.7
+ set N0, P0[1]
+ eq N0,3.7,OK_2
+ print "not "
+OK_2: print "ok 2\n"
+
+ set P0[1],"purple"
+ set S0, P0[1]
+ eq S0,"purple",OK_3
+ print "not "
+OK_3: print "ok 3\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+# TODO: Rewrite these properly when we have exceptions
+
+output_is(<<'CODE', <<'OUTPUT', "Setting out-of-bounds elements");
+ new P0, .ResizablePMCArray
+ set P0, 1
+
+ set P0[1], -7
+ print "ok 1\n"
+
+ end
+CODE
+ok 1
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements");
+ new P0, .ResizablePMCArray
+ set P0, 1
+
+ set I0, P0[1]
+ print "ok 1\n"
+ end
+CODE
+ok 1
+OUTPUT
+
+
+output_is(<<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizablePMCArray
+ new P1, .Key
+
+ set P1, 0
+ set P0[P1], 25
+
+ set P1, 1
+ set P0[P1], 2.5
+
+ set P1, 2
+ set P0[P1], "bleep"
+
+ set I0, P0[0]
+ eq I0, 25, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set N0, P0[1]
+ .fp_eq(N0, 2.5, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set S0, P0[2]
+ eq S0, "bleep", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys");
[EMAIL PROTECTED] $fp_equality_macro ]}
+ new P0, .ResizablePMCArray
+
+ set P0[25], 125
+ set P0[128], 10.2
+ set P0[513], "cow"
+ new P1, .PerlInt
+ set P1, 123456
+ set P0[1023], P1
+
+ new P2, .Key
+ set P2, 25
+ set I0, P0[P2]
+ eq I0, 125, OK1
+ print "not "
+OK1: print "ok 1\\n"
+
+ set P2, 128
+ set N0, P0[P2]
+ .fp_eq(N0, 10.2, OK2)
+ print "not "
+OK2: print "ok 2\\n"
+
+ set P2, 513
+ set S0, P0[P2]
+ eq S0, "cow", OK3
+ print "not "
+OK3: print "ok 3\\n"
+
+ set P2, 1023
+ set P3, P0[P2]
+ set I1, P3
+ eq I1, 123456, OK4
+ print "not "
+OK4: print "ok 4\\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+OUTPUT
+
+1;