Commit | Line | Data |
---|---|---|
4a9bdf3d BJ |
1 | # |
2 | /* | |
3 | * pxp - Pascal execution profiler | |
4 | * | |
5 | * Bill Joy UCB | |
6 | * Version 1.0 August 1977 | |
7 | */ | |
8 | ||
9 | #include "whoami" | |
10 | #include "0.h" | |
11 | #include "tree.h" | |
12 | ||
13 | /* | |
14 | * A "variable" | |
15 | */ | |
16 | lvalue(r) | |
17 | 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 | 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 | } |