Revision: 65307
          http://sourceforge.net/p/brlcad/code/65307
Author:   starseeker
Date:     2015-06-15 18:55:47 +0000 (Mon, 15 Jun 2015)
Log Message:
-----------
Going this route, also want to explicity specify an option for both input and 
output.

Modified Paths:
--------------
    brlcad/trunk/src/conv/gcv/gcv.cpp

Modified: brlcad/trunk/src/conv/gcv/gcv.cpp
===================================================================
--- brlcad/trunk/src/conv/gcv/gcv.cpp   2015-06-15 18:55:12 UTC (rev 65306)
+++ brlcad/trunk/src/conv/gcv/gcv.cpp   2015-06-15 18:55:47 UTC (rev 65307)
@@ -384,6 +384,7 @@
 #define gcv_inopt_str "Options to apply only while processing input file.  
Accepts options until another toplevel option is encountered."
 
 #define gcv_outopt_str "Options to apply only while preparing output file.  
Accepts options until another toplevel option is encountered."
+#define gcv_both_str "Options to apply both during input and output handling.  
Accepts options until another toplevel option is encountered."
 
 int
 main(int ac, const char **av)
@@ -401,6 +402,7 @@
     static char *out_path_str = NULL;
     static struct gcv_fmt_opts in_only_opts;
     static struct gcv_fmt_opts out_only_opts;
+    static struct gcv_fmt_opts both_opts;
     static struct gcv_help_state hs;
 
     struct bu_vls in_format = BU_VLS_INIT_ZERO;
@@ -426,11 +428,13 @@
        {"",  "output-format",    "format",     &model_mime,  (void 
*)&out_type,      "File format of output file." },
        {"I", "input-only-opts",  "opts",       &gcv_fmt_fun, (void 
*)&in_only_opts,  gcv_inopt_str,                },
        {"O", "output-only-opts", "opts",       &gcv_fmt_fun, (void 
*)&out_only_opts, gcv_outopt_str,               },
+       {"B", "input-and-output-opts", "opts",  &gcv_fmt_fun, (void 
*)&both_opts,     gcv_both_str,                 },
        BU_OPT_DESC_NULL
     };
 
     gcv_fmt_opts_init(&in_only_opts, gcv_opt_desc);
     gcv_fmt_opts_init(&out_only_opts, gcv_opt_desc);
+    gcv_fmt_opts_init(&both_opts, gcv_opt_desc);
 
     hs.flag = 0;
     hs.format = NULL;
@@ -528,6 +532,11 @@
            bu_ptbl_ins(&output_opts, (long *)av[i]);
        }
     }
+    /* Same for any options that were supplied explicitly to go to both input 
and output */
+    if (BU_PTBL_LEN(both_opts.args) > 0) {
+       bu_ptbl_cat(&input_opts, both_opts.args);
+       bu_ptbl_cat(&output_opts, both_opts.args);
+    }
 
     /* If we have input and/or output specific options, append them now */
     if (BU_PTBL_LEN(in_only_opts.args) > 0) {
@@ -641,6 +650,7 @@
     bu_ptbl_free(&output_opts);
     gcv_fmt_opts_free(&in_only_opts);
     gcv_fmt_opts_free(&out_only_opts);
+    gcv_fmt_opts_free(&both_opts);
     return ret;
 }
 

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


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to