Alphabetize and make uniform the symbols in codex.h

This commit is contained in:
Nick Chambers 2022-07-01 16:32:16 -05:00
parent 14b2b77c67
commit fe8776b6e9
2 changed files with 15 additions and 14 deletions

View File

@ -6,30 +6,31 @@
typedef uint8_t gargoyle_opt_type; typedef uint8_t gargoyle_opt_type;
static const gargoyle_opt_type GARGOYLE_TYPE_BOOL = 1 << 0; static const gargoyle_opt_type GARGOYLE_TYPE_BOOL = 1 << 0;
static const gargoyle_opt_type GARGOYLE_TYPE_UINT = 1 << 1;
static const gargoyle_opt_type GARGOYLE_TYPE_SINT = 1 << 2;
static const gargoyle_opt_type GARGOYLE_TYPE_DBLE = 1 << 3; static const gargoyle_opt_type GARGOYLE_TYPE_DBLE = 1 << 3;
static const gargoyle_opt_type GARGOYLE_TYPE_UINT = 1 << 1;
static const gargoyle_opt_type GARGOYLE_TYPE_ROPE = 1 << 4; static const gargoyle_opt_type GARGOYLE_TYPE_ROPE = 1 << 4;
static const gargoyle_opt_type GARGOYLE_TYPE_SINT = 1 << 2;
typedef uint8_t gargoyle_err_type; typedef uint8_t gargoyle_err_type;
static const gargoyle_err_type GARGOYLE_ERR_SUCCESS = 0; static const gargoyle_err_type GARGOYLE_ERR_SUCCESS = 0;
static const gargoyle_err_type GARGOYLE_ERR_UNKNOWN_OPT = 1 << 0;
static const gargoyle_err_type GARGOYLE_ERR_VALUE_REQUIRED = 1 << 1;
static const gargoyle_err_type GARGOYLE_ERR_INVALID_UINT = 1 << 2;
static const gargoyle_err_type GARGOYLE_ERR_INVALID_SINT = 1 << 3;
static const gargoyle_err_type GARGOYLE_ERR_INVALID_DBLE = 1 << 4; static const gargoyle_err_type GARGOYLE_ERR_INVALID_DBLE = 1 << 4;
static const gargoyle_err_type GARGOYLE_ERR_INVALID_SINT = 1 << 3;
static const gargoyle_err_type GARGOYLE_ERR_INVALID_UINT = 1 << 2;
static const gargoyle_err_type GARGOYLE_ERR_UNKNOWN_OPTN = 1 << 0;
static const gargoyle_err_type GARGOYLE_ERR_UNKNOWN_TYPE = 1 << 5; static const gargoyle_err_type GARGOYLE_ERR_UNKNOWN_TYPE = 1 << 5;
static const gargoyle_err_type GARGOYLE_ERR_VAL_REQUIRED = 1 << 1;
typedef uint8_t gargoyle_flag_type; typedef uint8_t gargoyle_flag_type;
static const gargoyle_flag_type GARGOYLE_FLG_BCASE = 1 << 0; static const gargoyle_flag_type GARGOYLE_FLG_BCASE = 1 << 0;
static const gargoyle_flag_type GARGOYLE_FLG_ECASE = 1 << 1; static const gargoyle_flag_type GARGOYLE_FLG_ECASE = 1 << 1;
static const gargoyle_flag_type GARGOYLE_FLG_ICASE = 1 << 2;
static const gargoyle_flag_type GARGOYLE_FLG_SYMBL = 1 << 3;
static const gargoyle_flag_type GARGOYLE_FLG_GREED = 1 << 4;
static const gargoyle_flag_type GARGOYLE_FLG_FILL0 = 1 << 5; static const gargoyle_flag_type GARGOYLE_FLG_FILL0 = 1 << 5;
static const gargoyle_flag_type GARGOYLE_FLG_GREED = 1 << 4;
static const gargoyle_flag_type GARGOYLE_FLG_ICASE = 1 << 2;
static const gargoyle_flag_type GARGOYLE_FLG_STRCT = 1 << 6; static const gargoyle_flag_type GARGOYLE_FLG_STRCT = 1 << 6;
static const gargoyle_flag_type GARGOYLE_FLG_SYMBL = 1 << 3;
static const gargoyle_flag_type GARGOYLE_FLG_FLXBL = GARGOYLE_FLG_BCASE | static const gargoyle_flag_type GARGOYLE_FLG_FLXBL = GARGOYLE_FLG_BCASE |
GARGOYLE_FLG_ECASE | GARGOYLE_FLG_ECASE |

View File

@ -37,7 +37,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc
if(!opt) { if(!opt) {
if(flags & GARGOYLE_FLG_STRCT) { if(flags & GARGOYLE_FLG_STRCT) {
char *eql = index(brand, '='); char *eql = index(brand, '=');
GARGOYLE_MK_ERR(err, GARGOYLE_ERR_UNKNOWN_OPT, "unknown option '--%.*s'", (int) (eql - brand), brand); GARGOYLE_MK_ERR(err, GARGOYLE_ERR_UNKNOWN_OPTN, "unknown option '--%.*s'", (int) (eql - brand), brand);
return err->code; return err->code;
} else { } else {
*argc -= 1; *argc -= 1;
@ -56,7 +56,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc
res = gargoyle_from_rope(opt, val, flags); res = gargoyle_from_rope(opt, val, flags);
} else { } else {
if(!*(*argv + 1)) { if(!*(*argv + 1)) {
GARGOYLE_MK_ERR(err, GARGOYLE_ERR_VALUE_REQUIRED, "option '--%s' requires a value", opt->brand); GARGOYLE_MK_ERR(err, GARGOYLE_ERR_VAL_REQUIRED, "option '--%s' requires a value", opt->brand);
return err->code; return err->code;
} }
@ -83,7 +83,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc
if(!opt) { if(!opt) {
if(flags & GARGOYLE_FLG_STRCT) { if(flags & GARGOYLE_FLG_STRCT) {
GARGOYLE_MK_ERR(err, GARGOYLE_ERR_UNKNOWN_OPT, "unknown option '-%c'", *idx); GARGOYLE_MK_ERR(err, GARGOYLE_ERR_UNKNOWN_OPTN, "unknown option '-%c'", *idx);
return err->code; return err->code;
} else { } else {
idx += 1; idx += 1;
@ -102,7 +102,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc
break; break;
} else { } else {
if(!*(*argv + 1)) { if(!*(*argv + 1)) {
GARGOYLE_MK_ERR(err, GARGOYLE_ERR_VALUE_REQUIRED, "option '-%c' requires a value", opt->emblem); GARGOYLE_MK_ERR(err, GARGOYLE_ERR_VAL_REQUIRED, "option '-%c' requires a value", opt->emblem);
return err->code; return err->code;
} }
@ -151,7 +151,7 @@ uint8_t gargoyle_digest_envh(uint16_t optc, struct gargoyle_opt *optv, const cha
if(!opt) { if(!opt) {
if(flags & GARGOYLE_FLG_STRCT) { if(flags & GARGOYLE_FLG_STRCT) {
char *eql = index(brand, '='); char *eql = index(brand, '=');
GARGOYLE_MK_ERR(err, GARGOYLE_ERR_UNKNOWN_OPT, "unknown variable '%.*s'", (int) (eql - brand), brand); GARGOYLE_MK_ERR(err, GARGOYLE_ERR_UNKNOWN_OPTN, "unknown variable '%.*s'", (int) (eql - brand), brand);
return err->code; return err->code;
} else { } else {
continue; continue;