Revision: 56440
          http://sourceforge.net/p/brlcad/code/56440
Author:   starseeker
Date:     2013-08-01 20:08:18 +0000 (Thu, 01 Aug 2013)
Log Message:
-----------
Oops, helps to actually commit the definition.

Modified Paths:
--------------
    brlcad/trunk/src/librt/comb/db_comb.c

Modified: brlcad/trunk/src/librt/comb/db_comb.c
===================================================================
--- brlcad/trunk/src/librt/comb/db_comb.c       2013-08-01 20:07:10 UTC (rev 
56439)
+++ brlcad/trunk/src/librt/comb/db_comb.c       2013-08-01 20:08:18 UTC (rev 
56440)
@@ -1107,7 +1107,63 @@
     return 0;
 }
 
+int
+db_comb_mvall(struct directory *dp, struct db_i *dbip, const char *old_name, 
const char *new_name, struct bu_ptbl *stack)
+{
+    struct rt_db_internal intern;
+    struct rt_comb_internal *comb;
+    union tree *comb_leaf;
+    int done=0;
+    int changed=0;
 
+    /* Make sure the stack bu_ptbl is ready */
+    bu_ptbl_reset(stack);
+
+    if (!(dp->d_flags & RT_DIR_COMB)) return 0;
+
+    if (rt_db_get_internal(&intern, dp, dbip, (fastf_t *)NULL, 
&rt_uniresource) < 0) return 0;
+
+    comb = (struct rt_comb_internal *)intern.idb_ptr;
+    comb_leaf = comb->tree;
+
+    if (comb_leaf) {
+       while (!done) {
+           while (comb_leaf->tr_op != OP_DB_LEAF) {
+               bu_ptbl_ins(stack, (long *)comb_leaf);
+               comb_leaf = comb_leaf->tr_b.tb_left;
+           }
+
+           if (BU_STR_EQUAL(comb_leaf->tr_l.tl_name, old_name)) {
+               bu_free(comb_leaf->tr_l.tl_name, "comb_leaf->tr_l.tl_name");
+               comb_leaf->tr_l.tl_name = bu_strdup(new_name);
+               changed = 1;
+           }
+
+           if (BU_PTBL_END(stack) < 1) {
+               done = 1;
+               break;
+           }
+           comb_leaf = (union tree *)BU_PTBL_GET(stack, BU_PTBL_END(stack)-1);
+           if (comb_leaf->tr_op != OP_DB_LEAF) {
+               bu_ptbl_rm(stack, (long *)comb_leaf);
+               comb_leaf = comb_leaf->tr_b.tb_right;
+           }
+       }
+    }
+
+    if (changed) {
+       if (rt_db_put_internal(dp, dbip, &intern, &rt_uniresource)) {
+           rt_db_free_internal(&intern);
+           return 2;
+       }
+    }
+
+    rt_db_free_internal(&intern);
+
+    /* success */
+    return 1;
+}
+
 /** @} */
 /*
  * Local Variables:

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


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to