Пример #1
0
globle void DefglobalBasicCommands()
  {
   AddSaveFunction("defglobal",SaveDefglobals,40);
   AddResetFunction("defglobal",ResetDefglobals,50);

#if ! RUN_TIME
   DefineFunction2("get-defglobal-list",'m',PTIF GetDefglobalListFunction,"GetDefglobalListFunction","01w");
   DefineFunction2("undefglobal",'v',PTIF UndefglobalCommand,"UndefglobalCommand","11w");
   DefineFunction2("defglobal-module",'w',PTIF DefglobalModuleFunction,"DefglobalModuleFunction","11w");

#if DEBUGGING_FUNCTIONS
   DefineFunction2("list-defglobals",'v', PTIF ListDefglobalsCommand,"ListDefglobalsCommand","01w");
   DefineFunction2("ppdefglobal",'v',PTIF PPDefglobalCommand,"PPDefglobalCommand","11w");
   AddWatchItem("globals",0,&WatchGlobals,0,DefglobalWatchAccess,DefglobalWatchPrint);
#endif

#if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE)
   DefglobalBinarySetup();
#endif

#if CONSTRUCT_COMPILER && (! RUN_TIME)
   DefglobalCompilerSetup();
#endif

#endif
  }
Пример #2
0
globle void DeftemplateBasicCommands()
  {
   AddResetFunction("deftemplate",ResetDeftemplates,0);
   AddClearFunction("deftemplate",ClearDeftemplates,0);
   AddSaveFunction("deftemplate",SaveDeftemplates,10);

#if ! RUN_TIME
   DefineFunction2("get-deftemplate-list",'m',PTIF GetDeftemplateListFunction,"GetDeftemplateListFunction","01w");
   DefineFunction2("undeftemplate",'v',PTIF UndeftemplateCommand,"UndeftemplateCommand","11w");
   DefineFunction2("deftemplate-module",'w',PTIF DeftemplateModuleFunction,"DeftemplateModuleFunction","11w");

#if DEBUGGING_FUNCTIONS
   DefineFunction2("list-deftemplates",'v', PTIF ListDeftemplatesCommand,"ListDeftemplatesCommand","01w");
   DefineFunction2("ppdeftemplate",'v',PTIF PPDeftemplateCommand,"PPDeftemplateCommand","11w");
#endif

#if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE)
   DeftemplateBinarySetup();
#endif

#if CONSTRUCT_COMPILER && (! RUN_TIME)
   DeftemplateCompilerSetup();
#endif

#endif
  }
Пример #3
0
globle void InitializeConstructs()
  {
#if (! RUN_TIME)
   DefineFunction2("clear",   'v', PTIF ClearCommand,   "ClearCommand", "00");
   DefineFunction2("reset",   'v', PTIF ResetCommand,   "ResetCommand", "00");
#endif

#if DEBUGGING_FUNCTIONS && (! RUN_TIME) && (! BLOAD_ONLY)
   AddWatchItem("compilations",0,&WatchCompilations,30,NULL,NULL);
#endif
  }
Пример #4
0
globle void WatchFunctionDefinitions()
  {
#if ! RUN_TIME
   DefineFunction2("watch",   'v', PTIF WatchCommand,   "WatchCommand", "1**w");
   DefineFunction2("unwatch", 'v', PTIF UnwatchCommand, "UnwatchCommand", "1**w");
   DefineFunction2("get-watch-item", 'b', PTIF GetWatchItemCommand,   "GetWatchItemCommand", "11w");
   DefineFunction2("list-watch-items", 'v', PTIF ListWatchItemsCommand,
                   "ListWatchItemsCommand", "0**w");
#endif

   AddRouter(WTRACE,1000,RecognizeWatchRouters,CaptureWatchPrints,NULL,NULL,NULL);
   DeactivateRouter(WTRACE);
  }
