NAME

src/pmc/packfileconstanttable.pmc - PackfileConstantTable PMC

DESCRIPTION

This class implements a PackfileConstantTable object, a segment of the .pbc data file used for storing constants of various types. (int, string, PMC)

See packfile.pmc for the toplevel Packfile interface, see packfilesegment.pmc for the list of common methods every packfile segment pmc must implement; see PDD13 for the design spec.

Methods

init
Create empty PackfileConstantTable.
void mark()
Marks the object as live.
set_pointer
Set pointer to underlying PackFile_ConstTable
void *get_pointer()
INTVAL elements()
Get the number of elements in the array.
FLOATVAL get_number_keyed_int(INTVAL index)
Fetch a numeric constant. An exception is thrown if the given constant isn't numeric.
STRING *get_string_keyed_int(INTVAL index)
Fetch a string constant. An exception is thrown if the given constant isn't a string.
PMC *get_pmc_keyed_int(INTVAL index)
Fetch a PMC constant. An exception is thrown if the given constant isn't a PMC.
void set_number_keyed_int(INTVAL index, FLOATVAL value)
Set the constant to the given number.
void set_string_keyed_int(INTVAL index, STRING *value)
Set the constant to the given string.
void set_pmc_keyed_int(INTVAL index, PMC *value)
Set the constant to the given PMC (or key).
INTVAL get_type(INTVAL index)
Get the type of the specified constant. Possible type IDs:
0x00 - No constant
0x6E - Number constant
0x73 - String constant
0x70 - PMC constant
0x6B - Key constant
void set_main(INTVAL index)
Set the :main flag in a Sub in the constant table.Experimental. Use with care. There is no way to set the private flags from PIR, so we need something like this.If something goes wrong, blame NotFound.
INTVAL get_or_create_constant()
Get or create constant for passed value.
METHOD type()
Set segment type.