static BOOL ParseIT8(LPIT8 it8) { InSymbol(it8); if (it8->sy == SIDENT) { strncpy(it8->SheetType, it8->id, MAXSTR-1); InSymbol(it8); /* if (!AddAvailableProperty(it8, it8 -> id)) return false; */ /* cmsxIT8SetProperty((LCMSHANDLE) it8, it8->id, NULL); */ } Skip(it8, SEOLN); while (it8-> sy != SEOF && it8-> sy != SSYNERROR) { switch (it8 -> sy) { case SBEGIN_DATA_FORMAT: if (!DataFormatSection(it8)) return false; break; case SBEGIN_DATA: if (!DataSection(it8)) return false; break; case SEOLN: Skip(it8, SEOLN); break; default: if (!HeaderSection(it8)) return false; } } return true; }
int main (int argc, char *argv[]) { int status = 0; static char eoferrmsg[] = "Unexpected end of file in %s section of file \"%s\" (line %d)\n"; parseoptions(argc, argv); InitTables(); InitConvert(); errno = 0; infp = fopen(Inputfile, "r"); if(!infp) { fprintf(stderr, "Can't open file '%s' for input (E%d: %s)\n", Inputfile, errno, strerror(errno)); exit(-1); } /* Initialise group */ Group.line = 0; /* Read DXF file and write Radiance data. */ next_group(infp, &Group); while (!feof(infp) && strcmp(Group.value,FILEEND) != 0) { if(Group.code == 0) { if(strcmp(Group.value, SECTION) == 0) { next_group(infp, &Group); /* code 2 group */ if(strcmp(Group.value,HEADER) == 0) { if(Options.verbose > 0) { fprintf(stderr, " Reading headers\n"); } HeaderSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "HEADER", Inputfile, Group.line); status = -1; } } else if(strcmp(Group.value,CLASSES) == 0) { if(Options.verbose > 0) { fprintf(stderr, " Ignoring classes\n"); } IgnoreSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "CLASSES", Inputfile, Group.line); status = -1; } } else if(strcmp(Group.value,TABLES) == 0) { if(Options.verbose > 0) { fprintf(stderr, " Reading tables\n"); } TablesSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "TABLES", Inputfile, Group.line); status = -1; } } else if(strcmp(Group.value,BLOCKS) == 0) { if(Options.verbose > 0) { fprintf(stderr, " Reading blocks\n"); } BlocksSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "BLOCKS", Inputfile, Group.line); status = -1; } } else if(strcmp(Group.value,ENTITIES) == 0) { if(Options.geom) { int i; time_t ltime; if(*Outputfile == '\0') { outf = stdout; } else { errno = 0; outf = fopen((const char*)&Outputfile, "w"); if(outf == NULL) { fprintf(stderr, "Can't open file '%s' for output (E%d: %s)\n", Outputfile, errno, strerror(errno)); exit(1); } } (void)time(<ime); fprintf(outf, "## Radiance geometry file \"%s\"\n", Outputfile[0] ? Outputfile : "<stdout>"); fprintf(outf, "## Converted by dxf2rad %s: %s##", DXF2RAD_VER, ctime(<ime)); for(i = 0; i < argc; i ++) { fprintf(outf, " %s", argv[i]); } fprintf(outf, "\n\n"); if(Options.verbose > 0) { fprintf(stderr, " Reading entities\n"); } EntitiesSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "ENTITIES", Inputfile, Group.line); status = -1; } } else { if(Options.verbose > 0) { fprintf(stderr, " Ignoring entities\n"); } IgnoreSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "ENTITIES", Inputfile, Group.line); status = -1; } } } else if(strcmp(Group.value,OBJECTS) == 0) { if(Options.verbose > 0) { fprintf(stderr, " Ignoring objects\n"); } IgnoreSection(); if(feof(infp)) { fprintf(stderr, eoferrmsg, "OBJECTS", Inputfile, Group.line); status = -1; } } } } next_group(infp, &Group); } if(outf) { if (status == 0) { fprintf(outf, "\n## End of Radiance geometry file \"%s\"\n\n", Outputfile[0] ? Outputfile : "<stdout>"); } fclose(outf); } fclose(infp); return status; }