Пример #5
0
globle void StringFunctionDefinitions()
  {
   DefineFunction2("str-cat", 'k', PTIF StrCatFunction, "StrCatFunction", "1*");
   DefineFunction2("sym-cat", 'k', PTIF SymCatFunction, "SymCatFunction", "1*");
   DefineFunction2("str-length", 'l', PTIF StrLengthFunction, "StrLengthFunction", "11j");
   DefineFunction2("str-compare", 'l', PTIF StrCompareFunction, "StrCompareFunction", "23*jji");
   DefineFunction2("upcase", 'j', PTIF UpcaseFunction, "UpcaseFunction", "11j");
   DefineFunction2("lowcase", 'j', PTIF LowcaseFunction, "LowcaseFunction", "11j");
   DefineFunction2("sub-string", 's', PTIF SubStringFunction, "SubStringFunction", "33*iij");
   DefineFunction2("str-index", 'u', PTIF StrIndexFunction, "StrIndexFunction", "22j");
   DefineFunction2("eval", 'u', PTIF EvalFunction, "EvalFunction", "11k");
   DefineFunction2("build", 'b', PTIF BuildFunction, "BuildFunction", "11k");
  }
Пример #6
0
globle void DeveloperCommands()
  {
#if ! RUN_TIME
   DefineFunction2("primitives-info",'v', PTIF PrimitiveTablesInfo,"PrimitiveTablesInfo","00");

#if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT
   DefineFunction2("show-fpn",'v', PTIF ShowFactPatternNetwork,"ShowFactPatternNetwork","11w");
   DefineFunction2("show-fht",'v', PTIF ShowFactHashTable,"ShowFactHashTable","00");
#endif
#if INSTANCE_PATTERN_MATCHING
   DefineFunction2("show-opn",'v',PTIF PrintObjectPatternNetwork,
                   "PrintObjectPatternNetwork","00");
#endif

#endif
  }
Пример #7
0
globle int DefineFunction(
  char *name,
  int returnType,
  int (*pointer)(void),
  char *actualName)
  {
   return(DefineFunction2(name,returnType,pointer,actualName,NULL));
  }
Пример #8
0
globle void DefruleBasicCommands()
  {
   AddResetFunction("defrule",ResetDefrules,70);
   AddSaveFunction("defrule",SaveDefrules,0);
#if (! RUN_TIME)
   AddClearReadyFunction("defrule",ClearDefrulesReady,0);
   AddClearFunction("defrule",ClearDefrules,0);
#endif

#if DEBUGGING_FUNCTIONS
   AddWatchItem("rules",0,&WatchRules,70,DefruleWatchAccess,DefruleWatchPrint);
#endif

#if ! RUN_TIME
   DefineFunction2("get-defrule-list",'m',PTIF GetDefruleListFunction,"GetDefruleListFunction","01w");
   DefineFunction2("undefrule",'v',PTIF UndefruleCommand,"UndefruleCommand","11w");
   DefineFunction2("defrule-module",'w',PTIF DefruleModuleFunction,"DefruleModuleFunction","11w");

#if DEBUGGING_FUNCTIONS
   DefineFunction2("rules",'v', PTIF ListDefrulesCommand,"ListDefrulesCommand","01w");
   DefineFunction2("list-defrules",'v', PTIF ListDefrulesCommand,"ListDefrulesCommand","01w");
   DefineFunction2("ppdefrule",'v',PTIF PPDefruleCommand,"PPDefruleCommand","11w");
#endif

#if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE)
   DefruleBinarySetup();
#endif

#if CONSTRUCT_COMPILER && (! RUN_TIME)
   DefruleCompilerSetup();
#endif

#endif
  }
Пример #9
0
globle void ProceduralFunctionDefinitions()
  {
   DefineFunction2("if", 'u', PTIF IfFunction, "IfFunction", NULL);
   DefineFunction2("while", 'u', PTIF WhileFunction, "WhileFunction", NULL);
   DefineFunction2("loop-for-count",'u', PTIF LoopForCountFunction, "LoopForCountFunction", NULL);
   DefineFunction2("(get-loop-count)",'l', PTIF GetLoopCount, "GetLoopCount", NULL);
   DefineFunction2("bind", 'u', PTIF BindFunction, "BindFunction", NULL);
   DefineFunction2("progn", 'u', PTIF PrognFunction, "PrognFunction", NULL);
   DefineFunction2("return", 'u', PTIF ReturnFunction, "ReturnFunction",NULL);
   DefineFunction2("break", 'v', PTIF BreakFunction, "BreakFunction",NULL);
   DefineFunction2("switch", 'u', PTIF SwitchFunction, "SwitchFunction",NULL);

   ProceduralFunctionParsers();

   FuncSeqOvlFlags("progn",FALSE,FALSE);
   FuncSeqOvlFlags("if",FALSE,FALSE);
   FuncSeqOvlFlags("while",FALSE,FALSE);
   FuncSeqOvlFlags("loop-for-count",FALSE,FALSE);
   FuncSeqOvlFlags("return",FALSE,FALSE);
   FuncSeqOvlFlags("switch",FALSE,FALSE);
  }
