From: helly Date: Sun, 13 Mar 2005 03:08:35 +0000 (+0000) Subject: - Use c++ instead of c workarounds X-Git-Tag: 0.13.6~674 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0dd5b146f687aea4ccaa8b21d98590a5ca9cf47;p=re2c - Use c++ instead of c workarounds --- diff --git a/main.cc b/main.cc index a058d067..78452626 100644 --- a/main.cc +++ b/main.cc @@ -29,15 +29,15 @@ static int opt_ind = 1; 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() diff --git a/mbo_getopt.h b/mbo_getopt.h index 96cf5669..092c32d2 100755 --- a/mbo_getopt.h +++ b/mbo_getopt.h @@ -14,14 +14,17 @@ 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);