[svn:parrot] r37633 - trunk/src/pmc
cotto at svn.parrot.org
cotto at svn.parrot.org
Sun Mar 22 03:16:23 UTC 2009
Author: cotto
Date: Sun Mar 22 03:16:19 2009
New Revision: 37633
URL: https://trac.parrot.org/parrot/changeset/37633
Log:
[PMC] Add get/set_pointer VTABLE functions to Hash-like PMCs.
This will make it easier to move away messing directly with PMC_struct_val for these PMCs.
Modified:
trunk/src/pmc/hash.pmc
Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc Sun Mar 22 02:18:15 2009 (r37632)
+++ trunk/src/pmc/hash.pmc Sun Mar 22 03:16:19 2009 (r37633)
@@ -168,6 +168,37 @@
/*
+=item C<void set_pointer(void *ptr)>
+
+Use C<ptr> as this PMC's Hash*.
+
+=cut
+
+*/
+
+ VTABLE void set_pointer(void *ptr) {
+ Hash *old_hash = (Hash *)PMC_struct_val(SELF);
+ Hash *new_hash = (Hash *)ptr;
+
+ PMC_struct_val(SELF) = new_hash;
+ parrot_hash_destroy(INTERP, old_hash);
+ }
+
+/*
+
+=item C<void *get_pointer()>
+
+Get a pointer to this PMC's Hash*.
+
+=cut
+
+*/
+ VTABLE void *get_pointer() {
+ return PMC_struct_val(SELF);
+ }
+
+/*
+
=item C<INTVAL get_integer()>
Returns the size of the hash.
More information about the parrot-commits
mailing list