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 init_pmc()
Initializes the "detached" subroutine from passed Hash. "Detached" means that surboutine is fully constructed but not attached to interpreter.
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(PMC *info)
This is used by freeze/thaw to visit the contents of the sub.
void freeze(PMC *info)
Archives the subroutine.
void thaw(PMC *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

INTVAL start_offs()
Returns the start offset of the Sub.
INTVAL end_offs()
Returns the end offset of the Sub.
PMC *get_namespace()
Returns the namespace PMC, where the Sub is defined.TODO return namespace_stash instead.
INTVAL __get_regs_used(char *kind)
Returns the number of used registers for register kinds "I", "S", "P", "N".
PMC *get_lexinfo()
Returns the LexInfo PMC, if any or a Null PMC.
PMC *get_multisig()
Returns 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()
Returns the arity of the Sub (the number of arguments, excluding optional and slurpy arguments).