globle void FlushMultifields( void *theEnv) { struct multifield *theSegment, *nextPtr, *lastPtr = NULL; unsigned long newSize; theSegment = MultifieldData(theEnv)->ListOfMultifields; while (theSegment != NULL) { nextPtr = theSegment->next; if ((theSegment->depth > EvaluationData(theEnv)->CurrentEvaluationDepth) && (theSegment->busyCount == 0)) { UtilityData(theEnv)->EphemeralItemCount--; UtilityData(theEnv)->EphemeralItemSize -= sizeof(struct multifield) + (sizeof(struct field) * theSegment->multifieldLength); if (theSegment->multifieldLength == 0) newSize = 1; else newSize = theSegment->multifieldLength; rtn_var_struct2(theEnv,multifield,sizeof(struct field) * (newSize - 1),theSegment); if (lastPtr == NULL) MultifieldData(theEnv)->ListOfMultifields = nextPtr; else lastPtr->next = nextPtr; } else { lastPtr = theSegment; } theSegment = nextPtr; } }
globle void ReturnMultifield( struct multifield *theSegment) { long newSize; /* 6.04 Bug Fix */ if (theSegment == NULL) return; if (theSegment->multifieldLength == 0) newSize = 1; else newSize = theSegment->multifieldLength; rtn_var_struct2(multifield,sizeof(struct field) * (newSize - 1),theSegment); }
globle void ReturnMultifield( void *theEnv, struct multifield *theSegment) { unsigned long newSize; if (theSegment == NULL) return; if (theSegment->multifieldLength == 0) newSize = 1; else newSize = theSegment->multifieldLength; rtn_var_struct2(theEnv,multifield,sizeof(struct field) * (newSize - 1),theSegment); }
globle void ReturnFact( struct fact *theFact) { struct multifield *theSegment; int newSize, i; theSegment = &theFact->theProposition; for (i = 0; i < (int) theSegment->multifieldLength; i++) { if (theSegment->theFields[i].type == MULTIFIELD) { ReturnMultifield((struct multifield *) theSegment->theFields[i].value); } } if (theFact->theProposition.multifieldLength == 0) newSize = 1; else newSize = theFact->theProposition.multifieldLength; rtn_var_struct2(fact,sizeof(struct field) * (newSize - 1),theFact); }