# 2.11BSD#431 - /usr/src/bin/awk/parse.c

##### Functions

    ALLOC             X
    exptostat         X
    genprint          X
    linkum            X
    node0             X
    node1             X
    node2             X
    node3             X
    node4             X
    op1               X
    op2               X
    op3               X
    pa2stat           X
    stat1             X
    stat2             X
    stat3             X
    stat4             X
    valtonode         X

##### Variables

    nullstat          X

       1: #ifndef lint
       2: static char sccsid[] = "@(#)parse.c	4.2 8/11/83";
       3: #endif
       4:
       5: #include "awk.def"
       6: #include "awk.h"
       7: #include "stdio.h"
       8: node *ALLOC(n)
       9: {
      10:     register node *x;
      11:     x = (node *) malloc(sizeof(node) + (n-1)*sizeof(node *));
      12:     if (x == NULL)
      13:         error(FATAL, "out of space in ALLOC");
      14:     return(x);
      15: }
      16: node *exptostat(a) node *a;
      17: {
      18:     a->ntype = NSTAT;
      19:     return(a);
      20: }
      21: node    *nullstat;
      22: node *node0(a)
      23: {
      24:     register node *x;
      25:     x=ALLOC(0);
      26:     x->nnext = NULL;
      27:     x->nobj=a;
      28:     return(x);
      29: }
      30: node *node1(a,b) node *b;
      31: {
      32:     register node *x;
      33:     x=ALLOC(1);
      34:     x->nnext = NULL;
      35:     x->nobj=a;
      36:     x->narg[0]=b;
      37:     return(x);
      38: }
      39: node *node2(a,b,c) node *b, *c;
      40: {
      41:     register node *x;
      42:     x = ALLOC(2);
      43:     x->nnext = NULL;
      44:     x->nobj = a;
      45:     x->narg[0] = b;
      46:     x->narg[1] = c;
      47:     return(x);
      48: }
      49: node *node3(a,b,c,d) node *b, *c, *d;
      50: {
      51:     register node *x;
      52:     x = ALLOC(3);
      53:     x->nnext = NULL;
      54:     x->nobj = a;
      55:     x->narg[0] = b;
      56:     x->narg[1] = c;
      57:     x->narg[2] = d;
      58:     return(x);
      59: }
      60: node *node4(a,b,c,d,e) node *b, *c, *d, *e;
      61: {
      62:     register node *x;
      63:     x = ALLOC(4);
      64:     x->nnext = NULL;
      65:     x->nobj = a;
      66:     x->narg[0] = b;
      67:     x->narg[1] = c;
      68:     x->narg[2] = d;
      69:     x->narg[3] = e;
      70:     return(x);
      71: }
      72: node *stat3(a,b,c,d) node *b, *c, *d;
      73: {
      74:     register node *x;
      75:     x = node3(a,b,c,d);
      76:     x->ntype = NSTAT;
      77:     return(x);
      78: }
      79: node *op2(a,b,c) node *b, *c;
      80: {
      81:     register node *x;
      82:     x = node2(a,b,c);
      83:     x->ntype = NEXPR;
      84:     return(x);
      85: }
      86: node *op1(a,b) node *b;
      87: {
      88:     register node *x;
      89:     x = node1(a,b);
      90:     x->ntype = NEXPR;
      91:     return(x);
      92: }
      93: node *stat1(a,b) node *b;
      94: {
      95:     register node *x;
      96:     x = node1(a,b);
      97:     x->ntype = NSTAT;
      98:     return(x);
      99: }
     100: node *op3(a,b,c,d) node *b, *c, *d;
     101: {
     102:     register node *x;
     103:     x = node3(a,b,c,d);
     104:     x->ntype = NEXPR;
     105:     return(x);
     106: }
     107: node *stat2(a,b,c) node *b, *c;
     108: {
     109:     register node *x;
     110:     x = node2(a,b,c);
     111:     x->ntype = NSTAT;
     112:     return(x);
     113: }
     114: node *stat4(a,b,c,d,e) node *b, *c, *d, *e;
     115: {
     116:     register node *x;
     117:     x = node4(a,b,c,d,e);
     118:     x->ntype = NSTAT;
     119:     return(x);
     120: }
     121: node *valtonode(a, b) cell *a;
     122: {
     123:     register node *x;
     124:     x = node0(a);
     125:     x->ntype = NVALUE;
     126:     x->subtype = b;
     127:     return(x);
     128: }
     129: node *pa2stat(a,b,c) node *a, *b, *c;
     130: {
     131:     register node *x;
     132:     x = node3(paircnt++, a, b, c);
     133:     x->ntype = NPA2;
     134:     return(x);
     135: }
     136: node *linkum(a,b) node *a, *b;
     137: {
     138:     register node *c;
     139:     if(a == NULL) return(b);
     140:     else if(b == NULL) return(a);
     141:     for(c=a; c->nnext != NULL; c=c->nnext);
     142:     c->nnext = b;
     143:     return(a);
     144: }
     145: node *genprint()
     146: {
     147:     register node *x;
     148:     x = stat2(PRINT,valtonode(lookup("$record", symtab, 0), CFLD), nullstat);
     149:     return(x);
     150: }

