12 if (!
strcmp (val_str,
"true"))
14 else if (!
strcmp (val_str,
"false"))
17 const char *
p = val_str;
26 if (!isdigit ((ch = *
p++)))
29 const int64_t bound = -(int64_t) INT_MIN;
30 int64_t mantissa = ch -
'0';
32 while (isdigit (ch = *
p++)) {
33 if (bound / 10 < mantissa)
37 const int digit = ch -
'0';
38 if (bound - digit < mantissa)
46 while (isdigit ((ch = *
p++)))
47 exponent = exponent ? 10 : ch -
'0';
54 int64_t val64 = mantissa;
55 for (
int i = 0; i < exponent; i++)
79 return k > l && !
strcmp (str + k - l, suffix);
83 for (
const char *
p = str, *q = prefix; *q; q++,
p++)
92 return !
strcmp (arg,
"--color") || !
strcmp (arg,
"--colors") ||
93 !
strcmp (arg,
"--colour") || !
strcmp (arg,
"--colours") ||
94 !
strcmp (arg,
"--color=1") || !
strcmp (arg,
"--colors=1") ||
95 !
strcmp (arg,
"--colour=1") || !
strcmp (arg,
"--colours=1") ||
96 !
strcmp (arg,
"--color=true") || !
strcmp (arg,
"--colors=true") ||
97 !
strcmp (arg,
"--colour=true") || !
strcmp (arg,
"--colours=true");
101 return !
strcmp (arg,
"--no-color") || !
strcmp (arg,
"--no-colors") ||
102 !
strcmp (arg,
"--no-colour") || !
strcmp (arg,
"--no-colours") ||
103 !
strcmp (arg,
"--color=0") || !
strcmp (arg,
"--colors=0") ||
104 !
strcmp (arg,
"--colour=0") || !
strcmp (arg,
"--colours=0") ||
105 !
strcmp (arg,
"--color=false") ||
106 !
strcmp (arg,
"--colors=false") ||
107 !
strcmp (arg,
"--colour=false") ||
108 !
strcmp (arg,
"--colours=false");
113static uint64_t primes[] = {
114 1111111111111111111lu, 2222222222222222249lu, 3333333333333333347lu,
115 4444444444444444537lu, 5555555555555555621lu, 6666666666666666677lu,
116 7777777777777777793lu, 8888888888888888923lu, 9999999999999999961lu,
120 const unsigned size =
sizeof primes /
sizeof *primes;
124 for (
const char *
p = str; (ch = *
p);
p++) {
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
bool has_suffix(const char *str, const char *suffix)
bool is_color_option(const char *arg)
bool parse_int_str(const char *val_str, int &val)
bool has_prefix(const char *str, const char *prefix)
uint64_t hash_string(const char *str)
bool is_no_color_option(const char *arg)