1 static char *sccsid = "@(#)lval.c 2.1 (Berkeley) 02/08/84"; 2 /* Copyright (c) 1979 Regents of the University of California */ 3 # 4 /* 5 * pxp - Pascal execution profiler 6 * 7 * Bill Joy UCB 8 * Version 1.2 January 1979 9 */ 10 11 #include "0.h" 12 #include "tree.h" 13 14 /* 15 * A "variable" 16 */ 17 lvalue(r) 18 register int *r; 19 { 20 register *c, *co; 21 22 ppid(r[2]); 23 for (c = r[3]; c != NIL; c = c[2]) { 24 co = c[1]; 25 if (co == NIL) 26 continue; 27 switch (co[0]) { 28 case T_PTR: 29 ppop("^"); 30 continue; 31 case T_ARY: 32 arycod(co[1]); 33 continue; 34 case T_FIELD: 35 ppop("."); 36 ppid(co[1]); 37 continue; 38 case T_ARGL: 39 ppid("{unexpected argument list}"); 40 break; 41 default: 42 panic("lval2"); 43 } 44 } 45 } 46 47 /* 48 * Subscripting 49 */ 50 arycod(el) 51 register int *el; 52 { 53 54 ppbra("["); 55 if (el != NIL) 56 for (;;) { 57 rvalue(el[1], NIL); 58 el = el[2]; 59 if (el == NIL) 60 break; 61 ppsep(", "); 62 } 63 else 64 rvalue(NIL, NIL); 65 ppket("]"); 66 } 67