---------------------------------------------------------------------------*/ * Read an adapted class description from File and return * a ptr to the adapted class. * * @param File open file to read adapted class from * @return Ptr to new adapted class. * * @note Globals: none * @note Exceptions: none * @note History: Tue Mar 19 14:11:01 1991, DSJ, Created. */
| 311 | * @note History: Tue Mar 19 14:11:01 1991, DSJ, Created. |
| 312 | */ |
| 313 | ADAPT_CLASS ReadAdaptedClass(FILE *File) { |
| 314 | int32_t NumTempProtos; |
| 315 | int32_t NumConfigs; |
| 316 | int i; |
| 317 | ADAPT_CLASS Class; |
| 318 | TEMP_PROTO TempProto; |
| 319 | |
| 320 | /* first read high level adapted class structure */ |
| 321 | Class = (ADAPT_CLASS) Emalloc (sizeof (ADAPT_CLASS_STRUCT)); |
| 322 | fread ((char *) Class, sizeof (ADAPT_CLASS_STRUCT), 1, File); |
| 323 | |
| 324 | /* then read in the definitions of the permanent protos and configs */ |
| 325 | Class->PermProtos = NewBitVector (MAX_NUM_PROTOS); |
| 326 | Class->PermConfigs = NewBitVector (MAX_NUM_CONFIGS); |
| 327 | fread ((char *) Class->PermProtos, sizeof (uinT32), |
| 328 | WordsInVectorOfSize (MAX_NUM_PROTOS), File); |
| 329 | fread ((char *) Class->PermConfigs, sizeof (uinT32), |
| 330 | WordsInVectorOfSize (MAX_NUM_CONFIGS), File); |
| 331 | |
| 332 | /* then read in the list of temporary protos */ |
| 333 | fread (&NumTempProtos, sizeof(NumTempProtos), 1, File); |
| 334 | Class->TempProtos = NIL_LIST; |
| 335 | for (i = 0; i < NumTempProtos; i++) { |
| 336 | TempProto = |
| 337 | (TEMP_PROTO) alloc_struct (sizeof (TEMP_PROTO_STRUCT), |
| 338 | "TEMP_PROTO_STRUCT"); |
| 339 | fread ((char *) TempProto, sizeof (TEMP_PROTO_STRUCT), 1, File); |
| 340 | Class->TempProtos = push_last (Class->TempProtos, TempProto); |
| 341 | } |
| 342 | |
| 343 | /* then read in the adapted configs */ |
| 344 | fread (&NumConfigs, sizeof(NumConfigs), 1, File); |
| 345 | for (i = 0; i < NumConfigs; i++) |
| 346 | if (test_bit (Class->PermConfigs, i)) |
| 347 | Class->Config[i].Perm = ReadPermConfig (File); |
| 348 | else |
| 349 | Class->Config[i].Temp = ReadTempConfig (File); |
| 350 | |
| 351 | return (Class); |
| 352 | |
| 353 | } /* ReadAdaptedClass */ |
| 354 | |
| 355 | |
| 356 | /*---------------------------------------------------------------------------*/ |
no test coverage detected