ArgKind
Description
Type tag for a target variable, computed at compile time via _Generic. Drives both value-string parsing and the metavar / error-message wording.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ArgParse.c:20:
// Human-readable type name used in invalid-value error messages. Lines
// up 1:1 with the ArgKind enum; new entries get a label here.
static const char *arg_kind_label(ArgKind k) {
switch (k) {
case ARG_KIND_ZSTR :- In
ArgParse.c:122:
// false on type-mismatch / out-of-range so the caller can emit a
// "invalid value 'X' for --flag: expected <type>" message.
static bool store_value(ArgKind kind, void *target, const char *value) {
switch (kind) {
case ARG_KIND_ZSTR : {- In
ArgParse.c:209:
// to unsigned-int kinds at registration time; signed counters would
// give surprising wrap-around semantics for repeated flags.
static bool count_bump(ArgKind kind, void *target) {
switch (kind) {
case ARG_KIND_U8 :- In
ArgParse.h:70:
ARG_KIND_F32,
ARG_KIND_F64,
} ArgKind;
///
- In
ArgParse.h:102:
///
typedef struct ArgTarget {
ArgKind kind;
void *target;
} ArgTarget;- In
ArgParse.h:117:
const char *help; // one-line description for `--help`
ArgRole role;
ArgKind kind;
void *target;
bool seen; // set during parse so missing-required can be checked
Last updated on