Exemple #1
0
/***********************************************************************
  NAME         : BloadStorageDefinstances
  DESCRIPTION  : This routine space required for definstances
                   structures and allocates space for them
  INPUTS       : Nothing
  RETURNS      : Nothing useful
  SIDE EFFECTS : Arrays allocated and set
  NOTES        : This routine makes no attempt to reset any pointers
                   within the structures
 ***********************************************************************/
static void BloadStorageDefinstances(
  void *theEnv)
  {
   unsigned long space;

   GenReadBinary(theEnv,(void *) &space,(unsigned long) sizeof(unsigned long));
   if (space == 0L)
     return;
   GenReadBinary(theEnv,(void *) &DefinstancesBinaryData(theEnv)->ModuleCount,(unsigned long) sizeof(unsigned long));
   GenReadBinary(theEnv,(void *) &DefinstancesBinaryData(theEnv)->DefinstancesCount,(unsigned long) sizeof(unsigned long));
   if (DefinstancesBinaryData(theEnv)->ModuleCount == 0L)
     {
      DefinstancesBinaryData(theEnv)->ModuleArray = NULL;
      DefinstancesBinaryData(theEnv)->DefinstancesArray = NULL;
      return;
     }

   space = (unsigned long) (DefinstancesBinaryData(theEnv)->ModuleCount * sizeof(DEFINSTANCES_MODULE));
   DefinstancesBinaryData(theEnv)->ModuleArray = (DEFINSTANCES_MODULE *) genlongalloc(theEnv,space);

   if (DefinstancesBinaryData(theEnv)->DefinstancesCount == 0L)
     {
      DefinstancesBinaryData(theEnv)->DefinstancesArray = NULL;
      return;
     }

   space = (unsigned long) (DefinstancesBinaryData(theEnv)->DefinstancesCount * sizeof(DEFINSTANCES));
   DefinstancesBinaryData(theEnv)->DefinstancesArray = (DEFINSTANCES *) genlongalloc(theEnv,space);
  }
Exemple #2
0
/***********************************************************************
  NAME         : BloadStorageDeffunctions
  DESCRIPTION  : This routine space required for deffunction
                   structures and allocates space for them
  INPUTS       : Nothing
  RETURNS      : Nothing useful
  SIDE EFFECTS : Arrays allocated and set
  NOTES        : This routine makes no attempt to reset any pointers
                   within the structures
 ***********************************************************************/
static void BloadStorageDeffunctions(
  void *theEnv)
  {
   unsigned long space;

   GenReadBinary(theEnv,(void *) &space,(unsigned long) sizeof(unsigned long));
   if (space == 0L)
     return;
   GenReadBinary(theEnv,(void *) &DeffunctionBinaryData(theEnv)->ModuleCount,(unsigned long) sizeof(unsigned long));
   GenReadBinary(theEnv,(void *) &DeffunctionBinaryData(theEnv)->DeffunctionCount,(unsigned long) sizeof(unsigned long));
   if (DeffunctionBinaryData(theEnv)->ModuleCount == 0L)
     {
      DeffunctionBinaryData(theEnv)->ModuleArray = NULL;
      DeffunctionBinaryData(theEnv)->DeffunctionArray = NULL;
      return;
     }

   space = (unsigned long) (DeffunctionBinaryData(theEnv)->ModuleCount * sizeof(DEFFUNCTION_MODULE));
   DeffunctionBinaryData(theEnv)->ModuleArray = (DEFFUNCTION_MODULE *) genlongalloc(theEnv,space);

   if (DeffunctionBinaryData(theEnv)->DeffunctionCount == 0L)
     {
      DeffunctionBinaryData(theEnv)->DeffunctionArray = NULL;
      return;
     }

   space = (unsigned long) (DeffunctionBinaryData(theEnv)->DeffunctionCount * sizeof(DEFFUNCTION));
   DeffunctionBinaryData(theEnv)->DeffunctionArray = (DEFFUNCTION *) genlongalloc(theEnv,space);
  }
Exemple #3
0
/***********************************************************************
  NAME         : BloadStorageDeffunctions
  DESCRIPTION  : This routine space required for deffunction
                   structures and allocates space for them
  INPUTS       : Nothing
  RETURNS      : Nothing useful
  SIDE EFFECTS : Arrays allocated and set
  NOTES        : This routine makes no attempt to reset any pointers
                   within the structures
 ***********************************************************************/
