File: dummy.c

package info (click to toggle)
xlispstat 3.52.14-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,560 kB
  • ctags: 12,676
  • sloc: ansic: 91,357; lisp: 21,759; sh: 1,525; makefile: 521; csh: 1
file content (351 lines) | stat: -rw-r--r-- 6,892 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#include "xlisp.h"
#include "xlbcode.h"

typedef VOID (*modulefun) P1H(int);

LOCAL VOID dummy1 P1H(int);
LOCAL VOID dummy2 P1H(int);
LOCAL VOID dummy3 P1H(int);
LOCAL VOID dummy4 P1H(int);
LOCAL VOID dummy5 P1H(int);
LOCAL VOID dummy6 P1H(int);
VOID init___dummy P2H(int *, modulefun **);

/* (cmp '(lambda (x) (+ x 1))) */
LOCAL VOID dummy1 P1C(int, entry)
{
  LVAL function = vsbase[-1];
  LVAL literals = bcode_literals(function);
  CONTINUATIONP FVcont = xlcstop;
  LVAL tmp, *base;

 Entry:

 L0:
  /* (%INITIALIZE 0 2 1 0 0) */
  cmp_check_required_only_argcount(2);
  pusharg(getlitval(0));

  /* (%ARITH2 43 1 2 0) */
  set_one_result(xladd2(getregval(1), getregval(2)));

  /* (%RETURN 0) */
  RETURN(0);
}

/* (cmp '(lambda (x) (let ((s 0)) (dolist (y x s) (incf s y))))) */
LOCAL VOID dummy2 P1C(int, entry)
{
  LVAL function = vsbase[-1];
  LVAL literals = bcode_literals(function);
  CONTINUATIONP FVcont = xlcstop;
  LVAL tmp;

 Entry:

  /* (%INITIALIZE 0 2 1 0 3) */
  cmp_check_required_only_argcount(2);
  pusharg(getlitval(0));
  cmp_push_space(3);

  /* (%COPY 2 3) */
  setregval(3, getregval(2));

  /* (%COPY 1 4) */
  setregval(4, getregval(1));

  /* (%CAR 4 5) */
  setregval(5, cmpCAR(getregval(4)));

  /* (%GOTO L2) */
  goto L2;

 L1:
  /* (%ARITH2 43 3 5 3) */
  setregval(3, xladd2(getregval(3), getregval(5)));

  /* (%CDR 4 4) */
  setregval(4, cmpCDR(getregval(4)));

  /* (%CAR 4 5) */
  setregval(5, cmpCAR(getregval(4)));

 L2:
  /* (%TEST-1 1 L1 L3 4) */
  if (consp(getregval(4))) goto L1;
  else goto L3;

 L3:
  /* (%SET-ONE-VALUE-RETURN 0 3) */
  set_one_result(getregval(3));
  RETURN(0);
}

/* (cmp '(lambda (x)
           (let ((s 0)) (dotimes (i (length x) s) (incf s (aref x i))))))*/
LOCAL VOID dummy3 P1C(int, entry)
{
  LVAL function = vsbase[-1];
  LVAL literals = bcode_literals(function);
  CONTINUATIONP FVcont = xlcstop;
  LVAL tmp, *base;

 Entry:

  switch (entry) {
  case 0: goto L0;
  case 1: goto L1;
  }

 L0:
  /* (%INITIALIZE 0 2 1 0 4) */
  cmp_check_required_only_argcount(2);
  pusharg(getlitval(0));
  cmp_push_space(4);

  /* (%COPY 2 3) */
  setregval(3, getregval(2));

  /* (%SAVE-CALL 1 4 1 1) */
  getlitfun(1, tmp);
  base = vsbase;
  cmp_call_setup(tmp, 4, 1, 1, NIL, FALSE);
  *xlsp++ = base[1];
  cmp_do_call_set(tmp, 1, 4);
 L1:

  /* (%COPY 2 5) */
  setregval(5, getregval(2));

  /* (%GOTO L3) */
  goto L3;

 L2:
  /* (%AREF1 1 5 6) */
  setregval(6, cmpAREF1(getregval(1), getregval(5)));

  /* (%ARITH2 43 3 6 3) */
  setregval(3, xladd2(getregval(3), getregval(6)));

  /* (%ARITH1 112 5 5) */
  setregval(5, xladd1(getregval(5)));

 L3:
  /* (%TEST-ARITH-2 60 L2 L4 5 4) */
  if (num_cmp2(60, getregval(5), getregval(4))) goto L2;
  else goto L4;

 L4:
  /* (%SET-ONE-VALUE-RETURN 0 3) */
  set_one_result(getregval(3));
  RETURN(0);
}

/*(cmp '(lambda (x) (f x)))*/
LOCAL VOID dummy4 P1C(int, entry)
{
  LVAL function = vsbase[-1];
  LVAL literals = bcode_literals(function);
  CONTINUATIONP FVcont = xlcstop;
  LVAL tmp, *base;

 Entry:

 L0:
  /* (%INITIALIZE 0 2 0 0) */
  cmp_check_required_only_argcount(2);

  /* (%CALL 0 0 1 1) */
  getlitfun(0, tmp);
  base = vsbase;
  cmp_call_setup(tmp, -1, 0, 1, getregval(0), TRUE);
  *xlsp++ = base[1];
  cmp_do_tail_call(tmp, base, 1, 0);
}

