/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for 
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #                                      
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    Dispatch.h  (for Misc.s.Dispatch)
    Author:  Copyright  1992 Shaun Blackmore
    Version: 1.00 (03 Apr 1992)
    Purpose: Function dispatcher
*/

#ifndef __dl_dispatch_h
#define __dl_dispatch_h

#ifdef __cplusplus
extern "C" {
#endif



typedef void (*dispatch_proc)();


extern int Dispatch(int value, int size, int table[],
                    dispatch_proc functions[],
                    int arg0, int arg1, int arg2, int arg3);
/*
 *  Dispatch()
 *  Performs a table look up of value in table[size], and
 *  calls the corrseponding procedure in functions[size], with
 *  up to 4 arguments (any excess arguments will be safely ignored, as
 *  these are the arguments that C passes in registers R0-R3)
 *
 *  If the table[] entry contains a -1 then the coresponding procedure in
 *  functions[] is ALWAYS taken - Use this for a default action
 */

#ifdef __cplusplus
}
#endif


#endif