static void BloadStorageDeffunctions()
  {
   unsigned long space;

   GenRead((void *) &space,(unsigned long) sizeof(unsigned long));
   if (space == 0L)
     return;
   GenRead((void *) &ModuleCount,(unsigned long) sizeof(unsigned long));
   GenRead((void *) &DeffunctionCount,(unsigned long) sizeof(unsigned long));
   if (ModuleCount == 0L)
     {
      ModuleArray = NULL;
      deffunctionArray = NULL;
      return;
     }

   space = (unsigned long) (ModuleCount * sizeof(DEFFUNCTION_MODULE));
   ModuleArray = (DEFFUNCTION_MODULE *) genlongalloc(space);

   if (DeffunctionCount == 0L)
     {
      deffunctionArray = NULL;
      return;
     }

   space = (unsigned long) (DeffunctionCount * sizeof(DEFFUNCTION));
   deffunctionArray = (DEFFUNCTION *) genlongalloc(space);
  }
Exemple #4
0
static void BloadStorage(
  void *theEnv)
  {
   unsigned long int space;

   /*=========================================================*/
   /* Determine the number of deftemplate, deftemplateModule, */
   /* and templateSlot data structures to be read.            */
   /*=========================================================*/

   GenReadBinary(theEnv,&space,(unsigned long) sizeof(unsigned long int));
   GenReadBinary(theEnv,&DeftemplateBinaryData(theEnv)->NumberOfDeftemplates,(unsigned long) sizeof(long int));
   GenReadBinary(theEnv,&DeftemplateBinaryData(theEnv)->NumberOfTemplateSlots,(unsigned long) sizeof(long int));
   GenReadBinary(theEnv,&DeftemplateBinaryData(theEnv)->NumberOfTemplateModules,(unsigned long) sizeof(long int));

   /*====================================*/
   /* Allocate the space needed for the  */
   /* deftemplateModule data structures. */
   /*====================================*/

   if (DeftemplateBinaryData(theEnv)->NumberOfTemplateModules == 0)
     {
      DeftemplateBinaryData(theEnv)->DeftemplateArray = NULL;
      DeftemplateBinaryData(theEnv)->SlotArray = NULL;
      DeftemplateBinaryData(theEnv)->ModuleArray = NULL;
      return;
     }

   space = DeftemplateBinaryData(theEnv)->NumberOfTemplateModules * sizeof(struct deftemplateModule);
   DeftemplateBinaryData(theEnv)->ModuleArray = (struct deftemplateModule *) genlongalloc(theEnv,space);

   /*===================================*/
   /* Allocate the space needed for the */
   /* deftemplate data structures.      */
   /*===================================*/

   if (DeftemplateBinaryData(theEnv)->NumberOfDeftemplates == 0)
     {
      DeftemplateBinaryData(theEnv)->DeftemplateArray = NULL;
      DeftemplateBinaryData(theEnv)->SlotArray = NULL;
      return;
     }

   space = DeftemplateBinaryData(theEnv)->NumberOfDeftemplates * sizeof(struct deftemplate);
   DeftemplateBinaryData(theEnv)->DeftemplateArray = (struct deftemplate *) genlongalloc(theEnv,space);

   /*===================================*/
   /* Allocate the space needed for the */
   /* templateSlot data structures.     */
   /*===================================*/

   if (DeftemplateBinaryData(theEnv)->NumberOfTemplateSlots == 0)
     {
      DeftemplateBinaryData(theEnv)->SlotArray = NULL;
      return;
     }

   space =  DeftemplateBinaryData(theEnv)->NumberOfTemplateSlots * sizeof(struct templateSlot);
   DeftemplateBinaryData(theEnv)->SlotArray = (struct templateSlot *) genlongalloc(theEnv,space);
  }
/***************************************************
  NAME         : BloadStorageObjectPatterns
  DESCRIPTION  : Reads in the storage requirements
                 for the object patterns in this
                 bload image
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Counts read and arrays allocated
  NOTES        : None
 ***************************************************/
static void BloadStorageObjectPatterns(
  void *theEnv)
  {
   UNLN space;
   long counts[2];

   GenReadBinary(theEnv,(void *) &space,(UNLN) sizeof(UNLN));
   GenReadBinary(theEnv,(void *) counts,space);
   ObjectReteBinaryData(theEnv)->AlphaNodeCount = counts[0];
   ObjectReteBinaryData(theEnv)->PatternNodeCount = counts[1];

   if (ObjectReteBinaryData(theEnv)->AlphaNodeCount == 0L)
     ObjectReteBinaryData(theEnv)->AlphaArray = NULL;
   else
     {
      space = (UNLN) (ObjectReteBinaryData(theEnv)->AlphaNodeCount * sizeof(OBJECT_ALPHA_NODE));
      ObjectReteBinaryData(theEnv)->AlphaArray = (OBJECT_ALPHA_NODE *) genlongalloc(theEnv,space);
     }
   if (ObjectReteBinaryData(theEnv)->PatternNodeCount == 0L)
     ObjectReteBinaryData(theEnv)->PatternArray = NULL;
   else
     {
      space = (UNLN) (ObjectReteBinaryData(theEnv)->PatternNodeCount * sizeof(OBJECT_PATTERN_NODE));
      ObjectReteBinaryData(theEnv)->PatternArray = (OBJECT_PATTERN_NODE *) genlongalloc(theEnv,space);
     }
  }
Exemple #6
0
/***************************************************
  NAME         : BloadStorageObjectPatterns
  DESCRIPTION  : Reads in the storage requirements
                 for the object patterns in this
                 bload image
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Counts read and arrays allocated
  NOTES        : None
 ***************************************************/
static void BloadStorageObjectPatterns()
  {
   UNLN space;
   long counts[2];

   GenRead((void *) &space,(UNLN) sizeof(UNLN));
   GenRead((void *) counts,space);
   AlphaNodeCount = counts[0];
   PatternNodeCount = counts[1];

   if (AlphaNodeCount == 0L)
     AlphaArray = NULL;
   else
     {
      space = (UNLN) (AlphaNodeCount * sizeof(OBJECT_ALPHA_NODE));
      AlphaArray = (OBJECT_ALPHA_NODE *) genlongalloc(space);
     }
   if (PatternNodeCount == 0L)
     PatternArray = NULL;
   else
     {
      space = (UNLN) (PatternNodeCount * sizeof(OBJECT_PATTERN_NODE));
      PatternArray = (OBJECT_PATTERN_NODE *) genlongalloc(space);
     }
  }
Exemple #7
0
static void BloadStorage(
  void *theEnv)
  {
   unsigned long space;

   /*=================================================*/
   /* Determine the number of defrule, defruleModule, */
   /* and joinNode data structures to be read.        */
   /*=================================================*/

   GenReadBinary(theEnv,&space,(unsigned long) sizeof(unsigned long int));
   GenReadBinary(theEnv,&DefruleBinaryData(theEnv)->NumberOfDefruleModules,(unsigned long) sizeof(long int));
   GenReadBinary(theEnv,&DefruleBinaryData(theEnv)->NumberOfDefrules,(unsigned long) sizeof(long int));
   GenReadBinary(theEnv,&DefruleBinaryData(theEnv)->NumberOfJoins,(unsigned long) sizeof(long int));

   /*===================================*/
   /* Allocate the space needed for the */
   /* defruleModule data structures.    */
   /*===================================*/

   if (DefruleBinaryData(theEnv)->NumberOfDefruleModules == 0)
     {
      DefruleBinaryData(theEnv)->ModuleArray = NULL;
      DefruleBinaryData(theEnv)->DefruleArray = NULL;
      DefruleBinaryData(theEnv)->JoinArray = NULL;
     }

   space = DefruleBinaryData(theEnv)->NumberOfDefruleModules * sizeof(struct defruleModule);
   DefruleBinaryData(theEnv)->ModuleArray = (struct defruleModule *) genlongalloc(theEnv,space);

   /*===============================*/
   /* Allocate the space needed for */
   /* the defrule data structures.  */
   /*===============================*/

   if (DefruleBinaryData(theEnv)->NumberOfDefrules == 0)
     {
      DefruleBinaryData(theEnv)->DefruleArray = NULL;
      DefruleBinaryData(theEnv)->JoinArray = NULL;
      return;
     }

   space = DefruleBinaryData(theEnv)->NumberOfDefrules * sizeof(struct defrule);
   DefruleBinaryData(theEnv)->DefruleArray = (struct defrule *) genlongalloc(theEnv,space);

   /*===============================*/
   /* Allocate the space needed for */
   /* the joinNode data structures. */
   /*===============================*/

   space = DefruleBinaryData(theEnv)->NumberOfJoins * sizeof(struct joinNode);
   DefruleBinaryData(theEnv)->JoinArray = (struct joinNode *) genlongalloc(theEnv,space);
  }
