Revision: 42146
http://brlcad.svn.sourceforge.net/brlcad/?rev=42146&view=rev
Author: brlcad
Date: 2011-01-12 15:58:03 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
restructure exception handling into try/catch form
Modified Paths:
--------------
brlcad/trunk/src/conv/euclid/g-euclid.c
brlcad/trunk/src/conv/iges/g-iges.c
Modified: brlcad/trunk/src/conv/euclid/g-euclid.c
===================================================================
--- brlcad/trunk/src/conv/euclid/g-euclid.c 2011-01-12 15:56:50 UTC (rev
42145)
+++ brlcad/trunk/src/conv/euclid/g-euclid.c 2011-01-12 15:58:03 UTC (rev
42146)
@@ -75,6 +75,7 @@
int facet_type;
};
+
void
fastf_print(FILE *out, size_t length, fastf_t f)
{
@@ -83,47 +84,48 @@
size_t i;
size_t buf_len;
- sprintf( &buffer[1], "%f", f );
+ sprintf(&buffer[1], "%f", f);
buffer[0] = ' ';
- buf_len = strlen( buffer );
- if ( buf_len <= length )
+ buf_len = strlen(buffer);
+ if (buf_len <= length)
{
- for ( i=0; i<length; i++ )
+ for (i=0; i<length; i++)
{
- if ( i < buf_len )
- fputc( buffer[i], out );
+ if (i < buf_len)
+ fputc(buffer[i], out);
else
- fputc( ' ', out );
+ fputc(' ', out);
}
return;
}
- ptr = strchr( buffer, '.' );
- if ( (size_t)(ptr - buffer) > length )
+ ptr = strchr(buffer, '.');
+ if ((size_t)(ptr - buffer) > length)
{
- bu_exit(1, "ERROR: Value (%f) too large for format length (%d)\n", f,
length );
+ bu_exit(1, "ERROR: Value (%f) too large for format length (%d)\n", f,
length);
}
- for ( i=0; i<length; i++ )
- fputc( buffer[i], out );
+ for (i=0; i<length; i++)
+ fputc(buffer[i], out);
}
+
void
insert_id(int id)
{
int i;
- for ( i=0; i<ident_count; i++ )
+ for (i=0; i<ident_count; i++)
{
- if ( idents[i] == id )
+ if (idents[i] == id)
return;
}
- if ( ident_count == ident_length )
+ if (ident_count == ident_length)
{
- idents = (int *)bu_realloc( (char *)idents, (ident_length +
IDENT_BLOCK)*sizeof( int ), "insert_id: idents" );
+ idents = (int *)bu_realloc((char *)idents, (ident_length +
IDENT_BLOCK)*sizeof(int), "insert_id: idents");
ident_length += IDENT_BLOCK;
}
@@ -131,41 +133,46 @@
ident_count++;
}
+
static int
select_region(struct db_tree_state *tsp, const struct db_full_path
*UNUSED(pathp), const struct rt_comb_internal *UNUSED(combp), genptr_t
UNUSED(client_data))
{
- if (verbose )
- bu_log( "select_region: curr_id = %d, tsp->ts_regionid = %d\n",
curr_id, tsp->ts_regionid);
+ if (verbose)
+ bu_log("select_region: curr_id = %d, tsp->ts_regionid = %d\n", curr_id,
tsp->ts_regionid);
- if ( tsp->ts_regionid == curr_id )
+ if (tsp->ts_regionid == curr_id)
return 0;
else
return -1;
}
+
static int
get_reg_id(struct db_tree_state *tsp, const struct db_full_path
*UNUSED(pathp), const struct rt_comb_internal *UNUSED(combp), genptr_t
UNUSED(client_data))
{
- if ( verbose )
- bu_log( "get_reg_id: Adding id %d to list\n", tsp->ts_regionid );
- insert_id( tsp->ts_regionid );
+ if (verbose)
+ bu_log("get_reg_id: Adding id %d to list\n", tsp->ts_regionid);
+ insert_id(tsp->ts_regionid);
return -1;
}
+
static union tree *
region_stub(struct db_tree_state *UNUSED(tsp), const struct db_full_path
*UNUSED(pathp), union tree *UNUSED(curtree), genptr_t UNUSED(client_data))
{
- bu_exit(1, "ERROR; region stub called, this shouldn't happen\n" );
+ bu_exit(1, "ERROR; region stub called, this shouldn't happen\n");
return (union tree *)NULL; /* just to keep the compilers happy */
}
+
static union tree *
leaf_stub(struct db_tree_state *UNUSED(tsp), const struct db_full_path
*UNUSED(pathp), struct rt_db_internal *UNUSED(ip), genptr_t UNUSED(client_data))
{
- bu_exit(1, "ERROR: leaf stub called, this shouldn't happen\n" );
+ bu_exit(1, "ERROR: leaf stub called, this shouldn't happen\n");
return (union tree *)NULL; /* just to keep the compilers happy */
}
+
static void
Write_euclid_face(const struct loopuse *lu, const int facet_type, const int
regionid, const int face_number)
{
@@ -174,46 +181,47 @@
plane_t plane;
int vertex_count=0;
- NMG_CK_LOOPUSE( lu );
+ NMG_CK_LOOPUSE(lu);
- if ( verbose )
- bu_log( "Write_euclid_face: lu=x%x, facet_type=%d, regionid=%d,
face_number=%d\n",
- lu, facet_type, regionid, face_number );
+ if (verbose)
+ bu_log("Write_euclid_face: lu=x%x, facet_type=%d, regionid=%d,
face_number=%d\n",
+ lu, facet_type, regionid, face_number);
- if ( BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC )
+ if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
return;
- if ( *lu->up.magic_p != NMG_FACEUSE_MAGIC )
+ if (*lu->up.magic_p != NMG_FACEUSE_MAGIC)
return;
- for ( BU_LIST_FOR( eu, edgeuse, &lu->down_hd ) )
+ for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd))
vertex_count++;
- fprintf( fp_out, "%10d%3d 0. 1%5d", regionid, facet_type,
vertex_count );
+ fprintf(fp_out, "%10d%3d 0. 1%5d", regionid, facet_type,
vertex_count);
vertex_count = 0;
- for ( BU_LIST_FOR( eu, edgeuse, &lu->down_hd ) )
+ for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd))
{
struct vertex *v;
int i;
- NMG_CK_EDGEUSE( eu );
+ NMG_CK_EDGEUSE(eu);
v = eu->vu_p->v_p;
- NMG_CK_VERTEX( v );
-/* fprintf( fp_out, "%10d%8f%8f%8f", ++vertex_count, V3ARGS(
v->vg_p->coord ) ); */
+ NMG_CK_VERTEX(v);
+/* fprintf(fp_out, "%10d%8f%8f%8f", ++vertex_count,
V3ARGS(v->vg_p->coord)); */
vertex_count++;
- fprintf( fp_out, "%10d", vertex_count );
+ fprintf(fp_out, "%10d", vertex_count);
- for ( i=X; i<=Z; i++ )
- fastf_print( fp_out, 8, v->vg_p->coord[i] );
+ for (i=X; i<=Z; i++)
+ fastf_print(fp_out, 8, v->vg_p->coord[i]);
}
fu = lu->up.fu_p;
- NMG_CK_FACEUSE( fu );
- NMG_GET_FU_PLANE( plane, fu );
- fprintf( fp_out, "%10d%15.5f%15.5f%15.5f%15.5f", face_number, V4ARGS(
plane ) );
+ NMG_CK_FACEUSE(fu);
+ NMG_GET_FU_PLANE(plane, fu);
+ fprintf(fp_out, "%10d%15.5f%15.5f%15.5f%15.5f", face_number,
V4ARGS(plane));
}
+
/* Routine to write an nmgregion in the Euclid "decoded" format */
static void
Write_euclid_region(struct nmgregion *r, struct db_tree_state *tsp)
@@ -222,66 +230,66 @@
struct facets *faces=NULL;
int i, j;
- NMG_CK_REGION( r );
+ NMG_CK_REGION(r);
- if ( verbose )
- bu_log( "Write_euclid_region: r=x%x\n", r );
+ if (verbose)
+ bu_log("Write_euclid_region: r=x%x\n", r);
/* if bounds haven't been calculated, do it now */
- if ( r->ra_p == NULL )
- nmg_region_a( r, &tol );
+ if (r->ra_p == NULL)
+ nmg_region_a(r, &tol);
/* Check if region extents are beyond the limitations of the format */
- for ( i=X; i<ELEMENTS_PER_POINT; i++ )
+ for (i=X; i<ELEMENTS_PER_POINT; i++)
{
- if ( r->ra_p->min_pt[i] < (-999999.0) )
+ if (r->ra_p->min_pt[i] < (-999999.0))
{
- bu_log( "g-euclid: Coordinates too large (%g) for Euclid format\n",
r->ra_p->min_pt[i] );
+ bu_log("g-euclid: Coordinates too large (%g) for Euclid format\n",
r->ra_p->min_pt[i]);
return;
}
- if ( r->ra_p->max_pt[i] > 9999999.0 )
+ if (r->ra_p->max_pt[i] > 9999999.0)
{
- bu_log( "g-euclid: Coordinates too large (%g) for Euclid format\n",
r->ra_p->max_pt[i] );
+ bu_log("g-euclid: Coordinates too large (%g) for Euclid format\n",
r->ra_p->max_pt[i]);
return;
}
}
/* write out each face in the region */
- for ( BU_LIST_FOR( s, shell, &r->s_hd ) )
+ for (BU_LIST_FOR(s, shell, &r->s_hd))
{
struct faceuse *fu;
- for ( BU_LIST_FOR( fu, faceuse, &s->fu_hd ) )
+ for (BU_LIST_FOR(fu, faceuse, &s->fu_hd))
{
struct loopuse *lu;
int no_of_loops=0;
int no_of_holes=0;
- if ( fu->orientation != OT_SAME )
+ if (fu->orientation != OT_SAME)
continue;
/* count the loops in this face */
- for ( BU_LIST_FOR( lu, loopuse, &fu->lu_hd ) )
+ for (BU_LIST_FOR(lu, loopuse, &fu->lu_hd))
{
- if ( BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC )
+ if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
continue;
no_of_loops++;
}
- if ( !no_of_loops )
+ if (!no_of_loops)
continue;
- faces = (struct facets *)bu_calloc( no_of_loops, sizeof( struct
facets ), "g-euclid: faces" );
+ faces = (struct facets *)bu_calloc(no_of_loops, sizeof(struct
facets), "g-euclid: faces");
i = 0;
- for ( BU_LIST_FOR( lu, loopuse, &fu->lu_hd ) )
+ for (BU_LIST_FOR(lu, loopuse, &fu->lu_hd))
{
- if ( BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC )
+ if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
continue;
faces[i].lu = lu;
- if ( lu->orientation == OT_OPPOSITE )
+ if (lu->orientation == OT_OPPOSITE)
faces[i].facet_type = 1; /* this is a hole */
else
faces[i].facet_type = (-1); /* TBD */
@@ -291,31 +299,31 @@
}
/* determine type of face
- * 0 -> simple facet (no holes )
+ * 0 -> simple facet (no holes)
* 1 -> a hole
* 2 -> a facet that will have holes
*/
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type == 1 )
+ if (faces[i].facet_type == 1)
no_of_holes++;
}
- if ( !no_of_holes )
+ if (!no_of_holes)
{
/* no holes, so each loop is a simple face (type 0) */
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
faces[i].facet_type = 0;
}
- else if ( no_of_loops == no_of_holes + 1 )
+ else if (no_of_loops == no_of_holes + 1)
{
struct loopuse *outer_lu=(struct loopuse *)NULL;
/* only one outer loop, so find it */
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type == (-1) )
+ if (faces[i].facet_type == (-1))
{
outer_lu = faces[i].lu;
faces[i].facet_type = 2;
@@ -324,9 +332,9 @@
}
/* every hole must have this same outer_loop */
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type == 1 )
+ if (faces[i].facet_type == 1)
faces[i].outer_loop = outer_lu;
}
}
@@ -336,24 +344,24 @@
int outer_loop_count;
/* must determine which holes go with which outer loops */
- for ( loop1=0; loop1<no_of_loops; loop1++ )
+ for (loop1=0; loop1<no_of_loops; loop1++)
{
- if ( faces[loop1].facet_type != 1 )
+ if (faces[loop1].facet_type != 1)
continue;
/* loop1 is a hole look for loops containing loop1 */
outer_loop_count = 0;
- for ( loop2=0; loop2<no_of_loops; loop2++ )
+ for (loop2=0; loop2<no_of_loops; loop2++)
{
int class;
- if ( faces[loop2].facet_type == 1 )
+ if (faces[loop2].facet_type == 1)
continue;
- class = nmg_classify_lu_lu( faces[loop1].lu,
- faces[loop2].lu, &tol );
+ class = nmg_classify_lu_lu(faces[loop1].lu,
+ faces[loop2].lu, &tol);
- if ( class != NMG_CLASS_AinB )
+ if (class != NMG_CLASS_AinB)
continue;
/* loop1 is inside loop2, possible outer loop */
@@ -361,26 +369,26 @@
outer_loop_count++;
}
- if ( outer_loop_count > 1 )
+ if (outer_loop_count > 1)
{
/* must choose outer loop from a list of candidates
* if any of these candidates contain one of the
* other candidates, the outer one can be eliminated
* as a possible choice */
- for ( loop2=0; loop2<no_of_loops; loop2++ )
+ for (loop2=0; loop2<no_of_loops; loop2++)
{
- if ( faces[loop2].facet_type != (-2) )
+ if (faces[loop2].facet_type != (-2))
continue;
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type != (-2) )
+ if (faces[i].facet_type != (-2))
continue;
- if ( nmg_classify_lu_lu( faces[i].lu,
- faces[loop2].lu, &tol
) )
+ if (nmg_classify_lu_lu(faces[i].lu,
+ faces[loop2].lu, &tol))
{
- if ( faces[i].facet_type != (-2) )
+ if (faces[i].facet_type != (-2))
continue;
faces[loop2].facet_type = (-1);
@@ -390,15 +398,15 @@
}
}
- if ( outer_loop_count != 1 )
+ if (outer_loop_count != 1)
{
- bu_log( "Failed to find outer loop for hole in
component %d\n", tsp->ts_regionid );
+ bu_log("Failed to find outer loop for hole in component
%d\n", tsp->ts_regionid);
goto outt;
}
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type == (-2) )
+ if (faces[i].facet_type == (-2))
{
faces[i].facet_type = 2;
faces[loop1].outer_loop = faces[i].lu;
@@ -407,9 +415,9 @@
}
/* Check */
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type < 0 )
+ if (faces[i].facet_type < 0)
{
/* all holes have been placed
* so these must be simple faces
@@ -417,55 +425,56 @@
faces[i].facet_type = 0;
}
- if ( faces[i].facet_type == 1 && faces[i].outer_loop ==
NULL )
+ if (faces[i].facet_type == 1 && faces[i].outer_loop == NULL)
{
- bu_log( "Failed to find outer loop for hole in
component %d\n", tsp->ts_regionid );
+ bu_log("Failed to find outer loop for hole in component
%d\n", tsp->ts_regionid);
goto outt;
}
}
}
/* output faces with holes first */
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
struct loopuse *outer_loop;
- if ( faces[i].facet_type != 2 )
+ if (faces[i].facet_type != 2)
continue;
outer_loop = faces[i].lu;
- Write_euclid_face( outer_loop, 2, tsp->ts_regionid,
++face_count );
+ Write_euclid_face(outer_loop, 2, tsp->ts_regionid,
++face_count);
/* output holes for this face */
- for ( j=0; j<no_of_loops; j++ )
+ for (j=0; j<no_of_loops; j++)
{
- if ( j == i )
+ if (j == i)
continue;
- if ( faces[j].outer_loop == outer_loop )
- Write_euclid_face( faces[j].lu, 1, tsp->ts_regionid,
++face_count );
+ if (faces[j].outer_loop == outer_loop)
+ Write_euclid_face(faces[j].lu, 1, tsp->ts_regionid,
++face_count);
}
}
/* output simple faces */
- for ( i=0; i<no_of_loops; i++ )
+ for (i=0; i<no_of_loops; i++)
{
- if ( faces[i].facet_type != 0 )
+ if (faces[i].facet_type != 0)
continue;
- Write_euclid_face( faces[i].lu, 0, tsp->ts_regionid,
++face_count );
+ Write_euclid_face(faces[i].lu, 0, tsp->ts_regionid,
++face_count);
}
- bu_free( (char *)faces, "g-euclid: faces" );
+ bu_free((char *)faces, "g-euclid: faces");
faces = (struct facets*)NULL;
}
}
regions_written++;
- outt:
- if ( faces )
- bu_free( (char *)faces, "g-euclid: faces" );
+outt:
+ if (faces)
+ bu_free((char *)faces, "g-euclid: faces");
return;
}
+
/*
* M A I N
*/
@@ -476,7 +485,7 @@
int c;
double percent;
- bu_setlinebuf( stderr );
+ bu_setlinebuf(stderr);
rt_g.debug = 0;
@@ -499,7 +508,7 @@
tree_state.ts_tol = &tol;
tree_state.ts_ttol = &ttol;
- rt_init_resource( &rt_uniresource, 0, NULL );
+ rt_init_resource(&rt_uniresource, 0, NULL);
/* For visualization purposes, in the debug plot files */
{
@@ -507,7 +516,7 @@
/* WTF: This value is specific to the Bradley */
nmg_eue_dist = 2.0;
}
- BU_LIST_INIT( &rt_g.rtg_vlfree ); /* for vlist macros */
+ BU_LIST_INIT(&rt_g.rtg_vlfree); /* for vlist macros */
/* Get command line arguments. */
while ((c = bu_getopt(argc, argv, "a:n:o:r:s:vx:P:X:")) != EOF) {
@@ -530,14 +539,14 @@
verbose++;
break;
case 'P':
-/* ncpu = atoi( bu_optarg ); */
+/* ncpu = atoi(bu_optarg); */
rt_g.debug = 1; /* NOTE: setting DEBUG_ALLRAYS to get core
dumps */
break;
case 'x':
- sscanf( bu_optarg, "%x", (unsigned int *)&rt_g.debug );
+ sscanf(bu_optarg, "%x", (unsigned int *)&rt_g.debug);
break;
case 'X':
- sscanf( bu_optarg, "%x", (unsigned int *)&rt_g.NMG_debug );
+ sscanf(bu_optarg, "%x", (unsigned int *)&rt_g.NMG_debug);
NMG_debug = rt_g.NMG_debug;
break;
default:
@@ -551,12 +560,12 @@
}
/* Open BRL-CAD database */
- if ((dbip = db_open( argv[bu_optind], "r")) == DBI_NULL)
+ if ((dbip = db_open(argv[bu_optind], "r")) == DBI_NULL)
{
perror(argv[0]);
bu_exit(1, "Cannot open %s\n", argv[bu_optind]);
}
- if ( db_dirbuild( dbip ) ) {
+ if (db_dirbuild(dbip)) {
bu_exit(1, "db_dirbuild failed\n");
}
@@ -566,16 +575,16 @@
setmode(fileno(fp_out), O_BINARY);
#endif
} else {
- if ((fp_out = fopen( out_file, "wb")) == NULL)
+ if ((fp_out = fopen(out_file, "wb")) == NULL)
{
- bu_log( "Cannot open %s\n", out_file );
- perror( argv[0] );
+ bu_log("Cannot open %s\n", out_file);
+ perror(argv[0]);
return 2;
}
}
bu_optind++;
- fprintf( fp_out, "$03" );
+ fprintf(fp_out, "$03");
/* First produce an unordered list of region ident codes */
(void)db_walk_tree(dbip, argc-bu_optind, (const char **)(&argv[bu_optind]),
@@ -588,21 +597,21 @@
/* Process regions in ident order */
curr_id = 0;
- for ( i=0; i<ident_length; i++ )
+ for (i=0; i<ident_length; i++)
{
int next_id = 99999999;
- for ( j=0; j<ident_length; j++ )
+ for (j=0; j<ident_length; j++)
{
int test_id;
test_id = idents[j];
- if ( test_id > curr_id && test_id < next_id )
+ if (test_id > curr_id && test_id < next_id)
next_id = test_id;
}
curr_id = next_id;
face_count = 0;
- bu_log( "Processing id %d\n", curr_id );
+ bu_log("Processing id %d\n", curr_id);
/* Walk indicated tree(s). Each region will be output separately */
@@ -620,19 +629,19 @@
nmg_booltree_leaf_tess,
(genptr_t)NULL); /* in librt/nmg_bool.c */
- nmg_km( the_model );
+ nmg_km(the_model);
}
percent = 0;
- if ( regions_tried > 0 )
+ if (regions_tried > 0)
percent = ((double)regions_converted * 100) / regions_tried;
- printf( "Tried %d regions, %d converted successfully. %g%%\n",
- regions_tried, regions_converted, percent );
+ printf("Tried %d regions, %d converted successfully. %g%%\n",
+ regions_tried, regions_converted, percent);
percent = 0;
- if ( regions_tried > 0 )
+ if (regions_tried > 0)
percent = ((double)regions_written * 100) / regions_tried;
- printf( " %d written successfully. %g%%\n",
- regions_written, percent );
+ printf(" %d written successfully. %g%%\n",
+ regions_written, percent);
/* Release dynamic storage */
rt_vlist_cleanup();
@@ -641,6 +650,7 @@
return 0;
}
+
/*
* D O _ R E G I O N _ E N D
*
@@ -655,8 +665,8 @@
struct bu_list vhead;
union tree *ret_tree;
- if ( verbose )
- bu_log( "do_region_end: regionid = %d\n", tsp->ts_regionid );
+ if (verbose)
+ bu_log("do_region_end: regionid = %d\n", tsp->ts_regionid);
RT_CK_TESS_TOL(tsp->ts_ttol);
BN_CK_TOL(tsp->ts_tol);
@@ -679,8 +689,24 @@
regions_tried++;
/* Begin bomb protection */
- if ( BU_SETJUMP )
- {
+ if (!BU_SETJUMP) {
+ /* try */
+
+ if (verbose)
+ bu_log("\tEvaluating region\n");
+ (void)nmg_model_fuse(*tsp->ts_m, tsp->ts_tol);
+
+ /* librt/nmg_bool.c */
+ ret_tree = nmg_booltree_evaluate(curtree, tsp->ts_tol, &rt_uniresource);
+
+ if (ret_tree)
+ r = ret_tree->tr_d.td_r;
+ else
+ r = (struct nmgregion *)NULL;
+
+ } else {
+ /* catch */
+
/* Error, bail out */
BU_UNSETJUMP; /* Relinquish the protection */
@@ -696,7 +722,7 @@
db_free_tree(curtree, &rt_uniresource); /* Does an nmg_kr() */
/* Get rid of (m)any other intermediate structures */
- if ( (*tsp->ts_m)->magic == NMG_MODEL_MAGIC )
+ if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
nmg_km(*tsp->ts_m);
else
bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
@@ -705,20 +731,8 @@
*tsp->ts_m = nmg_mm();
goto out;
- }
- if ( verbose )
- bu_log( "\tEvaluating region\n" );
- (void)nmg_model_fuse(*tsp->ts_m, tsp->ts_tol);
+ } BU_UNSETJUMP; /* Relinquish the protection */
- /* librt/nmg_bool.c */
- ret_tree = nmg_booltree_evaluate(curtree, tsp->ts_tol, &rt_uniresource);
-
- if ( ret_tree )
- r = ret_tree->tr_d.td_r;
- else
- r = (struct nmgregion *)NULL;
-
- BU_UNSETJUMP; /* Relinquish the protection */
regions_converted++;
if (r != (struct nmgregion *)NULL)
{
@@ -727,15 +741,15 @@
int empty_model=0;
/* Kill cracks */
- s = BU_LIST_FIRST( shell, &r->s_hd );
- while ( BU_LIST_NOT_HEAD( &s->l, &r->s_hd ) )
+ s = BU_LIST_FIRST(shell, &r->s_hd);
+ while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd))
{
struct shell *next_s;
- next_s = BU_LIST_PNEXT( shell, &s->l );
- if ( nmg_kill_cracks( s ) )
+ next_s = BU_LIST_PNEXT(shell, &s->l);
+ if (nmg_kill_cracks(s))
{
- if ( nmg_ks( s ) )
+ if (nmg_ks(s))
{
empty_region = 1;
break;
@@ -745,19 +759,19 @@
}
/* kill zero length edgeuses */
- if ( !empty_region )
+ if (!empty_region)
{
- empty_model = nmg_kill_zero_length_edgeuses( *tsp->ts_m );
+ empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
}
- if ( !empty_region && !empty_model )
+ if (!empty_region && !empty_model)
{
/* Write the region to the EUCLID file */
- Write_euclid_region( r, tsp );
+ Write_euclid_region(r, tsp);
}
- if ( !empty_model )
- nmg_kr( r );
+ if (!empty_model)
+ nmg_kr(r);
}
/*
@@ -768,13 +782,14 @@
*/
db_free_tree(curtree, &rt_uniresource); /* Does an nmg_kr() */
- out:
+out:
BU_GETUNION(curtree, tree);
curtree->magic = RT_TREE_MAGIC;
curtree->tr_op = OP_NOP;
return curtree;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/conv/iges/g-iges.c
===================================================================
--- brlcad/trunk/src/conv/iges/g-iges.c 2011-01-12 15:56:50 UTC (rev 42145)
+++ brlcad/trunk/src/conv/iges/g-iges.c 2011-01-12 15:58:03 UTC (rev 42146)
@@ -496,7 +496,25 @@
regions_tried++;
/* Begin bomb protection */
- if ( BU_SETJUMP ) {
+ if ( !BU_SETJUMP ) {
+ /* try */
+
+ if ( verbose )
+ bu_log( "\ndoing boolean tree evaluate...\n" );
+ (void)nmg_model_fuse(*tsp->ts_m, tsp->ts_tol);
+ result = nmg_booltree_evaluate(curtree, tsp->ts_tol, &rt_uniresource);
/* librt/nmg_bool.c */
+
+ if ( result )
+ r = result->tr_d.td_r;
+ else
+ r = (struct nmgregion *)NULL;
+
+ if ( verbose )
+ bu_log( "\nfinished boolean tree evaluate...\n" );
+
+ } else {
+ /* catch */
+
char *sofar;
/* Error, bail out */
@@ -521,20 +539,8 @@
/* Now, make a new, clean model structure for next pass. */
*tsp->ts_m = nmg_mm();
goto out;
- }
- if ( verbose )
- bu_log( "\ndoing boolean tree evaluate...\n" );
- (void)nmg_model_fuse(*tsp->ts_m, tsp->ts_tol);
- result = nmg_booltree_evaluate(curtree, tsp->ts_tol, &rt_uniresource);
/* librt/nmg_bool.c */
+ } BU_UNSETJUMP; /* Relinquish the protection */
- if ( result )
- r = result->tr_d.td_r;
- else
- r = (struct nmgregion *)NULL;
-
- if ( verbose )
- bu_log( "\nfinished boolean tree evaluate...\n" );
- BU_UNSETJUMP; /* Relinquish the protection */
regions_done++;
if (r != 0) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits