/*************************************************** 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 }
globle void InitializeEngine( void *theEnv) { AllocateEnvironmentData(theEnv,ENGINE_DATA,sizeof(struct engineData),DeallocateEngineData); EngineData(theEnv)->IncrementalResetFlag = TRUE; #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,"statistics",0,&EngineData(theEnv)->WatchStatistics,20,NULL,NULL); AddWatchItem(theEnv,"focus",0,&EngineData(theEnv)->WatchFocus,0,NULL,NULL); #endif }
globle void InitializeAgenda( void *theEnv) { AllocateEnvironmentData(theEnv,AGENDA_DATA,sizeof(struct agendaData),NULL); AgendaData(theEnv)->SalienceEvaluation = WHEN_DEFINED; AgendaData(theEnv)->Strategy = DEFAULT_STRATEGY; EnvAddClearFunction(theEnv,(char*)"agenda",AgendaClearFunction,0); #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,(char*)"activations",1,&AgendaData(theEnv)->WatchActivations,40,DefruleWatchAccess,DefruleWatchPrint); #endif #if ! RUN_TIME EnvDefineFunction2(theEnv,(char*)"refresh", 'v', PTIEF RefreshCommand, (char*)"RefreshCommand", (char*)"11w"); EnvDefineFunction2(theEnv,(char*)"refresh-agenda",'v', PTIEF RefreshAgendaCommand, (char*)"RefreshAgendaCommand", (char*)"01w"); EnvDefineFunction2(theEnv,(char*)"get-salience-evaluation",'w', PTIEF GetSalienceEvaluationCommand, (char*)"GetSalienceEvaluationCommand", (char*)"00"); EnvDefineFunction2(theEnv,(char*)"set-salience-evaluation",'w', PTIEF SetSalienceEvaluationCommand, (char*)"SetSalienceEvaluationCommand", (char*)"11w"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,(char*)"agenda", 'v', PTIEF AgendaCommand, (char*)"AgendaCommand", (char*)"01w"); #endif #endif }
globle void DefruleBasicCommands( void *theEnv) { EnvAddResetFunction(theEnv,"defrule",ResetDefrules,70); AddSaveFunction(theEnv,"defrule",SaveDefrules,0); #if (! RUN_TIME) AddClearReadyFunction(theEnv,"defrule",ClearDefrulesReady,0); EnvAddClearFunction(theEnv,"defrule",ClearDefrules,0); #endif #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,"rules",0,&DefruleData(theEnv)->WatchRules,70,DefruleWatchAccess,DefruleWatchPrint); #endif #if ! RUN_TIME EnvDefineFunction2(theEnv,"get-defrule-list",'m',PTIEF GetDefruleListFunction,"GetDefruleListFunction","01w"); EnvDefineFunction2(theEnv,"undefrule",'v',PTIEF UndefruleCommand,"UndefruleCommand","11w"); EnvDefineFunction2(theEnv,"defrule-module",'w',PTIEF DefruleModuleFunction,"DefruleModuleFunction","11w"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"rules",'v', PTIEF ListDefrulesCommand,"ListDefrulesCommand","01w"); EnvDefineFunction2(theEnv,"list-defrules",'v', PTIEF ListDefrulesCommand,"ListDefrulesCommand","01w"); EnvDefineFunction2(theEnv,"ppdefrule",'v',PTIEF PPDefruleCommand,"PPDefruleCommand","11w"); #endif #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) DefruleBinarySetup(theEnv); #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DefruleCompilerSetup(theEnv); #endif #endif }
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 }
globle void DefglobalBasicCommands( void *theEnv) { AddSaveFunction(theEnv,(char*)"defglobal",SaveDefglobals,40); EnvAddResetFunction(theEnv,(char*)"defglobal",ResetDefglobals,50); #if ! RUN_TIME EnvDefineFunction2(theEnv,(char*)"get-defglobal-list",'m',PTIEF GetDefglobalListFunction,(char*)"GetDefglobalListFunction",(char*)"01w"); EnvDefineFunction2(theEnv,(char*)"undefglobal",'v',PTIEF UndefglobalCommand,(char*)"UndefglobalCommand",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"defglobal-module",'w',PTIEF DefglobalModuleFunction,(char*)"DefglobalModuleFunction",(char*)"11w"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,(char*)"list-defglobals",'v', PTIEF ListDefglobalsCommand,(char*)"ListDefglobalsCommand",(char*)"01w"); EnvDefineFunction2(theEnv,(char*)"ppdefglobal",'v',PTIEF PPDefglobalCommand,(char*)"PPDefglobalCommand",(char*)"11w"); AddWatchItem(theEnv,(char*)"globals",0,&WatchGlobals,0,DefglobalWatchAccess,DefglobalWatchPrint); #endif #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) DefglobalBinarySetup(theEnv); #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DefglobalCompilerSetup(theEnv); #endif #endif }
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 }
globle void InitializeConstructs( void *theEnv) { #if (! RUN_TIME) EnvDefineFunction2(theEnv,"clear", 'v', PTIEF ClearCommand, "ClearCommand", "00"); EnvDefineFunction2(theEnv,"reset", 'v', PTIEF ResetCommand, "ResetCommand", "00"); #if DEBUGGING_FUNCTIONS && (! BLOAD_ONLY) AddWatchItem(theEnv,"compilations",0,&ConstructData(theEnv)->WatchCompilations,30,NULL,NULL); #endif #else #if MAC_XCD #pragma unused(theEnv) #endif #endif }
void InitializeConstructs( Environment *theEnv) { #if (! RUN_TIME) AddUDF(theEnv,"clear","v",0,0,NULL,ClearCommand,"ClearCommand",NULL); AddUDF(theEnv,"reset","v",0,0,NULL,ResetCommand,"ResetCommand",NULL); #if DEBUGGING_FUNCTIONS && (! BLOAD_ONLY) AddWatchItem(theEnv,"compilations",0,&ConstructData(theEnv)->WatchCompilations,30,NULL,NULL); #endif #else #if MAC_XCD #pragma unused(theEnv) #endif #endif }
void DefruleBasicCommands( void *theEnv) { EnvAddResetFunction(theEnv,"defrule",ResetDefrules,70); EnvAddResetFunction(theEnv,"defrule",ResetDefrulesPrime,10); AddSaveFunction(theEnv,"defrule",SaveDefrules,0); #if (! RUN_TIME) AddClearReadyFunction(theEnv,"defrule",ClearDefrulesReady,0); EnvAddClearFunction(theEnv,"defrule",ClearDefrules,0); #endif #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,"rules",0,&DefruleData(theEnv)->WatchRules,70,DefruleWatchAccess,DefruleWatchPrint); #endif #if ! RUN_TIME EnvAddUDF(theEnv,"get-defrule-list","m", GetDefruleListFunction,"GetDefruleListFunction",0,1,"y",NULL); EnvAddUDF(theEnv,"undefrule","v", UndefruleCommand,"UndefruleCommand",1,1,"y",NULL); EnvAddUDF(theEnv,"defrule-module","y", DefruleModuleFunction,"DefruleModuleFunction",1,1,"y",NULL); #if DEBUGGING_FUNCTIONS EnvAddUDF(theEnv,"rules","v", ListDefrulesCommand,"ListDefrulesCommand",0,1,"y",NULL); EnvAddUDF(theEnv,"list-defrules","v", ListDefrulesCommand,"ListDefrulesCommand",0,1,"y",NULL); EnvAddUDF(theEnv,"ppdefrule","v", PPDefruleCommand,"PPDefruleCommand",1,1,"y",NULL); #endif #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) DefruleBinarySetup(theEnv); #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DefruleCompilerSetup(theEnv); #endif #endif }
/*************************************************** NAME : SetupDeffunctions DESCRIPTION : Initializes parsers and access functions for deffunctions INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Deffunction environment initialized NOTES : None ***************************************************/ globle void SetupDeffunctions( void *theEnv) { ENTITY_RECORD deffunctionEntityRecord = { (char*)"PCALL", PCALL,0,0,1, PrintDeffunctionCall,PrintDeffunctionCall, NULL,EvaluateDeffunctionCall,NULL, DecrementDeffunctionBusyCount,IncrementDeffunctionBusyCount, NULL,NULL,NULL,NULL,NULL }; AllocateEnvironmentData(theEnv,DEFFUNCTION_DATA,sizeof(struct deffunctionData),DeallocateDeffunctionData); memcpy(&DeffunctionData(theEnv)->DeffunctionEntityRecord,&deffunctionEntityRecord,sizeof(struct entityRecord)); InstallPrimitive(theEnv,&DeffunctionData(theEnv)->DeffunctionEntityRecord,PCALL); DeffunctionData(theEnv)->DeffunctionModuleIndex = RegisterModuleItem(theEnv,(char*)"deffunction", #if (! RUN_TIME) AllocateModule,ReturnModule, #else NULL,NULL, #endif #if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY BloadDeffunctionModuleReference, #else NULL, #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DeffunctionCModuleReference, #else NULL, #endif EnvFindDeffunction); DeffunctionData(theEnv)->DeffunctionConstruct = AddConstruct(theEnv,(char*)"deffunction",(char*)"deffunctions", #if (! BLOAD_ONLY) && (! RUN_TIME) ParseDeffunction, #else NULL, #endif EnvFindDeffunction, GetConstructNamePointer,GetConstructPPForm, GetConstructModuleItem,EnvGetNextDeffunction, SetNextConstruct,EnvIsDeffunctionDeletable, EnvUndeffunction, #if (! BLOAD_ONLY) && (! RUN_TIME) RemoveDeffunction #else NULL #endif ); #if ! RUN_TIME AddClearReadyFunction(theEnv,(char*)"deffunction",ClearDeffunctionsReady,0); #if ! BLOAD_ONLY #if DEFMODULE_CONSTRUCT AddPortConstructItem(theEnv,(char*)"deffunction",SYMBOL); #endif AddSaveFunction(theEnv,(char*)"deffunction-headers",SaveDeffunctionHeaders,1000); AddSaveFunction(theEnv,(char*)"deffunctions",SaveDeffunctions,0); EnvDefineFunction2(theEnv,(char*)"undeffunction",'v',PTIEF UndeffunctionCommand,(char*)"UndeffunctionCommand",(char*)"11w"); #endif #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,(char*)"list-deffunctions",'v',PTIEF ListDeffunctionsCommand,(char*)"ListDeffunctionsCommand",(char*)"01"); EnvDefineFunction2(theEnv,(char*)"ppdeffunction",'v',PTIEF PPDeffunctionCommand,(char*)"PPDeffunctionCommand",(char*)"11w"); #endif EnvDefineFunction2(theEnv,(char*)"get-deffunction-list",'m',PTIEF GetDeffunctionListFunction, (char*)"GetDeffunctionListFunction",(char*)"01"); EnvDefineFunction2(theEnv,(char*)"deffunction-module",'w',PTIEF GetDeffunctionModuleCommand, (char*)"GetDeffunctionModuleCommand",(char*)"11w"); #if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY SetupDeffunctionsBload(theEnv); #endif #if CONSTRUCT_COMPILER SetupDeffunctionCompiler(theEnv); #endif #endif #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,(char*)"deffunctions",0,&DeffunctionData(theEnv)->WatchDeffunctions,32, DeffunctionWatchAccess,DeffunctionWatchPrint); #endif }
/*************************************************** 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( void *theEnv) { ENTITY_RECORD handlerGetInfo = { "HANDLER_GET", HANDLER_GET,0,1,1, PrintHandlerSlotGetFunction, PrintHandlerSlotGetFunction,NULL, HandlerSlotGetFunction, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }, handlerPutInfo = { "HANDLER_PUT", HANDLER_PUT,0,1,1, PrintHandlerSlotPutFunction, PrintHandlerSlotPutFunction,NULL, HandlerSlotPutFunction, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; AllocateEnvironmentData(theEnv,MESSAGE_HANDLER_DATA,sizeof(struct messageHandlerData),DeallocateMessageHandlerData); memcpy(&MessageHandlerData(theEnv)->HandlerGetInfo,&handlerGetInfo,sizeof(struct entityRecord)); memcpy(&MessageHandlerData(theEnv)->HandlerPutInfo,&handlerPutInfo,sizeof(struct entityRecord)); MessageHandlerData(theEnv)->hndquals[0] = "around"; MessageHandlerData(theEnv)->hndquals[1] = "before"; MessageHandlerData(theEnv)->hndquals[2] = "primary"; MessageHandlerData(theEnv)->hndquals[3] = "after"; InstallPrimitive(theEnv,&MessageHandlerData(theEnv)->HandlerGetInfo,HANDLER_GET); InstallPrimitive(theEnv,&MessageHandlerData(theEnv)->HandlerPutInfo,HANDLER_PUT); #if ! RUN_TIME MessageHandlerData(theEnv)->INIT_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,INIT_STRING); IncrementSymbolCount(MessageHandlerData(theEnv)->INIT_SYMBOL); MessageHandlerData(theEnv)->DELETE_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,DELETE_STRING); IncrementSymbolCount(MessageHandlerData(theEnv)->DELETE_SYMBOL); MessageHandlerData(theEnv)->CREATE_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,CREATE_STRING); IncrementSymbolCount(MessageHandlerData(theEnv)->CREATE_SYMBOL); EnvAddClearFunction(theEnv,"defclass",CreateSystemHandlers,-100); #if ! BLOAD_ONLY MessageHandlerData(theEnv)->SELF_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,SELF_STRING); IncrementSymbolCount(MessageHandlerData(theEnv)->SELF_SYMBOL); AddConstruct(theEnv,"defmessage-handler","defmessage-handlers", ParseDefmessageHandler,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); EnvDefineFunction2(theEnv,"undefmessage-handler",'v',PTIEF UndefmessageHandlerCommand, "UndefmessageHandlerCommand","23w"); #endif EnvDefineFunction2(theEnv,"send",'u',PTIEF SendCommand,"SendCommand","2*uuw"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"preview-send",'v',PTIEF PreviewSendCommand,"PreviewSendCommand","22w"); EnvDefineFunction2(theEnv,"ppdefmessage-handler",'v',PTIEF PPDefmessageHandlerCommand, "PPDefmessageHandlerCommand","23w"); EnvDefineFunction2(theEnv,"list-defmessage-handlers",'v',PTIEF ListDefmessageHandlersCommand, "ListDefmessageHandlersCommand","02w"); #endif EnvDefineFunction2(theEnv,"next-handlerp",'b',PTIEF NextHandlerAvailable,"NextHandlerAvailable","00"); FuncSeqOvlFlags(theEnv,"next-handlerp",TRUE,FALSE); EnvDefineFunction2(theEnv,"call-next-handler",'u', PTIEF CallNextHandler,"CallNextHandler","00"); FuncSeqOvlFlags(theEnv,"call-next-handler",TRUE,FALSE); EnvDefineFunction2(theEnv,"override-next-handler",'u', PTIEF CallNextHandler,"CallNextHandler",NULL); FuncSeqOvlFlags(theEnv,"override-next-handler",TRUE,FALSE); EnvDefineFunction2(theEnv,"dynamic-get",'u',PTIEF DynamicHandlerGetSlot,"DynamicHandlerGetSlot","11w"); EnvDefineFunction2(theEnv,"dynamic-put",'u',PTIEF DynamicHandlerPutSlot,"DynamicHandlerPutSlot","1**w"); EnvDefineFunction2(theEnv,"get",'u',PTIEF DynamicHandlerGetSlot,"DynamicHandlerGetSlot","11w"); EnvDefineFunction2(theEnv,"put",'u',PTIEF DynamicHandlerPutSlot,"DynamicHandlerPutSlot","1**w"); #endif #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,"messages",0,&MessageHandlerData(theEnv)->WatchMessages,36,NULL,NULL); AddWatchItem(theEnv,"message-handlers",0,&MessageHandlerData(theEnv)->WatchHandlers,35, DefmessageHandlerWatchAccess,DefmessageHandlerWatchPrint); #endif }
globle void DefruleCommands( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"run",'v', PTIEF RunCommand,"RunCommand", "*1i"); EnvDefineFunction2(theEnv,"halt",'v', PTIEF HaltCommand,"HaltCommand","00"); EnvDefineFunction2(theEnv,"focus",'b', PTIEF FocusCommand,"FocusCommand", "1*w"); EnvDefineFunction2(theEnv,"clear-focus-stack",'v',PTIEF ClearFocusStackCommand, "ClearFocusStackCommand","00"); EnvDefineFunction2(theEnv,"get-focus-stack",'m',PTIEF GetFocusStackFunction, "GetFocusStackFunction","00"); EnvDefineFunction2(theEnv,"pop-focus",'w',PTIEF PopFocusFunction, "PopFocusFunction","00"); EnvDefineFunction2(theEnv,"get-focus",'w',PTIEF GetFocusFunction, "GetFocusFunction","00"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"set-break",'v', PTIEF SetBreakCommand, "SetBreakCommand","11w"); EnvDefineFunction2(theEnv,"remove-break",'v', PTIEF RemoveBreakCommand, "RemoveBreakCommand", "*1w"); EnvDefineFunction2(theEnv,"show-breaks",'v', PTIEF ShowBreaksCommand, "ShowBreaksCommand", "01w"); EnvDefineFunction2(theEnv,"matches",'v',PTIEF MatchesCommand,"MatchesCommand","11w"); EnvDefineFunction2(theEnv,"join-activity",'g',PTIEF JoinActivityCommand,"JoinActivityCommand","11w"); EnvDefineFunction2(theEnv,"matches-count",'v',PTIEF MatchesCountCommand,"MatchesCountCommand","11w"); EnvDefineFunction2(theEnv,"list-focus-stack",'v', PTIEF ListFocusStackCommand, "ListFocusStackCommand", "00"); EnvDefineFunction2(theEnv,"dependencies", 'v', PTIEF DependenciesCommand, "DependenciesCommand", "11h"); EnvDefineFunction2(theEnv,"dependents", 'v', PTIEF DependentsCommand, "DependentsCommand", "11h"); EnvDefineFunction2(theEnv,"timetag", 'g', PTIEF TimetagFunction, "TimetagFunction", "11h"); #endif /* DEBUGGING_FUNCTIONS */ EnvDefineFunction2(theEnv,"get-incremental-reset",'b', GetIncrementalResetCommand,"GetIncrementalResetCommand","00"); EnvDefineFunction2(theEnv,"set-incremental-reset",'b', SetIncrementalResetCommand,"SetIncrementalResetCommand","11"); EnvDefineFunction2(theEnv,"get-beta-memory-resizing",'b', GetBetaMemoryResizingCommand,"GetBetaMemoryResizingCommand","00"); EnvDefineFunction2(theEnv,"set-beta-memory-resizing",'b', SetBetaMemoryResizingCommand,"SetBetaMemoryResizingCommand","11"); EnvDefineFunction2(theEnv,"get-strategy", 'w', PTIEF GetStrategyCommand, "GetStrategyCommand", "00"); EnvDefineFunction2(theEnv,"set-strategy", 'w', PTIEF SetStrategyCommand, "SetStrategyCommand", "11w"); #if DEVELOPER && (! BLOAD_ONLY) EnvDefineFunction2(theEnv,"rule-complexity",'l', PTIEF RuleComplexityCommand,"RuleComplexityCommand", "11w"); EnvDefineFunction2(theEnv,"show-joins", 'v', PTIEF ShowJoinsCommand, "ShowJoinsCommand", "11w"); EnvDefineFunction2(theEnv,"show-aht", 'v', PTIEF ShowAlphaHashTable, "ShowAlphaHashTable", "00"); #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,"rule-analysis",0,&DefruleData(theEnv)->WatchRuleAnalysis,0,NULL,NULL); #endif #endif /* DEVELOPER && (! BLOAD_ONLY) */ #else #if MAC_MCW || WIN_MCW || MAC_XCD #pragma unused(theEnv) #endif #endif /* ! RUN_TIME */ }
/********************************************************* NAME : SetupDefclasses DESCRIPTION : Initializes Class Hash Table, Function Parsers, and Data Structures INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : NOTES : None *********************************************************/ static void SetupDefclasses( void *theEnv) { InstallPrimitive(theEnv,&DefclassData(theEnv)->DefclassEntityRecord,DEFCLASS_PTR); DefclassData(theEnv)->DefclassModuleIndex = RegisterModuleItem(theEnv,(char*)"defclass", #if (! RUN_TIME) AllocateModule,ReturnModule, #else NULL,NULL, #endif #if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY BloadDefclassModuleReference, #else NULL, #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DefclassCModuleReference, #else NULL, #endif EnvFindDefclass); DefclassData(theEnv)->DefclassConstruct = AddConstruct(theEnv,(char*)"defclass",(char*)"defclasses", #if (! BLOAD_ONLY) && (! RUN_TIME) ParseDefclass, #else NULL, #endif EnvFindDefclass, GetConstructNamePointer,GetConstructPPForm, GetConstructModuleItem,EnvGetNextDefclass, SetNextConstruct,EnvIsDefclassDeletable, EnvUndefclass, #if (! RUN_TIME) RemoveDefclass #else NULL #endif ); AddClearReadyFunction(theEnv,(char*)"defclass",InstancesPurge,0); #if ! RUN_TIME EnvAddClearFunction(theEnv,(char*)"defclass",CreateSystemClasses,0); InitializeClasses(theEnv); #if ! BLOAD_ONLY #if DEFMODULE_CONSTRUCT AddPortConstructItem(theEnv,(char*)"defclass",SYMBOL); AddAfterModuleDefinedFunction(theEnv,(char*)"defclass",UpdateDefclassesScope,0); #endif EnvDefineFunction2(theEnv,(char*)"undefclass",'v',PTIEF UndefclassCommand,(char*)"UndefclassCommand",(char*)"11w"); AddSaveFunction(theEnv,(char*)"defclass",SaveDefclasses,10); #endif #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,(char*)"list-defclasses",'v',PTIEF ListDefclassesCommand,(char*)"ListDefclassesCommand",(char*)"01"); EnvDefineFunction2(theEnv,(char*)"ppdefclass",'v',PTIEF PPDefclassCommand,(char*)"PPDefclassCommand",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"describe-class",'v',PTIEF DescribeClassCommand,(char*)"DescribeClassCommand",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"browse-classes",'v',PTIEF BrowseClassesCommand,(char*)"BrowseClassesCommand",(char*)"01w"); #endif EnvDefineFunction2(theEnv,(char*)"get-defclass-list",'m',PTIEF GetDefclassListFunction, (char*)"GetDefclassListFunction",(char*)"01"); EnvDefineFunction2(theEnv,(char*)"superclassp",'b',PTIEF SuperclassPCommand,(char*)"SuperclassPCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"subclassp",'b',PTIEF SubclassPCommand,(char*)"SubclassPCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"class-existp",'b',PTIEF ClassExistPCommand,(char*)"ClassExistPCommand",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"message-handler-existp",'b', PTIEF MessageHandlerExistPCommand,(char*)"MessageHandlerExistPCommand",(char*)"23w"); EnvDefineFunction2(theEnv,(char*)"class-abstractp",'b',PTIEF ClassAbstractPCommand,(char*)"ClassAbstractPCommand",(char*)"11w"); #if DEFRULE_CONSTRUCT EnvDefineFunction2(theEnv,(char*)"class-reactivep",'b',PTIEF ClassReactivePCommand,(char*)"ClassReactivePCommand",(char*)"11w"); #endif EnvDefineFunction2(theEnv,(char*)"class-slots",'m',PTIEF ClassSlotsCommand,(char*)"ClassSlotsCommand",(char*)"12w"); EnvDefineFunction2(theEnv,(char*)"class-superclasses",'m', PTIEF ClassSuperclassesCommand,(char*)"ClassSuperclassesCommand",(char*)"12w"); EnvDefineFunction2(theEnv,(char*)"class-subclasses",'m', PTIEF ClassSubclassesCommand,(char*)"ClassSubclassesCommand",(char*)"12w"); EnvDefineFunction2(theEnv,(char*)"get-defmessage-handler-list",'m', PTIEF GetDefmessageHandlersListCmd,(char*)"GetDefmessageHandlersListCmd",(char*)"02w"); EnvDefineFunction2(theEnv,(char*)"slot-existp",'b',PTIEF SlotExistPCommand,(char*)"SlotExistPCommand",(char*)"23w"); EnvDefineFunction2(theEnv,(char*)"slot-facets",'m',PTIEF SlotFacetsCommand,(char*)"SlotFacetsCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-sources",'m',PTIEF SlotSourcesCommand,(char*)"SlotSourcesCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-types",'m',PTIEF SlotTypesCommand,(char*)"SlotTypesCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-allowed-values",'m',PTIEF SlotAllowedValuesCommand,(char*)"SlotAllowedValuesCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-allowed-classes",'m',PTIEF SlotAllowedClassesCommand,(char*)"SlotAllowedClassesCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-range",'m',PTIEF SlotRangeCommand,(char*)"SlotRangeCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-cardinality",'m',PTIEF SlotCardinalityCommand,(char*)"SlotCardinalityCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-writablep",'b',PTIEF SlotWritablePCommand,(char*)"SlotWritablePCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-initablep",'b',PTIEF SlotInitablePCommand,(char*)"SlotInitablePCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-publicp",'b',PTIEF SlotPublicPCommand,(char*)"SlotPublicPCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-direct-accessp",'b',PTIEF SlotDirectAccessPCommand, (char*)"SlotDirectAccessPCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"slot-default-value",'u',PTIEF SlotDefaultValueCommand, (char*)"SlotDefaultValueCommand",(char*)"22w"); EnvDefineFunction2(theEnv,(char*)"defclass-module",'w',PTIEF GetDefclassModuleCommand, (char*)"GetDefclassModuleCommand",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"get-class-defaults-mode", 'w', PTIEF GetClassDefaultsModeCommand, (char*)"GetClassDefaultsModeCommand", (char*)"00"); EnvDefineFunction2(theEnv,(char*)"set-class-defaults-mode", 'w', PTIEF SetClassDefaultsModeCommand, (char*)"SetClassDefaultsModeCommand", (char*)"11w"); #endif #if DEBUGGING_FUNCTIONS AddWatchItem(theEnv,(char*)"instances",0,&DefclassData(theEnv)->WatchInstances,75,DefclassWatchAccess,DefclassWatchPrint); AddWatchItem(theEnv,(char*)"slots",1,&DefclassData(theEnv)->WatchSlots,74,DefclassWatchAccess,DefclassWatchPrint); #endif }
globle void InitializeFacts() { /*=========================================*/ /* Initialize the fact hash table (used to */ /* quickly determine if a fact exists). */ /*=========================================*/ InitializeFactHashTable(); /*============================================*/ /* Initialize the fact callback functions for */ /* use with the reset and clear commands. */ /*============================================*/ AddResetFunction("facts",ResetFacts,60); AddClearReadyFunction("facts",ClearFactsReady,0); /*=============================*/ /* Initialize periodic garbage */ /* collection for facts. */ /*=============================*/ AddCleanupFunction("facts",RemoveGarbageFacts,0); /*===================================*/ /* Initialize fact pattern matching. */ /*===================================*/ InitializeFactPatterns(); /*==================================*/ /* Initialize the facts keyword for */ /* use with the watch command. */ /*==================================*/ #if DEBUGGING_FUNCTIONS AddWatchItem("facts",0,&WatchFacts,80,DeftemplateWatchAccess,DeftemplateWatchPrint); #endif /*=========================================*/ /* Initialize fact commands and functions. */ /*=========================================*/ FactCommandDefinitions(); FactFunctionDefinitions(); /*==================================*/ /* Initialize fact patterns for use */ /* with the bload/bsave commands. */ /*==================================*/ #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME) FactBinarySetup(); #endif /*===================================*/ /* Initialize fact patterns for use */ /* with the constructs-to-c command. */ /*===================================*/ #if CONSTRUCT_COMPILER && (! RUN_TIME) FactPatternsCompilerSetup(); #endif }