#### Defined functions

ALLOC defined in line 8; used 5 times

- in line 25, 33, 42, 52, 63

exptostat defined in line 16; used 1 times

- in /usr/src/bin/awk/awk.g.y line 236

genprint defined in line 145; used 2 times

- in /usr/src/bin/awk/awk.g.y line 153-155(2)

linkum defined in line 136; used 5 times

- in /usr/src/bin/awk/awk.g.y line 162-164(2), 183-184(2), 257

node0 defined in line 22; used 1 times

- in line 124

node1 defined in line 30; used 2 times

- in line 89, 96

node2 defined in line 39; used 2 times

- in line 82, 110

node3 defined in line 49; used 3 times

- in line 75, 103, 132

node4 defined in line 60; used 1 times

- in line 117

op1 defined in line 86; used 10 times

- in /usr/src/bin/awk/awk.g.y line 63, 70, 87, 108, 116, 133-138(5)

op2 defined in line 79; used 35 times

- in /usr/src/bin/awk/awk.g.y line 61-62(2), 68-69(2), 75, 95, 103, 110-115(3), 126-132(6), 143, 169, 200-211(11), 217
- in /usr/src/bin/awk/b.c line 9, 50-52(4)

op3 defined in line 100; used 4 times

- in /usr/src/bin/awk/awk.g.y line 118-124(4)

pa2stat defined in line 129; used 2 times

- in /usr/src/bin/awk/awk.g.y line 155-157(2)

stat1 defined in line 93; used 5 times

- in /usr/src/bin/awk/awk.g.y line 248-252(5)

stat2 defined in line 107; used 6 times

- in line 148
- in /usr/src/bin/awk/awk.g.y line 144, 153-158(3), 246

stat3 defined in line 72; used 8 times

- in /usr/src/bin/awk/awk.g.y line 44, 229-235(4), 243-245(2), 271

stat4 defined in line 114; used 2 times

- in /usr/src/bin/awk/awk.g.y line 267-269(2)

valtonode defined in line 121; used 10 times

- in line 148
- in /usr/src/bin/awk/awk.g.y line 75, 86, 100-102(3), 110-113(2), 169, 179

#### Defined variables

nullstat defined in line 21; used 22 times

- in line 148
- in /usr/src/bin/awk/awk.g.y line 51, 57, 120-124(2), 158-163(2), 231-237(5), 243, 258, 269
- in /usr/src/bin/awk/parse.c line 148
- in /usr/src/bin/awk/run.c line 280, 556, 614, 683, 715, 832

sccsid defined in line 2; never used

Last modified: 1987-02-08 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1283 |