Пример #10
0
/*---------------------------------------------------------------USERFUNCTIONS*/
VOID UserFunctions()
{
#include "c-misc-defs.c"
#include "c-pvm-defs.c"
DefineFunction2("tpn_n_c",'i',PTIF tpn_n_c,"tpn_n_c","45ikuikk");
DefineFunction2("DF2",'i',PTIF DF2,"DF2","45iskuss");
DefineFunction2("cf0i",'i',PTIF cf0i,"cf0i","11ii");
DefineFunction2("cf0v",'v',PTIF cf0v,"cf0v","11ii");
DefineFunction2("ftst",'i',PTIF ftst_,"ftst","00i");
DefineFunction2("ctst",'i',PTIF ctst,"ctst","00i");
}
Пример #11
0
/* DefineFunction2("DF2"",'i',PTIF DF2,"DF2","45iskuss"); */ 
int
DF2()
{
char c1, chr1[9] ,str1[99] ,str2[99] ,str3[99];
/*PTIF fncptr;  at the worst might have to give the return type &do a switch*/
int (*fncptr)();   /*might only be wrapping fnc that rtn ints anyway*/
    fncptr = PTIF get_ptr(3);
    if((int)fncptr < 999) printf("[fncptr=%d]",(int)fncptr); /*return(0);*/
    sprintf(str1,"%s",(char *)RtnLexeme(1));
    sprintf(chr1,"%s",(char *)RtnLexeme(2));
    sprintf(str2,"%s",(char *)RtnLexeme(4));
    c1= chr1[0];
    printf("[DefineFunction2 for:%s with type=%c]\n",str1,c1);
    if(RtnArgCount()>4)
    {
     sprintf(str3,"%s",(char *)RtnLexeme(5));
     DefineFunction2(str1,c1,PTIF fncptr,str2,str3); 
    }
    else DefineFunction(str1,c1,PTIF fncptr,str2); 
    return(1);
}
Пример #12
0
/****************************************************
  NAME         : SetupQuery
  DESCRIPTION  : Initializes instance query H/L
                   functions and parsers
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Sets up kernel functions and parsers
  NOTES        : None
 ****************************************************/
globle void SetupQuery()
  {
#if ! RUN_TIME
   QUERY_DELIMETER_SYMBOL = (SYMBOL_HN *) AddSymbol(QUERY_DELIMETER_STRING);
   IncrementSymbolCount(QUERY_DELIMETER_SYMBOL);

   DefineFunction2("(query-instance)",'o',
                  PTIF GetQueryInstance,"GetQueryInstance",NULL);

   DefineFunction2("(query-instance-slot)",'u',
                  PTIF GetQueryInstanceSlot,"GetQueryInstanceSlot",NULL);

   DefineFunction2("any-instancep",'b',PTIF AnyInstances,"AnyInstances",NULL);
   AddFunctionParser("any-instancep",ParseQueryNoAction);

   DefineFunction2("find-instance",'m',
                  PTIF QueryFindInstance,"QueryFindInstance",NULL);
   AddFunctionParser("find-instance",ParseQueryNoAction);

   DefineFunction2("find-all-instances",'m',
                  PTIF QueryFindAllInstances,"QueryFindAllInstances",NULL);
   AddFunctionParser("find-all-instances",ParseQueryNoAction);

   DefineFunction2("do-for-instance",'u',
                  PTIF QueryDoForInstance,"QueryDoForInstance",NULL);
   AddFunctionParser("do-for-instance",ParseQueryAction);

   DefineFunction2("do-for-all-instances",'u',
                  PTIF QueryDoForAllInstances,"QueryDoForAllInstances",NULL);
   AddFunctionParser("do-for-all-instances",ParseQueryAction);

   DefineFunction2("delayed-do-for-all-instances",'u',
                  PTIF DelayedQueryDoForAllInstances,
                  "DelayedQueryDoForAllInstances",NULL);
   AddFunctionParser("delayed-do-for-all-instances",ParseQueryAction);
#endif
  }
