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