Revision: 45750
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45750&view=rev
Author:   bhinesley
Date:     2011-08-01 22:14:07 +0000 (Mon, 01 Aug 2011)

Log Message:
-----------
Improved detection/alerts of translate command syntax-error.

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

Modified: brlcad/trunk/src/libged/edit.c
===================================================================
--- brlcad/trunk/src/libged/edit.c      2011-08-01 20:45:24 UTC (rev 45749)
+++ brlcad/trunk/src/libged/edit.c      2011-08-01 22:14:07 UTC (rev 45750)
@@ -1345,7 +1345,7 @@
         * be called */
        BU_ASSERT_PTR(cur_arg->next, !=, NULL);
 
-       /* a 'to' position is set; only flags that were possible when
+       /* a 'TO' position is set; only flags that were possible when
         * this function was last updated should be handled */
        BU_ASSERT(cur_arg->type ^ ~(EDIT_TO |
                                    EDIT_NATURAL_ORIGIN |
@@ -1357,11 +1357,31 @@
        if (cur_arg->cl_options[0] != '\0') 
            goto err_option_unknown; 
 
+       if (!(cur_arg->type & EDIT_ABS_POS)) {
+           /* intepret 'TO' arg as a relative distance by default */
+           cur_arg->type |= EDIT_REL_DIST;
+
+           if (cur_arg->object) {
+               if (noisy)
+                   bu_vls_printf(gedp->ged_result_str,
+                                 "cannot use a reference object's coordinates"
+                                 " as an offset distance");
+               return GED_ERROR;
+           }
+       }
+
        cmd->translate.ref_vector.to = cur_arg;
        cur_arg = cmd->cmd_line.args = cmd->cmd_line.args->next;
        cmd->translate.ref_vector.to->next = NULL;
     } else {
-       bu_vls_printf(gedp->ged_result_str, "missing \"TO\" argument");
+       if (cur_arg->type & EDIT_FROM) {
+           if (noisy)
+               bu_vls_printf(gedp->ged_result_str,
+                             "too many \"FROM\" arguments");
+           return GED_ERROR;
+       }
+       if (noisy)
+           bu_vls_printf(gedp->ged_result_str, "missing \"TO\" argument");
        return GED_ERROR;
     }
 


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

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to