Пример #13
0
globle void ParseFunctionDefinitions()
  {
   DefineFunction2("check-syntax",'u',PTIF CheckSyntaxFunction,"CheckSyntaxFunction","11s");
  }
Пример #14
0
globle void ConstructsToCCommandDefinition()
  {
   DefineFunction2("constructs-to-c",'v',
                   PTIF ConstructsToCCommand,
                   "ConstructsToCCommand", "23*kii");
  }
Пример #15
0
/***************************************************
  NAME         : SetupMessageHandlers
  DESCRIPTION  : Sets up internal symbols and
                 fucntion definitions pertaining to
                 message-handlers.  Also creates
                 system handlers
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Functions and data structures
                 initialized
  NOTES        : Should be called before
                 SetupInstanceModDupCommands() in
                 INSMODDP.C
 ***************************************************/
globle void SetupMessageHandlers()
  {
   InstallPrimitive(&HandlerGetInfo,HANDLER_GET);
   InstallPrimitive(&HandlerPutInfo,HANDLER_PUT);

#if ! RUN_TIME
   INIT_SYMBOL = (SYMBOL_HN *) AddSymbol(INIT_STRING);
   IncrementSymbolCount(INIT_SYMBOL);

   DELETE_SYMBOL = (SYMBOL_HN *) AddSymbol(DELETE_STRING);
   IncrementSymbolCount(DELETE_SYMBOL);
   AddClearFunction("defclass",CreateSystemHandlers,-100);

#if ! BLOAD_ONLY
   SELF_SYMBOL = (SYMBOL_HN *) AddSymbol(SELF_STRING);
   IncrementSymbolCount(SELF_SYMBOL);

   AddConstruct("defmessage-handler","defmessage-handlers",
                ParseDefmessageHandler,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
   DefineFunction2("undefmessage-handler",'v',PTIF UndefmessageHandlerCommand,
                  "UndefmessageHandlerCommand","23w");

#endif

   DefineFunction2("send",'u',PTIF SendCommand,"SendCommand","2*uuw");

#if DEBUGGING_FUNCTIONS
   DefineFunction2("preview-send",'v',PTIF PreviewSendCommand,"PreviewSendCommand","22w");

   DefineFunction2("ppdefmessage-handler",'v',PTIF PPDefmessageHandlerCommand,
                  "PPDefmessageHandlerCommand","23w");
   DefineFunction2("list-defmessage-handlers",'v',PTIF ListDefmessageHandlersCommand,
                  "ListDefmessageHandlersCommand","02w");
#endif

#if IMPERATIVE_MESSAGE_HANDLERS
   DefineFunction2("next-handlerp",'b',PTIF NextHandlerAvailable,"NextHandlerAvailable","00");
   FuncSeqOvlFlags("next-handlerp",TRUE,FALSE);
   DefineFunction2("call-next-handler",'u',
                  PTIF CallNextHandler,"CallNextHandler","00");
   FuncSeqOvlFlags("call-next-handler",TRUE,FALSE);
   DefineFunction2("override-next-handler",'u',
                  PTIF CallNextHandler,"CallNextHandler",NULL);
   FuncSeqOvlFlags("override-next-handler",TRUE,FALSE);
#endif

   DefineFunction2("dynamic-get",'u',PTIF DynamicHandlerGetSlot,"DynamicHandlerGetSlot","11w");
   DefineFunction2("dynamic-put",'u',PTIF DynamicHandlerPutSlot,"DynamicHandlerPutSlot","1**w");
   DefineFunction2("get",'u',PTIF DynamicHandlerGetSlot,"DynamicHandlerGetSlot","11w");
   DefineFunction2("put",'u',PTIF DynamicHandlerPutSlot,"DynamicHandlerPutSlot","1**w");
#endif

#if DEBUGGING_FUNCTIONS
   AddWatchItem("messages",0,&WatchMessages,36,NULL,NULL);
   AddWatchItem("message-handlers",0,&WatchHandlers,35,
                DefmessageHandlerWatchAccess,DefmessageHandlerWatchPrint);
#endif
  }
Пример #16
0
/**
 * Define rcall function in CLIPS which
 * will call aour cl_rcall function.
 */
void cl_rcall_define()
{
  DefineFunction2("rcall", 'v', PTIF cl_rcall, "cl_rcall", "2*");
}