#define strneq(s,t,n) ((DEBUG && (s) == NULL && (t) == NULL \
&& (abort (), 1)) || !strncmp (s, t, n))
-#define lowcase(c) tolower ((char)c)
+#define lowcase(c) tolower ((unsigned char)(c))
+#define UPCASE(c) toupper ((unsigned char)(c))
#define CHARS 256 /* 2^sizeof(char) */
#define CHAR(x) ((unsigned int)x & (CHARS - 1))
#define intoken(c) (_itk[CHAR(c)]) /* c can be in token */
#define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens */
+#define ISALNUM(c) isalnum ((unsigned char) (c))
+#define ISALPHA(c) isalpha ((unsigned char) (c))
+#define ISDIGIT(c) isdigit ((unsigned char) (c))
+#define ISLOWER(c) islower ((unsigned char) (c))
+
/*
* xnew, xrnew -- allocate, reallocate storage
dbp += 3;
return;
}
- if (!isdigit (*dbp))
+ if (!ISDIGIT (*dbp))
{
--dbp; /* force failure */
return;
}
do
dbp++;
- while (isdigit (*dbp));
+ while (ISDIGIT (*dbp));
}
static void
dbp += 6;
dbp = skip_spaces (dbp);
}
- if (!isalpha (*dbp) && *dbp != '_' && *dbp != '$')
+ if (!ISALPHA (*dbp) && *dbp != '_' && *dbp != '$')
return;
for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
continue;
dbp = skip_spaces (dbp);
for (cp = dbp;
(*cp != '\0'
- && (isalpha (*cp) || isdigit (*cp) || *cp == '_' || *cp == '.'));
+ && (ISALPHA (*cp) || ISDIGIT (*cp) || *cp == '_' || *cp == '.'));
cp++)
continue;
if (cp == dbp)
{
/* If first char is alphabetic or one of [_.$], test for colon
following identifier. */
- if (isalpha (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
+ if (ISALPHA (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
{
/* Read past label. */
cp++;
- while (isalnum (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
+ while (ISALNUM (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
cp++;
if (*cp == ':' || iswhite (*cp))
{
if (*cp == '$' || *cp == '@' || *cp == '%')
{
char* varstart = ++cp;
- while (isalnum (*cp) || *cp == '_')
+ while (ISALNUM (*cp) || *cp == '_')
cp++;
varname = savenstr (varstart, cp-varstart);
}
bp += 8;
/* If eoln, compiler option or comment ignore whole line. */
- if (bp[-1] != ' ' || !isalnum (bp[0]))
+ if (bp[-1] != ' ' || !ISALNUM (bp[0]))
continue;
- for (ep = bp; isalnum (*ep) || *ep == '-'; ep++)
+ for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
continue;
if (*ep++ == '.')
pfnote (savenstr (bp, ep-bp), TRUE,
origpos = pos;
- if (islower(s[pos]) || (s[pos] == '_'))
+ if (ISLOWER(s[pos]) || (s[pos] == '_'))
{
/* The atom is unquoted. */
pos++;
- while (isalnum(s[pos]) || (s[pos] == '_'))
+ while (ISALNUM(s[pos]) || (s[pos] == '_'))
{
pos++;
}
origpos = pos;
- if (isalpha (s[pos]) || s[pos] == '_')
+ if (ISALPHA (s[pos]) || s[pos] == '_')
{
/* The atom is unquoted. */
pos++;
- while (isalnum (s[pos]) || s[pos] == '_')
+ while (ISALNUM (s[pos]) || s[pos] == '_')
pos++;
return pos - origpos;
}
for (t = etags_strchr (out, '\\');
t != NULL;
t = etags_strchr (t + 2, '\\'))
- if (isdigit (t[1]))
+ if (ISDIGIT (t[1]))
{
dig = t[1] - '0';
diglen = regs->end[dig] - regs->start[dig];
result = xnew (size + 1, char);
for (t = result; *out != '\0'; out++)
- if (*out == '\\' && isdigit (*++out))
+ if (*out == '\\' && ISDIGIT (*++out))
{
/* Using "dig2" satisfies my debugger. Bleah. */
dig = *out - '0';
{
return (fn[0] == '/'
#ifdef DOS_NT
- || (isalpha(fn[0]) && fn[1] == ':' && fn[2] == '/')
+ || (ISALPHA(fn[0]) && fn[1] == ':' && fn[2] == '/')
#endif
);
}
{
#ifdef DOS_NT
/* Canonicalize drive letter case. */
- if (fn[0] && fn[1] == ':' && islower (fn[0]))
- fn[0] = toupper (fn[0]);
+ if (fn[0] && fn[1] == ':' && ISLOWER (fn[0]))
+ fn[0] = upcase (fn[0]);
/* Convert backslashes to slashes. */
for (; *fn != '\0'; fn++)
if (*fn == '\\')