Processing Events Directly Using Event Tables

The first step in processing user input with event tables is to read an event with evnt_get(). The next step in processing user input is to look up this event in the appropriate event table and call the associated event function. The Vermont Views function that performs this task is et_proc(). et_proc() is passed the pointer to the event structure, a pointer to the event table to use, and a pointer to context-sensitive data. The call for et_proc() is as follows:

int et_proc(eventp, etp, datap);
 
EVENTPTR eventp;
/* Event code to process
*/
ETPTR etp;
/* Event table to search
*/
PTR datap;
/* Pointer to data to pass to key function
*/

et_proc() searches the specified event table for the event code. If the event code is found, its associated event function is called. The pointer to the data specified in the et_proc() call is passed to this event function. The data pointed to depends on the system currently being processed. For instance, when processing a data form, a pointer to the current data form is passed to et_proc(). The value returned by the called event function is returned by et_proc().

If the specified event code is not found in the event table and there is an entry for ET_DEFAULT in the event table, this event function is called. The pointer to the data specified in the et_proc() call is passed to the default event function. The value returned by the default event function is returned by et_proc().

If there is no entry in the table for the event code and there is no default event function installed, et_proc() returns -1.

Naming Tip: All functions that manage event tables begin with the abbreviation "et_."


Home Contents Previous Next