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 .Sub constants 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.

METHODS ^

METHOD PMC *get_namespace()

Return the namespace PMC, where the Sub is defined.

TODO return namespace_stash instead.

METHOD INTVAL __get_regs_used(char *kind)

Return amount of used registers for register kinds "I", "S", "P", "N".

METHOD PMC *get_lexinfo()

Return the LexInfo PMC, if any or a Null PMC.

METHOD PMC *get_multisig()

Return the MMD signature PMC, if any or a Null PMC.

METHOD INTVAL arity()

Return the arity of the Sub (the number of arugments, excluding optional and slurpy arguments).

HISTORY ^

Initial version by Melvin on 2002/06/06.


parrot