NAME

src/pmc/sub.pmc - Subroutine

DESCRIPTION

These are the vtable functions for the Sub (subroutine) base class

Functions

void init()
Initializes the subroutine.
void destroy()
Destroys the subroutine.
STRING *get_string()
Returns the name of the subroutine.
void set_string_native(STRING *subname)
Sets the name of the subroutine.
void set_pointer(void *value)
Sets the pointer to the actual subroutine.*** Don't use that - use .const 'Sub' in PIR instead ***
void *get_pointer()
Returns the address of the actual subroutine.
INTVAL get_integer_keyed(PMC *key)
This just unconditionally returns the start of bytecode. It's wrong, wrong, wrong, *WRONG*. And there's no other good way, so it's here for now. -DRS
INTVAL defined()
INTVAL get_bool()
Returns True.
opcode_t *invoke(void *next)
Invokes the subroutine.
PMC *clone()
Creates and returns a clone of the subroutine.
void assign_pmc(PMC *other)
Set SELF to the data in other.
void mark()
Marks the sub as live.
INTVAL is_equal(PMC *value)
Returns whether the two subroutines are equal.
void visit(visit_info *info)
This is used by freeze/thaw to visit the contents of the sub.
void freeze(visit_info *info)
Archives the subroutine.
void thaw(visit_info *info)
Unarchives the subroutine.
PMC *inspect()
Returns the full set of meta-data about the sub.
PMC *inspect_str(STRING *what)
Returns the specified item of metadata about the sub. Allowable values are:
pos_required
The number of required positional arguments
pos_optional
The number of optional positional arguments
named_required
The number of required named arguments
named_optional
The number of optional named arguments
pos_slurpy
1 if it takes slurpy positional arguments, 0 if not
named_slurpy
1 if it takes slurpy named arguments, 0 if not

METHODS

PMC *get_namespace()
Return the namespace PMC, where the Sub is defined.TODO return namespace_stash instead.
INTVAL __get_regs_used(char *kind)
Return amount of used registers for register kinds "I", "S", "P", "N".
PMC *get_lexinfo()
Return the LexInfo PMC, if any or a Null PMC.
PMC *get_multisig()
Return the MMD signature PMC, if any or a Null PMC.
PMC *get_outer()
Gets the sub that is the outer of this one, if any or a Null PMC.
void set_outer(PMC *outer)
Sets the sub that is the outer of this one.
INTVAL arity()
Return the arity of the Sub (the number of arugments, excluding optional and slurpy arguments).