[brlcad-commits] SF.net SVN: brlcad:[41311] brlcad/trunk/src/libged/erase.c

2010-11-10 Thread bob1961
Revision: 41311
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41311view=rev
Author:   bob1961
Date: 2010-11-10 16:06:48 + (Wed, 10 Nov 2010)

Log Message:
---
This corrects behavior of the erase_all command (i.e. The who command now 
yields the proper results and a subsequent raytrace is also correct).

Modified Paths:
--
brlcad/trunk/src/libged/erase.c

Modified: brlcad/trunk/src/libged/erase.c
===
--- brlcad/trunk/src/libged/erase.c 2010-11-09 21:50:48 UTC (rev 41310)
+++ brlcad/trunk/src/libged/erase.c 2010-11-10 16:06:48 UTC (rev 41311)
@@ -401,7 +401,51 @@
 }
 }
 
+int
+_ged_eraseFirstSubpath(struct ged *gedp,
+  struct ged_display_list *gdlp,
+  struct db_full_path *subpath,
+  const int skip_first)
+{
+struct solid *sp;
+struct solid *nsp;
+struct db_full_path dup_path;
 
+db_full_path_init(dup_path);
+
+sp = BU_LIST_NEXT(solid, gdlp-gdl_headSolid);
+while (BU_LIST_NOT_HEAD(sp, gdlp-gdl_headSolid)) {
+   nsp = BU_LIST_PNEXT(solid, sp);
+   if (db_full_path_subset(sp-s_fullpath, subpath, skip_first)) {
+   int ret;
+
+   db_dup_full_path(dup_path, sp-s_fullpath);
+   BU_LIST_DEQUEUE(sp-l);
+   FREE_SOLID(sp, _FreeSolid.l);
+
+   BU_LIST_DEQUEUE(gdlp-l);
+
+   if (!BU_LIST_IS_EMPTY(gdlp-gdl_headSolid)) {
+   ged_splitGDL(gedp, gdlp, dup_path);
+   ret = 1;
+   } else {
+   ret = 0;
+   }
+
+   db_free_full_path(dup_path);
+
+   /* Free up the display list */
+   bu_vls_free(gdlp-gdl_path);
+   free((void *)gdlp);
+
+   return ret;
+   }
+   sp = nsp;
+}
+
+return 0;
+}
+
 /*
  * Erase/remove display list item from headDisplay if path is a subset of 
item's path.
  */
