/* allocate our input buffer */ buf = (char *)bu_calloc( sizeof(char), BUFSIZE, "input buffer" ); // wrkptr = buf; /* Read ASCII input file, each record on a line */ while( ( fgets( buf, 512 /*BUFSIZE*/, ifp ) ) != (char *) NULL ) { after_read: /* Clear the output record -- vital! */ (void)bzero( (char *)&record, sizeof(record) ); /* Check record type */ switch( buf[0] ) { case ID_SOLID: solbld(); break; // continue; case ID_COMB: if( combbld() > 0 ) goto after_read; break; // continue; case ID_MEMB: bu_log("Warning: unattached Member record, ignored\n"); break; // continue; case ID_ARS_A: arsabld(); break; // continue; case ID_ARS_B: arsbbld(); break; // continue; case ID_P_HEAD: polyhbld(); break; // continue; case ID_P_DATA: bu_log("Unattached POLY-solid P_DATA (Q) record, skippin break; // continue; case ID_IDENT: identbld(); break; // continue; case ID_MATERIAL: materbld(); break; // continue; case ID_BSOLID: bsplbld(); break; // continue; case ID_BSURF: bsurfbld(); break; // continue; case DBID_PIPE: pipebld(); break; // continue; case DBID_STRSOL: strsolbld(); break; // continue; case DBID_NMG: nmgbld(); break; // continue; case DBID_PARTICLE: particlebld(); break; // continue; case DBID_ARBN: arbnbld(); break; case DBID_CLINE: clinebld(); break; // continue; case DBID_BOT: botbld(); break; // continue; case DBID_EXTR: extrbld(); break; // continue; case DBID_SKETCH: sktbld(); break; // continue; default: bu_log("asc2g: bad record type '%c' (0%o), skipping\n", bu_log("%s\n", buf ); break; // continue; } continue; // memset(buf, 0, sizeof(char) * BUFSIZE); this is reset to 0 above } bu_free(buf, "input buffer"); /* Now, at the end of the database, dump out the entire * region-id-based color table. */ mk_write_color_table( ofp ); wdb_close(ofp); /* there should probably be an ifdef _WIN32 here :) */ exit(0);