Skip to content

Commit

Permalink
Add PF_ConstTable.push_* functions for convinience.
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Jan 5, 2011
1 parent abb9534 commit 10cbb73
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/pmc/packfileconstanttable.pmc
Expand Up @@ -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)>
Expand Down

0 comments on commit 10cbb73

Please sign in to comment.