Revision: 65137
http://sourceforge.net/p/brlcad/code/65137
Author: starseeker
Date: 2015-06-01 20:11:38 +0000 (Mon, 01 Jun 2015)
Log Message:
-----------
Update examples
Modified Paths:
--------------
brlcad/trunk/include/bu/opt.h
Modified: brlcad/trunk/include/bu/opt.h
===================================================================
--- brlcad/trunk/include/bu/opt.h 2015-06-01 20:04:07 UTC (rev 65136)
+++ brlcad/trunk/include/bu/opt.h 2015-06-01 20:11:38 UTC (rev 65137)
@@ -70,6 +70,8 @@
/* typedefs to avoid confusion when working with bu_opt_data
* and bu_opt_desc tables */
typedef struct bu_ptbl bu_opt_dtbl_t;
+
+/** TODO - should this be a full struct to allow for easier iteration? */
typedef struct bu_ptbl bu_opt_data_t;
/**
@@ -234,7 +236,8 @@
* {D1_VERBOSITY, 0, 1, "v", "verbosity", &(d1_verbosity), "Set
verbosity"},
* BU_OPT_DESC_NULL
* };
- * bu_opt_parse(argc, argv, d1);
+ * bu_opt_data_t *results;
+ * bu_opt_parse(&results, NULL, argc, argv, d1);
*/
BU_EXPORT extern int bu_opt_parse(bu_opt_data_t **results, struct bu_vls
*msgs, int ac, const char **argv, struct bu_opt_desc *ds);
/**
@@ -250,13 +253,20 @@
*
* If we need dynamic definitions, need to take a slightly different approach
*
- * enum d1_opt_ind {D1_HELP, D1_VERBOSITY};
- * struct bu_ptbl dtbl;
- * bu_opt_desc_init(&dtbl, NULL);
- * bu_opt_desc_add(D1_HELP, 0, 0, "h", "help", NULL, "-h", "--help",
"Help");
- * bu_opt_desc_add(D1_HELP, 0, 0, "?", "", NULL, "-?", "",
"");
- * bu_opt_desc_add(D1_O1, 0, 1, "v", "verbose", &(dtbl_v), "-v",
"--verbose", "Set verbosity");
- * bu_opt_parse_ptbl(argc, argv, dtbl);
+ * enum d1_opt_ind {D1_HELP, D1_VERBOSITY, D_MAX};
+ * struct bu_opt_desc d1[4] = {
+ * {D1_HELP, 0, 0, "h", "help", NULL, help_str},
+ * {D1_VERBOSITY, 0, 1, "v", "verbosity", &(d1_verbosity), "Set
verbosity"},
+ * BU_OPT_DESC_NULL
+ * };
+
+ * bu_opt_dtbl_t *dtbl;
+ * bu_opt_data_t *results;
+
+ * bu_opt_desc_init(&dtbl, (struct bu_opt_desc *)&d1);
+ * bu_opt_desc_add(D1_HELP, 0, 0, "?", "", NULL, "-?", "",
"");
+ * bu_opt_desc_add(D_MAX + 1, 0, 0, "d", "dummy", &(dtbl_d), "-d",
"--dummy", "Dummy opt");
+ * bu_opt_parse_dtbl(&results, NULL, argc, argv, dtbl);
*/
BU_EXPORT extern int bu_opt_parse_dtbl(bu_opt_data_t **results, struct bu_vls
*msgs, int ac, const char **argv, bu_opt_dtbl_t *dtbl);
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