/***********************************************************************
  NAME         : BloadStorageGenerics
  DESCRIPTION  : This routine space required for generic function
                   structures and allocates space for them
  INPUTS       : Nothing
  RETURNS      : Nothing useful
  SIDE EFFECTS : Arrays allocated and set
  NOTES        : This routine makes no attempt to reset any pointers
                   within the structures
 ***********************************************************************/
static void BloadStorageGenerics(
  void *theEnv)
  {
   unsigned long space;
   long counts[5];

   GenReadBinary(theEnv,(void *) &space,(unsigned long) sizeof(unsigned long));
   if (space == 0L)
     return;
   GenReadBinary(theEnv,(void *) counts,space);
   DefgenericBinaryData(theEnv)->ModuleCount = counts[0];
   DefgenericBinaryData(theEnv)->GenericCount = counts[1];
   DefgenericBinaryData(theEnv)->MethodCount = counts[2];
   DefgenericBinaryData(theEnv)->RestrictionCount = counts[3];
   DefgenericBinaryData(theEnv)->TypeCount = counts[4];
   if (DefgenericBinaryData(theEnv)->ModuleCount != 0L)
     {
      space = (unsigned long) (sizeof(DEFGENERIC_MODULE) * DefgenericBinaryData(theEnv)->ModuleCount);
      DefgenericBinaryData(theEnv)->ModuleArray = (DEFGENERIC_MODULE *) genlongalloc(theEnv,space);
     }
   else
     return;
   if (DefgenericBinaryData(theEnv)->GenericCount != 0L)
     {
      space = (unsigned long) (sizeof(DEFGENERIC) * DefgenericBinaryData(theEnv)->GenericCount);
      DefgenericBinaryData(theEnv)->DefgenericArray = (DEFGENERIC *) genlongalloc(theEnv,space);
     }
   else
     return;
   if (DefgenericBinaryData(theEnv)->MethodCount != 0L)
     {
      space = (unsigned long) (sizeof(DEFMETHOD) * DefgenericBinaryData(theEnv)->MethodCount);
      DefgenericBinaryData(theEnv)->MethodArray = (DEFMETHOD *) genlongalloc(theEnv,space);
     }
   else
     return;
   if (DefgenericBinaryData(theEnv)->RestrictionCount != 0L)
     {
      space = (unsigned long) (sizeof(RESTRICTION) * DefgenericBinaryData(theEnv)->RestrictionCount);
      DefgenericBinaryData(theEnv)->RestrictionArray = (RESTRICTION *) genlongalloc(theEnv,space);
     }
   else
     return;
   if (DefgenericBinaryData(theEnv)->TypeCount != 0L)
     {
      space = (unsigned long) (sizeof(void *) * DefgenericBinaryData(theEnv)->TypeCount);
      DefgenericBinaryData(theEnv)->TypeArray = (void * *) genlongalloc(theEnv,space);
     }
  }
Exemple #9
0
/***********************************************************************
  NAME         : BloadStorageGenerics
  DESCRIPTION  : This routine space required for generic function
                   structures and allocates space for them
  INPUTS       : Nothing
  RETURNS      : Nothing useful
  SIDE EFFECTS : Arrays allocated and set
  NOTES        : This routine makes no attempt to reset any pointers
                   within the structures
 ***********************************************************************/
static void BloadStorageGenerics()
  {
   unsigned long space;
   long counts[5];

   GenRead((void *) &space,(unsigned long) sizeof(unsigned long));
   if (space == 0L)
     return;
   GenRead((void *) counts,space);
   ModuleCount = counts[0];
   GenericCount = counts[1];
   MethodCount = counts[2];
   RestrictionCount = counts[3];
   TypeCount = counts[4];
   if (ModuleCount != 0L)
     {
      space = (unsigned long) (sizeof(DEFGENERIC_MODULE) * ModuleCount);
      ModuleArray = (DEFGENERIC_MODULE *) genlongalloc(space);
     }
   else
     return;
   if (GenericCount != 0L)
     {
      space = (unsigned long) (sizeof(DEFGENERIC) * GenericCount);
      defgenericArray = (DEFGENERIC *) genlongalloc(space);
     }
   else
     return;
   if (MethodCount != 0L)
     {
      space = (unsigned long) (sizeof(DEFMETHOD) * MethodCount);
      methodArray = (DEFMETHOD *) genlongalloc(space);
     }
   else
     return;
   if (RestrictionCount != 0L)
     {
      space = (unsigned long) (sizeof(RESTRICTION) * RestrictionCount);
      restrictionArray = (RESTRICTION *) genlongalloc(space);
     }
   else
     return;
   if (TypeCount != 0L)
     {
      space = (unsigned long) (sizeof(void *) * TypeCount);
      typeArray = (void * *) genlongalloc(space);
     }
  }
