diff options
Diffstat (limited to 'src/factrhs.c')
-rw-r--r-- | src/factrhs.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/src/factrhs.c b/src/factrhs.c index 285dbc6..9da8215 100644 --- a/src/factrhs.c +++ b/src/factrhs.c @@ -1,7 +1,7 @@ /*******************************************************/ /* "C" Language Integrated Production System */ /* */ - /* CLIPS Version 6.21 06/15/03 */ + /* CLIPS Version 6.30 02/05/15 */ /* */ /* FACT RHS PATTERN PARSER MODULE */ /*******************************************************/ @@ -18,10 +18,21 @@ /* */ /* Contributing Programmer(s): */ /* Chris Culbert */ -/* Brian L. Donnell */ +/* Brian L. Dantes */ /* */ /* Revision History: */ /* */ +/* 6.30: Added const qualifiers to remove C++ */ +/* deprecation warnings. */ +/* */ +/* Added code to prevent a clear command from */ +/* being executed during fact assertions via */ +/* Increment/DecrementClearReadyLocks API. */ +/* */ +/* Added code to keep track of pointers to */ +/* constructs that are contained externally to */ +/* to constructs, DanglingConstructs. */ +/* */ /*************************************************************/ #define _FACTRHS_SOURCE_ @@ -61,7 +72,7 @@ /***************************************/ #if RUN_TIME || BLOAD_ONLY || BLOAD || BLOAD_AND_BSAVE - static void NoSuchTemplateError(void *,char *); + static void NoSuchTemplateError(void *,const char *); #endif #if (! RUN_TIME) @@ -75,12 +86,12 @@ /**********************************************************************/ globle struct expr *BuildRHSAssert( void *theEnv, - char *logicalName, + const char *logicalName, struct token *theToken, int *error, int atLeastOne, int readFirstParen, - char *whereParsed) + const char *whereParsed) { struct expr *lastOne, *nextOne, *assertList, *stub; @@ -196,7 +207,7 @@ globle struct expr *BuildRHSAssert( /***************************************************************/ globle struct expr *GetRHSPattern( void *theEnv, - char *readSource, + const char *readSource, struct token *tempToken, int *error, int constantsOnly, @@ -209,6 +220,7 @@ globle struct expr *GetRHSPattern( int printError, count; struct deftemplate *theDeftemplate; struct symbolHashNode *templateName; + const char *nullBitMap = "\0"; /*=================================================*/ /* Get the opening parenthesis of the RHS pattern. */ @@ -338,6 +350,12 @@ globle struct expr *GetRHSPattern( firstOne->nextArg = ParseAssertTemplate(theEnv,readSource,tempToken, error,endType, constantsOnly,theDeftemplate); + +#if (! RUN_TIME) && (! BLOAD_ONLY) + if (! ConstructData(theEnv)->ParsingConstruct) + { ConstructData(theEnv)->DanglingConstructs++; } +#endif + if (*error) { ReturnExpression(theEnv,firstOne); @@ -354,6 +372,11 @@ globle struct expr *GetRHSPattern( firstOne = GenConstant(theEnv,DEFTEMPLATE_PTR,theDeftemplate); #if (! RUN_TIME) && (! BLOAD_ONLY) + if (! ConstructData(theEnv)->ParsingConstruct) + { ConstructData(theEnv)->DanglingConstructs++; } +#endif + +#if (! RUN_TIME) && (! BLOAD_ONLY) SavePPBuffer(theEnv," "); #endif @@ -397,7 +420,7 @@ globle struct expr *GetRHSPattern( /* single multifield slot. */ /*==========================================================*/ - firstOne->nextArg = GenConstant(theEnv,FACT_STORE_MULTIFIELD,AddBitMap(theEnv,(void *) "\0",1)); + firstOne->nextArg = GenConstant(theEnv,FACT_STORE_MULTIFIELD,EnvAddBitMap(theEnv,(void *) nullBitMap,1)); firstOne->nextArg->argList = argHead; /*==============================*/ @@ -417,7 +440,7 @@ globle struct expr *GetRHSPattern( /********************************************************************/ globle struct expr *GetAssertArgument( void *theEnv, - char *logicalName, + const char *logicalName, struct token *theToken, int *error, int endType, @@ -528,7 +551,7 @@ globle struct expr *GetAssertArgument( /****************************************************/ globle struct fact *StringToFact( void *theEnv, - char *str) + const char *str) { struct token theToken; struct fact *factPtr; @@ -541,7 +564,7 @@ globle struct fact *StringToFact( /* Open a string router and parse the fact */ /* using the router as an input source. */ /*=========================================*/ - + SetEvaluationError(theEnv,FALSE); OpenStringSource(theEnv,"assert_str",str,0); @@ -555,7 +578,7 @@ globle struct fact *StringToFact( /*===========================================*/ /* Check for errors or the use of variables. */ /*===========================================*/ - + if ((assertArgs == NULL) && (! error)) { SyntaxErrorMessage(theEnv,"RHS patterns"); @@ -592,6 +615,7 @@ globle struct fact *StringToFact( /* Copy the fields to the fact data structure. */ /*=============================================*/ + EnvIncrementClearReadyLocks(theEnv); ExpressionInstall(theEnv,assertArgs); /* DR0836 */ whichField = 0; for (tempPtr = assertArgs->nextArg; tempPtr != NULL; tempPtr = tempPtr->nextArg) @@ -603,6 +627,7 @@ globle struct fact *StringToFact( } ExpressionDeinstall(theEnv,assertArgs); /* DR0836 */ ReturnExpression(theEnv,assertArgs); + EnvDecrementClearReadyLocks(theEnv); /*==================*/ /* Return the fact. */ @@ -621,7 +646,7 @@ globle struct fact *StringToFact( /*********************************************************/ static void NoSuchTemplateError( void *theEnv, - char *templateName) + const char *templateName) { PrintErrorID(theEnv,"FACTRHS",1,FALSE); EnvPrintRouter(theEnv,WERROR,"Template "); |