/* tak */
LOCAL VOID dummy5 P1C(int, entry)
{
  LVAL function = vsbase[-1];
  LVAL literals = bcode_literals(function);
  CONTINUATIONP FVcont = xlcstop;
  LVAL tmp, *base;

 Entry:

  switch (entry) {
  case 0: goto L0;
  case 2: goto L2;
  case 3: goto L3;
  case 4: goto L4;
  }

 L0:
  /* (%INITIALIZE 0 4 0 3) */
  cmp_check_required_only_argcount(4);
  cmp_push_space(3);

  /* (%TEST-ARITH-2 60 L1 L5 2 1) */
  if (num_cmp2(60, getregval(2), getregval(1))) goto L1;
  else goto L5;

 L1:
  /* (%ARITH1 109 1 4) */
  setregval(4, xlsub1(getregval(1)));

  /* (%SAVE-CALL 0 4 3 4 2 3) */
  getlitfun(0, tmp);
  base = vsbase;
  cmp_call_setup(tmp, 4, 2, 3, NIL, FALSE);
  *xlsp++ = base[4];
  *xlsp++ = base[2];
  *xlsp++ = base[3];
  cmp_do_call_set(tmp, 3, 4);
 L2:

  /* (%ARITH1 109 2 5) */
  setregval(5, xlsub1(getregval(2)));

  /* (%SAVE-CALL 0 5 3 5 3 1) */
  getlitfun(0, tmp);
  base = vsbase;
  cmp_call_setup(tmp, 5, 3, 3, NIL, FALSE);
  *xlsp++ = base[5];
  *xlsp++ = base[3];
  *xlsp++ = base[1];
  cmp_do_call_set(tmp, 3, 5);
 L3:

  /* (%ARITH1 109 3 6) */
  setregval(6, xlsub1(getregval(3)));

  /* (%SAVE-CALL 0 6 3 6 1 2) */
  getlitfun(0, tmp);
  base = vsbase;
  cmp_call_setup(tmp, 6, 4, 3, NIL, FALSE);
  *xlsp++ = base[6];
  *xlsp++ = base[1];
  *xlsp++ = base[2];
  cmp_do_call_set(tmp, 3, 6);
 L4:

  /* (%CALL 0 0 3 4 5 6) */
  getlitfun(0, tmp);
  base = vsbase;
  cmp_call_setup(tmp, -1, 0, 3, getregval(0), TRUE);
  *xlsp++ = base[4];
  *xlsp++ = base[5];
  *xlsp++ = base[6];
  cmp_do_tail_call(tmp, base, 3, 0);

 L5:
  /* (%SET-ONE-VALUE-RETURN 0 3) */
  set_one_result(getregval(3));
  RETURN(0);
}

/* ltak */
LOCAL VOID dummy6 P1C(int, entry)
{
  LVAL function = vsbase[-1];
  LVAL literals = bcode_literals(function);
  CONTINUATIONP FVcont = xlcstop;
  LVAL tmp, *base;

 Entry:

  switch (entry) {
  case 0: goto L0;
  case 3: goto L3;
  case 4: goto L4;
  case 5: goto L5;
  }

 L0:
  /* (%INITIALIZE 0 4 0 0) */
  cmp_check_required_only_argcount(4);

  /* (%LCALL L1 0 3 1 2 3) */
  base = vsbase;
  cmp_tail_lcall_setup(3, getregval(0));
  *xlsp++ = base[1];
  *xlsp++ = base[2];
  *xlsp++ = base[3];
  cmp_do_tail_lcall(L1, base);

 L1:
  /* (%INITIALIZE 0 4 0 3) */
  cmp_check_required_only_argcount(4);
  cmp_push_space(3);

  /* (%TEST-ARITH-2 60 L2 L6 2 1) */
  if (num_cmp2(60, getregval(2), getregval(1))) goto L2;
  else goto L6;

 L2:
  /* (%ARITH1 109 1 4) */
  setregval(4, xlsub1(getregval(1)));

  /* (%SAVE-LCALL L1 4 3 4 2 3) */
  base = vsbase;
  cmp_lcall_setup(4, 3, 3);
  *xlsp++ = base[4];
  *xlsp++ = base[2];
  *xlsp++ = base[3];
  cmp_do_lcall(L1);
 L3:

  /* (%ARITH1 109 2 5) */
  setregval(5, xlsub1(getregval(2)));

  /* (%SAVE-LCALL L1 5 3 5 3 1) */
  base = vsbase;
  cmp_lcall_setup(5, 4, 3);
  *xlsp++ = base[5];
  *xlsp++ = base[3];
  *xlsp++ = base[1];
  cmp_do_lcall(L1);
 L4:

  /* (%ARITH1 109 3 6) */
  setregval(6, xlsub1(getregval(3)));

  /* (%SAVE-LCALL L1 6 3 6 1 2) */
  base = vsbase;
  cmp_lcall_setup(6, 5, 3);
  *xlsp++ = base[6];
  *xlsp++ = base[1];
  *xlsp++ = base[2];
  cmp_do_lcall(L1);
 L5:

  /* (%LCALL L1 0 3 4 5 6) */
  base = vsbase;
  cmp_tail_lcall_setup(3, getregval(0));
  *xlsp++ = base[4];
  *xlsp++ = base[5];
  *xlsp++ = base[6];
  cmp_do_tail_lcall(L1, base);

 L6:
  /* (%SET-ONE-VALUE-RETURN 0 3) */
  set_one_result(getregval(3));
  RETURN(0);
}

static VOID (*dummy___functions[]) _((int)) = {
  dummy1,
  dummy2,
  dummy3,
  dummy4,
  dummy5,
  dummy6
  };

#define dummy___count 6

VOID init___dummy P2C(int *, pn, modulefun **, pf)
{
  *pn = dummy___count;
  *pf = dummy___functions;
}