Author: jonathan
Date: Sun Mar 25 10:13:13 2007
New Revision: 17737
Removed:
trunk/src/pmc/metaattribute.pmc
trunk/t/pmc/metaattribute.t
Modified:
trunk/MANIFEST
trunk/src/pmc/class.pmc
trunk/src/pmc/role.pmc
Log:
[PDD15]: Remove MetaAttribute and PMC tests for it, and re-work Class and Role
PMCs to just store attribute metadata in hashes, as specified in the PDD.
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Sun Mar 25 10:13:13 2007
@@ -2578,7 +2578,6 @@
src/pmc/lexinfo.pmc []
src/pmc/lexpad.pmc []
src/pmc/managedstruct.pmc []
-src/pmc/metaattribute.pmc []
src/pmc/class.pmc []
src/pmc/multiarray.pmc []
src/pmc/multisub.pmc []
@@ -2883,7 +2882,6 @@
t/pmc/lexinfo.t []
t/pmc/lexpad.t []
t/pmc/managedstruct.t []
-t/pmc/metaattribute.t []
t/pmc/class.t []
t/pmc/mmd.t []
t/pmc/multiarray.t []
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc (original)
+++ trunk/src/pmc/class.pmc Sun Mar 25 10:13:13 2007
@@ -34,7 +34,7 @@
PMC *roles; /* An array of roles. */
PMC *methods; /* Hash of method names to methods in this class. */
PMC *vtable_methods; /* Hash of Parrot v-table methods we override. */
- PMC *attrib_metadata; /* Hash of attributes in this class to metadata. */
+ PMC *attrib_metadata; /* Hash of attributes in this class to hashes of
metadata. */
PMC *attrib_index; /* Lookup table for attributes in this and parents.
*/
PMC *attrib_cache; /* Cache of visible attrib names to indexes. */
} Parrot_Class;
@@ -96,7 +96,8 @@
STRING *full_key = string_copy(interp, fq_class);
/* Get attribute name and append it to the key. */
- (STRING *attrib_name) = PCCINVOKE(interp, cur_attrib, "name");
+ attrib_name = VTABLE_get_string_keyed_str(interp, cur_attrib,
+ CONST_STRING(interp, "name"));
full_key = string_append(interp, full_key, attrib_name);
/* Insert into hash, along with index. */
@@ -218,8 +219,8 @@
=item C<void attributes()>
-Return a hash where the keys are attribute names and the values are instances
-of MetaAttribute, describing the attribute.
+Return a hash where the keys are attribute names and the values are hashes
+providing a set of key/value pairs describing the attribute.
=cut
@@ -242,7 +243,7 @@
*/
PCCMETHOD void add_attribute(STRING *attribute_name, STRING*
attribute_type :optional, int got_type :opt_flag) {
Parrot_Class *class = PARROT_CLASS(SELF);
- PMC *new_attribute = pmc_new(interp, enum_class_MetaAttribute);
+ PMC *new_attribute = pmc_new(interp, enum_class_Hash);
/* If we've been instantiated already, need a new class. */
if (class->instantiated) {
@@ -259,9 +260,11 @@
}
/* Set name and type. */
- PCCINVOKE(interp, new_attribute, "name", STRING* attribute_name);
+ VTABLE_set_string_keyed_str(interp, new_attribute,
+ CONST_STRING(interp, "name"), attribute_name);
if (got_type) {
- PCCINVOKE(interp, new_attribute, "type", STRING* attribute_type);
+ VTABLE_set_string_keyed_str(interp, new_attribute,
+ CONST_STRING(interp, "type"), attribute_type);
}
/* Enter the attribute in the attributes array. */
Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc (original)
+++ trunk/src/pmc/role.pmc Sun Mar 25 10:13:13 2007
@@ -28,7 +28,7 @@
PMC *namespace; /* The namespace it's linked to, if any. */
PMC *roles; /* Any roles that this role is composed from. */
PMC *methods; /* Hash of method names to methods in this role. */
- PMC *attrib_metadata; /* Hash of attributes in this role to metadata. */
+ PMC *attrib_metadata; /* Hash of attributes in this role to hashes of
metadata. */
} Parrot_Role;
@@ -120,8 +120,8 @@
=item C<void attributes()>
-Return a hash where the keys are attribute names and the values are instances
-of MetaAttribute, describing the attribute.
+Return a hash where the keys are attribute names and the values are hashes
+providing a set of key/value pairs describing the attribute.
=cut
@@ -144,12 +144,14 @@
*/
PCCMETHOD void add_attribute(STRING *attribute_name, STRING*
attribute_type :optional, int got_type :opt_flag) {
Parrot_Role *role = PARROT_ROLE(SELF);
- PMC *new_attribute = pmc_new(interp, enum_class_MetaAttribute);
+ PMC *new_attribute = pmc_new(interp, enum_class_Hash);
/* Set name and type. */
- PCCINVOKE(interp, new_attribute, "name", STRING* attribute_name);
+ VTABLE_set_string_keyed_str(interp, new_attribute,
+ CONST_STRING(interp, "name"), attribute_name);
if (got_type) {
- PCCINVOKE(interp, new_attribute, "type", STRING* attribute_type);
+ VTABLE_set_string_keyed_str(interp, new_attribute,
+ CONST_STRING(interp, "type"), attribute_type);
}
/* Enter the attribute in the attributes array. */