/************************************************************************** NAME : CallSpecificMethod DESCRIPTION : Allows a specific method to be called without regards to higher precedence methods which might also be applicable However, shadowed methods can still be called. INPUTS : A data object buffer to hold the method evaluation result RETURNS : Nothing useful SIDE EFFECTS : Side-effects of method applicability tests and the evaluation of methods NOTES : H/L Syntax: (call-specific-method <generic-function> <method-index> <args>) **************************************************************************/ void CallSpecificMethod( UDFContext *context, CLIPSValue *returnValue) { CLIPSValue theArg; DEFGENERIC *gfunc; int mi; Environment *theEnv = UDFContextEnvironment(context); mCVSetBoolean(returnValue,false); if (! UDFFirstArgument(context,SYMBOL_TYPE,&theArg)) return; gfunc = CheckGenericExists(theEnv,"call-specific-method",mCVToString(&theArg)); if (gfunc == NULL) return; if (! UDFNextArgument(context,INTEGER_TYPE,&theArg)) return; mi = CheckMethodExists(theEnv,"call-specific-method",gfunc,(long) mCVToInteger(&theArg)); if (mi == -1) return; gfunc->methods[mi].busy++; GenericDispatch(theEnv,gfunc,NULL,&gfunc->methods[mi], GetFirstArgument()->nextArg->nextArg,returnValue); gfunc->methods[mi].busy--; }
/************************************************************************** NAME : CallSpecificMethod DESCRIPTION : Allows a specific method to be called without regards to higher precedence methods which might also be applicable However, shadowed methods can still be called. INPUTS : A data object buffer to hold the method evaluation result RETURNS : Nothing useful SIDE EFFECTS : Side-effects of method applicability tests and the evaluation of methods NOTES : H/L Syntax: (call-specific-method <generic-function> <method-index> <args>) **************************************************************************/ void CallSpecificMethod( Environment *theEnv, UDFContext *context, UDFValue *returnValue) { UDFValue theArg; Defgeneric *gfunc; int mi; returnValue->lexemeValue = FalseSymbol(theEnv); if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg)) return; gfunc = CheckGenericExists(theEnv,"call-specific-method",theArg.lexemeValue->contents); if (gfunc == NULL) return; if (! UDFNextArgument(context,INTEGER_BIT,&theArg)) return; mi = CheckMethodExists(theEnv,"call-specific-method",gfunc,(unsigned short) theArg.integerValue->contents); if (mi == METHOD_NOT_FOUND) return; gfunc->methods[mi].busy++; GenericDispatch(theEnv,gfunc,NULL,&gfunc->methods[mi], GetFirstArgument()->nextArg->nextArg,returnValue); gfunc->methods[mi].busy--; }