/*************************************************************** NAME : BloadObjects DESCRIPTION : This routine moves through the class and handler binary arrays updating pointers INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Pointers reset from array indices NOTES : Assumes all loading is finished **************************************************************/ static void BloadObjects() { UNLN space; GenRead((void *) &space,(UNLN) sizeof(UNLN)); if (space == 0L) return; if (ModuleCount != 0L) BloadandRefresh(ModuleCount,(unsigned) sizeof(BSAVE_DEFCLASS_MODULE),UpdateDefclassModule); if (ClassCount != 0L) { BloadandRefresh(ClassCount,(unsigned) sizeof(BSAVE_DEFCLASS),UpdateDefclass); BloadandRefresh(LinkCount,(unsigned) sizeof(DEFCLASS *),UpdateLink); BloadandRefresh(SlotNameCount,(unsigned) sizeof(BSAVE_SLOT_NAME),UpdateSlotName); BloadandRefresh(SlotCount,(unsigned) sizeof(BSAVE_SLOT_DESC),UpdateSlot); if (TemplateSlotCount != 0L) BloadandRefresh(TemplateSlotCount,(unsigned) sizeof(long),UpdateTemplateSlot); if (SlotNameMapCount != 0L) { space = (UNLN) (sizeof(unsigned) * SlotNameMapCount); GenRead((void *) mapslotArray,space); } if (HandlerCount != 0L) { BloadandRefresh(HandlerCount,(unsigned) sizeof(BSAVE_HANDLER),UpdateHandler); space = (UNLN) (sizeof(unsigned) * HandlerCount); GenRead((void *) maphandlerArray,space); } UpdatePrimitiveClassesMap(); } }
/*********************************************************************** 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); }
/*************************************************** 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); } }
/*********************************************************************** 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); } }
static void BloadBinaryItem() { unsigned long int space; /*======================================================*/ /* Read in the amount of space used by the binary image */ /* (this is used to skip the construct in the event it */ /* is not available in the version being run). */ /*======================================================*/ GenRead(&space,(unsigned long) sizeof(unsigned long int)); /*=============================================*/ /* Read in the defglobalModule data structures */ /* and refresh the pointers. */ /*=============================================*/ BloadandRefresh(NumberOfDefglobalModules, (unsigned) sizeof(struct bsaveDefglobalModule), UpdateDefglobalModule); /*=======================================*/ /* Read in the defglobal data structures */ /* and refresh the pointers. */ /*=======================================*/ BloadandRefresh(NumberOfDefglobals, (unsigned) sizeof(struct bsaveDefglobal), UpdateDefglobal); }
/********************************************************************* NAME : BloadDeffunctions DESCRIPTION : This routine reads deffunction information from a binary file This routine moves through the deffunction binary array updating pointers INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Pointers reset from array indices NOTES : Assumes all loading is finished ********************************************************************/ static void BloadDeffunctions() { unsigned long space; GenRead((void *) &space,(unsigned long) sizeof(unsigned long)); BloadandRefresh(ModuleCount,sizeof(BSAVE_DEFFUNCTION_MODULE),UpdateDeffunctionModule); BloadandRefresh(DeffunctionCount,sizeof(BSAVE_DEFFUNCTION),UpdateDeffunction); }
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); }
static void BloadStorage() { unsigned long int space; /*=======================================*/ /* Determine the number of defmodule and */ /* port item data structures to be read. */ /*=======================================*/ GenRead(&space,(unsigned long) sizeof(unsigned long int)); GenRead(&NumberOfDefmodules,(unsigned long) sizeof(long int)); GenRead(&NumberOfPortItems,(unsigned long) sizeof(long int)); /*================================*/ /* Allocate the space needed for */ /* the defmodule data structures. */ /*================================*/ if (NumberOfDefmodules == 0) { DefmoduleArray = NULL; return; } space = (unsigned long) (NumberOfDefmodules * sizeof(struct defmodule)); DefmoduleArray = (struct defmodule *) genlongalloc(space); /*================================*/ /* Allocate the space needed for */ /* the port item data structures. */ /*================================*/ if (NumberOfPortItems == 0) { PortItemArray = NULL; return; } space = (unsigned long) (NumberOfPortItems * sizeof(struct portItem)); PortItemArray = (struct portItem *) genlongalloc(space); }
static void BloadBinaryItem() { unsigned long int space; GenRead(&space,(unsigned long) sizeof(unsigned long int)); if (NumberOfDefmodules == 0) return; BloadandRefresh(NumberOfDefmodules,(unsigned) sizeof(struct bsaveDefmodule),UpdateDefmodule); BloadandRefresh(NumberOfPortItems,(unsigned) sizeof(struct bsavePortItem),UpdatePortItem); SetListOfDefmodules((void *) DefmoduleArray); SetCurrentModule((void *) GetNextDefmodule(NULL)); }
/********************************************************************* NAME : BloadGenerics DESCRIPTION : This routine reads generic function information from a binary file in four chunks: Generic-header array Method array Method restrictions array Restriction types array This routine moves through the generic function binary arrays updating pointers INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Pointers reset from array indices NOTES : Assumes all loading is finished ********************************************************************/ static void BloadGenerics() { unsigned long space; GenRead((void *) &space,(unsigned long) sizeof(unsigned long)); if (ModuleCount == 0L) return; BloadandRefresh(ModuleCount,(unsigned) sizeof(BSAVE_DEFGENERIC_MODULE),UpdateGenericModule); if (GenericCount == 0L) return; BloadandRefresh(GenericCount,(unsigned) sizeof(BSAVE_GENERIC),UpdateGeneric); BloadandRefresh(MethodCount,(unsigned) sizeof(BSAVE_METHOD),UpdateMethod); BloadandRefresh(RestrictionCount,(unsigned) sizeof(BSAVE_RESTRICTION),UpdateRestriction); BloadandRefresh(TypeCount,(unsigned) sizeof(long),UpdateType); }
static void BloadBinaryItem() { unsigned long space; /*======================================================*/ /* Read in the amount of space used by the binary image */ /* (this is used to skip the construct in the event it */ /* is not available in the version being run). */ /*======================================================*/ GenRead(&space,(unsigned long) sizeof(unsigned long int)); /*===========================================*/ /* Read in the defruleModule data structures */ /* and refresh the pointers. */ /*===========================================*/ BloadandRefresh(NumberOfDefruleModules,(unsigned) sizeof(struct bsaveDefruleModule), UpdateDefruleModule); /*=====================================*/ /* Read in the defrule data structures */ /* and refresh the pointers. */ /*=====================================*/ BloadandRefresh(NumberOfDefrules,(unsigned) sizeof(struct bsaveDefrule), UpdateDefrule); #if FUZZY_DEFTEMPLATES if (NumberOfPatternFuzzyValues > 0) BloadandRefresh(NumberOfPatternFuzzyValues,(unsigned) sizeof(struct bsaveFzSlotLocator), UpdatePatternFuzzyValues); #endif /*======================================*/ /* Read in the joinNode data structures */ /* and refresh the pointers. */ /*======================================*/ BloadandRefresh(NumberOfJoins,(unsigned) sizeof(struct bsaveJoinNode), UpdateJoin); }
/**************************************************** 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]); }
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); }
/*********************************************************************** 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); } }