static void DeallocateProceduralFunctionData( void *theEnv) { struct BindInfo *temp_bind; while (ProcedureParserData(theEnv)->ListOfParsedBindNames != NULL) { temp_bind = ProcedureParserData(theEnv)->ListOfParsedBindNames->next; rtn_struct(theEnv,BindInfo,ProcedureParserData(theEnv)->ListOfParsedBindNames); ProcedureParserData(theEnv)->ListOfParsedBindNames = temp_bind; } }
static int AddBindName( void *theEnv, SYMBOL_HN *variableName, CONSTRAINT_RECORD *theConstraint) { CONSTRAINT_RECORD *tmpConstraint; struct BindInfo *currentBind, *lastBind; int theIndex = 1; /*=========================================================*/ /* Look for the variable name in the list of bind variable */ /* names already parsed. If it is found, then return the */ /* index to the variable and union the new constraint */ /* information with the old constraint information. */ /*=========================================================*/ lastBind = NULL; currentBind = ProcedureParserData(theEnv)->ListOfParsedBindNames; while (currentBind != NULL) { if (currentBind->name == variableName) { if (theConstraint != NULL) { tmpConstraint = currentBind->constraints; currentBind->constraints = UnionConstraints(theEnv,theConstraint,currentBind->constraints); RemoveConstraint(theEnv,tmpConstraint); RemoveConstraint(theEnv,theConstraint); } return(theIndex); } lastBind = currentBind; currentBind = currentBind->next; theIndex++; } /*===============================================================*/ /* If the variable name wasn't found, then add it to the list of */ /* variable names and store the constraint information with it. */ /*===============================================================*/ currentBind = get_struct(theEnv,BindInfo); currentBind->name = variableName; currentBind->constraints = theConstraint; currentBind->next = NULL; if (lastBind == NULL) ProcedureParserData(theEnv)->ListOfParsedBindNames = currentBind; else lastBind->next = currentBind; return(theIndex); }
globle void ClearParsedBindNames( void *theEnv) { struct BindInfo *temp_bind; while (ProcedureParserData(theEnv)->ListOfParsedBindNames != NULL) { temp_bind = ProcedureParserData(theEnv)->ListOfParsedBindNames->next; RemoveConstraint(theEnv,ProcedureParserData(theEnv)->ListOfParsedBindNames->constraints); rtn_struct(theEnv,BindInfo,ProcedureParserData(theEnv)->ListOfParsedBindNames); ProcedureParserData(theEnv)->ListOfParsedBindNames = temp_bind; } }
globle intBool ParsedBindNamesEmpty( void *theEnv) { if (ProcedureParserData(theEnv)->ListOfParsedBindNames != NULL) return(FALSE); return(TRUE); }
globle void RemoveParsedBindName( void *theEnv, struct symbolHashNode *bname) { struct BindInfo *prv,*tmp; prv = NULL; tmp = ProcedureParserData(theEnv)->ListOfParsedBindNames; while ((tmp != NULL) ? (tmp->name != bname) : FALSE) { prv = tmp; tmp = tmp->next; } if (tmp != NULL) { if (prv == NULL) ProcedureParserData(theEnv)->ListOfParsedBindNames = tmp->next; else prv->next = tmp->next; RemoveConstraint(theEnv,tmp->constraints); rtn_struct(theEnv,BindInfo,tmp); } }
globle int CountParsedBindNames( void *theEnv) { struct BindInfo *theVariable; int theIndex = 0; theVariable = ProcedureParserData(theEnv)->ListOfParsedBindNames; while (theVariable != NULL) { theVariable = theVariable->next; theIndex++; } return(theIndex); }
globle struct constraintRecord *FindBindConstraints( void *theEnv, SYMBOL_HN *nameSought) { struct BindInfo *theVariable; theVariable = ProcedureParserData(theEnv)->ListOfParsedBindNames; while (theVariable != NULL) { if (theVariable->name == nameSought) { return(theVariable->constraints); } theVariable = theVariable->next; } return(NULL); }
globle int SearchParsedBindNames( void *theEnv, SYMBOL_HN *name_sought) { struct BindInfo *var_ptr; int theIndex = 1; var_ptr = ProcedureParserData(theEnv)->ListOfParsedBindNames; while (var_ptr != NULL) { if (var_ptr->name == name_sought) { return(theIndex); } var_ptr = var_ptr->next; theIndex++; } return(0); }
globle void SetParsedBindNames( void *theEnv, struct BindInfo *newValue) { ProcedureParserData(theEnv)->ListOfParsedBindNames = newValue; }
globle struct BindInfo *GetParsedBindNames( void *theEnv) { return(ProcedureParserData(theEnv)->ListOfParsedBindNames); }