--- trunk/SHAPES/SHAPE.cpp 2004/06/23 20:53:17 1290 +++ trunk/SHAPES/SHAPE.cpp 2004/06/24 15:31:52 1295 @@ -35,23 +35,21 @@ void SHAPE::readSHAPEfile(const char *fname) { printf("Could not open SHAPE file %s\n", fname); exit(-1); } - rewind(shapeFile); - lineNum = 0; + + findBegin( "ShapeInfo" ); + eof_test = fgets( readLine, sizeof(readLine), shapeFile ); - lineNum++; - if( eof_test == NULL ){ - printf("Error in reading SHAPE from SHAPE file at line %d.\n", - lineNum ); - exit(-1); - } - // first find the shape name: + while( eof_test != NULL ){ // toss comment lines if( readLine[0] != '!' && readLine[0] != '#' ){ + + foo = strtok(readLine, " ,;\t"); + if (!strcasecmp(foo, "end")) break; nTokens = count_tokens(readLine, " ,;\t"); if (nTokens < 5) { - printf("Not enough data on information line in SHAPE file.\n"); + printf("Not enough data on shapeInfo line in SHAPE file.\n"); exit(-1); } @@ -68,7 +66,6 @@ void SHAPE::readSHAPEfile(const char *fname) { break; } eof_test = fgets( readLine, sizeof(readLine), shapeFile ); - lineNum++; } findBegin( "ContactFunctions" );