1: static char Sccsid[] = "ak.c @(#)ak.c 1.1 10/1/82 Berkeley ";
2: #include "apl.h"
3:
4: ex_scn0()
5: {
6: fetch1();
7: scan0(0);
8: }
9:
10: ex_scan()
11: {
12: register struct item *p;
13:
14: p = fetch1();
15: scan0(p->rank-1);
16: }
17:
18: ex_scnk()
19: {
20: register i;
21:
22: i = topfix() - thread.iorg;
23: scan0(i);
24: }
25:
26: scan0(k)
27: {
28: register struct item *p, *q;
29: data *param[2];
30: int scan1();
31:
32: p = fetch1();
33: if(p->type != DA)
34: error("scan T");
35:
36: bidx(p);
37: colapse(k);
38: if(idx.dimk == 0) {
39: /*
40: * scan identities - ets/jrl 5/76
41: */
42: q = newdat(DA,0,1);
43: q->dim[0] = 1;
44: switch(*pcp++) {
45: case ADD:
46: case SUB:
47: case OR:
48: q->datap[0] = 0;
49: break;
50: case AND:
51: case MUL:
52: case DIV:
53: q->datap[0] = 1;
54: break;
55: case MIN:
56: q->datap[0] = 1.0e38;
57: break;
58: case MAX:
59: q->datap[0] = -1.0e38;
60: break;
61: default:
62: error("reduce identity");
63: }
64: pop();
65: *sp++ = q;
66: return;
67: }
68: param[0] = p->datap;
69: param[1] = (data *)exop[*pcp++];
70: forloop(scan1, param);
71: }
72:
73: scan1(param)
74: data *param[];
75: {
76: register i;
77: register data *dp;
78: data d;
79: data (*f)();
80:
81: dp = param[0];
82: f = (data (*)())param[1];
83: dp += access();
84: d = *dp;
85: for(i = 1; i < idx.dimk; i++) {
86: dp += idx.delk;
87: *dp = d = (*f)(*dp, d);
88: }
89: }
90:
91: data scalex = 453.;
92: data scaley = 453.;
93: data origx = 0.0;
94: data origy = 0.0;
95:
96: ex_plot()
97: {
98: register struct item *p;
99: register data *dp;
100: register i;
101: int ic;
102: int x, y;
103:
104: p = fetch1();
105: if(p->type != DA)
106: error("plot T");
107: if(p->rank != 2)
108: error("plot R");
109: if(p->dim[1] != 2)
110: error("plot C");
111:
112: dp = p->datap;
113: if ((i = p->dim[0]) == 0) return;
114: ic=0;
115: while(i--) {
116: x = scalex*(*dp++ - origx);
117: y = 454-(scaley*(*dp++ - origy));
118: if(x<0 || x >= 576 ||
119: y<0 || y>=454)
120: error("plot off screen");
121: if(ic)
122: line(x,y);
123: else {
124: move(x,y);
125: ic=1;
126: }
127: }
128: }
129: line(x,y)
130: {
131: }
132: move(x,y)
133: {
134: }
Defined functions
line
defined in line
129; used 1 times
move
defined in line
132; used 1 times
scan0
defined in line
26; used 3 times
scan1
defined in line
73; used 2 times
Defined variables
Sccsid
defined in line
1;
never used