[BACK]Return to b.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / awk

Diff for /src/usr.bin/awk/b.c between version 1.7 and 1.8

version 1.7, 1999/04/20 17:31:29 version 1.8, 1999/12/08 23:09:45
Line 199 
Line 199 
                 parent(right(p)) = p;                  parent(right(p)) = p;
                 break;                  break;
         default:        /* can't happen */          default:        /* can't happen */
                 ERROR "can't happen: unknown type %d in penter", type(p) FATAL;                  FATAL("can't happen: unknown type %d in penter", type(p));
                 break;                  break;
         }          }
 }  }
Line 221 
Line 221 
                 xfree(p);                  xfree(p);
                 break;                  break;
         default:        /* can't happen */          default:        /* can't happen */
                 ERROR "can't happen: unknown type %d in freetr", type(p) FATAL;                  FATAL("can't happen: unknown type %d in freetr", type(p));
                 break;                  break;
         }          }
 }  }
Line 292 
Line 292 
   
         op = p;          op = p;
         if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL)          if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL)
                 ERROR "out of space for character class [%.10s...] 1", p FATAL;                  FATAL("out of space for character class [%.10s...] 1", p);
         bp = buf;          bp = buf;
         for (i = 0; (c = *p++) != 0; ) {          for (i = 0; (c = *p++) != 0; ) {
                 if (c == '\\') {                  if (c == '\\') {
Line 310 
Line 310 
                                 }                                  }
                                 while (c < c2) {                                  while (c < c2) {
                                         if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))                                          if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))
                                                 ERROR "out of space for character class [%.10s...] 2", p FATAL;                                                  FATAL("out of space for character class [%.10s...] 2", p);
                                         *bp++ = ++c;                                          *bp++ = ++c;
                                         i++;                                          i++;
                                 }                                  }
Line 318 
Line 318 
                         }                          }
                 }                  }
                 if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))                  if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))
                         ERROR "out of space for character class [%.10s...] 3", p FATAL;                          FATAL("out of space for character class [%.10s...] 3", p);
                 *bp++ = c;                  *bp++ = c;
                 i++;                  i++;
         }          }
Line 330 
Line 330 
   
 void overflo(char *s)  void overflo(char *s)
 {  {
         ERROR "regular expression too big: %.30s...", s FATAL;          FATAL("regular expression too big: %.30s...", s);
 }  }
   
 void cfoll(fa *f, Node *v)      /* enter follow set of each leaf of vertex v into lfollow[leaf] */  void cfoll(fa *f, Node *v)      /* enter follow set of each leaf of vertex v into lfollow[leaf] */
Line 370 
Line 370 
                 cfoll(f,right(v));                  cfoll(f,right(v));
                 break;                  break;
         default:        /* can't happen */          default:        /* can't happen */
                 ERROR "can't happen: unknown type %d in cfoll", type(v) FATAL;                  FATAL("can't happen: unknown type %d in cfoll", type(v));
         }          }
 }  }
   
Line 411 
Line 411 
                 if (first(left(p)) == 0 || b == 0) return(0);                  if (first(left(p)) == 0 || b == 0) return(0);
                 return(1);                  return(1);
         }          }
         ERROR "can't happen: unknown type %d in first", type(p) FATAL;  /* can't happen */          FATAL("can't happen: unknown type %d in first", type(p));       /* can't happen */
         return(-1);          return(-1);
 }  }
   
Line 584 
Line 584 
         lastre = prestr = p;    /* prestr points to string to be parsed */          lastre = prestr = p;    /* prestr points to string to be parsed */
         rtok = relex();          rtok = relex();
         if (rtok == '\0')          if (rtok == '\0')
                 ERROR "empty regular expression" FATAL;                  FATAL("empty regular expression");
         np = regexp();          np = regexp();
         if (rtok != '\0')          if (rtok != '\0')
                 ERROR "syntax error in regular expression %s at %s", lastre, prestr FATAL;                  FATAL("syntax error in regular expression %s at %s", lastre, prestr);
         return(np);          return(np);
 }  }
   
Line 637 
Line 637 
                         return (unary(np));                          return (unary(np));
                 }                  }
                 else                  else
                         ERROR "syntax error in regular expression %s at %s", lastre, prestr FATAL;                          FATAL("syntax error in regular expression %s at %s", lastre, prestr);
         default:          default:
                 ERROR "illegal primary in regular expression %s at %s", lastre, prestr FATAL;                  FATAL("illegal primary in regular expression %s at %s", lastre, prestr);
         }          }
         return 0;       /*NOTREACHED*/          return 0;       /*NOTREACHED*/
 }  }
Line 707 
Line 707 
                 return CHAR;                  return CHAR;
         case '[':          case '[':
                 if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL)                  if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL)
                         ERROR "out of space in reg expr %.10s..", lastre FATAL;                          FATAL("out of space in reg expr %.10s..", lastre);
                 bp = buf;                  bp = buf;
                 if (*prestr == '^') {                  if (*prestr == '^') {
                         cflag = 1;                          cflag = 1;
Line 717 
Line 717 
                         cflag = 0;                          cflag = 0;
                 n = 2 * strlen(prestr)+1;                  n = 2 * strlen(prestr)+1;
                 if (!adjbuf(&buf, &bufsz, n, n, &bp, 0))                  if (!adjbuf(&buf, &bufsz, n, n, &bp, 0))
                         ERROR "out of space for reg expr %.10s...", lastre FATAL;                          FATAL("out of space for reg expr %.10s...", lastre);
                 for (; ; ) {                  for (; ; ) {
                         if ((c = *prestr++) == '\\') {                          if ((c = *prestr++) == '\\') {
                                 *bp++ = '\\';                                  *bp++ = '\\';
                                 if ((c = *prestr++) == '\0')                                  if ((c = *prestr++) == '\0')
                                         ERROR "nonterminated character class %.20s...", lastre FATAL;                                          FATAL("nonterminated character class %.20s...", lastre);
                                 *bp++ = c;                                  *bp++ = c;
                         } else if (c == '\n') {                          } else if (c == '\n') {
                                 ERROR "newline in character class %.20s...", lastre FATAL;                                  FATAL("newline in character class %.20s...", lastre);
                         } else if (c == '\0') {                          } else if (c == '\0') {
                                 ERROR "nonterminated character class %.20s", lastre FATAL;                                  FATAL("nonterminated character class %.20s", lastre);
                         } else if (bp == buf) { /* 1st char is special */                          } else if (bp == buf) { /* 1st char is special */
                                 *bp++ = c;                                  *bp++ = c;
                         } else if (c == ']') {                          } else if (c == ']') {
Line 749 
Line 749 
         int *p, *q;          int *p, *q;
   
         if (c < 0)          if (c < 0)
                 ERROR "can't happen: neg char %d in cgoto", c FATAL;                  FATAL("can't happen: neg char %d in cgoto", c);
         while (f->accept >= maxsetvec) {        /* guessing here! */          while (f->accept >= maxsetvec) {        /* guessing here! */
                 maxsetvec *= 4;                  maxsetvec *= 4;
                 setvec = (int *) realloc(setvec, maxsetvec * sizeof(int));                  setvec = (int *) realloc(setvec, maxsetvec * sizeof(int));

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8