Change the scan policy of the *.t and test.pl files,
[p5sagit/p5-mst-13.2.git] / x2p / walk.c
index 24b86aa..4d5f1d3 100644 (file)
@@ -1,6 +1,6 @@
 /* $RCSfile: walk.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:31 $
  *
- *    Copyright (c) 1991-1997, Larry Wall
+ *    Copyright (c) 1991-2001, Larry Wall
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -26,14 +26,14 @@ char *limit;
 STR *subs;
 STR *curargs = Nullstr;
 
-static void addsemi _(( STR *str ));
-static void emit_split _(( STR *str, int level ));
-static void fixtab _(( STR *str, int lvl ));
-static void numericize _(( int node ));
-static void tab _(( STR *str, int lvl ));
+static void addsemi ( STR *str );
+static void emit_split ( STR *str, int level );
+static void fixtab ( STR *str, int lvl );
+static void numericize ( int node );
+static void tab ( STR *str, int lvl );
 
-int prewalk _(( int numit, int level, int node, int *numericptr ));
-STR * walk _(( int useval, int level, int node, int *numericptr, int minprec ));
+int prewalk ( int numit, int level, int node, int *numericptr );
+STR * walk ( int useval, int level, int node, int *numericptr, int minprec );
 
 
 STR *
@@ -52,7 +52,7 @@ walk(int useval, int level, register int node, int *numericptr, int minprec)
     STR *tmp2str;
     STR *tmp3str;
     char *t;
-    char *d, *s;
+    char *d, *s = 0;
     int numarg;
     int numeric = FALSE;
     STR *fstr;
@@ -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,'_'))
@@ -750,7 +750,7 @@ sub Pick {\n\
        subretnum |= numarg;
        s = Nullch;
        t = tmp2str->str_ptr;
-       while (t = instr(t,"return "))
+       while ((t = instr(t,"return ")))
            s = t++;
        if (s) {
            i = 0;
@@ -863,7 +863,7 @@ sub Pick {\n\
            str_scat(tmp3str,tmp2str);
            str_cat(tmp3str,").'\"') =~ s/&/\\$&/g, ");
            str_set(tmp2str,"eval $s_");
-           s = (*s == 'g' ? "ge" : "e");
+           s = (char*)(*s == 'g' ? "ge" : "e");
            i++;
        }
        type = ops[ops[node+1].ival].ival;
@@ -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,'_'))
@@ -1219,7 +1219,7 @@ sub Pick {\n\
        }
        tmpstr = walk(1+(type==OPRINT),level,ops[node+1].ival,&numarg,P_MIN);
        if (!*tmpstr->str_ptr && lval_field) {
-           t = saw_OFS ? "$," : "' '";
+           t = (char*)(saw_OFS ? "$," : "' '");
            if (split_to_array) {
                sprintf(tokenbuf,"join(%s,@Fld)",t);
                str_cat(tmpstr,tokenbuf);
@@ -1292,10 +1292,10 @@ sub Pick {\n\
        if (len > 0)
            tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN);
        else
-           tmpstr = str_new(0);;
+           tmpstr = str_new(0);
        if (!tmpstr->str_ptr || !*tmpstr->str_ptr) {
            if (lval_field) {
-               t = saw_OFS ? "$," : "' '";
+               t = (char*)(saw_OFS ? "$," : "' '");
                if (split_to_array) {
                    sprintf(tokenbuf,"join(%s,@Fld)",t);
                    str_cat(tmpstr,tokenbuf);
@@ -1417,7 +1417,7 @@ sub Pick {\n\
        str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
        str_free(fstr);
        if (str->str_ptr[str->str_cur - 1] == '\n')
-           --str->str_cur;;
+           --str->str_cur;
        str_cat(str," while (");
        str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
        str_free(fstr);
@@ -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)
@@ -1463,7 +1463,7 @@ sub Pick {\n\
        if (!s)
            fatal("Illegal for loop: %s",d);
        *s++ = '\0';
-       for (t = s; i = *t; t++) {
+       for (t = s; (i = *t); t++) {
            i &= 127;
            if (i == '}' || i == ']')
                break;