cvsuser 03/10/22 07:55:16
Modified: . object.ops objects.c
classes parrotclass.pmc
Log:
Reorder a few things to make objects and classes a touch closer
Revision Changes Path
1.16 +1 -1 parrot/object.ops
Index: object.ops
===================================================================
RCS file: /cvs/public/parrot/object.ops,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -r1.15 -r1.16
--- object.ops 21 Oct 2003 20:15:26 -0000 1.15
+++ object.ops 22 Oct 2003 14:55:13 -0000 1.16
@@ -226,7 +226,7 @@
PMC* classname_pmc;
classname_pmc = VTABLE_get_pmc_keyed_int(interpreter,
- (PMC *)PMC_data($2), 4);
+ (PMC *)PMC_data($2), 1);
if (classname_pmc) {
$1 = VTABLE_get_string(interpreter, classname_pmc);
}
1.12 +34 -34 parrot/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/objects.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- objects.c 18 Oct 2003 01:54:44 -0000 1.11
+++ objects.c 22 Oct 2003 14:55:13 -0000 1.12
@@ -1,7 +1,7 @@
/* objects.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: objects.c,v 1.11 2003/10/18 01:54:44 scog Exp $
+ * $Id: objects.c,v 1.12 2003/10/22 14:55:13 dan Exp $
* Overview:
* Handles class and object manipulation
* Data Structure and Algorithms:
@@ -42,32 +42,6 @@
VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 0, temp_pmc);
VTABLE_set_pmc_keyed_int(interpreter, temp_pmc, 0, base_class);
- /* Our penultimate parent list is a clone of our parent's parent
- list, with our parent unshifted onto the beginning */
- temp_pmc = pmc_new_noinit(interpreter, enum_class_Array);
- VTABLE_clone(interpreter,
- VTABLE_get_pmc_keyed_int(interpreter,
- (PMC *)PMC_data(base_class), 1),
- temp_pmc);
- VTABLE_unshift_pmc(interpreter, temp_pmc, base_class);
- VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 1, temp_pmc);
-
- /* Our attribute list is our parent's attribute list */
- temp_pmc = pmc_new_noinit(interpreter, enum_class_PerlHash);
- VTABLE_clone(interpreter,
- VTABLE_get_pmc_keyed_int(interpreter,
- (PMC *)PMC_data(base_class), 2),
- temp_pmc);
- VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 2, temp_pmc);
-
- /* And our full keyed attribute list is our parent's */
- temp_pmc = pmc_new_noinit(interpreter, enum_class_PerlHash);
- VTABLE_clone(interpreter,
- VTABLE_get_pmc_keyed_int(interpreter,
- (PMC *)PMC_data(base_class), 3),
- temp_pmc);
- VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 3, temp_pmc);
-
/* Set the classname, if we have one */
classname_pmc = pmc_new(interpreter, enum_class_PerlString);
if (child_class_name) {
@@ -85,7 +59,33 @@
11, NULL, 0, NULL));
}
- VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 4, classname_pmc);
+ VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 1, classname_pmc);
+
+ /* Our penultimate parent list is a clone of our parent's parent
+ list, with our parent unshifted onto the beginning */
+ temp_pmc = pmc_new_noinit(interpreter, enum_class_Array);
+ VTABLE_clone(interpreter,
+ VTABLE_get_pmc_keyed_int(interpreter,
+ (PMC *)PMC_data(base_class), 2),
+ temp_pmc);
+ VTABLE_unshift_pmc(interpreter, temp_pmc, base_class);
+ VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 2, temp_pmc);
+
+ /* Our attribute list is our parent's attribute list */
+ temp_pmc = pmc_new_noinit(interpreter, enum_class_OrderedHash);
+ VTABLE_clone(interpreter,
+ VTABLE_get_pmc_keyed_int(interpreter,
+ (PMC *)PMC_data(base_class), 3),
+ temp_pmc);
+ VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 3, temp_pmc);
+
+ /* And our full keyed attribute list is our parent's */
+ temp_pmc = pmc_new_noinit(interpreter, enum_class_OrderedHash);
+ VTABLE_clone(interpreter,
+ VTABLE_get_pmc_keyed_int(interpreter,
+ (PMC *)PMC_data(base_class), 4),
+ temp_pmc);
+ VTABLE_set_pmc_keyed_int(interpreter, child_class_array, 4, temp_pmc);
return child_class;
}
@@ -108,17 +108,17 @@
/* Our parent class array has nothing in it */
VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 0,
pmc_new(interpreter, enum_class_Array));
- VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 1,
- pmc_new(interpreter, enum_class_Array));
VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 2,
- pmc_new(interpreter, enum_class_PerlHash));
+ pmc_new(interpreter, enum_class_Array));
VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 3,
- pmc_new(interpreter, enum_class_PerlHash));
+ pmc_new(interpreter, enum_class_OrderedHash));
+ VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 4,
+ pmc_new(interpreter, enum_class_OrderedHash));
/* Set the classname, if we have one */
classname_pmc = pmc_new(interpreter, enum_class_PerlString);
VTABLE_set_string_native(interpreter, classname_pmc, class_name);
- VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 4, classname_pmc);
+ VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 1, classname_pmc);
/* Add ourselves to the interpreter's class hash */
VTABLE_set_pmc_keyed(interpreter, interpreter->class_hash,
@@ -154,7 +154,7 @@
/* 0 - class PMC, 1 - class name */
VTABLE_set_pmc_keyed_int(interpreter, new_object_array, 0, class);
VTABLE_set_pmc_keyed_int(interpreter, new_object_array, 1,
- VTABLE_get_pmc_keyed_int(interpreter, class_array, 4));
+ VTABLE_get_pmc_keyed_int(interpreter, class_array, 1));
/* Allocate the object itself */
new_object = pmc_new(interpreter, enum_class_ParrotObject);
1.8 +5 -5 parrot/classes/parrotclass.pmc
Index: parrotclass.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/parrotclass.pmc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- parrotclass.pmc 28 Aug 2003 13:17:01 -0000 1.7
+++ parrotclass.pmc 22 Oct 2003 14:55:16 -0000 1.8
@@ -1,7 +1,7 @@
/* parrotclass.pmc
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: parrotclass.pmc,v 1.7 2003/08/28 13:17:01 leo Exp $
+ * $Id: parrotclass.pmc,v 1.8 2003/10/22 14:55:16 dan Exp $
* Overview:
* These are the vtable functions for the ParrotClass base class
* Data Structure and Algorithms:
@@ -16,12 +16,12 @@
to an array of PMCs. That array has:
0: An array of immediate parents
- 1: An array of all parents, in search order
- 2: A hash, keys are the class names, values are the offsets to
+ 1: The class name PMC
+ 2: An array of all parents, in search order
+ 3: A hash, keys are the class names, values are the offsets to
their attributes
- 3: A hash, the keys are the classname/attrib name pair (separated
+ 4: A hash, the keys are the classname/attrib name pair (separated
by a NULL), while the value is the offset to the attribute
- 4: The class name PMC
*/