Revision: 42316
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42316&view=rev
Author:   brlcad
Date:     2011-01-16 07:33:50 +0000 (Sun, 16 Jan 2011)

Log Message:
-----------
apply a fix for sf bug 3159020 reported by jra regarding asc2g's failure to 
recognize the 'color' command.  this was due to libged refactoring where 'db 
color' was no longer valid.  this fix restores the migrated commands as 
subcommands of db, iterating over the list and running the command against the 
current wdbp nad stashing the result.  should once again be able to 
successfully run: g2asc ktank.g new.asc && asc2g new.asc newtank.g

Modified Paths:
--------------
    brlcad/trunk/BUGS
    brlcad/trunk/src/libged/wdb_obj.c

Modified: brlcad/trunk/BUGS
===================================================================
--- brlcad/trunk/BUGS   2011-01-16 07:22:48 UTC (rev 42315)
+++ brlcad/trunk/BUGS   2011-01-16 07:33:50 UTC (rev 42316)
@@ -15,9 +15,6 @@
 Recent Bugs
 -----------
 
-* asc2g+g2asc of ktank.g (_GLOBAL has a colortable, writes out "color"
-  command lines) fails saying "color" command not recognized.
-
 * asc2g of a .asc file containing the first line as a "#" comment
   results in a bu_malloc(0) bomb.  comment lines should be valid in
   .asc files.

Modified: brlcad/trunk/src/libged/wdb_obj.c
===================================================================
--- brlcad/trunk/src/libged/wdb_obj.c   2011-01-16 07:22:48 UTC (rev 42315)
+++ brlcad/trunk/src/libged/wdb_obj.c   2011-01-16 07:33:50 UTC (rev 42316)
@@ -429,6 +429,27 @@
 static int
 wdb_cmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
 {
+    struct bu_cmdtab *ctp = NULL;
+    struct rt_wdb *wdbp = (struct rt_wdb *)clientData;
+    struct ged ged;
+    int ret;
+
+    /* look for the new libged commands too, but don't call bu_cmd()
+     * or wdb_newcmds_tcl() as there's no way to distinguish between
+     * TCL_ERROR from a found command and an unfound command.
+     */
+    GED_INIT(&ged, wdbp);
+    for (ctp = wdb_newcmds; ctp->ct_name != (char *)0; ctp++) {
+       if (BU_STR_EQUAL(ctp->ct_name, argv[1])) {
+           ret = (*ctp->ct_func)(&ged, argc-1, argv+1);
+           Tcl_SetResult(interp, bu_vls_addr(&ged.ged_result_str), 
TCL_VOLATILE);
+           if (ret == GED_OK)
+               return TCL_OK;
+           return TCL_ERROR;
+       }
+    }
+
+    /* not a new command -- look for the command in the old command table */
     return bu_cmd(clientData, interp, argc, (const char **)argv, wdb_cmds, 1);
 }
 


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

Reply via email to