general indent beautification

This commit is contained in:
Matej Sekoranja
2016-03-10 23:36:16 +01:00
parent d139c42d17
commit 5279d247ca
110 changed files with 21778 additions and 21525 deletions
+91 -91
View File
@@ -38,131 +38,131 @@ using namespace epics::pvAccess;
int
Wildcard::wildcardfit (const char *wildcard, const char *test)
{
int fit = 1;
for (; ('\000' != *wildcard) && (1 == fit) && ('\000' != *test); wildcard++)
int fit = 1;
for (; ('\000' != *wildcard) && (1 == fit) && ('\000' != *test); wildcard++)
{
switch (*wildcard)
switch (*wildcard)
{
case '[':
wildcard++; /* leave out the opening square bracket */
fit = set (&wildcard, &test);
/* we don't need to decrement the wildcard as in case */
/* of asterisk because the closing ] is still there */
break;
wildcard++; /* leave out the opening square bracket */
fit = set (&wildcard, &test);
/* we don't need to decrement the wildcard as in case */
/* of asterisk because the closing ] is still there */
break;
case '?':
test++;
break;
test++;
break;
case '*':
fit = asterisk (&wildcard, &test);
/* the asterisk was skipped by asterisk() but the loop will */
/* increment by itself. So we have to decrement */
wildcard--;
break;
fit = asterisk (&wildcard, &test);
/* the asterisk was skipped by asterisk() but the loop will */
/* increment by itself. So we have to decrement */
wildcard--;
break;
default:
fit = (int) (*wildcard == *test);
test++;
fit = (int) (*wildcard == *test);
test++;
}
}
while ((*wildcard == '*') && (1 == fit))
/* here the teststring is empty otherwise you cannot */
/* leave the previous loop */
wildcard++;
return (int) ((1 == fit) && ('\0' == *test) && ('\0' == *wildcard));
while ((*wildcard == '*') && (1 == fit))
/* here the teststring is empty otherwise you cannot */
/* leave the previous loop */
wildcard++;
return (int) ((1 == fit) && ('\0' == *test) && ('\0' == *wildcard));
}
int
Wildcard::set (const char **wildcard, const char **test)
{
int fit = 0;
int negation = 0;
int at_beginning = 1;
int fit = 0;
int negation = 0;
int at_beginning = 1;
if ('!' == **wildcard)
if ('!' == **wildcard)
{
negation = 1;
(*wildcard)++;
negation = 1;
(*wildcard)++;
}
while ((']' != **wildcard) || (1 == at_beginning))
while ((']' != **wildcard) || (1 == at_beginning))
{
if (0 == fit)
if (0 == fit)
{
if (('-' == **wildcard)
&& ((*(*wildcard - 1)) < (*(*wildcard + 1)))
&& (']' != *(*wildcard + 1))
&& (0 == at_beginning))
if (('-' == **wildcard)
&& ((*(*wildcard - 1)) < (*(*wildcard + 1)))
&& (']' != *(*wildcard + 1))
&& (0 == at_beginning))
{
if (((**test) >= (*(*wildcard - 1)))
&& ((**test) <= (*(*wildcard + 1))))
if (((**test) >= (*(*wildcard - 1)))
&& ((**test) <= (*(*wildcard + 1))))
{
fit = 1;
(*wildcard)++;
fit = 1;
(*wildcard)++;
}
}
else if ((**wildcard) == (**test))
else if ((**wildcard) == (**test))
{
fit = 1;
fit = 1;
}
}
(*wildcard)++;
at_beginning = 0;
(*wildcard)++;
at_beginning = 0;
}
if (1 == negation)
/* change from zero to one and vice versa */
fit = 1 - fit;
if (1 == fit)
(*test)++;
if (1 == negation)
/* change from zero to one and vice versa */
fit = 1 - fit;
if (1 == fit)
(*test)++;
return (fit);
return (fit);
}
int
Wildcard::asterisk (const char **wildcard, const char **test)
{
/* Warning: uses multiple returns */
int fit = 1;
/* Warning: uses multiple returns */
int fit = 1;
/* erase the leading asterisk */
(*wildcard)++;
while (('\000' != (**test))
&& (('?' == **wildcard)
|| ('*' == **wildcard)))
{
if ('?' == **wildcard)
(*test)++;
(*wildcard)++;
}
/* Now it could be that test is empty and wildcard contains */
/* aterisks. Then we delete them to get a proper state */
while ('*' == (**wildcard))
/* erase the leading asterisk */
(*wildcard)++;
if (('\0' == (**test)) && ('\0' != (**wildcard)))
return (fit = 0);
if (('\0' == (**test)) && ('\0' == (**wildcard)))
return (fit = 1);
else
while (('\000' != (**test))
&& (('?' == **wildcard)
|| ('*' == **wildcard)))
{
/* Neither test nor wildcard are empty! */
/* the first character of wildcard isn't in [*?] */
if (0 == wildcardfit(*wildcard, (*test)))
{
do
{
(*test)++;
/* skip as much characters as possible in the teststring */
/* stop if a character match occurs */
while (((**wildcard) != (**test))
&& ('[' != (**wildcard))
&& ('\0' != (**test)))
(*test)++;
}
while ((('\0' != **test))?
(0 == wildcardfit (*wildcard, (*test)))
: (0 != (fit = 0)));
}
if (('\0' == **test) && ('\0' == **wildcard))
fit = 1;
return (fit);
if ('?' == **wildcard)
(*test)++;
(*wildcard)++;
}
/* Now it could be that test is empty and wildcard contains */
/* aterisks. Then we delete them to get a proper state */
while ('*' == (**wildcard))
(*wildcard)++;
if (('\0' == (**test)) && ('\0' != (**wildcard)))
return (fit = 0);
if (('\0' == (**test)) && ('\0' == (**wildcard)))
return (fit = 1);
else
{
/* Neither test nor wildcard are empty! */
/* the first character of wildcard isn't in [*?] */
if (0 == wildcardfit(*wildcard, (*test)))
{
do
{
(*test)++;
/* skip as much characters as possible in the teststring */
/* stop if a character match occurs */
while (((**wildcard) != (**test))
&& ('[' != (**wildcard))
&& ('\0' != (**test)))
(*test)++;
}
while ((('\0' != **test))?
(0 == wildcardfit (*wildcard, (*test)))
: (0 != (fit = 0)));
}
if (('\0' == **test) && ('\0' == **wildcard))
fit = 1;
return (fit);
}
}