1: static char Sccsid[] = "ac.c @(#)ac.c 1.1 10/1/82 Berkeley ";
2: #include "apl.h"
3:
4: ex_rot0()
5: {
6:
7: fetch2();
8: rotk(0);
9: }
10:
11: ex_rotk()
12: {
13: register k;
14:
15: k = topfix() - thread.iorg;
16: fetch2();
17: rotk(k);
18: }
19:
20: ex_rot()
21: {
22: register struct item *p;
23:
24: fetch2();
25: p = sp[-2];
26: rotk(p->rank-1);
27: }
28:
29: rotk(k)
30: {
31: register struct item *p, *q;
32: register param;
33: int rot1();
34:
35: p = sp[-1];
36: bidx(sp[-2]);
37: if(k < 0 || k >= idx.rank)
38: error("rotate X");
39: param = 0;
40: colapse(k);
41: if(idx.size != p->size) {
42: if(p->size != 1)
43: error("rotate C");
44: param++;
45: datum = getdat(p);
46: }
47: p = newdat(idx.type, 1, idx.dimk);
48: *sp++ = p;
49: forloop(rot1, param);
50: pop();
51: pop();
52: }
53:
54: rot1(param)
55: {
56: register struct item *p, *q;
57: register i;
58: int o, n;
59:
60: if(param == 0)
61: datum = getdat(sp[-2]);
62: o = fix(datum);
63: if(o < 0)
64: o = idx.dimk - (-o % idx.dimk);
65: q = sp[-1];
66: p = sp[-3];
67: q->index = 0;
68: n = access();
69: for(i=0; i<idx.dimk; i++) {
70: p->index = n + (o%idx.dimk)*idx.delk;
71: putdat(q, getdat(p));
72: o++;
73: }
74: for(i=0; i<idx.dimk; i++) {
75: p->index = n;
76: putdat(p, getdat(q));
77: n += idx.delk;
78: }
79: }
Defined functions
rot1
defined in line
54; used 2 times
rotk
defined in line
29; used 3 times
Defined variables
Sccsid
defined in line
1;
never used