mirror of
https://github.com/boostorg/predef.git
synced 2025-07-30 11:57:12 +02:00
untabify
This commit is contained in:
@ -35,27 +35,27 @@ int predef_info_compare(const void * a, const void * b)
|
|||||||
|
|
||||||
const char * str_token(const char ** str, const char * space)
|
const char * str_token(const char ** str, const char * space)
|
||||||
{
|
{
|
||||||
unsigned span;
|
unsigned span;
|
||||||
char * token;
|
char * token;
|
||||||
for (; **str != 0; *str += 1)
|
for (; **str != 0; *str += 1)
|
||||||
{
|
{
|
||||||
if (0 == strchr(space, **str))
|
if (0 == strchr(space, **str))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span = strcspn(*str, space);
|
span = strcspn(*str, space);
|
||||||
token = (char *)malloc(span+1);
|
token = (char *)malloc(span+1);
|
||||||
strncpy(token, *str, span);
|
strncpy(token, *str, span);
|
||||||
token[span] = 0;
|
token[span] = 0;
|
||||||
for (*str += span; **str != 0; *str += 1)
|
for (*str += span; **str != 0; *str += 1)
|
||||||
{
|
{
|
||||||
if (0 == strchr(space, **str))
|
if (0 == strchr(space, **str))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * whitespace = " ";
|
const char * whitespace = " ";
|
||||||
@ -82,38 +82,38 @@ int main(int argc, const char ** argv)
|
|||||||
qsort(predefs,predef_count,sizeof(predef_info*),predef_info_compare);
|
qsort(predefs,predef_count,sizeof(predef_info*),predef_info_compare);
|
||||||
for (argi = 1; argi < argc; ++argi)
|
for (argi = 1; argi < argc; ++argi)
|
||||||
{
|
{
|
||||||
const char * exp = argv[argi];
|
const char * exp = argv[argi];
|
||||||
const char * exp_name = str_token(&exp, whitespace);
|
const char * exp_name = str_token(&exp, whitespace);
|
||||||
const char * exp_op = str_token(&exp, whitespace);
|
const char * exp_op = str_token(&exp, whitespace);
|
||||||
const char * exp_val = str_token(&exp, whitespace);
|
const char * exp_val = str_token(&exp, whitespace);
|
||||||
unsigned exp_version = 0;
|
unsigned exp_version = 0;
|
||||||
if (*exp_val != 0)
|
if (*exp_val != 0)
|
||||||
{
|
{
|
||||||
exp = exp_val;
|
exp = exp_val;
|
||||||
const char * exp_val_a = str_token(&exp, dot);
|
const char * exp_val_a = str_token(&exp, dot);
|
||||||
const char * exp_val_b = str_token(&exp, dot);
|
const char * exp_val_b = str_token(&exp, dot);
|
||||||
const char * exp_val_c = str_token(&exp, dot);
|
const char * exp_val_c = str_token(&exp, dot);
|
||||||
exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c));
|
exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c));
|
||||||
}
|
}
|
||||||
for (x = 0; x < predef_count; ++x)
|
for (x = 0; x < predef_count; ++x)
|
||||||
{
|
{
|
||||||
if (*exp_op == 0 &&
|
if (*exp_op == 0 &&
|
||||||
predefs[x]->value == 0 &&
|
predefs[x]->value == 0 &&
|
||||||
strcmp(exp_name, predefs[x]->name) == 0)
|
strcmp(exp_name, predefs[x]->name) == 0)
|
||||||
{
|
{
|
||||||
return argi;
|
return argi;
|
||||||
}
|
}
|
||||||
else if (*exp_op != 0 && *exp_val != 0 &&
|
else if (*exp_op != 0 && *exp_val != 0 &&
|
||||||
strcmp(exp_name, predefs[x]->name) == 0)
|
strcmp(exp_name, predefs[x]->name) == 0)
|
||||||
{
|
{
|
||||||
if (0 == strcmp(">",exp_op) && !(predefs[x]->value > exp_version)) return argi;
|
if (0 == strcmp(">",exp_op) && !(predefs[x]->value > exp_version)) return argi;
|
||||||
if (0 == strcmp("<",exp_op) && !(predefs[x]->value < exp_version)) return argi;
|
if (0 == strcmp("<",exp_op) && !(predefs[x]->value < exp_version)) return argi;
|
||||||
if (0 == strcmp(">=",exp_op) && !(predefs[x]->value >= exp_version)) return argi;
|
if (0 == strcmp(">=",exp_op) && !(predefs[x]->value >= exp_version)) return argi;
|
||||||
if (0 == strcmp("<=",exp_op) && !(predefs[x]->value <= exp_version)) return argi;
|
if (0 == strcmp("<=",exp_op) && !(predefs[x]->value <= exp_version)) return argi;
|
||||||
if (0 == strcmp("==",exp_op) && !(predefs[x]->value == exp_version)) return argi;
|
if (0 == strcmp("==",exp_op) && !(predefs[x]->value == exp_version)) return argi;
|
||||||
if (0 == strcmp("!=",exp_op) && !(predefs[x]->value != exp_version)) return argi;
|
if (0 == strcmp("!=",exp_op) && !(predefs[x]->value != exp_version)) return argi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user