DeskLib 2.90a:Dispatch.h


Contents


Introduction and Overview

This header declares a function for dispatching other functions - calling a given function for a given value of a variable.


Function


Dispatch

int Dispatch(int value, int size, int table[], dispatch_proc functions[], int arg0, int arg1, int arg2, int arg3);

This function looks up 'value' in table[size], and calls the corresponding function in functions[size] with up to four arguments (any excess arguments will be safely ignored).

If one of the elements in table has the value -1, it is always called, so if you want a default action, make it the last in the table.


Type


dispatch_proc

typedef void (*dispatch_proc)(void );

This type holds a pointer to a function to be called by the Dispatch function. Functions can have up to four arguments.