Exemple #10
0
static void BloadStorage(
  void *theEnv)
  {
   unsigned long int space;

   /*=======================================*/
   /* Determine the number of defmodule and */
   /* port item data structures to be read. */
   /*=======================================*/

   GenReadBinary(theEnv,&space,(unsigned long) sizeof(unsigned long int));
   GenReadBinary(theEnv,&DefmoduleData(theEnv)->BNumberOfDefmodules,(unsigned long) sizeof(long int));
   GenReadBinary(theEnv,&DefmoduleData(theEnv)->NumberOfPortItems,(unsigned long) sizeof(long int));

   /*================================*/
   /* Allocate the space needed for  */
   /* the defmodule data structures. */
   /*================================*/

   if (DefmoduleData(theEnv)->BNumberOfDefmodules == 0)
     {
      DefmoduleData(theEnv)->DefmoduleArray = NULL;
      return;
     }

   space = (unsigned long) (DefmoduleData(theEnv)->BNumberOfDefmodules * sizeof(struct defmodule));
   DefmoduleData(theEnv)->DefmoduleArray = (struct defmodule *) genlongalloc(theEnv,space);

   /*================================*/
   /* Allocate the space needed for  */
   /* the port item data structures. */
   /*================================*/

   if (DefmoduleData(theEnv)->NumberOfPortItems == 0)
     {
      DefmoduleData(theEnv)->PortItemArray = NULL;
      return;
     }

   space = (unsigned long) (DefmoduleData(theEnv)->NumberOfPortItems * sizeof(struct portItem));
   DefmoduleData(theEnv)->PortItemArray = (struct portItem *) genlongalloc(theEnv,space);
  }
Exemple #11
0
static void BloadStorageDefglobals()
  {
   unsigned long int space;

   /*=======================================================*/
   /* Determine the number of defglobal and defglobalModule */
   /* data structures to be read.                           */
   /*=======================================================*/

   GenRead(&space,(unsigned long) sizeof(unsigned long int));
   GenRead(&NumberOfDefglobals,(unsigned long) sizeof(long int));
   GenRead(&NumberOfDefglobalModules,(unsigned long) sizeof(long int));

   /*===================================*/
   /* Allocate the space needed for the */
   /* defglobalModule data structures.  */
   /*===================================*/

   if (NumberOfDefglobalModules == 0)
     {
      DefglobalArray = NULL;
      ModuleArray = NULL;
     }

   space = NumberOfDefglobalModules * sizeof(struct defglobalModule);
   ModuleArray = (struct defglobalModule *) genlongalloc(space);

   /*===================================*/
   /* Allocate the space needed for the */
   /* defglobal data structures.        */
   /*===================================*/

   if (NumberOfDefglobals == 0)
     {
      DefglobalArray = NULL;
      return;
     }

   space = (unsigned long) (NumberOfDefglobals * sizeof(struct defglobal));
   DefglobalArray = (struct defglobal *) genlongalloc(space);
  }
globle void ReadNeededConstraints(
  void *theEnv)
  {
   GenReadBinary(theEnv,(void *) &ConstraintData(theEnv)->NumberOfConstraints,(unsigned long)
                                         sizeof(unsigned long int));
   if (ConstraintData(theEnv)->NumberOfConstraints == 0) return;

   ConstraintData(theEnv)->ConstraintArray = (CONSTRAINT_RECORD *)
           genlongalloc(theEnv,(unsigned long) (sizeof(CONSTRAINT_RECORD) *
                                        ConstraintData(theEnv)->NumberOfConstraints));

   BloadandRefresh(theEnv,ConstraintData(theEnv)->NumberOfConstraints,sizeof(BSAVE_CONSTRAINT_RECORD),
                   CopyFromBsaveConstraintRecord);
  }
