Revision: 65582
          http://sourceforge.net/p/brlcad/code/65582
Author:   starseeker
Date:     2015-07-12 00:09:47 +0000 (Sun, 12 Jul 2015)
Log Message:
-----------
Remove tcl interp usages from nmg.c

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/nmg/nmg.c

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg.c 2015-07-11 23:48:45 UTC (rev 
65581)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg.c 2015-07-12 00:09:47 UTC (rev 
65582)
@@ -41,8 +41,8 @@
 #include "nmg.h"
 #include "raytrace.h"
 #include "rt/nurb.h"
+#include "../../librt_private.h"
 
-
 /* rt_nmg_internal is just "model", from nmg.h */
 
 #define NMG_SPEC_START_MAGIC 6014061
@@ -2881,7 +2881,7 @@
     struct nmgregion *r=NULL;
     struct shell *s=NULL;
     struct faceuse *fu=NULL;
-    Tcl_Obj *obj, **obj_array;
+    const char **obj_array;
     int len;
     int num_verts = 0;
     int num_loops = 0;
@@ -2899,24 +2899,23 @@
     verts = (struct tmp_v *)NULL;
     for (i=0; i<argc; i += 2) {
        if (BU_STR_EQUAL(argv[i], "V")) {
-           obj = Tcl_NewStringObj(argv[i+1], -1);
-           if (Tcl_ListObjGetElements(brlcad_interp, obj, &num_verts,
-                                      &obj_array) != TCL_OK) {
-               bu_vls_printf(logstr,
-                             "ERROR: failed to parse vertex list\n");
-               Tcl_DecrRefCount(obj);
+           if (bu_argv_from_tcl_list(argv[i+1], &num_verts, (const char 
***)&obj_array) != 0) {
+               bu_vls_printf(logstr, "ERROR: failed to parse vertex list\n");
                return BRLCAD_ERROR;
            }
+           if (num_verts == 0) {
+               bu_vls_printf(logstr, "ERROR: no vertices found\n");
+               return BRLCAD_ERROR;
+           }
+
            verts = (struct tmp_v *)bu_calloc(num_verts,
                                              sizeof(struct tmp_v),
                                              "verts");
-           for (j=0; j<num_verts; j++) {
+           for (j = 0; j < num_verts; j++) {
                len = 3;
                tmp = &verts[j].pt[0];
-               if (tcl_obj_to_fastf_array(brlcad_interp, obj_array[j],
-                                          &tmp, &len) != 3) {
-                   bu_vls_printf(logstr,
-                                 "ERROR: incorrect number of coordinates for 
vertex\n");
+               if (rt_tcl_list_to_fastf_array(obj_array[j], &tmp, &len) != 3) {
+                   bu_vls_printf(logstr, "ERROR: incorrect number of 
coordinates for vertex\n");
                    return BRLCAD_ERROR;
                }
            }
@@ -2943,21 +2942,20 @@
                r = BU_LIST_FIRST(nmgregion, &m->r_hd);
                s = BU_LIST_FIRST(shell, &r->s_hd);
            }
-           obj = Tcl_NewStringObj(argv[1], -1);
-           if (Tcl_ListObjGetElements(brlcad_interp, obj, &num_loops,
-                                      &obj_array) != TCL_OK) {
-               bu_vls_printf(logstr,
-                             "ERROR: failed to parse face list\n");
-               Tcl_DecrRefCount(obj);
+           if (bu_argv_from_tcl_list(argv[1], &num_loops, (const char 
***)&obj_array) != 0) {
+               bu_vls_printf(logstr, "ERROR: failed to parse face list\n");
                return BRLCAD_ERROR;
            }
+           if (num_loops == 0) {
+               bu_vls_printf(logstr, "ERROR: no face loops found\n");
+               return BRLCAD_ERROR;
+           }
            for (i=0, fu=NULL; i<num_loops; i++) {
                struct vertex **loop_verts;
                /* struct faceuse fu is initialized in earlier scope */
 
                loop_len = 0;
-               (void)tcl_obj_to_int_array(brlcad_interp, obj_array[i],
-                                          &loop, &loop_len);
+               (void)rt_tcl_list_to_int_array(obj_array[i], &loop, &loop_len);
                if (!loop_len) {
                    bu_vls_printf(logstr,
                                  "ERROR: unable to parse face list\n");

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


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to