1: #
2:
3: #include "m6.h"
4:
5:
6: doif() {
7: int i;
8: int *p;
9: char *arg();
10: i = 1;
11: while(!comp(arg(i),one)) if((i =+ 2)>8) return;
12: p = arg(i+1) - 2;
13: ge = move(p,&gf->ga0,p->word+1);
14: setscan(dummy);
15: }
16:
17: bindec(n) {
18: if(n == 0) return;
19: bindec(n/10);
20: *ge++ = (n%10) + '0';
21: }
22:
23: result(n) {
24: char *p;
25: setscan(dummy);
26: ge = 2 + (p = &gf->ga0);
27: if(n<0) {
28: *ge++ = '-';
29: n = -n;
30: }
31: if(n==0) *ge++ = '0';
32: else bindec(n);
33: *ge++ = 0;
34: ge = (ge+1)&0177776;
35: p->word = ge - p;
36: *ge++ = *ge++ = 0;
37: }
38:
39: binop(code) {
40: int r1,r2;
41: int r,t;
42: int arg1, arg2;
43: arg1 = decbin(1);
44: arg2 = decbin(2);
45: if(code < 7) /* relationals */
46: result((code & ((arg1<arg2)?4:(arg1==arg2)?2:1)) != 0);
47: else if(code < 9) /* seq=7 sne=8 */
48: result((code==7)==comp(arg(1),arg(2)));
49: else switch (code) {
50: case 9:
51: result(arg1+arg2);
52: return;
53: case 10:
54: result(arg1-arg2);
55: return;
56: case 11:
57: result(arg1*arg2);
58: return;
59: case 12:
60: result(arg1/arg2);
61: if(arg2==0) gf->ga0 = 0;
62: return;
63: case 13: /* exp */
64: r = 1;
65: while(arg2-->0) r =* arg1;
66: result(r);
67: if(arg2<-1) gf->ga0 = 0;
68: }
69: }
70:
71: decbin(i) {
72: char *s;
73: char t;
74: int n;
75: if(t = (*(s = arg(i))=='-')) s++;
76: n = 0;
77: while(*s>='0' && *s<='9') n = 10*n + *s++ - '0';
78: return(t?-n:n);
79: }
80:
81: dnl() {
82: char d;
83: d = 0;
84: while(d=getchar()) if(d=='\n') return;
85: }
86:
87: quote() {
88: char *p,*s;
89: p = finddef(1);
90: s = &p[p->dtext];
91: while(c = *s++) put();
92: }
93:
94: list() {
95: int n,i;
96: char *p;
97: if((n=decbin(1))<=0) return;
98: p = df;
99: for(i=1;;) {
100: if(p<=d0) return;
101: if(p->dswitch>=0)
102: if(i++>=n) break;
103: p =+ p->prev;
104: }
105: for(p = &p->dident;c = *p++;)
106: put();
107: }
108:
109: copy() {
110: char *p;
111: p = finddef(1);
112: remove(2);
113: newdef(p->dswitch);
114: setdef(arg(2),p+p->dtext);
115: }
116:
117: go(n) {
118: if(comp(arg(1),one)) {
119: popget();
120: if(lg>0)
121: if(n==26) popget();
122: else setscan(gf->mframe); /* gobk=27 */
123: }
124: }
125:
126: size() {
127: int i;
128: char *p;
129: i = 0;
130: p = arg(1);
131: while(*p++ != 0) i++;
132: result(i);
133: }
134:
135: meta() {
136: char d;
137: int i;
138: char *arg();
139: if((d = *arg(2))!=0) {
140: for(i=0;i<NMETA;i++)
141: if(metas[i]== *arg(1)) metas[i] = d;
142: }
143: }
144:
145: substr() {
146: char *s;
147: int arg2,arg3;
148: char *arg();
149: newdef(-1);
150: setscan(df);
151: s = arg(1);
152: arg2 = decbin(2);
153: arg3 = *arg(3)==0?32767:decbin(3);
154: if(arg2<1) {
155: arg3 =+ arg2-1;
156: arg2=1;
157: }
158: while(--arg2>0 && *s!=0) s++;
159: while(arg3-->0) {
160: if((*de++ = *s++)==0) return;
161: if(de>dmax) diag("No room for substr");
162: }
163: *de++ = 0;
164: }
Defined functions
binop
defined in line
39; used 1 times
copy
defined in line
109; used 1 times
dnl
defined in line
81; used 1 times
doif
defined in line
6; used 1 times
go
defined in line
117; used 1 times
list
defined in line
94; used 1 times
meta
defined in line
135; used 1 times
quote
defined in line
87; used 1 times
size
defined in line
126; used 1 times