#if !defined(STATE_H) #define STATE_H #include /* # if !defined OLC93SU523_H # include "olc93su523.h" # endif */ /* #include "f93olc.h" */ # if !defined OLC3COMMON_H # include "olc3common.h" # endif #if __STDC__ typedef void (ActionRoutine)(hcg_key); #else typedef void (ActionRoutine)(); #endif /* ** Limits to the size of State strings ** ** StatesActionRoutineNameMaxLen : The maximum length of the name of ** a state's action routine. Names in excess of this length will ** will be silently truncated to this length. ** ** StatesNameMaxLen : The maximum length of the name of a state. Names ** in excess of this length will be silently truncated to this length. */ enum { StatesActionRoutineNameMaxLen = 32, StatesNameMaxLen = 80 }; /* ** StateCreate: Creates a State object ** ** StateName : The name of the state ** ** SMid : The key of the StateModel containing the state ** ** ** ActionRoutineName: The name of the state's action routine. Whenever this ** state in entered, the action routine will be called. ** ** ActionRoutine: The pointer to the state's action routine */ PROTOTYPE(hcg_key StateCreate, (const char *StateName, hcg_key SMid, const char *ActionRoutineName, ActionRoutine *ActionRoutine)) /* ** StateDelete: Deletes a State object ** ** StateToDelete : the key of the State object to Delete */ PROTOTYPE(void StateDelete, (hcg_key StateToDelete)) /* ** StateFirst: Returns the first State object ** StateNext: Returns the State object following the specified state, ** 0 otherwise. ** ** These routines offer a way to loop through all existing states. ** The routines offer no guarantee as to the order of the states, ** only that StateFirst followed by StateNext until it returns ** 0 will return keys for all the states with no key be returned ** more than once. ** */ PROTOTYPE(hcg_key StateFirst, (void)) PROTOTYPE(hcg_key StateNext, (hcg_key STid)) /* ** StateGetSMid : Returns the key of the StateModel containing the state ** StateGetActName : Returns a pointer to the state's action routine ** ** STid : the key of state from which to fetch the state model or the ** the action routine */ PROTOTYPE(hcg_key StateGetSMid, (hcg_key STid)) PROTOTYPE(ActionRoutine *StateGetActFunc, (hcg_key STid)) /* ** StateGetName : Returns a pointer to the state's name ** StateCopyName : Copies the state's name into a character array ** ** STid : the state whose name you wish to get/copy ** ** CopyDst : (StateCopyName only) a writable character arrray into which ** StateCopyName will copy the State's name. The array should be ** at least StatesNameMaxLen+1 characters large. ** ** StateGetName returns a pointer to the internal name space of the state. ** This pointer will be valid until the next call to any State routine. The ** state of this pointer after such a call is undefined. You may not write ** into the space pointed to by this pointer. Use StateCopyName if you need ** the name of a state for a longer period of time than that guaranteed by ** StateGetName. */ PROTOTYPE(const char * StateGetName, (hcg_key STid)) PROTOTYPE(void StateCopyName, (hcg_key STid, char *CopyDst)) /* ** StateGetActName : Returns a pointer to the name of the state's action ** routine. ** StateCopyActName : Copies the name of the state's action routine into ** a character array ** ** STid : the state whose ActName you wish to get/copy ** ** CopyDst : (StateCopyActName only) a writable character arrray into which ** StateCopyActName will copy the State's ActName. The array should be ** at least StatesActNameMaxLen+1 characters large. ** ** StateGetActName returns a pointer to the internal ActName space of the state. ** This pointer will be valid until the next call to any State routine. The ** state of this pointer after such a call is undefined. You may not write ** into the space pointed to by this pointer. Use StateCopyActName if you need ** the ActName of a state for a longer period of time than that guaranteed by ** StateGetActName. */ PROTOTYPE(const char * StateGetActName, (hcg_key STid)) PROTOTYPE(void StateCopyActName,(hcg_key STid, char *CopyDst)) #endif