Exemple #13
0
/************************************************************
  NAME         : BloadandRefresh
  DESCRIPTION  : Loads and refreshes objects - will bload
                 all objects at once, if possible, but
                 will aslo work in increments if memory is
                 restricted
  INPUTS       : 1) the number of objects to bload and update
                 2) the size of one object
                 3) An update function which takes a bloaded
                    object buffer and the index of the object
                    to refresh as arguments
  RETURNS      : Nothing useful
  SIDE EFFECTS : Objects bloaded and updated
  NOTES        : Assumes binary file pointer is positioned
                 for bloads of the objects
 ************************************************************/
globle void BloadandRefresh(
  void *theEnv,
  long objcnt,
  unsigned objsz,
  void (*objupdate)(void *,void *,long))
  {
   register long i,bi;
   char *buf;
   long objsmaxread,objsread;
   unsigned long space;
   int (*oldOutOfMemoryFunction)(void *,unsigned long);

   if (objcnt == 0L) return;

   oldOutOfMemoryFunction = EnvSetOutOfMemoryFunction(theEnv,BloadOutOfMemoryFunction);
   objsmaxread = objcnt;
   do
     {
      space = objsmaxread * objsz;
      buf = (char *) genlongalloc(theEnv,space);
      if (buf == NULL)
        {
         if ((objsmaxread / 2) == 0)
           {
            if ((*oldOutOfMemoryFunction)(theEnv,space) == TRUE)
              {
               EnvSetOutOfMemoryFunction(theEnv,oldOutOfMemoryFunction);
               return;
              }
           }
         else
           objsmaxread /= 2;
        }
     }
   while (buf == NULL);

   EnvSetOutOfMemoryFunction(theEnv,oldOutOfMemoryFunction);

   i = 0L;
   do
     {
      objsread = (objsmaxread > (objcnt - i)) ? (objcnt - i) : objsmaxread;
      GenReadBinary(theEnv,(void *) buf,objsread * objsz);
      for (bi = 0L ; bi < objsread ; bi++ , i++)
        (*objupdate)(theEnv,buf + objsz * bi,i);
     }
   while (i < objcnt);
   genlongfree(theEnv,(void *) buf,space);
  }
globle int PrintNRouter(
  void *theEnv,
  char *logicalName,
  char *str,
  unsigned long length)
  {
   char *tempStr;
   int rv;

   tempStr = (char *) genlongalloc(theEnv,length+1);
   strncpy(tempStr,str,length);
   tempStr[length] = 0;
   rv = EnvPrintRouter(theEnv,logicalName,tempStr);
   genlongfree(theEnv,tempStr,length+1);
   return(rv);
  }
Exemple #15
0
globle void *gm3(
  void *theEnv,
  long size)
  {
   struct memoryPtr *memPtr;

   if (size < sizeof(char *)) size = sizeof(char *);

   if (size >= MEM_TABLE_SIZE) return(genlongalloc(theEnv,(unsigned long) size));

   memPtr = (struct memoryPtr *) MemoryData(theEnv)->MemoryTable[(int) size];
   if (memPtr == NULL)
     {
      return(genalloc(theEnv,(unsigned int) size));
     }

   MemoryData(theEnv)->MemoryTable[(int) size] = memPtr->next;

   return ((void *) memPtr);
  }
Exemple #16
0
static void BloadStorage()
  {
   unsigned long space;

   /*=================================================*/
   /* Determine the number of defrule, defruleModule, */
   /* and joinNode data structures to be read.        */
   /*=================================================*/

   GenRead(&space,(unsigned long) sizeof(unsigned long int));
   GenRead(&NumberOfDefruleModules,(unsigned long) sizeof(long int));
   GenRead(&NumberOfDefrules,(unsigned long) sizeof(long int));
   GenRead(&NumberOfJoins,(unsigned long) sizeof(long int));
#if FUZZY_DEFTEMPLATES 
   GenRead(&NumberOfPatternFuzzyValues,(unsigned long) sizeof(long int));
#endif

   /*===================================*/
   /* Allocate the space needed for the */
   /* defruleModule data structures.    */
   /*===================================*/

   if (NumberOfDefruleModules == 0)
     {
      ModuleArray = NULL;
      DefruleArray = NULL;
      JoinArray = NULL;
#if FUZZY_DEFTEMPLATES 
      PatternFuzzyValueArray = NULL;
#endif
     }

   space = NumberOfDefruleModules * sizeof(struct defruleModule);
   ModuleArray = (struct defruleModule *) genlongalloc(space);

   /*===============================*/
   /* Allocate the space needed for */
   /* the defrule data structures.  */
   /*===============================*/

   if (NumberOfDefrules == 0)
     {
      DefruleArray = NULL;
      JoinArray = NULL;
#if FUZZY_DEFTEMPLATES
      PatternFuzzyValueArray = NULL;
#endif
      return;
     }

   space = NumberOfDefrules * sizeof(struct defrule);
   DefruleArray = (struct defrule *) genlongalloc(space);

#if FUZZY_DEFTEMPLATES
   /*=======================================*/
   /* Get Space for the PatternFuzzyValues. */
   /*=======================================*/

   space = NumberOfPatternFuzzyValues * sizeof(struct fzSlotLocator);
   if (space >  0)
      PatternFuzzyValueArray = (struct fzSlotLocator *) genlongalloc(space);
   else
      PatternFuzzyValueArray = NULL;
#endif

   /*===============================*/
   /* Allocate the space needed for */
   /* the joinNode data structures. */
   /*===============================*/

   space = NumberOfJoins * sizeof(struct joinNode);
   JoinArray = (struct joinNode *) genlongalloc(space);
  }
