From fe8776b6e98aeafb639a501b1d6e5fe4ff9f50de Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Fri, 1 Jul 2022 16:32:16 -0500 Subject: [PATCH] Alphabetize and make uniform the symbols in codex.h --- include/gargoyle/codex.h | 19 ++++++++++--------- src/gargoyle.c | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/gargoyle/codex.h b/include/gargoyle/codex.h index d7f146b..9b9c57d 100644 --- a/include/gargoyle/codex.h +++ b/include/gargoyle/codex.h @@ -6,30 +6,31 @@ typedef uint8_t gargoyle_opt_type; 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_UINT = 1 << 1; 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; 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_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_VAL_REQUIRED = 1 << 1; typedef uint8_t gargoyle_flag_type; 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_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_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_SYMBL = 1 << 3; static const gargoyle_flag_type GARGOYLE_FLG_FLXBL = GARGOYLE_FLG_BCASE | GARGOYLE_FLG_ECASE | diff --git a/src/gargoyle.c b/src/gargoyle.c index 8a92c38..295b9a7 100644 --- a/src/gargoyle.c +++ b/src/gargoyle.c @@ -37,7 +37,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc if(!opt) { if(flags & GARGOYLE_FLG_STRCT) { 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; } else { *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); } else { 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; } @@ -83,7 +83,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc if(!opt) { 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; } else { idx += 1; @@ -102,7 +102,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_opt *optv, int *argc break; } else { 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; } @@ -151,7 +151,7 @@ uint8_t gargoyle_digest_envh(uint16_t optc, struct gargoyle_opt *optv, const cha if(!opt) { if(flags & GARGOYLE_FLG_STRCT) { 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; } else { continue;