On Wed, Sep 4, 2013 at 2:20 PM, Clifford Yapp <[email protected]> wrote:
>
> Give me a little bit Tom, and I'll try to rough something out.
Here are some preliminary thoughts on the wrapping, which (without
having seen Tom's full setup) may need drastic change - but they
should serve to get the discussion going.
in bu.h, something like:
typedef struct bu_cmd bu_cmd_t;
bu_cmd_t *bu_cmd_init(const char *cmdname);
void bu_cmd_free(bu_cmd_t *cmd);
int bu_cmd_add_int_option(const char *short,
struct bu_cmd *cmd,
const char *short,
const char *long,
const char *description,
int required, /* 0 is optional, 1 is required */
int default
);
int bu_cmd_add_float_option(
struct bu_cmd *cmd,
const char *short,
const char *long,
const char *description,
int required /* 0 is optional, 1 is required */
float default
);
/* Gets return 0 on success, else id indicates failure (option and
function type don't match...)
int bu_cmd_get_int(struct bu_cmd *cmd, char *opt_identifier, int *result);
int bu_cmd_get_float(struct bu_cmd *cmd, char *opt_identifier, float *result);
and so on for the various option types we end up needing. There may
be a good way to make the default value a generic that is unwrapped
behind the scenes and cut down on the sheer number of functions
required...
The implementation (C++) could look like:
extern "C" {
struct bu_cmd {
TCLAP::CmdLine *cmd
}
}
extern "C" int
bu_cmd_add_int_option(struct bu_cmd *cmd, const char *short, const char *long,
const char *description, int required, int default)
{
TCLAP::ValueArg<int> intArg(short,long,description,required,default,"int");
cmd->add(intArg);
}
etc.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel