cvsuser 03/10/15 13:31:52
Modified: . object.ops objects.c
Log:
Object instantiation's in, though there's not much you can do with it yet
Revision Changes Path
1.13 +1 -0 parrot/object.ops
Index: object.ops
===================================================================
RCS file: /cvs/public/parrot/object.ops,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- object.ops 15 Oct 2003 19:58:26 -0000 1.12
+++ object.ops 15 Oct 2003 20:31:52 -0000 1.13
@@ -251,6 +251,7 @@
inline op instantiate(out PMC, in PMC) {
+ $1 = Parrot_instantiate_object(interpreter, $2);
goto NEXT();
}
1.9 +18 -5 parrot/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/objects.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- objects.c 15 Oct 2003 19:58:26 -0000 1.8
+++ objects.c 15 Oct 2003 20:31:52 -0000 1.9
@@ -1,7 +1,7 @@
/* objects.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: objects.c,v 1.8 2003/10/15 19:58:26 dan Exp $
+ * $Id: objects.c,v 1.9 2003/10/15 20:31:52 dan Exp $
* Overview:
* Handles class and object manipulation
* Data Structure and Algorithms:
@@ -140,19 +140,32 @@
PMC *new_object;
PMC *new_object_array;
INTVAL attrib_count;
+ PMC *class_array;
/* Grab the attribute count from the parent */
attrib_count = class->cache.int_val;
- /* */
+ class_array = PMC_data(class);
+
+ /* Build the array that hangs off the new object */
new_object_array = pmc_new(interpreter, enum_class_Array);
- VTABLE_set_integer_native(interpreter, new_object_array, attrib_count);
+ /* Presize it */
+ VTABLE_set_integer_native(interpreter, new_object_array, attrib_count + 2);
+ /* 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));
+
+ /* Allocate teh object itself */
new_object = pmc_new(interpreter, enum_class_ParrotObject);
+ /* Note the number of used slots */
+ new_object->cache.int_val = 2;
+
PMC_data(new_object) = new_object_array;
PObj_flag_SET(is_PMC_ptr, new_object);
+ /* We really ought to call the class init routines here... */
return new_object;
-
}
PMC *