NAME

src/pmc/eventhandler.pmc - a handler for events

DESCRIPTION

A PMC that captures the state of the interpreter to invoke when handling an Event.

Vtable Functions

void init()
Initializes an empty EventHandler. Add attributes to it if you want it to do anything.
void init_pmc(PMC *data)
Initializes a new EventHandler with either a Sub PMC (or descendant) or a Hash PMC. With the latter, the keys should be any or all of:
code
a Sub (or descendant) PMC containing code to invoke when handling the event
interp
a ParrotInterpreter PMC in which to invoke the code PMC
type
a STRING recording the type of event to handle
priority
the minimum threshhold of priority which the event must meet or exceed for the handler to care
void mark()
Marks this PMC and any of its contents as live.
void destroy()
Frees any memory held by this PMC.
void set_string(STRING *type)
Sets the type attribute of this event handler to the passed-in string.
STRING *get_string()
Retrieves the type attribute of this event handler.
void set_integer_native(INTVAL priority)
Sets the minimum interesting priority for this event handler.
void set_pmc(PMC *interpreter)
Sets the passed-in ParrotInterpreter as the active interpreter in which to handle the registered events.
PMC *get_attr_str(STRING *name)
opcode_t *invoke(void *next)
Runs the contained code, if any; this is what handles the event.

Methods

METHOD can_handle(PMC *event)
Report whether the event handler can handle a particular type of event.