static const mbo_opt_struct OPTIONS[] =
{
- {'?', 0, "help"},
- {'b', 0, "bit-vectors"},
- {'e', 0, "ecb"},
- {'h', 0, "help"},
- {'s', 0, "nested-ifs"},
- {'o', 1, "output"},
- {'v', 0, "version"},
- {'V', 0, "vernum"},
- {'-', 0, NULL} /* end of args */
+ mbo_opt_struct('?', 0, "help"),
+ mbo_opt_struct('b', 0, "bit-vectors"),
+ mbo_opt_struct('e', 0, "ecb"),
+ mbo_opt_struct('h', 0, "help"),
+ mbo_opt_struct('s', 0, "nested-ifs"),
+ mbo_opt_struct('o', 1, "output"),
+ mbo_opt_struct('v', 0, "version"),
+ mbo_opt_struct('V', 0, "vernum"),
+ mbo_opt_struct('-', 0, NULL) /* end of args */
};
static void usage()
namespace re2c
{
-typedef struct _mbo_opt_struct
+struct mbo_opt_struct
{
+ mbo_opt_struct(char _opt_char, int _need_param, const char * _opt_name)
+ : opt_char(_opt_char), need_param(_need_param), opt_name(_opt_name)
+ {
+ }
+
const char opt_char;
const int need_param;
const char * opt_name;
-}
-
-mbo_opt_struct;
+};
int mbo_getopt(int argc, char* const *argv, const mbo_opt_struct opts[], char **optarg, int *optind, int show_err);