src/pmc/eventhandler.pmc - EventHandler PMC


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:
a Sub (or descendant) PMC containing code to invoke when handling the event
a ParrotInterpreter PMC in which to invoke the code PMC
a STRING recording the type of event to handle
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 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.


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