/*************************************************** NAME : FindDefmessageHandler DESCRIPTION : Determines the index of a specfied message-handler INPUTS : 1) A pointer to the class 2) Name-string of the handler 3) Handler-type: "around","before", "primary", or "after" RETURNS : The index of the handler (0 if not found) SIDE EFFECTS : None NOTES : None ***************************************************/ globle unsigned FindDefmessageHandler( void *ptr, char *hname, char *htypestr) { int htype; SYMBOL_HN *hsym; DEFCLASS *cls; int index; htype = HandlerType("handler-lookup",htypestr); if (htype == MERROR) return(0); hsym = FindSymbol(hname); if (hsym == NULL) return(0); cls = (DEFCLASS *) ptr; index = FindHandlerByIndex(cls,hsym,(unsigned) htype); return((unsigned) (index+1)); }
/*************************************************** NAME : EnvFindDefmessageHandler DESCRIPTION : Determines the index of a specfied message-handler INPUTS : 1) A pointer to the class 2) Name-string of the handler 3) Handler-type: "around","before", "primary", or "after" RETURNS : The index of the handler (0 if not found) SIDE EFFECTS : None NOTES : None ***************************************************/ globle unsigned EnvFindDefmessageHandler( void *theEnv, void *ptr, const char *hname, const char *htypestr) { unsigned htype; SYMBOL_HN *hsym; DEFCLASS *cls; int theIndex; htype = HandlerType(theEnv,"handler-lookup",htypestr); if (htype == MERROR) return(0); hsym = FindSymbolHN(theEnv,hname); if (hsym == NULL) return(0); cls = (DEFCLASS *) ptr; theIndex = FindHandlerByIndex(cls,hsym,(unsigned) htype); return((unsigned) (theIndex+1)); }