[svn:parrot] r45864 - trunk/src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Wed Apr 21 20:29:59 UTC 2010
Author: NotFound
Date: Wed Apr 21 20:29:59 2010
New Revision: 45864
URL: https://trac.parrot.org/parrot/changeset/45864
Log:
implement Hash init_int vtable to create a hash with given value type, use it in Lexinfo init_pmc
Modified:
trunk/src/pmc/hash.pmc
trunk/src/pmc/lexinfo.pmc
Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc Wed Apr 21 20:24:35 2010 (r45863)
+++ trunk/src/pmc/hash.pmc Wed Apr 21 20:29:59 2010 (r45864)
@@ -61,6 +61,10 @@
Initializes the instance.
+=item C<void init_int(INTVAL value_type)>
+
+Initializes the instance with the value_type provided.
+
=item C<void destroy()>
Free hash structure.
@@ -78,6 +82,19 @@
PObj_custom_mark_destroy_SETALL(SELF);
}
+ VTABLE void init_int(INTVAL value_type) {
+ Parrot_Hash_attributes * const attr =
+ (Parrot_Hash_attributes *) PMC_data(SELF);
+
+ attr->hash = parrot_create_hash(INTERP,
+ (PARROT_DATA_TYPE)value_type,
+ Hash_key_type_STRING,
+ STRING_compare,
+ (hash_hash_key_fn)key_hash_STRING);
+ attr->hash->container = SELF;
+ PObj_custom_mark_destroy_SETALL(SELF);
+ }
+
VTABLE void destroy() {
Hash * const hash = (Hash *)SELF.get_pointer();
if (hash)
Modified: trunk/src/pmc/lexinfo.pmc
==============================================================================
--- trunk/src/pmc/lexinfo.pmc Wed Apr 21 20:24:35 2010 (r45863)
+++ trunk/src/pmc/lexinfo.pmc Wed Apr 21 20:29:59 2010 (r45864)
@@ -64,7 +64,7 @@
PARROT_ASSERT(PObj_constant_TEST(SELF));
/* Set value type to INTVAL */
- Parrot_pcc_invoke_method_from_c_args(interp, SELF, CONST_STRING(INTERP, "set_value_type"), "I->", (INTVAL)enum_type_INTVAL);
+ SELF.init_int((INTVAL)enum_type_INTVAL);
PObj_custom_mark_destroy_SETALL(SELF);
}
More information about the parrot-commits
mailing list