Permalink
Browse files

Add PF_ConstTable.push_* functions for convinience.

  • Loading branch information...
1 parent abb9534 commit 10cbb73e386df72e240c44722a9a840289f9ace3 @bacek bacek committed Jan 5, 2011
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/pmc/packfileconstanttable.pmc
View
25 src/pmc/packfileconstanttable.pmc
@@ -278,6 +278,31 @@ Set the constant to the given PMC (or key).
VTABLE_set_pmc_keyed_int(INTERP, attrs->pmc_constants, index, value);
}
+
+ VTABLE void push_float(FLOATVAL val) {
+ Parrot_PackfileConstantTable_attributes * const attrs =
+ PARROT_PACKFILECONSTANTTABLE(SELF);
+ VTABLE_set_number_keyed_int(INTERP, SELF,
+ VTABLE_get_integer(INTERP, attrs->num_constants),
+ val);
+ }
+
+ VTABLE void push_string(STRING *val) {
+ Parrot_PackfileConstantTable_attributes * const attrs =
+ PARROT_PACKFILECONSTANTTABLE(SELF);
+ VTABLE_set_string_keyed_int(INTERP, SELF,
+ VTABLE_get_integer(INTERP, attrs->str_constants),
+ val);
+ }
+
+ VTABLE void push_pmc(PMC *val) {
+ Parrot_PackfileConstantTable_attributes * const attrs =
+ PARROT_PACKFILECONSTANTTABLE(SELF);
+ VTABLE_set_pmc_keyed_int(INTERP, SELF,
+ VTABLE_get_integer(INTERP, attrs->pmc_constants),
+ val);
+ }
+
/*
=item C<void set_main(INTVAL index)>

0 comments on commit 10cbb73

Please sign in to comment.