summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-03 23:58:04 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-03 23:58:04 +0000
commit3f939f220e50adb6f28f2dd14f06461c7cebfe14 (patch)
tree9d0a29dd1a27a086a9d668b3526d9dcaca6f84f3 /x2p
parent425d70b4c4324ccafae8099527a1f9ab13640b5c (diff)
downloadperl-3f939f220e50adb6f28f2dd14f06461c7cebfe14.tar.gz
-Wall "subscript has type `char'" cleanup.
p4raw-id: //depot/perl@10418
Diffstat (limited to 'x2p')
-rw-r--r--x2p/a2py.c154
-rw-r--r--x2p/str.c7
-rw-r--r--x2p/walk.c28
3 files changed, 95 insertions, 94 deletions
diff --git a/x2p/a2py.c b/x2p/a2py.c
index 5642b3673b..1b1d00ebab 100644
--- a/x2p/a2py.c
+++ b/x2p/a2py.c
@@ -281,7 +281,7 @@ yylex(void)
s++;
XTERM('}');
case '}':
- for (d = s + 1; isspace(*d); d++) ;
+ for (d = s + 1; isSPACE(*d); d++) ;
if (!*d)
s = d - 1;
*s = 127;
@@ -383,7 +383,7 @@ yylex(void)
#define SNARFWORD \
d = tokenbuf; \
- while (isalpha(*s) || isdigit(*s) || *s == '_') \
+ while (isALPHA(*s) || isDIGIT(*s) || *s == '_') \
*d++ = *s++; \
*d = '\0'; \
d = tokenbuf; \
@@ -402,8 +402,8 @@ yylex(void)
ID("0");
}
do_split = TRUE;
- if (isdigit(*s)) {
- for (d = s; isdigit(*s); s++) ;
+ if (isDIGIT(*s)) {
+ for (d = s; isDIGIT(*s); s++) ;
yylval = string(d,s-d);
tmp = atoi(d);
if (tmp > maxfld)
@@ -473,15 +473,15 @@ yylex(void)
XTERM(FUN1);
}
if (strEQ(d,"chdir"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"crypt"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"chop"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"chmod"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"chown"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'd': case 'D':
SNARFWORD;
@@ -490,7 +490,7 @@ yylex(void)
if (strEQ(d,"delete"))
XTERM(DELETE);
if (strEQ(d,"die"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'e': case 'E':
SNARFWORD;
@@ -507,26 +507,26 @@ yylex(void)
XTERM(FUN1);
}
if (strEQ(d,"elsif"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"eq"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"eval"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"eof"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"each"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"exec"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'f': case 'F':
SNARFWORD;
if (strEQ(d,"FS")) {
saw_FS++;
if (saw_FS == 1 && in_begin) {
- for (d = s; *d && isspace(*d); d++) ;
+ for (d = s; *d && isSPACE(*d); d++) ;
if (*d == '=') {
- for (d++; *d && isspace(*d); d++) ;
+ for (d++; *d && isSPACE(*d); d++) ;
if (*d == '"' && d[2] == '"')
const_FS = d[1];
}
@@ -540,13 +540,13 @@ yylex(void)
if (strEQ(d,"FILENAME"))
d = "ARGV";
if (strEQ(d,"foreach"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"format"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"fork"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"fh"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'g': case 'G':
SNARFWORD;
@@ -555,18 +555,18 @@ yylex(void)
if (strEQ(d,"gsub"))
XTERM(GSUB);
if (strEQ(d,"ge"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"gt"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"goto"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"gmtime"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'h': case 'H':
SNARFWORD;
if (strEQ(d,"hex"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'i': case 'I':
SNARFWORD;
@@ -586,14 +586,14 @@ yylex(void)
case 'j': case 'J':
SNARFWORD;
if (strEQ(d,"join"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'k': case 'K':
SNARFWORD;
if (strEQ(d,"keys"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"kill"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'l': case 'L':
SNARFWORD;
@@ -606,17 +606,17 @@ yylex(void)
XTERM(FUN1);
}
if (strEQ(d,"last"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"local"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"lt"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"le"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"locatime"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"link"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'm': case 'M':
SNARFWORD;
@@ -625,7 +625,7 @@ yylex(void)
XTERM(MATCH);
}
if (strEQ(d,"m"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'n': case 'N':
SNARFWORD;
@@ -636,7 +636,7 @@ yylex(void)
XTERM(NEXT);
}
if (strEQ(d,"ne"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'o': case 'O':
SNARFWORD;
@@ -652,11 +652,11 @@ yylex(void)
d = "#";
}
if (strEQ(d,"open"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"ord"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"oct"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'p': case 'P':
SNARFWORD;
@@ -667,9 +667,9 @@ yylex(void)
XTERM(PRINTF);
}
if (strEQ(d,"push"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"pop"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'q': case 'Q':
SNARFWORD;
@@ -687,11 +687,11 @@ yylex(void)
if (strEQ(d,"return"))
XTERM(RET);
if (strEQ(d,"reset"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"redo"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"rename"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 's': case 'S':
SNARFWORD;
@@ -734,73 +734,73 @@ yylex(void)
XTERM(FUN1);
}
if (strEQ(d,"s"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"shift"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"select"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"seek"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"stat"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"study"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"sleep"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"symlink"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"sort"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 't': case 'T':
SNARFWORD;
if (strEQ(d,"tr"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"tell"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"time"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"times"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'u': case 'U':
SNARFWORD;
if (strEQ(d,"until"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"unless"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"umask"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"unshift"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"unlink"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"utime"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'v': case 'V':
SNARFWORD;
if (strEQ(d,"values"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'w': case 'W':
SNARFWORD;
if (strEQ(d,"while"))
XTERM(WHILE);
if (strEQ(d,"write"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
else if (strEQ(d,"wait"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'x': case 'X':
SNARFWORD;
if (strEQ(d,"x"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'y': case 'Y':
SNARFWORD;
if (strEQ(d,"y"))
- *d = toupper(*d);
+ *d = toUPPER(*d);
ID(d);
case 'z': case 'Z':
SNARFWORD;
@@ -869,13 +869,13 @@ scannum(register char *s)
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case '0' : case '.':
d = tokenbuf;
- while (isdigit(*s)) {
+ while (isDIGIT(*s)) {
*d++ = *s++;
}
if (*s == '.') {
- if (isdigit(s[1])) {
+ if (isDIGIT(s[1])) {
*d++ = *s++;
- while (isdigit(*s)) {
+ while (isDIGIT(*s)) {
*d++ = *s++;
}
}
@@ -886,7 +886,7 @@ scannum(register char *s)
*d++ = *s++;
if (*s == '+' || *s == '-')
*d++ = *s++;
- while (isdigit(*s))
+ while (isDIGIT(*s))
*d++ = *s++;
}
*d = '\0';
@@ -1059,9 +1059,9 @@ fixup(STR *str)
s++;
}
else if (*s == '\n') {
- for (t = s+1; isspace(*t & 127); t++) ;
+ for (t = s+1; isSPACE(*t & 127); t++) ;
t--;
- while (isspace(*t & 127) && *t != '\n') t--;
+ while (isSPACE(*t & 127) && *t != '\n') t--;
if (*t == '\n' && t-s > 1) {
if (s[-1] == '{')
s--;
@@ -1094,7 +1094,7 @@ putlines(STR *str)
if (pos > 78) { /* split a long line? */
*d-- = '\0';
newpos = 0;
- for (t = tokenbuf; isspace(*t & 127); t++) {
+ for (t = tokenbuf; isSPACE(*t & 127); t++) {
if (*t == '\t')
newpos += 8;
else
diff --git a/x2p/str.c b/x2p/str.c
index 0587205270..15f341fe23 100644
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -285,13 +285,14 @@ str_gets(register STR *str, register FILE *fp)
ptr = FILE_ptr(fp);
for (;;) {
while (--cnt >= 0) {
- if ((*bp++ = *ptr++) == newline)
+ if ((*bp++ = *ptr++) == newline) {
if (bp <= str->str_ptr || bp[-2] != '\\')
goto thats_all_folks;
else {
line++;
bp -= 2;
}
+ }
}
FILE_cnt(fp) = cnt; /* deregisterize cnt and ptr */
@@ -353,7 +354,7 @@ str_inc(register STR *str)
}
for (d = str->str_ptr; *d && *d != '.'; d++) ;
d--;
- if (!isdigit(*str->str_ptr) || !isdigit(*d) ) {
+ if (!isDIGIT(*str->str_ptr) || !isDIGIT(*d) ) {
str_numset(str,atof(str->str_ptr) + 1.0); /* punt */
return;
}
@@ -389,7 +390,7 @@ str_dec(register STR *str)
}
for (d = str->str_ptr; *d && *d != '.'; d++) ;
d--;
- if (!isdigit(*str->str_ptr) || !isdigit(*d) || (*d == '0' && d == str->str_ptr)) {
+ if (!isDIGIT(*str->str_ptr) || !isDIGIT(*d) || (*d == '0' && d == str->str_ptr)) {
str_numset(str,atof(str->str_ptr) - 1.0); /* punt */
return;
}
diff --git a/x2p/walk.c b/x2p/walk.c
index 10546db197..4d5f1d3a5e 100644
--- a/x2p/walk.c
+++ b/x2p/walk.c
@@ -69,12 +69,12 @@ walk(int useval, int level, register int node, int *numericptr, int minprec)
case OPROG:
arymax = 0;
if (namelist) {
- while (isalpha(*namelist)) {
+ while (isALPHA(*namelist)) {
for (d = tokenbuf,s=namelist;
- isalpha(*s) || isdigit(*s) || *s == '_';
+ isALPHA(*s) || isDIGIT(*s) || *s == '_';
*d++ = *s++) ;
*d = '\0';
- while (*s && !isalpha(*s)) s++;
+ while (*s && !isALPHA(*s)) s++;
namelist = s;
nameary[++arymax] = savestr(tokenbuf);
}
@@ -241,7 +241,7 @@ sub Pick {\n\
tmpstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN);
/* translate \nnn to [\nnn] */
for (s = tmpstr->str_ptr, d = tokenbuf; *s; s++, d++) {
- if (*s == '\\' && isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3])){
+ if (*s == '\\' && isDIGIT(s[1]) && isDIGIT(s[2]) && isDIGIT(s[3])){
*d++ = '[';
*d++ = *s++;
*d++ = *s++;
@@ -589,9 +589,9 @@ sub Pick {\n\
s = savestr(tokenbuf);
for (t = tokenbuf; *t; t++) {
*t &= 127;
- if (islower(*t))
- *t = toupper(*t);
- if (!isalpha(*t) && !isdigit(*t))
+ if (isLOWER(*t))
+ *t = toUPPER(*t);
+ if (!isALPHA(*t) && !isDIGIT(*t))
*t = '_';
}
if (!strchr(tokenbuf,'_'))
@@ -1120,9 +1120,9 @@ sub Pick {\n\
s = savestr(tokenbuf);
for (t = tokenbuf; *t; t++) {
*t &= 127;
- if (islower(*t))
- *t = toupper(*t);
- if (!isalpha(*t) && !isdigit(*t))
+ if (isLOWER(*t))
+ *t = toUPPER(*t);
+ if (!isALPHA(*t) && !isDIGIT(*t))
*t = '_';
}
if (!strchr(tokenbuf,'_'))
@@ -1157,9 +1157,9 @@ sub Pick {\n\
s = savestr(tokenbuf);
for (t = tokenbuf; *t; t++) {
*t &= 127;
- if (islower(*t))
- *t = toupper(*t);
- if (!isalpha(*t) && !isdigit(*t))
+ if (isLOWER(*t))
+ *t = toUPPER(*t);
+ if (!isALPHA(*t) && !isDIGIT(*t))
*t = '_';
}
if (!strchr(tokenbuf,'_'))
@@ -1430,7 +1430,7 @@ sub Pick {\n\
i = numarg;
if (i) {
t = s = tmpstr->str_ptr;
- while (isalpha(*t) || isdigit(*t) || *t == '$' || *t == '_')
+ while (isALPHA(*t) || isDIGIT(*t) || *t == '$' || *t == '_')
t++;
i = t - s;
if (i < 2)