globle void *SetStrategyCommand( void *theEnv) { DATA_OBJECT argPtr; char *argument; int oldStrategy; oldStrategy = AgendaData(theEnv)->Strategy; /*=====================================================*/ /* Check for the correct number and type of arguments. */ /*=====================================================*/ if (EnvArgCountCheck(theEnv,"set-strategy",EXACTLY,1) == -1) { return((SYMBOL_HN *) EnvAddSymbol(theEnv,GetStrategyName(EnvGetStrategy(theEnv)))); } if (EnvArgTypeCheck(theEnv,"set-strategy",1,SYMBOL,&argPtr) == FALSE) { return((SYMBOL_HN *) EnvAddSymbol(theEnv,GetStrategyName(EnvGetStrategy(theEnv)))); } argument = DOToString(argPtr); /*=============================================*/ /* Set the strategy to the specified strategy. */ /*=============================================*/ if (strcmp(argument,"depth") == 0) { EnvSetStrategy(theEnv,DEPTH_STRATEGY); } else if (strcmp(argument,"breadth") == 0) { EnvSetStrategy(theEnv,BREADTH_STRATEGY); } else if (strcmp(argument,"lex") == 0) { EnvSetStrategy(theEnv,LEX_STRATEGY); } else if (strcmp(argument,"mea") == 0) { EnvSetStrategy(theEnv,MEA_STRATEGY); } else if (strcmp(argument,"complexity") == 0) { EnvSetStrategy(theEnv,COMPLEXITY_STRATEGY); } else if (strcmp(argument,"simplicity") == 0) { EnvSetStrategy(theEnv,SIMPLICITY_STRATEGY); } else if (strcmp(argument,"random") == 0) { EnvSetStrategy(theEnv,RANDOM_STRATEGY); } else { ExpectedTypeError1(theEnv,"set-strategy",1, "symbol with value depth, breadth, lex, mea, complexity, simplicity, or random"); return((SYMBOL_HN *) EnvAddSymbol(theEnv,GetStrategyName(EnvGetStrategy(theEnv)))); } /*=======================================*/ /* Return the old value of the strategy. */ /*=======================================*/ return((SYMBOL_HN *) EnvAddSymbol(theEnv,GetStrategyName(oldStrategy))); }
globle void *GetStrategyCommand( void *theEnv) { EnvArgCountCheck(theEnv,"get-strategy",EXACTLY,0); return((SYMBOL_HN *) EnvAddSymbol(theEnv,GetStrategyName(EnvGetStrategy(theEnv)))); }
void SaveExecutionInformation() { HKEY hKey; DWORD lpdwDisposition; struct ExecutionInformation executionInfo; if (RegCreateKeyEx(HKEY_CURRENT_USER,TEXT("Software\\CLIPS\\CLIPSWin"),0,"",0, KEY_READ | KEY_WRITE,NULL,&hKey,&lpdwDisposition) != ERROR_SUCCESS) { return; } executionInfo.salienceEvaluation = EnvGetSalienceEvaluation(GlobalEnv); executionInfo.strategy = EnvGetStrategy(GlobalEnv); executionInfo.staticConstraintChecking = (boolean) EnvGetStaticConstraintChecking(GlobalEnv); executionInfo.dynamicConstraintChecking = (boolean) EnvGetDynamicConstraintChecking(GlobalEnv); executionInfo.autoFloatDividend = (boolean) EnvGetAutoFloatDividend(GlobalEnv); executionInfo.resetGlobals = (boolean) EnvGetResetGlobals(GlobalEnv); executionInfo.factDuplication = (boolean) EnvGetFactDuplication(GlobalEnv); executionInfo.incrementalReset = (boolean) EnvGetIncrementalReset(GlobalEnv); executionInfo.sequenceOperatorRecognition = (boolean) EnvGetSequenceOperatorRecognition(GlobalEnv); if (RegSetValueEx(hKey,"Execution",0,REG_BINARY,(BYTE *) &executionInfo, sizeof(struct ExecutionInformation)) != ERROR_SUCCESS) { RegCloseKey(hKey); return; } RegCloseKey(hKey); }
/******************************************************************************* Name: UpdateOptionsMenu Description: Set menu item mark on options selected Arguments: None Returns: None *******************************************************************************/ void UpdateOptionsMenu() { int i; unsigned n = 0; void *theEnv = GetCurrentEnvironment(); XtSetArg(TheArgs[n], XtNleftBitmap, None);n++; for(i = 0; i <= RANDOM_STRATEGY;i++) XtSetValues(strategy_widgets[i], TheArgs, n); for(i = 0; i <= EVERY_CYCLE;i++) XtSetValues(sal_opt_widgets[i],TheArgs,n); n = 0; XtSetArg(TheArgs[n], XtNleftBitmap, checker);n++; XtSetValues(strategy_widgets[EnvGetStrategy(theEnv)],TheArgs,n); XtSetValues(sal_opt_widgets[EnvGetSalienceEvaluation(theEnv)],TheArgs,n); n = 0; if (EnvGetFactDuplication(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_FACT_DUPLICATION], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_FACT_DUPLICATION], TheArgs, n); } n = 0; if (EnvGetDynamicConstraintChecking(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_DYN_CONSTRAINT_CHK], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_DYN_CONSTRAINT_CHK], TheArgs, n); } n = 0; if (EnvGetStaticConstraintChecking(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_STA_CONSTRAINT_CHK], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_STA_CONSTRAINT_CHK], TheArgs, n); } n = 0; if (EnvGetSequenceOperatorRecognition(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_SEQUENCE_OPT_REG], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_SEQUENCE_OPT_REG], TheArgs, n); } n = 0; if (EnvGetAutoFloatDividend(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_AUTO_FLOAT_DIV], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_AUTO_FLOAT_DIV], TheArgs, n); } n = 0; if (EnvGetIncrementalReset(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_INCREMENTAL_RESET], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_INCREMENTAL_RESET], TheArgs, n); } n = 0; if (EnvGetResetGlobals(theEnv)) { XtSetArg(TheArgs[n], XtNstate,True);n++; XtSetValues(option_widgets[INT_RESET_GLOBALS], TheArgs, n); } else { XtSetArg(TheArgs[n], XtNstate,False);n++; XtSetValues(option_widgets[INT_RESET_GLOBALS], TheArgs, n); } }