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

Diff for /src/usr.bin/awk/parse.c between version 1.1 and 1.2

version 1.1, 1996/07/04 20:34:45 version 1.2, 1997/08/25 16:17:13
Line 1 
Line 1 
   /*      $OpenBSD$       */
 /****************************************************************  /****************************************************************
 Copyright (C) AT&T and Lucent Technologies 1996  Copyright (C) Lucent Technologies 1997
 All Rights Reserved  All Rights Reserved
   
 Permission to use, copy, modify, and distribute this software and  Permission to use, copy, modify, and distribute this software and
Line 7 
Line 8 
 granted, provided that the above copyright notice appear in all  granted, provided that the above copyright notice appear in all
 copies and that both that the copyright notice and this  copies and that both that the copyright notice and this
 permission notice and warranty disclaimer appear in supporting  permission notice and warranty disclaimer appear in supporting
 documentation, and that the names of AT&T or Lucent Technologies  documentation, and that the name Lucent Technologies or any of
 or any of their entities not be used in advertising or publicity  its entities not be used in advertising or publicity pertaining
 pertaining to distribution of the software without specific,  to distribution of the software without specific, written prior
 written prior permission.  permission.
   
 AT&T AND LUCENT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS  LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
 FITNESS. IN NO EVENT SHALL AT&T OR LUCENT OR ANY OF THEIR  IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
 ENTITIES BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
 USE OR PERFORMANCE OF THIS SOFTWARE.  THIS SOFTWARE.
 ****************************************************************/  ****************************************************************/
   
 #define DEBUG  #define DEBUG
Line 27 
Line 28 
 #include <string.h>  #include <string.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include "awk.h"  #include "awk.h"
 #include "awkgram.h"  #include "ytab.h"
   
 Node *nodealloc(int n)  Node *nodealloc(int n)
 {  {
Line 165 
Line 166 
         return(x);          return(x);
 }  }
   
 Node *valtonode(Cell *a, int b)  Node *celltonode(Cell *a, int b)
 {  {
         Node *x;          Node *x;
   
Line 178 
Line 179 
   
 Node *rectonode(void)   /* make $0 into a Node */  Node *rectonode(void)   /* make $0 into a Node */
 {  {
         return valtonode(recloc, CFLD);          extern Cell *literal0;
           return op1(INDIRECT, celltonode(literal0, CUNK));
 }  }
   
 Node *makearr(Node *p)  Node *makearr(Node *p)
Line 187 
Line 189 
   
         if (isvalue(p)) {          if (isvalue(p)) {
                 cp = (Cell *) (p->narg[0]);                  cp = (Cell *) (p->narg[0]);
                 if (isfunc(cp))                  if (isfcn(cp))
                         ERROR "%s is a function, not an array", cp->nval SYNTAX;                          ERROR "%s is a function, not an array", cp->nval SYNTAX;
                 else if (!isarr(cp)) {                  else if (!isarr(cp)) {
                         xfree(cp->sval);                          xfree(cp->sval);
Line 198 
Line 200 
         return p;          return p;
 }  }
   
   #define PA2NUM  50      /* max number of pat,pat patterns allowed */
   int     paircnt;                /* number of them in use */
   int     pairstack[PA2NUM];      /* state of each pat,pat */
   
 Node *pa2stat(Node *a, Node *b, Node *c)        /* pat, pat {...} */  Node *pa2stat(Node *a, Node *b, Node *c)        /* pat, pat {...} */
 {  {
         Node *x;          Node *x;
   
         x = node4(PASTAT2, a, b, c, (Node *) paircnt);          x = node4(PASTAT2, a, b, c, (Node *) paircnt);
         paircnt++;          if (paircnt++ >= PA2NUM)
                   ERROR "limited to %d pat,pat statements", PA2NUM SYNTAX;
         x->ntype = NSTAT;          x->ntype = NSTAT;
         return(x);          return(x);
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2