Revision: 41213
http://brlcad.svn.sourceforge.net/brlcad/?rev=41213&view=rev
Author: brlcad
Date: 2010-11-02 10:36:22 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
convert our bu_setjump/bu_unsetjump blocks to more familiar try/catch exception
handling layout. this should happen across the entire code base for clarity
and consistency. I remember it taking me a while to wrap my head around jumps
when I started and the inconsistent calling style didn't help.
Modified Paths:
--------------
brlcad/trunk/src/libged/facetize.c
Modified: brlcad/trunk/src/libged/facetize.c
===================================================================
--- brlcad/trunk/src/libged/facetize.c 2010-11-02 10:31:29 UTC (rev 41212)
+++ brlcad/trunk/src/libged/facetize.c 2010-11-02 10:36:22 UTC (rev 41213)
@@ -194,7 +194,11 @@
/* Now, evaluate the boolean tree into ONE region */
bu_vls_printf(&gedp->ged_result_str, "facetize: evaluating boolean
expressions\n");
- if (BU_SETJUMP) {
+ if (!BU_SETJUMP) {
+ /* try */
+ failed = nmg_boolean(facetize_tree, nmg_model,
&gedp->ged_wdbp->wdb_tol, &rt_uniresource);
+ } else {
+ /* catch */
BU_UNSETJUMP;
bu_vls_printf(&gedp->ged_result_str, "WARNING: facetization
failed!!!\n");
if (facetize_tree)
@@ -203,10 +207,8 @@
nmg_km(nmg_model);
nmg_model = (struct model *)NULL;
return GED_ERROR;
- }
+ } BU_UNSETJUMP;
- failed = nmg_boolean(facetize_tree, nmg_model,
&gedp->ged_wdbp->wdb_tol, &rt_uniresource);
- BU_UNSETJUMP;
} else
failed = 1;
@@ -226,7 +228,14 @@
/* Triangulate model, if requested */
if (triangulate && !make_bot) {
bu_vls_printf(&gedp->ged_result_str, "facetize: triangulating
resulting object\n");
- if (BU_SETJUMP) {
+ if (!BU_SETJUMP) {
+ /* try */
+ if (marching_cube == 1)
+ nmg_triangulate_model_mc(nmg_model, &gedp->ged_wdbp->wdb_tol);
+ else
+ nmg_triangulate_model(nmg_model, &gedp->ged_wdbp->wdb_tol);
+ } else {
+ /* catch */
BU_UNSETJUMP;
bu_vls_printf(&gedp->ged_result_str, "WARNING: triangulation
failed!!!\n");
if (facetize_tree)
@@ -235,12 +244,7 @@
nmg_km(nmg_model);
nmg_model = (struct model *)NULL;
return GED_ERROR;
- }
- if (marching_cube == 1)
- nmg_triangulate_model_mc(nmg_model, &gedp->ged_wdbp->wdb_tol);
- else
- nmg_triangulate_model(nmg_model, &gedp->ged_wdbp->wdb_tol);
- BU_UNSETJUMP;
+ } BU_UNSETJUMP;
}
if (make_bot) {
@@ -253,7 +257,12 @@
/* WTF, FIXME: this is only dumping the first shell of the first region
*/
r = BU_LIST_FIRST(nmgregion, &nmg_model->r_hd);
s = BU_LIST_FIRST(shell, &r->s_hd);
- if (BU_SETJUMP) {
+
+ if (!BU_SETJUMP) {
+ /* try */
+ bot = (struct rt_bot_internal *)nmg_bot(s,
&gedp->ged_wdbp->wdb_tol);
+ } else {
+ /* catch */
BU_UNSETJUMP;
bu_vls_printf(&gedp->ged_result_str, "WARNING: conversion to BOT
failed!\n");
if (facetize_tree)
@@ -262,9 +271,6 @@
nmg_km(nmg_model);
nmg_model = (struct model *)NULL;
return GED_ERROR;
-
- } else {
- bot = (struct rt_bot_internal *)nmg_bot(s,
&gedp->ged_wdbp->wdb_tol);
} BU_UNSETJUMP;
nmg_km(nmg_model);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits