globle void WatchFunctionDefinitions( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,name_watch, 'v', PTIEF WatchCommand, fWatchCommand, (char*)"1**w"); EnvDefineFunction2(theEnv,name_unwatch, 'v', PTIEF UnwatchCommand, fUnwatchCommand, (char*)"1**w"); EnvDefineFunction2(theEnv, name_getwatchitem, 'b', PTIEF GetWatchItemCommand, fGetWatchItemCommand, (char*)"11w"); EnvDefineFunction2(theEnv,name_listwatchitems, 'v', PTIEF ListWatchItemsCommand, fListWatchItemsCommand, (char*)"0**w"); #endif EnvAddRouter(theEnv,WTRACE,1000,RecognizeWatchRouters,CaptureWatchPrints, NULL,NULL,NULL); EnvDeactivateRouter(theEnv,WTRACE); }
globle void WatchFunctionDefinitions( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"watch", 'v', PTIEF WatchCommand, "WatchCommand", "1**w"); EnvDefineFunction2(theEnv,"unwatch", 'v', PTIEF UnwatchCommand, "UnwatchCommand", "1**w"); EnvDefineFunction2(theEnv, "get-watch-item", 'b', PTIEF GetWatchItemCommand, "GetWatchItemCommand", "11w"); EnvDefineFunction2(theEnv,"list-watch-items", 'v', PTIEF ListWatchItemsCommand, "ListWatchItemsCommand", "0**w"); #endif EnvAddRouter(theEnv,WTRACE,1000,RecognizeWatchRouters,CaptureWatchPrints, NULL,NULL,NULL); EnvDeactivateRouter(theEnv,WTRACE); }
globle void DefglobalBasicCommands( void *theEnv) { AddSaveFunction(theEnv,"defglobal",SaveDefglobals,40); EnvAddResetFunction(theEnv,"defglobal",ResetDefglobals,50); #if ! RUN_TIME EnvDefineFunction2(theEnv,"get-defglobal-list",'m',PTIEF GetDefglobalListFunction,"GetDefglobalListFunction","01w"); EnvDefineFunction2(theEnv,"undefglobal",'v',PTIEF UndefglobalCommand,"UndefglobalCommand","11w"); EnvDefineFunction2(theEnv,"defglobal-module",'w',PTIEF DefglobalModuleFunction,"DefglobalModuleFunction","11w"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"list-defglobals",'v', PTIEF ListDefglobalsCommand,"ListDefglobalsCommand","01w"); EnvDefineFunction2(theEnv,"ppdefglobal",'v',PTIEF PPDefglobalCommand,"PPDefglobalCommand","11w"); AddWatchItem(theEnv,"globals",0,&DefglobalData(theEnv)->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 DeftemplateBasicCommands( void *theEnv) { #if ! DEFFACTS_CONSTRUCT EnvAddResetFunction(theEnv,(char*)"deftemplate",ResetDeftemplates,0); #endif EnvAddClearFunction(theEnv,(char*)"deftemplate",ClearDeftemplates,0); AddSaveFunction(theEnv,(char*)"deftemplate",SaveDeftemplates,10); #if ! RUN_TIME EnvDefineFunction2(theEnv,(char*)"get-deftemplate-list",'m',PTIEF GetDeftemplateListFunction,(char*)"GetDeftemplateListFunction",(char*)"01w"); EnvDefineFunction2(theEnv,(char*)"undeftemplate",'v',PTIEF UndeftemplateCommand,(char*)"UndeftemplateCommand",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"deftemplate-module",'w',PTIEF DeftemplateModuleFunction,(char*)"DeftemplateModuleFunction",(char*)"11w"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,(char*)"list-deftemplates",'v', PTIEF ListDeftemplatesCommand,(char*)"ListDeftemplatesCommand",(char*)"01w"); EnvDefineFunction2(theEnv,(char*)"ppdeftemplate",'v',PTIEF PPDeftemplateCommand,(char*)"PPDeftemplateCommand",(char*)"11w"); #endif #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) DeftemplateBinarySetup(theEnv); #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DeftemplateCompilerSetup(theEnv); #endif #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 DefmoduleBasicCommands( void *theEnv) { EnvAddClearFunction(theEnv,"defmodule",ClearDefmodules,2000); #if DEFMODULE_CONSTRUCT AddSaveFunction(theEnv,"defmodule",SaveDefmodules,1100); #if ! RUN_TIME EnvDefineFunction2(theEnv,"get-defmodule-list",'m',PTIEF EnvGetDefmoduleList,"EnvGetDefmoduleList","00"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"list-defmodules",'v', PTIEF ListDefmodulesCommand,"ListDefmodulesCommand","00"); EnvDefineFunction2(theEnv,"ppdefmodule",'v',PTIEF PPDefmoduleCommand,"PPDefmoduleCommand","11w"); #endif #endif #endif #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) DefmoduleBinarySetup(theEnv); #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DefmoduleCompilerSetup(theEnv); #endif }
globle void DeffactsBasicCommands( void *theEnv) { EnvAddResetFunction(theEnv,"deffacts",ResetDeffacts,0); EnvAddClearFunction(theEnv,"deffacts",ClearDeffacts,0); AddSaveFunction(theEnv,"deffacts",SaveDeffacts,10); #if ! RUN_TIME EnvDefineFunction2(theEnv,"get-deffacts-list",'m',PTIEF GetDeffactsListFunction,"GetDeffactsListFunction","01w"); EnvDefineFunction2(theEnv,"undeffacts",'v',PTIEF UndeffactsCommand,"UndeffactsCommand","11w"); EnvDefineFunction2(theEnv,"deffacts-module",'w',PTIEF DeffactsModuleFunction,"DeffactsModuleFunction","11w"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"list-deffacts",'v', PTIEF ListDeffactsCommand,"ListDeffactsCommand","01w"); EnvDefineFunction2(theEnv,"ppdeffacts",'v',PTIEF PPDeffactsCommand,"PPDeffactsCommand","11w"); #endif #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) DeffactsBinarySetup(theEnv); #endif #if CONSTRUCT_COMPILER && (! RUN_TIME) DeffactsCompilerSetup(theEnv); #endif #endif }
globle void ConstructProfilingFunctionDefinitions( void *theEnv) { struct userDataRecord profileDataInfo = { 0, CreateProfileData, DeleteProfileData }; AllocateEnvironmentData(theEnv,PROFLFUN_DATA,sizeof(struct profileFunctionData),NULL); memcpy(&ProfileFunctionData(theEnv)->ProfileDataInfo,&profileDataInfo,sizeof(struct userDataRecord)); ProfileFunctionData(theEnv)->LastProfileInfo = NO_PROFILE; ProfileFunctionData(theEnv)->PercentThreshold = 0.0; ProfileFunctionData(theEnv)->OutputString = OUTPUT_STRING; #if ! RUN_TIME EnvDefineFunction2(theEnv,"profile",'v', PTIEF ProfileCommand,"ProfileCommand","11w"); EnvDefineFunction2(theEnv,"profile-info",'v', PTIEF ProfileInfoCommand,"ProfileInfoCommand","01w"); EnvDefineFunction2(theEnv,"profile-reset",'v', PTIEF ProfileResetCommand,"ProfileResetCommand","00"); EnvDefineFunction2(theEnv,"set-profile-percent-threshold",'d', PTIEF SetProfilePercentThresholdCommand, "SetProfilePercentThresholdCommand","11n"); EnvDefineFunction2(theEnv,"get-profile-percent-threshold",'d', PTIEF GetProfilePercentThresholdCommand, "GetProfilePercentThresholdCommand","00"); ProfileFunctionData(theEnv)->ProfileDataID = InstallUserDataRecord(theEnv,&ProfileFunctionData(theEnv)->ProfileDataInfo); EnvAddClearFunction(theEnv,"profile",ProfileClearFunction,0); #endif }
globle void InitializeConstraints( void *theEnv) { #if (! RUN_TIME) && (! BLOAD_ONLY) int i; #endif AllocateEnvironmentData(theEnv,CONSTRAINT_DATA,sizeof(struct constraintData),DeallocateConstraintData); ConstraintData(theEnv)->StaticConstraintChecking = TRUE; #if (! RUN_TIME) && (! BLOAD_ONLY) ConstraintData(theEnv)->ConstraintHashtable = (struct constraintRecord **) gm2(theEnv,(int) sizeof (struct constraintRecord *) * SIZE_CONSTRAINT_HASH); if (ConstraintData(theEnv)->ConstraintHashtable == NULL) EnvExitRouter(theEnv,EXIT_FAILURE); for (i = 0; i < SIZE_CONSTRAINT_HASH; i++) ConstraintData(theEnv)->ConstraintHashtable[i] = NULL; #endif #if (! RUN_TIME) EnvDefineFunction2(theEnv,"get-dynamic-constraint-checking",'b',GDCCommand,"GDCCommand", "00"); EnvDefineFunction2(theEnv,"set-dynamic-constraint-checking",'b',SDCCommand,"SDCCommand", "11"); EnvDefineFunction2(theEnv,"get-static-constraint-checking",'b',GSCCommand,"GSCCommand", "00"); EnvDefineFunction2(theEnv,"set-static-constraint-checking",'b',SSCCommand,"SSCCommand", "11"); #endif }
globle void FactCommandDefinitions( void *theEnv) { #if ! RUN_TIME #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"facts", 'v', PTIEF FactsCommand, "FactsCommand", "*4iu"); #endif //madianyi Begin EnvDefineFunction(theEnv,"update", 'u', PTIEF UpdateCommand, "UpdateCommand"); //madianyi End EnvDefineFunction(theEnv,"assert", 'u', PTIEF AssertCommand, "AssertCommand"); EnvDefineFunction2(theEnv,"retract", 'v', PTIEF RetractCommand, "RetractCommand","1*z"); EnvDefineFunction2(theEnv,"assert-string", 'u', PTIEF AssertStringFunction, "AssertStringFunction", "11s"); EnvDefineFunction2(theEnv,"str-assert", 'u', PTIEF AssertStringFunction, "AssertStringFunction", "11s"); EnvDefineFunction2(theEnv,"get-fact-duplication",'b', GetFactDuplicationCommand,"GetFactDuplicationCommand", "00"); EnvDefineFunction2(theEnv,"set-fact-duplication",'b', SetFactDuplicationCommand,"SetFactDuplicationCommand", "11"); EnvDefineFunction2(theEnv,"save-facts", 'b', PTIEF SaveFactsCommand, "SaveFactsCommand", "1*wk"); EnvDefineFunction2(theEnv,"load-facts", 'b', PTIEF LoadFactsCommand, "LoadFactsCommand", "11k"); EnvDefineFunction2(theEnv,"fact-index", 'g', PTIEF FactIndexFunction,"FactIndexFunction", "11y"); AddFunctionParser(theEnv,"assert",AssertParse); FuncSeqOvlFlags(theEnv,"assert",FALSE,FALSE); #else #if MAC_XCD #pragma unused(theEnv) #endif #endif }
globle void DeveloperCommands( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,(char*)"primitives-info",'v', PTIEF PrimitiveTablesInfo,(char*)"PrimitiveTablesInfo",(char*)"00"); EnvDefineFunction2(theEnv,(char*)"primitives-usage",'v', PTIEF PrimitiveTablesUsage,(char*)"PrimitiveTablesUsage",(char*)"00"); EnvDefineFunction2(theEnv,(char*)"enable-gc-heuristics",'v', PTIEF EnableGCHeuristics,(char*)"EnableGCHeuristics",(char*)"00"); EnvDefineFunction2(theEnv,(char*)"disable-gc-heuristics",'v', PTIEF DisableGCHeuristics,(char*)"DisableGCHeuristics",(char*)"00"); #if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT EnvDefineFunction2(theEnv,(char*)"validate-fact-integrity", 'b', PTIEF ValidateFactIntegrity, (char*)"ValidateFactIntegrity", "00"); EnvDefineFunction2(theEnv,(char*)"show-fpn",'v', PTIEF ShowFactPatternNetwork,(char*)"ShowFactPatternNetwork",(char*)"11w"); EnvDefineFunction2(theEnv,(char*)"show-fht",'v', PTIEF ShowFactHashTable,(char*)"ShowFactHashTable",(char*)"00"); #endif #if DEFRULE_CONSTRUCT && OBJECT_SYSTEM EnvDefineFunction2(theEnv,(char*)"show-opn",'v',PTIEF PrintObjectPatternNetwork, (char*)"PrintObjectPatternNetwork",(char*)"00"); #endif #if OBJECT_SYSTEM EnvDefineFunction2(theEnv,(char*)"instance-table-usage",'v', PTIEF InstanceTableUsage,(char*)"InstanceTableUsage",(char*)"00"); #endif #endif }
globle void FactCommandDefinitions( void *theEnv) { #if ! RUN_TIME #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,(char*)"facts", 'v', PTIEF FactsCommand, (char*)"FactsCommand", (char*)"*4iu"); #endif EnvDefineFunction(theEnv,(char*)"assert", 'u', PTIEF AssertCommand, (char*)"AssertCommand"); EnvDefineFunction2(theEnv,(char*)"retract", 'v', PTIEF RetractCommand, (char*)"RetractCommand",(char*)"1*z"); EnvDefineFunction2(theEnv,(char*)"assert-string", 'u', PTIEF AssertStringFunction, (char*)"AssertStringFunction", (char*)"11s"); EnvDefineFunction2(theEnv,(char*)"str-assert", 'u', PTIEF AssertStringFunction, (char*)"AssertStringFunction", (char*)"11s"); EnvDefineFunction2(theEnv,(char*)"get-fact-duplication",'b', GetFactDuplicationCommand,(char*)"GetFactDuplicationCommand", (char*)"00"); EnvDefineFunction2(theEnv,(char*)"set-fact-duplication",'b', SetFactDuplicationCommand,(char*)"SetFactDuplicationCommand", (char*)"11"); EnvDefineFunction2(theEnv,(char*)"save-facts", 'b', PTIEF SaveFactsCommand, (char*)"SaveFactsCommand", (char*)"1*wk"); EnvDefineFunction2(theEnv,(char*)"load-facts", 'b', PTIEF LoadFactsCommand, (char*)"LoadFactsCommand", (char*)"11k"); EnvDefineFunction2(theEnv,(char*)"fact-index", 'g', PTIEF FactIndexFunction,(char*)"FactIndexFunction", (char*)"11y"); AddFunctionParser(theEnv,(char*)"assert",AssertParse); FuncSeqOvlFlags(theEnv,(char*)"assert",FALSE,FALSE); #else #if MAC_MCW || WIN_MCW || MAC_XCD #pragma unused(theEnv) #endif #endif }
globle void ProceduralFunctionDefinitions( void *theEnv) { AllocateEnvironmentData(theEnv,PRCDRFUN_DATA,sizeof(struct procedureFunctionData),DeallocateProceduralFunctionData); #if ! RUN_TIME EnvDefineFunction2(theEnv,"if", 'u', PTIEF IfFunction, "IfFunction", NULL); EnvDefineFunction2(theEnv,"while", 'u', PTIEF WhileFunction, "WhileFunction", NULL); EnvDefineFunction2(theEnv,"loop-for-count",'u', PTIEF LoopForCountFunction, "LoopForCountFunction", NULL); EnvDefineFunction2(theEnv,"(get-loop-count)",'g', PTIEF GetLoopCount, "GetLoopCount", NULL); EnvDefineFunction2(theEnv,"bind", 'u', PTIEF BindFunction, "BindFunction", NULL); EnvDefineFunction2(theEnv,"progn", 'u', PTIEF PrognFunction, "PrognFunction", NULL); EnvDefineFunction2(theEnv,"return", 'u', PTIEF ReturnFunction, "ReturnFunction",NULL); EnvDefineFunction2(theEnv,"break", 'v', PTIEF BreakFunction, "BreakFunction",NULL); EnvDefineFunction2(theEnv,"switch", 'u', PTIEF SwitchFunction, "SwitchFunction",NULL); ProceduralFunctionParsers(theEnv); FuncSeqOvlFlags(theEnv,"progn",FALSE,FALSE); FuncSeqOvlFlags(theEnv,"if",FALSE,FALSE); FuncSeqOvlFlags(theEnv,"while",FALSE,FALSE); FuncSeqOvlFlags(theEnv,"loop-for-count",FALSE,FALSE); FuncSeqOvlFlags(theEnv,"return",FALSE,FALSE); FuncSeqOvlFlags(theEnv,"switch",FALSE,FALSE); #endif EnvAddResetFunction(theEnv,"bind",FlushBindList,0); EnvAddClearFunction(theEnv,"bind",FlushBindList,0); }
globle void FileCommandDefinitions( void *theEnv) { AllocateEnvironmentData(theEnv,FILECOM_DATA,sizeof(struct fileCommandData),DeallocateFileCommandData); #if ! RUN_TIME #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"batch",'b',PTIEF BatchCommand,"BatchCommand","11k"); EnvDefineFunction2(theEnv,"batch*",'b',PTIEF BatchStarCommand,"BatchStarCommand","11k"); EnvDefineFunction2(theEnv,"dribble-on",'b',PTIEF DribbleOnCommand,"DribbleOnCommand","11k"); EnvDefineFunction2(theEnv,"dribble-off",'b',PTIEF DribbleOffCommand,"DribbleOffCommand","00"); EnvDefineFunction2(theEnv,"save",'b',PTIEF SaveCommand,"SaveCommand","11k"); #endif EnvDefineFunction2(theEnv,"load",'b',PTIEF LoadCommand,"LoadCommand","11k"); EnvDefineFunction2(theEnv,"load*",'b',PTIEF LoadStarCommand,"LoadStarCommand","11k"); #if BLOAD_AND_BSAVE InitializeBsaveData(theEnv); EnvDefineFunction2(theEnv,"bsave",'b', PTIEF BsaveCommand,"BsaveCommand","11k"); #endif #if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE InitializeBloadData(theEnv); EnvDefineFunction2(theEnv,"bload",'b',PTIEF BloadCommand,"BloadCommand","11k"); #endif #endif }
globle void FactFunctionDefinitions( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"fact-existp", 'b', PTIEF FactExistpFunction, "FactExistpFunction", "11z"); EnvDefineFunction2(theEnv,"fact-relation",'w', PTIEF FactRelationFunction,"FactRelationFunction", "11z"); EnvDefineFunction2(theEnv,"fact-slot-value",'u', PTIEF FactSlotValueFunction,"FactSlotValueFunction", "22*zw"); EnvDefineFunction2(theEnv,"fact-slot-names",'u', PTIEF FactSlotNamesFunction,"FactSlotNamesFunction", "11z"); EnvDefineFunction2(theEnv,"get-fact-list",'m',PTIEF GetFactListFunction,"GetFactListFunction","01w"); #else #if MAC_MCW || IBM_MCW || MAC_XCD #pragma unused(theEnv) #endif #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 }
extern void ArchitectureDetectionFunctionDefinitions(void* theEnv) { EnvDefineFunction2(theEnv, "architecture", 'w', PTIEF GetArchitecture, "GetArchitecture", "00a"); }
globle void SortFunctionDefinitions( void *theEnv) { AllocateEnvironmentData(theEnv,SORTFUN_DATA,sizeof(struct sortFunctionData),DeallocateSortFunctionData); #if ! RUN_TIME EnvDefineFunction2(theEnv,"sort",'u', PTIEF SortFunction,"SortFunction","1**w"); #endif }
globle void DeveloperCommands( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"primitives-info",'v', PTIEF PrimitiveTablesInfo,"PrimitiveTablesInfo","00"); EnvDefineFunction2(theEnv,"primitives-usage",'v', PTIEF PrimitiveTablesUsage,"PrimitiveTablesUsage","00"); #if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT EnvDefineFunction2(theEnv,"validate-fact-integrity", 'b', PTIEF ValidateFactIntegrity, "ValidateFactIntegrity", "00"); EnvDefineFunction2(theEnv,"show-fpn",'v', PTIEF ShowFactPatternNetwork,"ShowFactPatternNetwork","11w"); EnvDefineFunction2(theEnv,"show-fht",'v', PTIEF ShowFactHashTable,"ShowFactHashTable","00"); #endif #if DEFRULE_CONSTRUCT && OBJECT_SYSTEM EnvDefineFunction2(theEnv,"show-opn",'v',PTIEF PrintObjectPatternNetwork, "PrintObjectPatternNetwork","00"); #endif #if OBJECT_SYSTEM EnvDefineFunction2(theEnv,"instance-table-usage",'v', PTIEF InstanceTableUsage,"InstanceTableUsage","00"); #endif #endif }
globle void ParseFunctionDefinitions( void *theEnv) { AllocateEnvironmentData(theEnv,PARSEFUN_DATA,sizeof(struct parseFunctionData),NULL); #if ! RUN_TIME EnvDefineFunction2(theEnv,"check-syntax",'u',PTIEF CheckSyntaxFunction,"CheckSyntaxFunction","11s"); #endif }
globle void DefglobalCommandDefinitions( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"set-reset-globals",'b', SetResetGlobalsCommand,"SetResetGlobalsCommand", "11"); EnvDefineFunction2(theEnv,"get-reset-globals",'b', GetResetGlobalsCommand,"GetResetGlobalsCommand", "00"); #if DEBUGGING_FUNCTIONS EnvDefineFunction2(theEnv,"show-defglobals",'v', PTIEF ShowDefglobalsCommand,"ShowDefglobalsCommand", "01w"); #endif #else #if MAC_MCW || IBM_MCW || MAC_XCD #pragma unused(theEnv) #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 InitializeDefaultRouters( void *theEnv) { AllocateEnvironmentData(theEnv,ROUTER_DATA,sizeof(struct routerData),DeallocateRouterData); RouterData(theEnv)->CommandBufferInputCount = -1; #if (! RUN_TIME) EnvDefineFunction2(theEnv,"exit", 'v', PTIEF ExitCommand, "ExitCommand", "*1i"); #endif InitializeFileRouter(theEnv); InitializeStringRouter(theEnv); }
globle void InitializeDefaultRouters( void *theEnv, EXEC_STATUS) { AllocateEnvironmentData(theEnv,execStatus,ROUTER_DATA,sizeof(struct routerData),DeallocateRouterData); RouterData(theEnv,execStatus)->CommandBufferInputCount = 0; RouterData(theEnv,execStatus)->AwaitingInput = TRUE; #if (! RUN_TIME) EnvDefineFunction2(theEnv,execStatus,"exit", 'v', PTIEF ExitCommand, "ExitCommand", "*1i"); #endif InitializeFileRouter(theEnv,execStatus); InitializeStringRouter(theEnv,execStatus); }
globle void InitializeDefmodules( void *theEnv) { DefmoduleBasicCommands(theEnv); #if (! RUN_TIME) CreateMainModule(theEnv); #endif #if DEFMODULE_CONSTRUCT && (! RUN_TIME) && (! BLOAD_ONLY) AddConstruct(theEnv,"defmodule","defmodules",ParseDefmodule,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL); #endif #if (! RUN_TIME) && DEFMODULE_CONSTRUCT EnvDefineFunction2(theEnv,"get-current-module", 'w', PTIEF GetCurrentModuleCommand, "GetCurrentModuleCommand", "00"); EnvDefineFunction2(theEnv,"set-current-module", 'w', PTIEF SetCurrentModuleCommand, "SetCurrentModuleCommand", "11w"); #endif }
/**************************************************** NAME : SetupFactQuery DESCRIPTION : Initializes fact query H/L functions and parsers INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Sets up kernel functions and parsers NOTES : None ****************************************************/ globle void SetupFactQuery( void *theEnv) { AllocateEnvironmentData(theEnv,FACT_QUERY_DATA,sizeof(struct factQueryData),NULL); #if RUN_TIME FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL = FindSymbolHN(theEnv,QUERY_DELIMETER_STRING); #endif #if ! RUN_TIME FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,QUERY_DELIMETER_STRING); IncrementSymbolCount(FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL); EnvDefineFunction2(theEnv,"(query-fact)",'u', PTIEF GetQueryFact,"GetQueryFact",NULL); EnvDefineFunction2(theEnv,"(query-fact-slot)",'u', PTIEF GetQueryFactSlot,"GetQueryFactSlot",NULL); EnvDefineFunction2(theEnv,"any-factp",'b',PTIEF AnyFacts,"AnyFacts",NULL); AddFunctionParser(theEnv,"any-factp",FactParseQueryNoAction); EnvDefineFunction2(theEnv,"find-fact",'m', PTIEF QueryFindFact,"QueryFindFact",NULL); AddFunctionParser(theEnv,"find-fact",FactParseQueryNoAction); EnvDefineFunction2(theEnv,"find-all-facts",'m', PTIEF QueryFindAllFacts,"QueryFindAllFacts",NULL); AddFunctionParser(theEnv,"find-all-facts",FactParseQueryNoAction); EnvDefineFunction2(theEnv,"do-for-fact",'u', PTIEF QueryDoForFact,"QueryDoForFact",NULL); AddFunctionParser(theEnv,"do-for-fact",FactParseQueryAction); EnvDefineFunction2(theEnv,"do-for-all-facts",'u', PTIEF QueryDoForAllFacts,"QueryDoForAllFacts",NULL); AddFunctionParser(theEnv,"do-for-all-facts",FactParseQueryAction); EnvDefineFunction2(theEnv,"delayed-do-for-all-facts",'u', PTIEF DelayedQueryDoForAllFacts, "DelayedQueryDoForAllFacts",NULL); AddFunctionParser(theEnv,"delayed-do-for-all-facts",FactParseQueryAction); #endif }
/**************************************************** 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( void *theEnv, EXEC_STATUS) { AllocateEnvironmentData(theEnv,execStatus,INSTANCE_QUERY_DATA,sizeof(struct instanceQueryData),NULL); #if ! RUN_TIME InstanceQueryData(theEnv,execStatus)->QUERY_DELIMETER_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,execStatus,QUERY_DELIMETER_STRING); IncrementSymbolCount(InstanceQueryData(theEnv,execStatus)->QUERY_DELIMETER_SYMBOL); EnvDefineFunction2(theEnv,execStatus,"(query-instance)",'o', PTIEF GetQueryInstance,"GetQueryInstance",NULL); EnvDefineFunction2(theEnv,execStatus,"(query-instance-slot)",'u', PTIEF GetQueryInstanceSlot,"GetQueryInstanceSlot",NULL); EnvDefineFunction2(theEnv,execStatus,"any-instancep",'b',PTIEF AnyInstances,"AnyInstances",NULL); AddFunctionParser(theEnv,execStatus,"any-instancep",ParseQueryNoAction); EnvDefineFunction2(theEnv,execStatus,"find-instance",'m', PTIEF QueryFindInstance,"QueryFindInstance",NULL); AddFunctionParser(theEnv,execStatus,"find-instance",ParseQueryNoAction); EnvDefineFunction2(theEnv,execStatus,"find-all-instances",'m', PTIEF QueryFindAllInstances,"QueryFindAllInstances",NULL); AddFunctionParser(theEnv,execStatus,"find-all-instances",ParseQueryNoAction); EnvDefineFunction2(theEnv,execStatus,"do-for-instance",'u', PTIEF QueryDoForInstance,"QueryDoForInstance",NULL); AddFunctionParser(theEnv,execStatus,"do-for-instance",ParseQueryAction); EnvDefineFunction2(theEnv,execStatus,"do-for-all-instances",'u', PTIEF QueryDoForAllInstances,"QueryDoForAllInstances",NULL); AddFunctionParser(theEnv,execStatus,"do-for-all-instances",ParseQueryAction); EnvDefineFunction2(theEnv,execStatus,"delayed-do-for-all-instances",'u', PTIEF DelayedQueryDoForAllInstances, "DelayedQueryDoForAllInstances",NULL); AddFunctionParser(theEnv,execStatus,"delayed-do-for-all-instances",ParseQueryAction); #endif }
globle void DeveloperCommands( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"primitives-info",'v', PTIEF PrimitiveTablesInfo,"PrimitiveTablesInfo","00"); EnvDefineFunction2(theEnv,"primitives-usage",'v', PTIEF PrimitiveTablesUsage,"PrimitiveTablesUsage","00"); EnvDefineFunction2(theEnv,"enable-gc-heuristics",'v', PTIEF EnableGCHeuristics,"EnableGCHeuristics","00"); EnvDefineFunction2(theEnv,"disable-gc-heuristics",'v', PTIEF DisableGCHeuristics,"DisableGCHeuristics","00"); #if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT EnvDefineFunction2(theEnv,"show-fpn",'v', PTIEF ShowFactPatternNetwork,"ShowFactPatternNetwork","11w"); EnvDefineFunction2(theEnv,"show-fht",'v', PTIEF ShowFactHashTable,"ShowFactHashTable","00"); #endif #if DEFRULE_CONSTRUCT && OBJECT_SYSTEM EnvDefineFunction2(theEnv,"show-opn",'v',PTIEF PrintObjectPatternNetwork, "PrintObjectPatternNetwork","00"); #endif #if OBJECT_SYSTEM EnvDefineFunction2(theEnv,"instance-table-usage",'v', PTIEF InstanceTableUsage,"InstanceTableUsage","00"); #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 }
globle void ExtendedMathFunctionDefinitions( void *theEnv) { #if ! RUN_TIME EnvDefineFunction2(theEnv,"cos", 'd', PTIEF CosFunction, "CosFunction", "11n"); EnvDefineFunction2(theEnv,"sin", 'd', PTIEF SinFunction, "SinFunction", "11n"); EnvDefineFunction2(theEnv,"tan", 'd', PTIEF TanFunction, "TanFunction", "11n"); EnvDefineFunction2(theEnv,"sec", 'd', PTIEF SecFunction, "SecFunction", "11n"); EnvDefineFunction2(theEnv,"csc", 'd', PTIEF CscFunction, "CscFunction", "11n"); EnvDefineFunction2(theEnv,"cot", 'd', PTIEF CotFunction, "CotFunction", "11n"); EnvDefineFunction2(theEnv,"acos", 'd', PTIEF AcosFunction, "AcosFunction", "11n"); EnvDefineFunction2(theEnv,"asin", 'd', PTIEF AsinFunction, "AsinFunction", "11n"); EnvDefineFunction2(theEnv,"atan", 'd', PTIEF AtanFunction, "AtanFunction", "11n"); EnvDefineFunction2(theEnv,"asec", 'd', PTIEF AsecFunction, "AsecFunction", "11n"); EnvDefineFunction2(theEnv,"acsc", 'd', PTIEF AcscFunction, "AcscFunction", "11n"); EnvDefineFunction2(theEnv,"acot", 'd', PTIEF AcotFunction, "AcotFunction", "11n"); EnvDefineFunction2(theEnv,"cosh", 'd', PTIEF CoshFunction, "CoshFunction", "11n"); EnvDefineFunction2(theEnv,"sinh", 'd', PTIEF SinhFunction, "SinhFunction", "11n"); EnvDefineFunction2(theEnv,"tanh", 'd', PTIEF TanhFunction, "TanhFunction", "11n"); EnvDefineFunction2(theEnv,"sech", 'd', PTIEF SechFunction, "SechFunction", "11n"); EnvDefineFunction2(theEnv,"csch", 'd', PTIEF CschFunction, "CschFunction", "11n"); EnvDefineFunction2(theEnv,"coth", 'd', PTIEF CothFunction, "CothFunction", "11n"); EnvDefineFunction2(theEnv,"acosh", 'd', PTIEF AcoshFunction, "AcoshFunction", "11n"); EnvDefineFunction2(theEnv,"asinh", 'd', PTIEF AsinhFunction, "AsinhFunction", "11n"); EnvDefineFunction2(theEnv,"atanh", 'd', PTIEF AtanhFunction, "AtanhFunction", "11n"); EnvDefineFunction2(theEnv,"asech", 'd', PTIEF AsechFunction, "AsechFunction", "11n"); EnvDefineFunction2(theEnv,"acsch", 'd', PTIEF AcschFunction, "AcschFunction", "11n"); EnvDefineFunction2(theEnv,"acoth", 'd', PTIEF AcothFunction, "AcothFunction", "11n"); EnvDefineFunction2(theEnv,"mod", 'n', PTIEF ModFunction, "ModFunction", "22n"); EnvDefineFunction2(theEnv,"exp", 'd', PTIEF ExpFunction, "ExpFunction", "11n"); EnvDefineFunction2(theEnv,"log", 'd', PTIEF LogFunction, "LogFunction", "11n"); EnvDefineFunction2(theEnv,"log10", 'd', PTIEF Log10Function, "Log10Function", "11n"); EnvDefineFunction2(theEnv,"sqrt", 'd', PTIEF SqrtFunction, "SqrtFunction", "11n"); EnvDefineFunction2(theEnv,"pi", 'd', PTIEF PiFunction, "PiFunction", "00"); EnvDefineFunction2(theEnv,"deg-rad", 'd', PTIEF DegRadFunction, "DegRadFunction", "11n"); EnvDefineFunction2(theEnv,"rad-deg", 'd', PTIEF RadDegFunction, "RadDegFunction", "11n"); EnvDefineFunction2(theEnv,"deg-grad", 'd', PTIEF DegGradFunction, "DegGradFunction", "11n"); EnvDefineFunction2(theEnv,"grad-deg", 'd', PTIEF GradDegFunction, "GradDegFunction", "11n"); EnvDefineFunction2(theEnv,"**", 'd', PTIEF PowFunction, "PowFunction", "22n"); EnvDefineFunction2(theEnv,"round", 'g', PTIEF RoundFunction, "RoundFunction", "11n"); #else #if MAC_XCD #pragma unused(theEnv) #endif #endif }