Revision: 45933
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45933&view=rev
Author:   bhinesley
Date:     2011-08-12 00:36:29 +0000 (Fri, 12 Aug 2011)

Log Message:
-----------
Translations to absolute coordinates are mostly working now, id est "translate 
10 20 30 sphere.s". Ommitted coordinates are set to 0 for the time being; will 
be enabled once relative positioning is working. Fixed lots of small stuff that 
was causing big problems: return variables not being checked properly, vectors 
not being initialized, using a ptr where a ptr-to-ptr was needed, etc.

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

Modified: brlcad/trunk/src/libged/edit.c
===================================================================
--- brlcad/trunk/src/libged/edit.c      2011-08-11 22:45:43 UTC (rev 45932)
+++ brlcad/trunk/src/libged/edit.c      2011-08-12 00:36:29 UTC (rev 45933)
@@ -1065,22 +1065,22 @@
 edit_arg_to_coord(struct ged *gedp, struct edit_arg *const arg, vect_t *coord)
 {
     vect_t obj_coord = VINIT_ZERO;
-    vect_t *dest;
+    vect_t **dest;
 
     if (coord)
-       dest = coord;
+       dest = &coord;
     else
-       dest = arg->vector;
+       dest = &arg->vector;
 
     if (edit_arg_to_apparent_coord(gedp, arg, &obj_coord) == GED_ERROR)
        return GED_ERROR;
 
     if (arg->vector) {
-       VADD2(*dest, *arg->vector, obj_coord);
+       VADD2(**dest, *arg->vector, obj_coord);
     } else {
-       dest = (vect_t *)bu_malloc(sizeof(vect_t),
+       *dest = (vect_t *)bu_malloc(sizeof(vect_t),
                                        "vect_t block for edit_arg_to_coord()");
-       VMOVE(*dest, obj_coord);
+       VMOVE(**dest, obj_coord);
     }
 
     if (!coord) {
@@ -1229,7 +1229,7 @@
 edit_cmd_expand_vectors(struct ged *gedp, union edit_cmd *const subcmd)
 {
     struct edit_arg *arg_head;
-    vect_t src_v;
+    vect_t src_v = VINIT_ZERO;
     int i = 0;
 
     /* draw source vector from of target object */
@@ -1691,8 +1691,8 @@
     if (!cmd->translate.ref_vector.from) {
        edit_arg_duplicate(&cmd->translate.ref_vector.from,
                           cmd->translate.objects);
-       cmd->translate.ref_vector.from->next = NULL;
-       cmd->translate.ref_vector.from->type ^= EDIT_TARGET_OBJ | EDIT_FROM;
+       cmd->translate.ref_vector.from->type &= ~EDIT_TARGET_OBJ;
+       cmd->translate.ref_vector.from->type |= EDIT_FROM;
     }
 
     return GED_OK;
@@ -2091,15 +2091,21 @@
        ++(*argv);
     }
 
-    /* disable unsupplied optional coords (from "[x [y [z]]]" fmt) */
-    if ((arg->coords_used & EDIT_COORDS_ALL) == EDIT_COORDS_ALL)
-       if (arg->coords_used & EDIT_COORD_IS_SET_X)
-           arg->coords_used |= EDIT_COORD_X;
-       if (arg->coords_used & EDIT_COORD_IS_SET_Y)
-           arg->coords_used |= EDIT_COORD_Y;
-       if (arg->coords_used & EDIT_COORD_IS_SET_Z)
-           arg->coords_used |= EDIT_COORD_Z;
+    /* disable unsupplied optional coords */
+    if (((arg->coords_used & EDIT_COORDS_ALL) == EDIT_COORDS_ALL) &&
+       (arg->coords_used & ~EDIT_COORDS_ALL)) {
 
+       /* All EDIT_COORDS_ALL are set, and at least one other flag,
+        * implying that the coords were in the '[x [y [z]]]" format.
+        */
+       if (!(arg->coords_used & EDIT_COORD_IS_SET_X))
+           arg->coords_used ^= EDIT_COORD_X;
+       if (!(arg->coords_used ^ EDIT_COORD_IS_SET_Y))
+           arg->coords_used ^= EDIT_COORD_Y;
+       if (!(arg->coords_used ^ EDIT_COORD_IS_SET_Z))
+           arg->coords_used ^= EDIT_COORD_Z;
+    }
+
     /* these flags are only for internal use */
     /* FIXME: exactly why they should be internalized, and not
      * edit_arg flags */
@@ -2308,7 +2314,7 @@
     while (edit_strs_to_arg(gedp, &argc, &argv, cur_arg, GED_QUIET) !=
           GED_ERROR) {
        if (argc == 0) {
-           if (edit_arg_is_empty(subcmd.cmd_line.args)) {
+           if (edit_arg_is_empty(subcmd.cmd_line.args) == GED_OK) {
                edit_arg_free(subcmd.cmd_line.args);
                subcmd.cmd_line.args = NULL;
            }


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

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to