Exemple #17
0
/***********************************************************************
  NAME         : BloadStorageObjects
  DESCRIPTION  : This routine reads class and handler information from
                 a binary file in five chunks:
                 Class count
                 Handler count
                 Class array
                 Handler array
  INPUTS       : Notthing
  RETURNS      : Nothing useful
  SIDE EFFECTS : Arrays allocated and set
  NOTES        : This routine makes no attempt to reset any pointers
                   within the structures
                 Bload fails if there are still classes in the system!!
 ***********************************************************************/
static void BloadStorageObjects()
  {
   UNLN space;
   long counts[9];

   if ((ClassIDMap != NULL) || (MaxClassID != 0))
     {
      SystemError("OBJBIN",1);
      ExitRouter(EXIT_FAILURE);
     }
   GenRead((void *) &space,(UNLN) sizeof(UNLN));
   if (space == 0L)
     {
      ClassCount = HandlerCount = 0L;
      return;
     }
   GenRead((void *) counts,space);
   ModuleCount = counts[0];
   ClassCount = counts[1];
   LinkCount = counts[2];
   SlotNameCount = counts[3];
   SlotCount = counts[4];
   TemplateSlotCount = counts[5];
   SlotNameMapCount = counts[6];
   HandlerCount = counts[7];
   MaxClassID = (unsigned short) counts[8];
   if (ModuleCount != 0L)
     {
      space = (UNLN) (sizeof(DEFCLASS_MODULE) * ModuleCount);
      ModuleArray = (DEFCLASS_MODULE *) genlongalloc(space);
     }
   if (ClassCount != 0L)
     {
      space = (UNLN) (sizeof(DEFCLASS) * ClassCount);
      defclassArray = (DEFCLASS *) genlongalloc(space);
      ClassIDMap = (DEFCLASS **) gm2((int) (sizeof(DEFCLASS *) * MaxClassID));
     }
   if (LinkCount != 0L)
     {
      space = (UNLN) (sizeof(DEFCLASS *) * LinkCount);
      linkArray = (DEFCLASS * *) genlongalloc(space);
     }
   if (SlotCount != 0L)
     {
      space = (UNLN) (sizeof(SLOT_DESC) * SlotCount);
      slotArray = (SLOT_DESC *) genlongalloc(space);
     }
   if (SlotNameCount != 0L)
     {
      space = (UNLN) (sizeof(SLOT_NAME) * SlotNameCount);
      slotNameArray = (SLOT_NAME *) genlongalloc(space);
     }
   if (TemplateSlotCount != 0L)
     {
      space = (UNLN) (sizeof(SLOT_DESC *) * TemplateSlotCount);
      tmpslotArray = (SLOT_DESC * *) genlongalloc(space);
     }
   if (SlotNameMapCount != 0L)
     {
      space = (UNLN) (sizeof(unsigned) * SlotNameMapCount);
      mapslotArray = (unsigned *) genlongalloc(space);
     }
   if (HandlerCount != 0L)
     {
      space = (UNLN) (sizeof(HANDLER) * HandlerCount);
      handlerArray = (HANDLER *) genlongalloc(space);
      space = (UNLN) (sizeof(unsigned) * HandlerCount);
      maphandlerArray = (unsigned *) genlongalloc(space);
     }
  }