Example #1
0
/***************************************************
  NAME         : ClearBloadObjectPatterns
  DESCRIPTION  : Releases all emmory associated
                 with binary image object patterns
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Memory released and global
                 network pointers set to NULL
  NOTES        : None
 ***************************************************/
static void ClearBloadObjectPatterns()
  {
   UNLN space;
   register long i;

   /* ================================================
      All instances have been deleted by this point
      so we don't need to worry about clearing partial
      matches
      ================================================ */
   for (i = 0L ; i < AlphaNodeCount ; i++)
     {
      DecrementBitMapCount(AlphaArray[i].classbmp);
      if (AlphaArray[i].slotbmp != NULL)
        DecrementBitMapCount(AlphaArray[i].slotbmp);
     }

   if (AlphaNodeCount != 0L)
     {
      space = (UNLN) (AlphaNodeCount * sizeof(OBJECT_ALPHA_NODE));
      genlongfree((void *) AlphaArray,space);
      AlphaArray = NULL;
      space = (UNLN) (PatternNodeCount * sizeof(OBJECT_PATTERN_NODE));
      genlongfree((void *) PatternArray,space);
      PatternArray = NULL;
     }

   SetObjectNetworkTerminalPointer(NULL);
   SetObjectNetworkPointer(NULL);
#if BLOAD_ONLY
   ResetObjectMatchTimeTags();
#endif
  }
Example #2
0
/****************************************************
  NAME         : BloadObjectPatterns
  DESCRIPTION  : Reads in all object pattern
                 data structures from binary
                 image and updates pointers
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Binary data structures updated
  NOTES        : Assumes storage allocated previously
 ****************************************************/
static void BloadObjectPatterns(
  void *theEnv,
  EXEC_STATUS)
  {
   size_t space;
   long i;

   GenReadBinary(theEnv,execStatus,(void *) &space,sizeof(size_t));
   if (space == 0L)
     return;

   /* ================================================
      Read in the alpha and intermediate pattern nodes
      ================================================ */
   BloadandRefresh(theEnv,execStatus,ObjectReteBinaryData(theEnv,execStatus)->AlphaNodeCount,sizeof(BSAVE_OBJECT_ALPHA_NODE),UpdateAlpha);
   BloadandRefresh(theEnv,execStatus,ObjectReteBinaryData(theEnv,execStatus)->PatternNodeCount,sizeof(BSAVE_OBJECT_PATTERN_NODE),UpdatePattern);

   for (i = 0; i < ObjectReteBinaryData(theEnv,execStatus)->PatternNodeCount; i++)
     {
      if ((ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].lastLevel != NULL) &&
          (ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].lastLevel->selector))
        { 
         AddHashedPatternNode(theEnv,execStatus,ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].lastLevel,
                                     &ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i],
                                     ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].networkTest->type,
                                     ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].networkTest->value); 
        }
     }

   /* =======================
      Set the global pointers
      ======================= */
   SetObjectNetworkTerminalPointer(theEnv,execStatus,(OBJECT_ALPHA_NODE *) &ObjectReteBinaryData(theEnv,execStatus)->AlphaArray[0]);
   SetObjectNetworkPointer(theEnv,execStatus,(OBJECT_PATTERN_NODE *) &ObjectReteBinaryData(theEnv,execStatus)->PatternArray[0]);
  }
Example #3
0
/***************************************************
  NAME         : ClearBloadObjectPatterns
  DESCRIPTION  : Releases all emmory associated
                 with binary image object patterns
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Memory released and global
                 network pointers set to NULL
  NOTES        : None
 ***************************************************/
static void ClearBloadObjectPatterns(
  void *theEnv,
  EXEC_STATUS)
  {
   size_t space;
   register long i;

   for (i = 0; i < ObjectReteBinaryData(theEnv,execStatus)->PatternNodeCount; i++)
     {
      if ((ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].lastLevel != NULL) &&
          (ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].lastLevel->selector))
        { 
         RemoveHashedPatternNode(theEnv,execStatus,ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].lastLevel,
                                        &ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i],
                                        ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].networkTest->type,
                                        ObjectReteBinaryData(theEnv,execStatus)->PatternArray[i].networkTest->value); 
        }
     }

   /* ================================================
      All instances have been deleted by this point
      so we don't need to worry about clearing partial
      matches
      ================================================ */
   for (i = 0L ; i < ObjectReteBinaryData(theEnv,execStatus)->AlphaNodeCount ; i++)
     {
      DecrementBitMapCount(theEnv,execStatus,ObjectReteBinaryData(theEnv,execStatus)->AlphaArray[i].classbmp);
      if (ObjectReteBinaryData(theEnv,execStatus)->AlphaArray[i].slotbmp != NULL)
        DecrementBitMapCount(theEnv,execStatus,ObjectReteBinaryData(theEnv,execStatus)->AlphaArray[i].slotbmp);
     }

   if (ObjectReteBinaryData(theEnv,execStatus)->AlphaNodeCount != 0L)
     {
      space = (ObjectReteBinaryData(theEnv,execStatus)->AlphaNodeCount * sizeof(OBJECT_ALPHA_NODE));
      genfree(theEnv,execStatus,(void *) ObjectReteBinaryData(theEnv,execStatus)->AlphaArray,space);
      ObjectReteBinaryData(theEnv,execStatus)->AlphaArray = NULL;
      ObjectReteBinaryData(theEnv,execStatus)->AlphaNodeCount = 0;
      space = (ObjectReteBinaryData(theEnv,execStatus)->PatternNodeCount * sizeof(OBJECT_PATTERN_NODE));
      genfree(theEnv,execStatus,(void *) ObjectReteBinaryData(theEnv,execStatus)->PatternArray,space);
      ObjectReteBinaryData(theEnv,execStatus)->PatternArray = NULL;
      ObjectReteBinaryData(theEnv,execStatus)->PatternNodeCount = 0;
     }

   SetObjectNetworkTerminalPointer(theEnv,execStatus,NULL);
   SetObjectNetworkPointer(theEnv,execStatus,NULL);
#if BLOAD_ONLY
   ResetObjectMatchTimeTags(theEnv,execStatus);
#endif
  }
Example #4
0
/****************************************************
  NAME         : BloadObjectPatterns
  DESCRIPTION  : Reads in all object pattern
                 data structures from binary
                 image and updates pointers
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Binary data structures updated
  NOTES        : Assumes storage allocated previously
 ****************************************************/
static void BloadObjectPatterns()
  {
   UNLN space;

   GenRead((void *) &space,(UNLN) sizeof(UNLN));
   if (space == 0L)
     return;

   /* ================================================
      Read in the alpha and intermediate pattern nodes
      ================================================ */
   BloadandRefresh(AlphaNodeCount,(unsigned) sizeof(BSAVE_OBJECT_ALPHA_NODE),UpdateAlpha);
   BloadandRefresh(PatternNodeCount,(unsigned) sizeof(BSAVE_OBJECT_PATTERN_NODE),UpdatePattern);

   /* =======================
      Set the global pointers
      ======================= */
   SetObjectNetworkTerminalPointer((OBJECT_ALPHA_NODE *) &AlphaArray[0]);
   SetObjectNetworkPointer((OBJECT_PATTERN_NODE *) &PatternArray[0]);
  }