@@ -417,13 +461,30 @@
 if (db_string_to_path(subpath, gedp-ged_wdbp-dbip, path) == 0) {
gdlp = BU_LIST_NEXT(ged_display_list, gedp-ged_gdp-gd_headDisplay);
while (BU_LIST_NOT_HEAD(gdlp, gedp-ged_gdp-gd_headDisplay)) {
+   gdlp-gdl_wflag = 0;
+   gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
+   }
+
+   gdlp = BU_LIST_NEXT(ged_display_list, gedp-ged_gdp-gd_headDisplay);
+   while (BU_LIST_NOT_HEAD(gdlp, gedp-ged_gdp-gd_headDisplay)) {
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
 
+   /* This display list has already been visited. */
+   if (gdlp-gdl_wflag) {
+   gdlp = next_gdlp;
+   continue;
+   }
+
+   /* Mark as being visited. */
+   gdlp-gdl_wflag = 1;
+
if (db_string_to_path(fullpath, gedp-ged_wdbp-dbip, 
bu_vls_addr(gdlp-gdl_path)) == 0) {
if (db_full_path_subset(fullpath, subpath, skip_first)) {
_ged_freeDisplayListItem(gedp, gdlp);
-   } else {
-   eraseAllSubpathsFromSolidList(gdlp, subpath, skip_first);
+   } else if (_ged_eraseFirstSubpath(gedp, gdlp, subpath, 
skip_first)) {
+   gdlp = BU_LIST_NEXT(ged_display_list, 
gedp-ged_gdp-gd_headDisplay);
+   db_free_full_path(fullpath);
+   continue;
}
 
db_free_full_path(fullpath);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41312] brlcad/trunk/src/tclscripts/archer

2010-11-10 Thread bob1961
Revision: 41312
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41312view=rev
Author:   bob1961
Date: 2010-11-10 18:25:04 + (Wed, 10 Nov 2010)

Log Message:
---
Added a way to bypass tree decoration (i.e. increase tree update speed) by 
setting a no_tree_decorate variable in .archerrc.

Modified Paths:
--
brlcad/trunk/src/tclscripts/archer/Archer.tcl
brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl

Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl   2010-11-10 16:06:48 UTC 
(rev 41311)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl   2010-11-10 18:25:04 UTC 
(rev 41312)
@@ -8313,6 +8313,7 @@
 
 ::itcl::body Archer::readPreferences {} {
 global env
+global no_tree_decorate
 
 if {$mViewOnly} {
return
@@ -8385,6 +8386,12 @@
 }
 
 ::itcl::body Archer::writePreferencesBody {_pfile} {
+global no_tree_decorate
+
+if {[info exists no_tree_decorate]} {
+   puts $_pfile set no_tree_decorate $no_tree_decorate
+}
+
 puts $_pfile set mBackgroundColor \$mBackgroundColor\
 puts $_pfile set mBindingMode $mBindingMode
 puts $_pfile set mEnableBigE $mEnableBigE

Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2010-11-10 16:06:48 UTC 
(rev 41311)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2010-11-10 18:25:04 UTC 
(rev 41312)
@@ -3287,6 +3287,8 @@
 }
 
 ::itcl::body ArcherCore::fillTree {_pnode _ctext _flat {_allow_multiple 0}} {
+global no_tree_decorate
+
 set cnodes [getCNodesFromCText $_pnode $_ctext]
 
 # Atleast one node for _pnode/_ctext already exists
@@ -3303,12 +3305,18 @@
 }
 
 set ptext $mNode2Text($_pnode)
-set op [getTreeOp $ptext $_ctext]
-set img [getTreeImage $_ctext $ctype $op $isregion]
-set cnode [$itk_component(newtree) insert $_pnode end \
-  -tags $TREE_POPUP_TAG \
-  -text $_ctext \
-  -image $img]
+if {[info exists no_tree_decorate]  $no_tree_decorate} {
+   set cnode [$itk_component(newtree) insert $_pnode end \
+  -tags $TREE_POPUP_TAG \
+  -text $_ctext]
+} else {
+   set op [getTreeOp $ptext $_ctext]
+   set img [getTreeImage $_ctext $ctype $op $isregion]
+   set cnode [$itk_component(newtree) insert $_pnode end \
+  -tags $TREE_POPUP_TAG \
+  -text $_ctext \
+  -image $img]
+}
 fillTreeColumns $cnode $_ctext
 
 if {!$_flat  $ctype == comb} {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41314] brlcad/trunk

2010-11-10 Thread brlcad
Revision: 41314
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41314view=rev
Author:   brlcad
Date: 2010-11-10 19:23:29 + (Wed, 10 Nov 2010)

Log Message:
---
eliminate the use of RT_MAXARGS by making oldTrees be a dynamically allocated 
array.  adding a capacity parameter to keep track of how many slots are 
available.  renamed oldNumTrees to just numTrees and used size_t for sizes.

Modified Paths:
--
brlcad/trunk/include/dm-rtgl.h
brlcad/trunk/src/libdm/dm-rtgl.c

Modified: brlcad/trunk/include/dm-rtgl.h
===
--- brlcad/trunk/include/dm-rtgl.h  2010-11-10 19:20:57 UTC (rev 41313)
+++ brlcad/trunk/include/dm-rtgl.h  2010-11-10 19:23:29 UTC (rev 41314)
@@ -136,12 +136,13 @@
 int controlClip;
 int calls;
 int jobsDone;
-char *oldTrees[RT_MAXARGS];
-int oldNumTrees;
+char **oldTrees;
+size_t numTrees;
+size_t treeCapacity;
 struct bu_hash_tbl *colorTable;
 struct ptInfoList *currItem;
 struct jobList *currJob;
-int numJobs;
+size_t numJobs;
 int rtglWasClosed;
 };
 

Modified: brlcad/trunk/src/libdm/dm-rtgl.c
===
--- brlcad/trunk/src/libdm/dm-rtgl.c2010-11-10 19:20:57 UTC (rev 41313)
+++ brlcad/trunk/src/libdm/dm-rtgl.c2010-11-10 19:23:29 UTC (rev 41314)
@@ -170,6 +170,7 @@
 0,
 NULL,
 0,
+0,
 NULL,
 NULL,
 NULL,
@@ -773,9 +774,15 @@
 rtgljob.controlClip = 1;
 rtgljob.calls = 0;
 rtgljob.jobsDone = 0;
-rtgljob.oldNumTrees = 0;
+rtgljob.numTrees = 0;
 rtgljob.numJobs = 0;
 rtgljob.rtglWasClosed = 1;
+
+/* release trees */
+if (rtgljob.oldTrees != NULL)
+   bu_free(rtgljob.oldTrees, free oldTrees);
+rtgljob.oldTrees = (char **)NULL;
+rtgljob.treeCapacity = 0;
 
 /* free draw list */
 if (rtgljob.colorTable != NULL) {
@@ -786,11 +793,31 @@
 rtgljob.currItem = NULL;
 rtgljob.currJob = NULL;
 
-
-
 return TCL_OK;
 }
 
+
+/* stash a new job into a dynamically allocated container */
+HIDDEN void
+rtgl_stashTree(struct rtglJobs *job, char *tree)
+{
+static const size_t STEP = 1024;
+
+/* make sure there is enough room */
+if (job-treeCapacity == 0) {
+   job-oldTrees = (char **)bu_calloc(STEP, sizeof(char *), called 
oldTrees);
+   job-treeCapacity = STEP;
+} else if (job-numTrees + 1 = job-treeCapacity) {
+   job-oldTrees = (char **)bu_realloc(job-oldTrees, (sizeof(char *) * 
job-treeCapacity) + STEP, realloc oldTrees);
+   job-treeCapacity += STEP;
+}
+
+/* add it */
+job-oldTrees[job-numTrees] = tree;
+job-numTrees++;
+}
+
+
 /*
  * O G L _ D R A W B E G I N
  *
@@ -1611,7 +1638,7 @@
 
 int foundalloldtrees = 1;
 int foundthistree = 0;
-for (i = 0; i  rtgljob.oldNumTrees; i++) {
+for (i = 0; i  rtgljob.numTrees; i++) {
currTree = rtgljob.oldTrees[i];
foundthistree = 0;
for (j = 0; j  numVisible; j++) {
@@ -1627,7 +1654,7 @@
foundalloldtrees = 1;

/* drop previous work */
-   rtgljob.oldNumTrees = 0;
+   rtgljob.numTrees = 0;
freeJobList(jobs);
 
if (rtgljob.colorTable != NULL) {
@@ -1651,7 +1678,7 @@
 if (numVisible == 0) {
 
/* drop previous work */
-   rtgljob.oldNumTrees = 0;
+   rtgljob.numTrees = 0;
freeJobList(jobs);
 
if (rtgljob.colorTable != NULL) {
@@ -1682,7 +1709,7 @@
 
 if (rtgljob.rtglWasClosed == 1) {
rtgljob.rtglWasClosed = 0;
-   rtgljob.oldNumTrees = 0;
+   rtgljob.numTrees = 0;
/* drop previous work */
freeJobList(jobs);

@@ -1717,7 +1744,7 @@
 * but that's not set up yet without clearing everything
 * first and starting over.
 */
-for (j = 0; j  rtgljob.oldNumTrees; j++) {
+for (j = 0; j  rtgljob.numTrees; j++) {
 if (strcmp(currTree, rtgljob.oldTrees[j]) == 0)
 new = 0;
 }
@@ -1729,7 +1756,7 @@
 
/* add new tree to list of displayed */
 numNew++;
-   rtgljob.oldTrees[rtgljob.oldNumTrees++] = currTree;
+   rtgl_stashTree(rtgljob, currTree);
 }
 }
 
@@ -1750,7 +1777,7 @@
jobsArray = NULL;
}
maxSpan = 0.0;
-   rtgljob.oldNumTrees = 0;
+   rtgljob.numTrees = 0;
numShot = rtgljob.numJobs = 0;
rtgljob.currJob = NULL;
numVisible = ged_build_tops(gedp, visibleTrees, 
visibleTrees[RT_MAXARGS]);
@@ -1763,7 +1790,7 @@
 * but that's not set up yet without clearing everything
 * first and starting over.
 **/
-   for (j = 0; j  rtgljob.oldNumTrees; j++) {
+   for (j = 0; j  rtgljob.numTrees; j++) {
if (strcmp(currTree, rtgljob.oldTrees[j]) 

[brlcad-commits] SF.net SVN: brlcad:[41316] brlcad/trunk/src/libdm/dm-rtgl.c

2010-11-10 Thread brlcad
Revision: 41316
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41316view=rev
Author:   brlcad
Date: 2010-11-10 19:57:23 + (Wed, 10 Nov 2010)

Log Message:
---
quell all verbose compilation warnings including unused params, unused vars, 
validation checks, and some cleanup.

Modified Paths:
--
brlcad/trunk/src/libdm/dm-rtgl.c

Modified: brlcad/trunk/src/libdm/dm-rtgl.c
===
--- brlcad/trunk/src/libdm/dm-rtgl.c2010-11-10 19:24:35 UTC (rev 41315)
+++ brlcad/trunk/src/libdm/dm-rtgl.c2010-11-10 19:57:23 UTC (rev 41316)
@@ -156,14 +156,12 @@
 
 /* lighting parameters */
 static float amb_three[] = {0.3, 0.3, 0.3, 1.0};
-static float light0_direction[] = {0.0, 0.0, 1.0, 0.0};
 static float light0_position[] = {0.0, 0.0, 1.0, 0.0};
 static float light0_diffuse[] = {1.0, 1.0, 1.0, 1.0};
 static float wireColor[4];
 static float ambientColor[4];
 static float specularColor[4];
 static float diffuseColor[4];
-static float backColor[] = {1.0, 1.0, 0.0, 1.0};
 
 struct rtglJobs rtgljob = {
 1,
@@ -185,7 +183,9 @@
 struct rt_i *rtip;
 
 /* free all jobs from job list */
-void freeJobList(struct jobList *jobs) {
+void
+freeJobList(struct jobList *jobs)
+{
 
 /* list cannot be empty */
 if (jobs-l.forw != NULL  (struct jobList *)jobs-l.forw != (*jobs)) {
@@ -1024,16 +1024,12 @@
 * clipping) in z direction, but less precision
 */
zclip[10] = clip;
-   }
-
-   /* use default z clipping */
-   else {
+   } else {
+   /* use default z clipping */
zclip[10] = dmp-dm_bound;
}
-}
-
-/* prevent z-clipping */
-else {
+} else {
+   /* prevent z-clipping */
zclip[10] = 1e-20;
 }
 
@@ -1076,16 +1072,11 @@
 
 /* apply view */
 if (rtgljob.controlClip) {
-/*
-  bu_log(clip: %3.2f translate:%3.2f, clip, clip - 1.25);
-*/
/* move clipping volume when zooming-in
 * to prevent clipping front surfaces
 */
glTranslatef(0.0, 0.0, clip - 1.75);
-}
-
-else {
+} else {
glTranslatef(0.0, 0.0, -1.0);
 }
 
@@ -1097,7 +1088,9 @@
 
 
 /* convert color vector to unsigned char array */
-unsigned char* getColorKey(float *color) {
+HIDDEN unsigned char *
+getColorKey(float *color)
+{
 int i, value;
 unsigned char* key = bu_malloc(sizeof(char) * KEY_LENGTH, dm-rtgl.c: 
getColorKey);
 
@@ -,7 +1104,9 @@
 
 
 /* calculate and add hit-point info to info list */
-void addInfo(struct application *app, struct hit *hit, struct soltab *soltab, 
char flip, float *partColor) {
+HIDDEN void
+addInfo(struct application *app, struct hit *hit, struct soltab *soltab, char 
flip, float *partColor)
+{
 point_t point;
 vect_t normal;
 int newColor;
@@ -1174,11 +1169,9 @@
/* add the new bin to the table */
entry = bu_hash_add_entry(rtgljob.colorTable, colorKey, KEY_LENGTH, 
newColor);
bu_set_hash_value(entry, (unsigned char *)bin); 
-}
+} else {
+   /* found existing color bin */
 
-/* found existing color bin */
-else {
-
/* get bin's current list item */
head = (bin-list-l);
rtgljob.currItem = (struct ptInfoList *)head-forw;
@@ -1206,12 +1199,16 @@
 
 
 /* add all hit point info to info list */
-int recordHit(struct application *app, struct partition *partH, struct seg 
*segs)
+HIDDEN int
+recordHit(struct application *app, struct partition *partH, struct seg *segs)
 {
 struct partition *part;
 struct soltab *soltab;
 float *partColor;
 
+RT_CK_APPLICATION(app);
+RT_CK_SEG(segs);
+
 /* add all hit points */
 for (part = partH-pt_forw; part != partH; part = part-pt_forw) {
 
@@ -1235,12 +1232,17 @@
 
 
 /* don't care about misses */
-int ignoreMiss(struct application *app) {
+HIDDEN int
+ignoreMiss(struct application *app)
+{
+RT_CK_APPLICATION(app);
 return 0;
 }
 
 
-double jitter(double range) {
+HIDDEN double
+jitter(double range)
+{
 if (rand() % 2)
return fmod(rand(), range);
 
@@ -1248,7 +1250,9 @@
 }
 
 
-void randShots(fastf_t *center, fastf_t radius, int flag) {
+HIDDEN void
+randShots(fastf_t *center, fastf_t radius, int flag)
+{
 int i, j;
 vect_t view, dir;
 point_t pt;
@@ -1285,9 +1289,7 @@

if (RT_BADVEC(app.a_ray.r_pt)) {
VPRINT(bad pt:, app.a_ray.r_pt);
-   }
-   
-   else if (flag) {
+   } else if (flag) {
/* shoot ray */
rt_shootray(app);
}
@@ -1314,11 +1316,13 @@
 }
 
 
-void swapItems(struct bu_list *a, struct bu_list *b) {
+HIDDEN void
+swapItems(struct bu_list *a, struct bu_list *b)
+{
 struct bu_list temp;
 
-/* a immediately followed by b */
 if (a-forw == b) {
+   /* a immediately followed by b */
 
/* fix surrounding links */
a-back-forw = b;
@@ 

[brlcad-commits] SF.net SVN: brlcad:[41317] brlcad/trunk/src/libdm/dm-rtgl.c

2010-11-10 Thread brlcad
Revision: 41317
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41317view=rev
Author:   brlcad
Date: 2010-11-10 20:19:21 + (Wed, 10 Nov 2010)

Log Message:
---
remove couple more instances of fixed-size RT_MAXARGS arrays.  make 
visibleTrees array size dynamic, exactly big enough to fix the max number it 
might possibly store.

Modified Paths:
--
brlcad/trunk/src/libdm/dm-rtgl.c

Modified: brlcad/trunk/src/libdm/dm-rtgl.c
===
--- brlcad/trunk/src/libdm/dm-rtgl.c2010-11-10 19:57:23 UTC (rev 41316)
+++ brlcad/trunk/src/libdm/dm-rtgl.c2010-11-10 20:19:21 UTC (rev 41317)
@@ -1623,11 +1623,15 @@
 HIDDEN int
 rtgl_drawVList(struct dm *dmp, struct bn_vlist *UNUSED(vp))
 {
-size_t i, j, new, numVisible, numNew, maxPixels, viewSize;
+size_t i, j, new, numNew, maxPixels, viewSize;
 vect_t span;
-char *currTree, *visibleTrees[RT_MAXARGS];
+char *currTree;
 struct db_i *dbip;
 struct jobList jobs;
+
+size_t numVisible = 0;
+size_t visibleCount = 0;
+char **visibleTrees = NULL;
 
 int foundalloldtrees = 1;
 int foundthistree = 0;
@@ -1666,8 +1670,18 @@
rtgljob.colorTable = bu_create_hash_tbl(START_TABLE_SIZE);
 }
 
+/* allocate our visible trees */
+{
+   struct ged_display_list *gdlp;
+   visibleCount = 0;
+   for (BU_LIST_FOR(gdlp, ged_display_list, 
gedp-ged_gdp-gd_headDisplay)) {
+   visibleCount++;
+   }
+   visibleTrees = (char **)bu_calloc(visibleCount, sizeof(char *), alloc 
visibleTrees);
+}
+
 /* get number and names of visible tree tops */
-numVisible = ged_build_tops(gedp, visibleTrees, visibleTrees[RT_MAXARGS]);
+numVisible = ged_build_tops(gedp, visibleTrees, 
visibleTrees[visibleCount]);
 
 for (i = 0; i  rtgljob.numTrees; i++) {
currTree = rtgljob.oldTrees[i];
@@ -1811,7 +1825,7 @@
rtgljob.numTrees = 0;
numShot = rtgljob.numJobs = 0;
rtgljob.currJob = NULL;
-   numVisible = ged_build_tops(gedp, visibleTrees, 
visibleTrees[RT_MAXARGS]);
+   numVisible = ged_build_tops(gedp, visibleTrees, 
visibleTrees[visibleCount]);
for (i = 0; i  numVisible; i++) {
currTree = visibleTrees[i];
new = 1;
@@ -1893,6 +1907,12 @@
 
 } /* numNew  0 */
 
+/* done with visibleTrees */
+if (visibleTrees != NULL) {
+   bu_free(visibleTrees, free visibleTrees);
+   visibleTrees = NULL;
+}
+
 /* get view vector */
 bn_vec_aed(view, gedp-ged_gvp-gv_aet[0]*DEG2RAD, 
gedp-ged_gvp-gv_aet[1]*DEG2RAD, 1);
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41320] brlcad/trunk/src/mged

2010-11-10 Thread brlcad
Revision: 41320
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41320view=rev
Author:   brlcad
Date: 2010-11-10 21:16:56 + (Wed, 10 Nov 2010)

Log Message:
---
more MAXARGS elimination.  use a -1 magic to imply unlimited args for the 
funtab.

Modified Paths:
--
brlcad/trunk/src/mged/animedit.c
brlcad/trunk/src/mged/cmd.c
brlcad/trunk/src/mged/mged.h

Modified: brlcad/trunk/src/mged/animedit.c
===
--- brlcad/trunk/src/mged/animedit.c2010-11-10 21:09:31 UTC (rev 41319)
+++ brlcad/trunk/src/mged/animedit.c2010-11-10 21:16:56 UTC (rev 41320)
@@ -85,29 +85,29 @@
 {joint , , Joint command table,
  0, 0, 0, FALSE},
 {?, [commands], summary of available joint commands,
- f_jfhelp, 0, MAXARGS, FALSE},
+ f_jfhelp, 0, FUNTAB_UNLIMITED, FALSE},
 {accept, [joints], accept a series of moves,
- f_jaccept, 1, MAXARGS, FALSE},
+ f_jaccept, 1, FUNTAB_UNLIMITED, FALSE},
 {debug, [hex code], Show/set debuging bit vector for joints,
  f_jdebug, 1, 2, FALSE},
 {help, [commands], give usage message for given joint commands,
- f_jhelp, 0, MAXARGS, FALSE},
+ f_jhelp, 0, FUNTAB_UNLIMITED, FALSE},
 {holds, [names], list constraints,
- f_jhold, 1, MAXARGS, FALSE},
+ f_jhold, 1, FUNTAB_UNLIMITED, FALSE},
 {list, [names], list joints.,
- f_jlist, 1, MAXARGS, FALSE},
+ f_jlist, 1, FUNTAB_UNLIMITED, FALSE},
 {load, file_name, load a joint/constraint file,
- f_jload, 2, MAXARGS, FALSE},
+ f_jload, 2, FUNTAB_UNLIMITED, FALSE},
 {mesh, , Build the grip mesh,
  f_jmesh, 0, 1, FALSE},
 {move, joint_name p1 [p2...p6], Manual adjust a joint,
  f_jmove, 3, 8, FALSE},
 {reject, [joint_names], reject joint motions,
- f_jreject, 1, MAXARGS, FALSE},
+ f_jreject, 1, FUNTAB_UNLIMITED, FALSE},
 {save,   file_name, Save joints and constraints to disk,
  f_jsave, 2, 2, FALSE},
 {solve, constraint, Solve a or all constraints,
- f_jsolve, 1, MAXARGS, FALSE},
+ f_jsolve, 1, FUNTAB_UNLIMITED, FALSE},
 {test, file_name, test use of bu_lex routine.,
  f_jtest, 2, 2, FALSE},
 {unload, , Unload any joint/constrants that have been loaded,

Modified: brlcad/trunk/src/mged/cmd.c
===
--- brlcad/trunk/src/mged/cmd.c 2010-11-10 21:09:31 UTC (rev 41319)
+++ brlcad/trunk/src/mged/cmd.c 2010-11-10 21:16:56 UTC (rev 41320)
@@ -1219,7 +1219,7 @@
if (strcmp(ftp-ft_name, argv[0]) != 0)
continue;
/* We have a match */
-   if ((ftp-ft_min = argc)  (argc = ftp-ft_max)) {
+   if ((ftp-ft_min = argc)  (ftp-ft_max  0 || argc = ftp-ft_max)) {
/* Input has the right number of args.  Call function
 * listed in table, with main(argc, argv) style args
 */

Modified: brlcad/trunk/src/mged/mged.h
===
--- brlcad/trunk/src/mged/mged.h2010-11-10 21:09:31 UTC (rev 41319)
+++ brlcad/trunk/src/mged/mged.h2010-11-10 21:16:56 UTC (rev 41320)
@@ -398,6 +398,9 @@
return TCL_ERROR; \
}
 
+
+#define FUNTAB_UNLIMITED -1
+
 struct funtab {
 char *ft_name;
 char *ft_parms;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41321] brlcad/trunk/src/tclscripts/archer/CombEditFrame .tcl

2010-11-10 Thread bob1961
Revision: 41321
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41321view=rev
Author:   bob1961
Date: 2010-11-10 22:32:19 + (Wed, 10 Nov 2010)

Log Message:
---
Added the validTableEntry method for validating CombEditFrame's relative edit 
tables entries.

Modified Paths:
--
brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl

Modified: brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl
===
--- brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl2010-11-10 
21:16:56 UTC (rev 41320)
+++ brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl2010-11-10 
22:32:19 UTC (rev 41321)
@@ -99,6 +99,7 @@
method deleteRow  {_type _row}
method setKeypoint  {args}
method setKeypointVC  {_tname _row _col}
+   method validateTableEntry {_row _col _newval _tname}
 
# Override what's in GeometryEditFrame
method updateGeometryIfMod {}
@@ -565,7 +566,9 @@
-cols $cols \
-titlerows 1 \
-colstretchmode all \
-   -variable [::itcl::scope mMemberData$tname]
+   -variable [::itcl::scope mMemberData$tname] \
+   -validate 1 \
+   -validatecommand [::itcl::code $this validateTableEntry %r %c 
%S $tname]
} {}
 
# Create scrollbars
@@ -934,6 +937,26 @@
 }
 }
 
+::itcl::body CombEditFrame::validateTableEntry {_row _col _newval _tname} {
+if {$_col == 0 || ![info exists mMemberData$_tname\($_row,0)]} {
+   return 0
+}
+
+if {$_col == 1} {
+   if {[regexp {[/\?\*\n]} $_newval]} {
+   return 0
+   }
+
+   return 1
+}
+
+if {[string is double $_newval])} {
+   return 1
+}
+
+return 0
+}
+
 ::itcl::body CombEditFrame::updateGeometryIfMod {} {
 if {$itk_option(-mged) ==  ||
$itk_option(-geometryObject) == } {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41323] brlcad/trunk/src/libbu/malloc.c

2010-11-10 Thread r_weiss
Revision: 41323
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41323view=rev
Author:   r_weiss
Date: 2010-11-10 23:37:28 + (Wed, 10 Nov 2010)

Log Message:
---
Updated function bu_realloc to function more line the standard function realloc.

Modified Paths:
--
brlcad/trunk/src/libbu/malloc.c

Modified: brlcad/trunk/src/libbu/malloc.c
===
--- brlcad/trunk/src/libbu/malloc.c 2010-11-10 22:37:36 UTC (rev 41322)
+++ brlcad/trunk/src/libbu/malloc.c 2010-11-10 23:37:28 UTC (rev 41323)
@@ -352,7 +352,13 @@
 bu_n_free++;
 }
 
-
+/**
+ * B U _ R E A L L O C
+ *
+ * This routine is to mimic the behavior of the standard
+ * function realloc. If this function frees memory then
+ * a NULL pointer is returned.
+ */
 genptr_t
 bu_realloc(register genptr_t ptr, size_t cnt, const char *str)
 {
@@ -360,18 +366,38 @@
 genptr_t original_ptr;
 const size_t MINSIZE = sizeof(uint32_t)  sizeof(intptr_t) ? 
sizeof(uint32_t) : sizeof(intptr_t);
 
-if (UNLIKELY(cnt  MINSIZE)) {
-cnt = MINSIZE;
+/* If bu_realloc receives a NULL pointer and zero size then bomb
+ * because the behavior of realloc is undefined for these inputs.
+ */
+if (UNLIKELY(!cnt  !ptr)) {
+   bu_bomb(bu_realloc(): invalid input, NULL pointer and zero size\n);
 }
 
+/* If bu_realloc receives a NULL pointer and non-zero size then
+ * allocate the memory.
+ */
 if (UNLIKELY(!ptr)) {
-   /* This is so we are compatible with system realloc.  It seems
-* like an odd behaviour, but some non-BRL-CAD code relies on
-* this.
-*/
return bu_malloc(cnt, str);
 }
 
+/* If bu_realloc receives a non-NULL pointer and zero size then
+ * free the memory.
+ */
+if (UNLIKELY(!cnt)) {
+   bu_free(ptr, str);
+   return (genptr_t)NULL;
+}
+
+/* If the new allocation size is smaller than the minimum size
+ * to store a pointer then set the size to this minimum size.
+ * This is necessary so that the function bu_free can place a
+ * value in the memory before it is freed. The size allocated
+ * needs to be large enough to hold this value.
+ */
+if (UNLIKELY(cnt  MINSIZE)) {
+cnt = MINSIZE;
+}
+
 if (UNLIKELY(bu_debugBU_DEBUG_MEM_CHECK)) {
mp = _bu_memdebug_check(ptr, str);
if (UNLIKELY(mp == MEMDEBUG_NULL)) {
@@ -400,11 +426,6 @@
BU_LIST_DEQUEUE((mqp-q));
 }
 
-if (UNLIKELY(cnt == 0)) {
-   fprintf(stderr, ERROR: bu_realloc cnt=0 (ptr=%p) %s\n, ptr, str);
-   bu_bomb(ERROR: bu_realloc(0)\n);
-}
-
 original_ptr = ptr;
 
 #if defined(MALLOC_NOT_MP_SAFE)
@@ -415,6 +436,14 @@
 bu_semaphore_release(BU_SEM_SYSCALL);
 #endif
 
+/* If realloc returns NULL then it failed to allocate the
+ * requested memory and we need to bomb.
+ */
+if (UNLIKELY(!ptr)) {
+   fprintf(stderr, bu_realloc(): unable to allocate requested memory of 
size %d, %s\n, cnt, str);
+   bu_bomb(bu_realloc(): unable to allocate requested memory.\n);
+}
+
 if (UNLIKELY(ptr==(char *)0 || bu_debugBU_DEBUG_MEM_LOG)) {
bu_semaphore_acquire(BU_SEM_SYSCALL);
if (ptr == original_ptr) {
@@ -427,10 +456,7 @@
 
bu_semaphore_release(BU_SEM_SYSCALL);
 }
-if (UNLIKELY(ptr==(char *)0  cnt  0)) {
-   fprintf(stderr, bu_realloc: Insufficient memory available\n);
-   bu_bomb(bu_realloc: malloc failure);
-}
+
 if (UNLIKELY(bu_debugBU_DEBUG_MEM_CHECK  ptr)) {
/* Even if ptr didn't change, need to update cnt  barrier */
bu_semaphore_acquire(BU_SEM_SYSCALL);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41325] brlcad/trunk/include/bu.h

2010-11-10 Thread brlcad
Revision: 41325
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41325view=rev
Author:   brlcad
Date: 2010-11-11 02:33:58 + (Thu, 11 Nov 2010)

Log Message:
---
expand the documentation for bu_realloc() and how it relates to the boundary 
cases where size in zero and/or the ptr is NULL with particular clarity that 
NULL will still never be returned.  fortunately, the standard allows the return 
to be non-null even for zero sizes.

Modified Paths:
--
brlcad/trunk/include/bu.h

Modified: brlcad/trunk/include/bu.h
===
--- brlcad/trunk/include/bu.h   2010-11-11 02:32:30 UTC (rev 41324)
+++ brlcad/trunk/include/bu.h   2010-11-11 02:33:58 UTC (rev 41325)
@@ -3234,13 +3234,18 @@
  *
  * bu_malloc()/bu_free() compatible wrapper for realloc().
  *
+ * this routine mimics the C99 standard behavior of realloc() except
+ * that NULL will never be returned.  it will bomb if siz is zero and
+ * ptr is NULL.  it will return a minimum allocation suitable for
+ * bu_free() if siz is zero and ptr is non-NULL.
+ *
  * While the string 'str' is provided for the log messages, don't
- * disturb the mdb_str value, so that this storage allocation can be
+ * disturb the str value, so that this storage allocation can be
  * tracked back to it's original creator.
  */
 BU_EXPORT BU_EXTERN(genptr_t bu_realloc,
(genptr_t ptr,
-size_t cnt,
+size_t siz,
 const char *str));
 
 /**


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41324] brlcad/trunk/src/libbu/malloc.c

2010-11-10 Thread brlcad
Revision: 41324
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41324view=rev
Author:   brlcad
Date: 2010-11-11 02:32:30 + (Thu, 11 Nov 2010)

Log Message:
---
rename cnt to siz to reflect that it's not a count ala calloc() but that it's a 
size ala malloc().  also remove the doxygen comment on bu_realloc() since 
public API comments for libbu are all included in the public interface headers. 
 implementation files only include doxygen comments for significant 
implementation details that are noteworthy.

Modified Paths:
--
brlcad/trunk/src/libbu/malloc.c

Modified: brlcad/trunk/src/libbu/malloc.c
===
--- brlcad/trunk/src/libbu/malloc.c 2010-11-10 23:37:28 UTC (rev 41323)
+++ brlcad/trunk/src/libbu/malloc.c 2010-11-11 02:32:30 UTC (rev 41324)
@@ -352,15 +352,9 @@
 bu_n_free++;
 }
 
-/**
- * B U _ R E A L L O C
- *
- * This routine is to mimic the behavior of the standard
- * function realloc. If this function frees memory then
- * a NULL pointer is returned.
- */
+
 genptr_t
-bu_realloc(register genptr_t ptr, size_t cnt, const char *str)
+bu_realloc(register genptr_t ptr, size_t siz, const char *str)
 {
 struct memdebug *mp=NULL;
 genptr_t original_ptr;
@@ -369,7 +363,7 @@
 /* If bu_realloc receives a NULL pointer and zero size then bomb
  * because the behavior of realloc is undefined for these inputs.
  */
-if (UNLIKELY(!cnt  !ptr)) {
+if (UNLIKELY(!siz  !ptr)) {
bu_bomb(bu_realloc(): invalid input, NULL pointer and zero size\n);
 }
 
@@ -377,13 +371,13 @@
  * allocate the memory.
  */
 if (UNLIKELY(!ptr)) {
-   return bu_malloc(cnt, str);
+   return bu_malloc(siz, str);
 }
 
 /* If bu_realloc receives a non-NULL pointer and zero size then
  * free the memory.
  */
-if (UNLIKELY(!cnt)) {
+if (UNLIKELY(!siz)) {
bu_free(ptr, str);
return (genptr_t)NULL;
 }
@@ -394,22 +388,22 @@
  * value in the memory before it is freed. The size allocated
  * needs to be large enough to hold this value.
  */
-if (UNLIKELY(cnt  MINSIZE)) {
-cnt = MINSIZE;
+if (UNLIKELY(siz  MINSIZE)) {
+siz = MINSIZE;
 }
 
 if (UNLIKELY(bu_debugBU_DEBUG_MEM_CHECK)) {
mp = _bu_memdebug_check(ptr, str);
if (UNLIKELY(mp == MEMDEBUG_NULL)) {
fprintf(stderr, %p realloc%6d %s ** barrier check failure\n,
-   ptr, (int)cnt, str);
+   ptr, (int)siz, str);
}
/* Pad, plus full long for magic number */
-   cnt = (cnt+2*sizeof(long)-1)(~(sizeof(long)-1));
+   siz = (siz+2*sizeof(long)-1)(~(sizeof(long)-1));
 } else if (UNLIKELY(bu_debugBU_DEBUG_MEM_QCHECK)) {
struct memqdebug *mqp = ((struct memqdebug *)ptr)-1;
 
-   cnt = (cnt + 2*sizeof(struct memqdebug) - 1)
+   siz = (siz + 2*sizeof(struct memqdebug) - 1)
(~(sizeof(struct memqdebug)-1));
 
if (UNLIKELY(BU_LIST_MAGIC_WRONG((mqp-q), MDB_MAGIC))) {
@@ -431,7 +425,7 @@
 #if defined(MALLOC_NOT_MP_SAFE)
 bu_semaphore_acquire(BU_SEM_SYSCALL);
 #endif
-ptr = realloc(ptr, cnt);
+ptr = realloc(ptr, siz);
 #if defined(MALLOC_NOT_MP_SAFE)
 bu_semaphore_release(BU_SEM_SYSCALL);
 #endif
@@ -440,7 +434,7 @@
  * requested memory and we need to bomb.
  */
 if (UNLIKELY(!ptr)) {
-   fprintf(stderr, bu_realloc(): unable to allocate requested memory of 
size %d, %s\n, cnt, str);
+   fprintf(stderr, bu_realloc(): unable to allocate requested memory of 
size %d, %s\n, siz, str);
bu_bomb(bu_realloc(): unable to allocate requested memory.\n);
 }
 
@@ -448,26 +442,26 @@
bu_semaphore_acquire(BU_SEM_SYSCALL);
if (ptr == original_ptr) {
fprintf(stderr, %p realloc%6d %s [grew in place]\n,
-   ptr, (int)cnt, str);
+   ptr, (int)siz, str);
} else {
fprintf(stderr, %p realloc%6d %s [moved from %p]\n,
-   ptr, (int)cnt, str, original_ptr);
+   ptr, (int)siz, str, original_ptr);
}
 
bu_semaphore_release(BU_SEM_SYSCALL);
 }
 
 if (UNLIKELY(bu_debugBU_DEBUG_MEM_CHECK  ptr)) {
-   /* Even if ptr didn't change, need to update cnt  barrier */
+   /* Even if ptr didn't change, need to update siz  barrier */
bu_semaphore_acquire(BU_SEM_SYSCALL);
mp-mdb_addr = ptr;
-   mp-mdb_len = cnt;
+   mp-mdb_len = siz;
 
/* Install a barrier word at the new end of the dynamic
-* arena. Correct location depends on 'cnt' being rounded up,
+* arena. Correct location depends on 'siz' being rounded up,
 * above.
 */
-   *((long *)(((char *)ptr)+cnt-sizeof(long))) = MDB_MAGIC;
+   *((long *)(((char *)ptr)+siz-sizeof(long))) = MDB_MAGIC;
bu_semaphore_release(BU_SEM_SYSCALL);
 } else if 

[brlcad-commits] SF.net SVN: brlcad:[41326] brlcad/trunk/src/libbu/malloc.c

2010-11-10 Thread brlcad
Revision: 41326
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41326view=rev
Author:   brlcad
Date: 2010-11-11 02:53:45 + (Thu, 11 Nov 2010)

Log Message:
---
libbu memory management is not allowed to return NULL (by design) so having 
bu_realloc() free memory then return NULL for the case where the size is zero 
but the pointer is non-NULL would be inconsistent with that design.  
FORTUNATELY, the standard allows for the return of 'a unique pointer that can 
be successfully passed to free()' so go ahead and return a new uninitialized 
minimum-sized allocation.  this is consistent with c99 and IEEE Std 1003.1-2001.

Modified Paths:
--
brlcad/trunk/src/libbu/malloc.c

Modified: brlcad/trunk/src/libbu/malloc.c
===
--- brlcad/trunk/src/libbu/malloc.c 2010-11-11 02:33:58 UTC (rev 41325)
+++ brlcad/trunk/src/libbu/malloc.c 2010-11-11 02:53:45 UTC (rev 41326)
@@ -363,23 +363,26 @@
 /* If bu_realloc receives a NULL pointer and zero size then bomb
  * because the behavior of realloc is undefined for these inputs.
  */
-if (UNLIKELY(!siz  !ptr)) {
+if (UNLIKELY(ptr == NULL  siz == 0)) {
bu_bomb(bu_realloc(): invalid input, NULL pointer and zero size\n);
 }
 
 /* If bu_realloc receives a NULL pointer and non-zero size then
- * allocate the memory.
+ * allocate new memory.
  */
-if (UNLIKELY(!ptr)) {
+if (UNLIKELY(ptr == NULL  siz  0)) {
return bu_malloc(siz, str);
 }
 
 /* If bu_realloc receives a non-NULL pointer and zero size then
- * free the memory.
+ * free the memory.  Instead of returning NULL, though, the
+ * standard says we can return a small allocation suitable for
+ * passing to bu_free().  Do that so we can maintain are LIBBU
+ * guarantee of worry-free memory management.
  */
-if (UNLIKELY(!siz)) {
+if (UNLIKELY(ptr != NULL  siz == 0)) {
bu_free(ptr, str);
-   return (genptr_t)NULL;
+   return bu_malloc(MINSIZE, str);
 }
 
 /* If the new allocation size is smaller than the minimum size
@@ -411,8 +414,12 @@
or not allocated with bu_malloc!  Ignored.\n,
ptr, str);
/*
-* Since we're ignoring this, atleast return the pointer
-* that was passed in. We should probably return NULL.
+* Since we're ignoring this, at least return the pointer
+* that was passed in.  Standard says behavior is
+* undefined when reallocating memory not allocated with
+* the matching allocation routines (i.e., bu_malloc() or
+* bu_calloc() in our situation), so we are fair game to
+* just return the pointer we were given.
 */
return ptr;
}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41327] brlcad/trunk/src/libbu/tcl.c

2010-11-10 Thread brlcad
Revision: 41327
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41327view=rev
Author:   brlcad
Date: 2010-11-11 04:02:24 + (Thu, 11 Nov 2010)

Log Message:
---
random crash report showed a crash inside free() from 
bu_tcl_get_value_by_keyword(), so add additional protections.  Call Tcl_Free() 
instead of free() directly since that's what the Tcl doc's say should be called 
after Tcl_SplitList().  also init listv to NULL for the case where listc is 0.

Modified Paths:
--
brlcad/trunk/src/libbu/tcl.c

Modified: brlcad/trunk/src/libbu/tcl.c
===
--- brlcad/trunk/src/libbu/tcl.c2010-11-11 02:53:45 UTC (rev 41326)
+++ brlcad/trunk/src/libbu/tcl.c2010-11-11 04:02:24 UTC (rev 41327)
@@ -278,11 +278,11 @@
int argc,
const char **argv)
 {
-int listc;
-const char **listv;
-const char *iwant;
+int i = 0;
+int listc = 0;
+const char *iwant = (const char *)NULL;
+const char **listv = (const char **)NULL;
 const char **tofree = (const char **)NULL;
-int i;
 
 /* quell usage warning */
 clientData = clientData;
@@ -302,10 +302,7 @@
 
 if (argc == 3) {
if (Tcl_SplitList(interp, argv[2], listc, (const char ***)listv) != 
TCL_OK) {
-   Tcl_AppendResult(interp,
-bu_get_value_by_keyword: iwant=', iwant,
-', unable to split ',
-argv[2], '\n, (char *)NULL);
+   Tcl_AppendResult(interp, bu_get_value_by_keyword: iwant=', iwant, 
', unable to split ', argv[2], '\n, (char *)NULL);
return TCL_ERROR;
}
tofree = listv;
@@ -318,10 +315,9 @@
 if ((listc  1) != 0) {
char buf[TINYBUFSIZ];
snprintf(buf, TINYBUFSIZ, %d, listc);
-   Tcl_AppendResult(interp,
-bu_get_value_by_keyword: odd # of items in list (, 
buf, ).\n,
-(char *)NULL);
-   if (tofree) free((char *)tofree);   /* not bu_free() */
+   Tcl_AppendResult(interp, bu_get_value_by_keyword: odd # of items in 
list (, buf, ).\n, (char *)NULL);
+   if (tofree)
+   Tcl_Free(tofree); /* not bu_free() */
return TCL_ERROR;
 }
 
@@ -335,21 +331,21 @@
bu_vls_strcat(str, listv[i+1][1]);
/* Trim trailing } */
bu_vls_trunc(str, -1);
-   Tcl_AppendResult(interp,
-bu_vls_addr(str), (char *)NULL);
+   Tcl_AppendResult(interp, bu_vls_addr(str), (char *)NULL);
bu_vls_free(str);
} else {
Tcl_AppendResult(interp, listv[i+1], (char *)NULL);
}
-   if (tofree) free((char *)tofree);   /* not bu_free() */
+   if (tofree)
+   Tcl_Free(tofree); /* not bu_free() */
return TCL_OK;
}
 }
 
 /* Not found */
-Tcl_AppendResult(interp, bu_get_value_by_keyword: keyword ',
-iwant, ' not found in list\n, (char *)NULL);
-if (tofree) free((char *)tofree);  /* not bu_free() */
+Tcl_AppendResult(interp, bu_get_value_by_keyword: keyword ', iwant, ' 
not found in list\n, (char *)NULL);
+if (tofree)
+   Tcl_Free(tofree); /* not bu_free() */
 return TCL_ERROR;
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits