-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathlispf41.c
3940 lines (3507 loc) · 86.5 KB
/
lispf41.c
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* lispf41.f -- translated by f2c (version 20000704).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
#include <stdio.h>
#define SHOWINT(x) fprintf(stderr, #x " = %d\n", x)
static int shostk_(void);
/* Common Block Declarations */
struct {
integer narea, jbytes, ibytes, bytes, chdiv, maxint, maxbig, maxrec,
natomp, nfreep, jbp, numbp, nfreet, numadd, npname, nfreeb, natom,
nstack, nhtab, bignum, ismall, dpnp, dpname, ipromp, nathsh,
nbytes, nchtyp, nbmess, maxmes, iresol, ipower;
real bigmax, fuzz;
integer garbs, cgarbs, ngarbs, agarbs;
real rmax;
} a_;
#define a_1 a_
struct {
integer arg, arg2, arg3, alist__, form, temp1, temp2, temp3, i1cons,
i2cons, nargs, nil, a000, apply, eval, fncell, fexpr, funarg,
lambda, array, string, substr, lispx, nlambd, unboun, prog, quote,
expr, error, sform, sinter, subarg, dotat, t, subr0, subr11,
subr1, subr2, subr3, subr, fsubr, ip, jp, ipp, jpp, middl, abup1,
cht, chr, numgen, unused, brlev, brflg, iflg1, iflg2, isplft;
logical ibreak;
integer errtyp, iobuff, maxlun, lunsys, lunins, lunuts, maxpar, itabwg,
lunin, rdpos, lmargr, margr, lunut, prtpos, lmarg, marg, levell,
levelp, dreg[7], abuff[160], rdbuff[160], prbuff[160], buff[160],
imess[400];
real *pname;
integer *pnp, *htab, *stack;
} b_;
#define b_1 b_
struct {
integer *car, *cdr, chtab[256];
} carcdr_;
#define carcdr_1 carcdr_
struct {
integer space, lpar, rpar, ilbchr, irbchr, strchr, iqchr, ubr, dot, itchr,
iplus, iminus, ifig[10], atend, softbr, echar, nochar;
} chars_;
#define chars_1 chars_
struct {
integer *jill, *jack, env, tops, hill, hillw;
} jaan_;
#define jaan_1 jaan_
struct {
integer protxt[80], prolen;
} prompt_;
#define prompt_1 prompt_
/* Table of constant values */
static integer c__20 = 20;
static integer c__22 = 22;
static integer c__17 = 17;
static struct { integer fill; char val[4+1]; char fill2[3]; } c_b8_st = { 0,
"_ " };
#define c_b8 c_b8_st.val
static integer c__1 = 1;
static integer c__0 = 0;
static integer c__7 = 7;
static integer c__19 = 19;
static integer c__6 = 6;
static integer c__26 = 26;
static integer c__9 = 9;
static integer c__2 = 2;
static integer c_n5 = -5;
static integer c_n10 = -10;
static integer c_n20 = -20;
static integer c__3 = 3;
static integer c__5 = 5;
static integer c__14 = 14;
static integer c__21 = 21;
static integer c__18 = 18;
static integer c__4 = 4;
static integer c__27 = 27;
static integer c__12 = 12;
static integer c__13 = 13;
static integer c__23 = 23;
static integer c__11 = 11;
static integer c__16 = 16;
static integer c__40 = 40;
/* ******HEART (HEART OF INTERPRETER) */
/* Subroutine */ int lispf4_(integer *iree)
{
/* System generated locals */
shortint s__1;
integer i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8, i__9, i__10;
static real equiv_2[1];
/* Local variables */
extern integer garb_(integer *);
static integer icar, icdr, main, ireg;
#define args ((integer *)&b_1.arg) /* ((integer *)&b_1) */
extern /* Subroutine */ int apop_(integer *);
static integer imax;
extern integer cons_(integer *, integer *);
#define narr (equiv_2)
#define ires ((integer *)&b_1.arg) /* ((integer *)&b_1) */
extern /* Subroutine */ int mess_(integer *);
static integer iret;
extern /* Subroutine */ int apop2_(integer *, integer *), prin1_(integer *
);
static integer i__, j, k, l;
#define n ((integer *)equiv_2)
extern integer iread_(integer *);
static real r__, s;
extern /* Subroutine */ int getch_();
extern integer xcall_(integer *, integer *), openf_(integer *), subpr_(
integer *, integer *, integer *), equal_(integer *, integer *),
getpn_(integer *, integer *, integer *, integer *), ratom_(
integer *, integer *);
static integer index;
#define iotab ((integer *)&b_1.lunin) /* ((integer *)&b_1 + 65) */
#define rargs ((real *)&b_1.arg) /* ((real *)&b_1) */
extern integer mknum_(integer *);
extern /* Subroutine */ int fpush_(integer *);
static integer local, iprev, iargs, k1;
extern /* Subroutine */ int shift_(integer *);
extern integer matom_(integer *);
extern /* Subroutine */ int eject_(integer *), lspex_(void);
extern integer mslft_(integer *);
extern /* Subroutine */ int mtime_(integer *), mdate_(integer *), apush_(
integer *);
static integer n1, n2;
extern /* Subroutine */ int putch_(real *, integer *, integer *);
static integer jndex, kalle;
extern /* Subroutine */ int apush2_(integer *, integer *);
static integer jb, ic, ii, ll, locale, irflag;
static logical aplyfl, noeval, formfl;
extern integer getcht_(integer *), comppn_(integer *, integer *), getnum_(
integer *), rollin_(integer *);
#define ipname ((integer *) b_1.pname) /* ((integer *)&b_1 + 1122) */
#define jpname ((shortint *) b_1.pname) /* ((shortint *)&b_1 + 2244) */
extern /* Subroutine */ int iprint_(integer *), terpri_(void);
extern integer mkreal_(real *);
extern /* Subroutine */ int rollou_(integer *),
arrutl_(integer *, integer *, integer *, integer *, integer *);
extern doublereal gtreal_(integer *, integer *);
static integer if41;
extern integer nchars_(integer *, integer *);
static integer ich;
extern /* Subroutine */ int setcht_(integer *, integer *);
static integer nch, jb2;
extern integer get_(integer *, integer *);
static integer ict, min__, ipl, max__, if42;
extern /* Subroutine */ int rew_(integer *);
static integer ist, ipl2;
/* OMMON AND INTEGER DECLARATIONS */
/* OMMON AND INTEGER DECLARATIONS END */
/* THIS IS A MODIFIED LISPF3 THAT USE A STACK */
/* AND NOT A A-LIST FOR VARIABLE BINDINGS. */
/* LOCAL DECLARATIONS */
/* ================== */
/* SPECAT(JDUMMY) = JDUMMY.EQ.STRING .OR. JDUMMY.EQ.SUBSTR */
/* * .OR. JDUMMY.EQ.ARRAY */
/* L2: */
switch (*iree) {
case 1: goto L10;
case 2: goto L1;
case 3: goto L1;
}
/* INI STA REE */
L10:
mess_(&c__20);
b_1.prtpos = 12;
i__2 = a_1.numadd + YEAR;
i__4 = a_1.numadd + MONTH;
i__6 = a_1.numadd + DAY;
i__5 = cons_(&i__6, &b_1.nil);
i__3 = cons_(&i__4, &i__5);
i__1 = cons_(&i__2, &i__3);
iprint_(&i__1);
mess_(&c__22);
b_1.prtpos = 12;
i__ = a_1.numbp - a_1.dpnp - 2;
j = a_1.numbp - (a_1.jbp - 2) / a_1.bytes - 3;
if (j < i__) {
i__ = j;
}
i__3 = a_1.nfreep - a_1.nfreeb;
i__2 = mknum_(&i__3);
i__5 = a_1.numadd + a_1.ismall;
i__7 = mknum_(&i__);
i__10 = a_1.natom - a_1.natomp;
i__9 = mknum_(&i__10);
i__8 = cons_(&i__9, &b_1.nil);
i__6 = cons_(&i__7, &i__8);
i__4 = cons_(&i__5, &i__6);
i__1 = cons_(&i__2, &i__4);
iprint_(&i__1);
/* RESTART OF INTERPRETER */
/* ----------------------------- */
L1:
b_1.ip = 1;
b_1.jp = a_1.nstack + 1;
b_1.ipp = 0;
b_1.jpp = 0;
mess_(&c__17);
/* *SETC* CALL SETCAR(NIL,NIL) */
carcdr_1.car[b_1.nil - 1] = b_1.nil;
/* *SETC* CALL SETCDR(NIL,NIL) */
carcdr_1.cdr[b_1.nil - 1] = b_1.nil;
/* *SETC* CALL SETCAR(T,T) */
carcdr_1.car[b_1.t - 1] = b_1.t;
b_1.iflg1 = a_1.numadd;
terpri_();
b_1.iflg1 = b_1.nil;
b_1.iflg2 = b_1.nil;
b_1.cht = 1;
b_1.rdpos = 1000;
b_1.lunin = b_1.lunins;
b_1.form = b_1.nil;
jaan_1.hillw = jaan_1.hill - 150;
b_1.middl = a_1.nstack / 10;
b_1.isplft = 400;
b_1.ibreak = FALSE_;
b_1.arg = b_1.lispx;
b_1.arg2 = b_1.nil;
jaan_1.env = 0;
jaan_1.tops = 0;
getch_(c_b8, prompt_1.protxt, &c__1, (ftnlen)1);
prompt_1.prolen = 1;
goto L1500;
/* RECURSIVE RETURN PROCEDURE */
/* DROP TOP BLOCK */
L997:
jaan_1.env = -jaan_1.jack[jaan_1.tops - 1];
/* ! RESTORE ENVIRONMENT */
L998:
jaan_1.tops = jaan_1.jill[jaan_1.tops - 1];
/* ! DROP TOP BLOCK */
L999:
i__ = b_1.stack[b_1.ip - 1];
--b_1.ip;
/* L1000: */
switch (i__) {
case 1: goto L15013;
case 2: goto L2020;
case 3: goto L2620;
case 4: goto L2120;
case 5: goto L12185;
case 6: goto L997;
case 7: goto L1020;
case 8: goto L1710;
case 9: goto L1830;
case 10: goto L18060;
case 11: goto L20130;
case 12: goto L18100;
case 13: goto L18170;
case 14: goto L12260;
case 15: goto L18210;
case 16: goto L25090;
case 17: goto L25100;
case 18: goto L15010;
case 19: goto L998;
case 20: goto L12150;
case 21: goto L12290;
case 22: goto L12640;
case 23: goto L20095;
case 24: goto L1795;
case 25: goto L1778;
case 26: goto L1799;
case 27: goto L18012;
}
/* APPLYS EVLIS EVLAS EVCON EVSTK &POPE LISPX */
/* EAPPL FUNAR SETQ PROG AND OR */
/* MAPC SELEC ?STOV ?STUN APPLA &POP EVALA */
/* MAPC RPT PROG EVARGN EVARG NOSP FUNCTION =27 */
goto L25130;
/* ! INTERNAL STACK PROBLEM */
/* RECURSIVE FUNCTION LISPX() */
/* ----------------------------------------------------------------------- */
/* USE EVAL IN TOP LEVEL LOOP */
L1010:
b_1.ibreak = FALSE_;
b_1.arg = iread_(&c__0);
fpush_(&c__7);
goto L1600;
/* --R7 RETURN POSITION FROM EVAL */
L1020:
iprint_(ires);
terpri_();
goto L1010;
/* RECURSIVE FUNCTION APPLY(ARG,ARG2) */
L1477:
fpush_(&c__19);
L1500:
if (b_1.arg == b_1.nil) {
goto L999;
}
l = b_1.arg;
aplyfl = TRUE_;
b_1.arg = cons_(&l, &b_1.arg2);
b_1.form = cons_(&b_1.nil, &b_1.arg);
goto L1671;
/* ! TO ENTRY EAPPLY(L,ARG2) IN EVAL */
/* RECURSIVE FUNCTION EVAL(ARG) */
/* ============================ */
L1600:
if (b_1.ibreak) {
goto L2400;
}
if (jaan_1.tops > jaan_1.hillw) {
goto L25095;
}
if (b_1.jp <= b_1.ip + b_1.middl) {
goto L25090;
}
/* ! THESE ARE THE ONLY */
/* ! STACK-OVERFLOW TESTS NEEDED */
if (b_1.arg > a_1.natom) {
goto L1660;
}
/* ! LIST OR NUMBER */
if (b_1.arg == b_1.nil || b_1.arg == b_1.t) {
goto L999;
}
s__1 = (shortint) carcdr_1.car[b_1.arg - 1];
if (s__1 <= b_1.substr && s__1 >= b_1.array) {
goto L999;
}
/* EVAL - ATOM. */
/* ATOM NOT NIL, T, STRING, */
/* ARRAY OR NUMBER. CHECK IF BOUND ON STACK */
local = jaan_1.env;
if (local <= 0) {
goto L1650;
}
goto L1620;
L1610:
local = -jaan_1.jack[local - 1];
if (local <= 0) {
goto L1650;
}
L1620:
locale = jaan_1.jill[local - 1] + 2;
k = local;
L1630:
--k;
if (k < locale) {
goto L1610;
}
if (jaan_1.jack[k - 1] != b_1.arg) {
goto L1630;
}
*ires = jaan_1.jill[k - 1];
goto L999;
/* ATOM NOT ON STACK CHECK VALUE CELL. */
L1650:
if (carcdr_1.car[b_1.arg - 1] == b_1.unboun) {
goto L2200;
}
/* ! 2200=FAULTEVAL(ARG) */
*ires = carcdr_1.car[b_1.arg - 1];
goto L999;
/* HERE IF ARG NUMBER OR LIST */
/* ========================== */
L1660:
if (b_1.arg > a_1.nfreet) {
goto L999;
}
/* ! IT'S A NUMBER */
/* EVAL - LIST */
b_1.form = b_1.arg;
l = carcdr_1.car[b_1.arg - 1];
b_1.arg2 = carcdr_1.cdr[b_1.arg - 1];
/* EAPPLY(L,ARG2) . CALLED FROM EVAL AND FROM APPLY. */
/* L1670: */
aplyfl = FALSE_;
L1671:
ll = l;
if (ll > a_1.natom) {
goto L1720;
}
/* ! CAR OF FORM IS A LIST */
/* ! HOPEFULLY (LAMBDA ...) */
/* ! OR (SUBR . ...) */
/* THE FOLLOWING CODE IS FOR AVOIDING CALLS TO GET FOR TESTING IF */
/* THERE IS ANY FUNCTION DEFINITION STORED UNDER THE FNCELL PROPERTY */
ll = carcdr_1.cdr[l - 1];
if (ll == b_1.nil) {
goto L1676;
}
if (carcdr_1.car[ll - 1] != b_1.fncell) {
goto L1677;
}
ll = carcdr_1.car[carcdr_1.cdr[ll - 1] - 1];
goto L1720;
L1677:
ll = get_(&l, &b_1.fncell);
/* ! IS THERE ANYTHING IN FUNC.CELL? */
if (ll != b_1.nil) {
goto L1720;
}
/* ! THERE WAS SOMETHING */
L1676:
if (l > b_1.fsubr) {
goto L2230;
}
/* ! 2230 = FAULTAPPLY(L) */
if (l > b_1.subr) {
goto L18000;
}
/* ! 18000 = THE MATCH ROUTINE FOR FSUBRS. */
if (l == b_1.nil) {
goto L2230;
}
/* SUBR CASE */
/* ========= */
/* 1. PUT THE BOTOM BLOCK */
L1680:
iprev = jaan_1.tops;
/* ! SAVE OLD TOPS */
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = l;
jaan_1.jill[jaan_1.tops - 1] = b_1.arg;
/* ! WE PUSH *FORM AND ARG */
/* 2. SPREAD THE ARGS */
L1690:
if (b_1.arg2 <= a_1.natom || b_1.arg2 > a_1.nfreet) {
goto L1695;
}
/* ! ARG2 HOLDS THE ARGLIST */
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = b_1.subarg;
jaan_1.jill[jaan_1.tops - 1] = carcdr_1.car[b_1.arg2 - 1];
b_1.arg2 = carcdr_1.cdr[b_1.arg2 - 1];
goto L1690;
/* 3. PUT TOP BLOCK */
L1695:
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = -iprev;
/* ! LINK TO PREVIUS BLOCK */
jaan_1.jill[jaan_1.tops - 1] = iprev + 1;
/* ! LINK TO FORM */
if (aplyfl) {
goto L1713;
}
/* ! DON'T EVALUATE ARGS IF */
/* ! SUBR CALLED BY APPLY */
/* CALL APUSH(L) INLINE */
/* JP=JP-1 */
/* IF(IP .GE. JP) GO TO 2 */
/* STACK(JP)=L */
/* ! WE SAVE L (THATS THE SUBR) */
/* ! ON THE STACK OTHERVISE */
/* ! IT IS HARD TO KNOW WHAT SUBR */
/* ! WE HAD WHEN WE HAVE EVALUATED */
/* ! THE ARGS TO THE SUBR */
/* EVAL ARGS TO SUBR */
/* ================= */
/* WHEN WE ARRIVE HERE THE TOP BLOCK MAY LOOK LIKE THIS. */
/* THE GLOBAL VARIABLE TOPS POINTS TO THE TOPBLOCK. */
/* THE POINTER IN JILL(TOPS) POINTS TO ARGUMENT UNDER */
/* EVALUATION. */
/* I-- LINK,,LINK ------------- <--- TOPS */
/* I -*- FOO I */
/* I -*- BAR I */
/* I *FORM (CONS FOO BAR) <-I */
/* I */
/* I-> LINK,,LINK */
L1697:
++jaan_1.jill[jaan_1.tops - 1];
if (jaan_1.jill[jaan_1.tops - 1] == jaan_1.tops) {
goto L1712;
}
/* ! WE HAVE EVALUATED ALL ARGS */
b_1.arg = jaan_1.jill[jaan_1.jill[jaan_1.tops - 1] - 1];
++b_1.ip;
b_1.stack[b_1.ip - 1] = 8;
/* ! CALL FPUSH(8) */
goto L1600;
/* R-8 */
L1710:
if41 = jaan_1.jill[jaan_1.tops - 1];
jaan_1.jill[if41 - 1] = *ires;
goto L1697;
L1712:
/* OK WE ARE READY NOW WE MUST */
/* 1. COMPUTE INDEX TO FIRST ARG */
/* 2. RESTORE FORM */
/* 3. RESTORE FUNCTION (=L) */
/* 4. FIX LINK TO PREVIUS BLOCK */
/* 5. COMPUTE NUMBER OF ARGS */
index = -jaan_1.jack[jaan_1.tops - 1];
/* ! THATS TO PREVIUS BLOCK SO WE MUST */
/* ! ADD 2 TO GET THE REAL INDEX */
/* ! BUT WE CAN USE THIS INDEX FIRST */
if41 = index + 1;
b_1.form = jaan_1.jill[if41 - 1];
l = jaan_1.jack[if41 - 1];
jaan_1.jack[if41 - 1] = b_1.sform;
/* CALL APOP(L) INLINE */
/* IF (JP .GT. NSTACK) GO TO 2 */
/* L=STACK(JP) */
/* JP=JP+1 */
jaan_1.jill[jaan_1.tops - 1] = index;
jaan_1.jack[jaan_1.tops - 1] = 0;
/* ! JACK = 0 SHOWS THIS BLOCK */
/* ! HAS NO VARIABLES */
index += 2;
iargs = jaan_1.tops - index;
goto L2800;
/* ! 2800 THE DISPATCH FOR SUBRS */
/* SUBR CALLED FROM APPLY */
/* WE DO THE SAME THING BUT WE DONT HAVE TO */
/* RESTORE FORM OR FUNCTION */
L1713:
index = -jaan_1.jack[jaan_1.tops - 1];
jaan_1.jill[jaan_1.tops - 1] = index;
jaan_1.jack[jaan_1.tops - 1] = 0;
index += 2;
iargs = jaan_1.tops - index;
goto L2800;
/* ! 2800 THE DISPATCH FOR SUBRS */
/* APPLYFN2(LL,ARG2) */
/* APPLIES A LIST FORM ONTO ARG2 */
/* LL IS (HOPFULLY) ON FORM (LAMBDA (X Y) .....) */
/* OR (SUBR . ...) */
/* ARG2 IS A LIST OF PARAMETERS */
L1720:
if (ll <= a_1.natom || ll > a_1.nfreet) {
goto L2210;
}
/* ! 2210=FAULTAPPLY(LL) */
l = carcdr_1.car[ll - 1];
if (l == b_1.lambda) {
goto L1730;
}
if (l == b_1.nlambd) {
goto L1722;
}
/* (SUBR . X) CASE */
if (l == b_1.expr) {
goto L1810;
}
/* (FSUBR . X) CASE */
if (l == b_1.fexpr) {
goto L1815;
}
if (l == b_1.funarg) {
goto L1818;
}
goto L2210;
L1722:
noeval = TRUE_;
goto L1731;
L1730:
noeval = FALSE_;
/* LAMBDA & NLAMBDA CASE */
/* ===================== */
/* 1. BOTTOM BLOCK */
L1731:
iprev = jaan_1.tops;
/* ! THIS IS PREVIUS BLOCK */
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = b_1.sform;
jaan_1.jill[jaan_1.tops - 1] = b_1.arg;
/* ! PUSH FORM ON STACK */
/* 2. FIND THE LAMBDALIST */
/* IF THE FORM IS (FOO FIE FUM (SETQ BAR 77)) */
/* AND FOO = (DE FOO (X Y)(CONS X Y)) */
/* THEN LL = (LAMBDA (X Y)(CONS X Y)) */
/* AND ARG2 = (FIE FUM (SETQ BAR 77)) */
/* L1750: */
icdr = carcdr_1.cdr[ll - 1];
icar = carcdr_1.car[icdr - 1];
/* ! ICAR IS THEN (X Y) */
L1760:
if (icar <= a_1.natom || icar > a_1.nfreet) {
goto L1770;
}
/* ! THERE WERE NO LAMBDALIST */
/* ! OR IT IS EXAUSTED */
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = carcdr_1.car[icar - 1];
jaan_1.jill[jaan_1.tops - 1] = carcdr_1.car[b_1.arg2 - 1];
b_1.arg2 = carcdr_1.cdr[b_1.arg2 - 1];
icar = carcdr_1.cdr[icar - 1];
goto L1760;
L1770:
if (icar != b_1.nil) {
goto L1789;
}
/* ! WE HAVE A LAMBDA LIST ON FORMAT */
/* ! (X Y . Z), HALFSPREAD OR L, NOSPREAD */
/* WE ARE ABOUT TO PUT THE TOPBLOCK */
/* BUT MAYBE ARE THERE EXTRA ARGUMENTS TO THE FUNCTION */
L1771:
if (b_1.arg2 <= a_1.natom || b_1.arg2 > a_1.nfreet) {
goto L1772;
}
/* ! THERE WERE NO EXTRA ARGS */
/* SOMEONE HAS CALLED A LAMBDA WITH MORE ARGUMENTS */
/* THAN DEFINED IN LAMBDALIST. */
/* WE PUT THE EXTRA ARGS ABOVE THE "REAL" ONES. */
/* THESE ARGS ALL GET THE NAME -*- */
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = b_1.subarg;
jaan_1.jill[jaan_1.tops - 1] = carcdr_1.car[b_1.arg2 - 1];
b_1.arg2 = carcdr_1.cdr[b_1.arg2 - 1];
goto L1771;
/* NOW WE CAN PUT THE TOP BLOCK */
L1772:
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = -iprev;
/* ! TO PREVIUS BLOCK */
jaan_1.jill[jaan_1.tops - 1] = iprev + 1;
/* ! TO FORM */
if (noeval || aplyfl) {
goto L1785;
}
/* ! IT WAS A NLAMBDA */
/* ! OR FUNCTION CALLED BY APPLY */
/* EVALUATE ALL ARGS */
/* ================= */
/* WHEN WE ARRIVE HERE THE TOP BLOCK MAY LOOK LIKE THIS. */
/* THE GLOBAL VARIABLE TOPS POINTS TO THE TOPBLOCK */
/* I-- LINK,,LINK ------------------------- <--- TOPS */
/* I -*- (SETQ BAR 77) I */
/* I Y FUM I */
/* I X FIE I */
/* I *FORM (FOO FIE FUM (SETQ BAR 77)) <-I */
/* I */
/* I-> LINK,,LINK */
L1777:
++jaan_1.jill[jaan_1.tops - 1];
if (jaan_1.jill[jaan_1.tops - 1] == jaan_1.tops) {
goto L1785;
}
if41 = jaan_1.jill[jaan_1.tops - 1];
b_1.arg = jaan_1.jill[if41 - 1];
++b_1.ip;
b_1.stack[b_1.ip - 1] = 25;
/* ! CALL FPUSH(25) */
goto L1600;
/* R-25 */
L1778:
if41 = jaan_1.jill[jaan_1.tops - 1];
jaan_1.jill[if41 - 1] = *ires;
goto L1777;
/* WE HAVE EVALUATED ALL ARGS */
/* ========================== */
/* WE MUST NOW */
/* FIX LINK TO PREVIUS BLOCK */
/* SAVE THE OLD ENVIRONMENT */
/* MAKE THIS THE NEW ENVIRONMENT */
/* RESTORE FORM AND FUNCTION */
L1785:
index = -jaan_1.jack[jaan_1.tops - 1];
jaan_1.jill[jaan_1.tops - 1] = index;
jaan_1.jack[jaan_1.tops - 1] = -jaan_1.env;
jaan_1.env = jaan_1.tops;
b_1.form = jaan_1.jill[index];
l = carcdr_1.car[b_1.form - 1];
L1776:
if (l <= a_1.natom || l > a_1.nfreet) {
goto L1786;
}
ll = l;
b_1.temp1 = carcdr_1.car[l - 1];
if (b_1.temp1 != b_1.funarg) {
goto L1788;
}
b_1.temp1 = carcdr_1.cdr[l - 1];
l = carcdr_1.car[b_1.temp1 - 1];
goto L1776;
/* THE FOLLOWING CODE IS FOR AVOIDING CALLS TO GET */
L1786:
ll = carcdr_1.cdr[l - 1];
/* ASSUME THAT THERE IS ALWAYS A PROPERTY LIST */
if (carcdr_1.car[ll - 1] != b_1.fncell) {
goto L1787;
}
ll = carcdr_1.car[carcdr_1.cdr[ll - 1] - 1];
goto L1788;
L1787:
ll = get_(&l, &b_1.fncell);
L1788:
b_1.arg = carcdr_1.cdr[ll - 1];
b_1.arg = carcdr_1.cdr[b_1.arg - 1];
/* NOW ITS TIME TO CALL EVLAST WITH THE FUNCTION BODY */
/* AND WHEN WE RETURN FROM THERE GOTO 997 TO POP ENVIRONMENT. */
/* THIS WE COULD HAVE DONE WITH */
/* CALL FPUSH(?) */
/* GOTO 2600 */
/* R- ? */
/* XXXX GOTO 997 */
/* BUT AS FPUSH(6) RETURNS TO 997 WE SAVE ONE RECURSION BY */
fpush_(&c__6);
goto L2600;
/* HALF AND NOSPREAD ARGS */
/* ====================== */
L1789:
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = icar;
jaan_1.jill[jaan_1.tops - 1] = b_1.arg2;
/* ! PUT THE LAST ARG (HALFSPREAD) */
/* ! OR THE ONLY ARG (NOSPREAD) */
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = -iprev;
jaan_1.jill[jaan_1.tops - 1] = iprev + 1;
if (noeval || aplyfl) {
goto L1785;
}
L1790:
++jaan_1.jill[jaan_1.tops - 1];
if (jaan_1.jill[jaan_1.tops - 1] == jaan_1.tops - 1) {
goto L1797;
}
/* ! LAST ARGUMENT */
if41 = jaan_1.jill[jaan_1.tops - 1];
b_1.arg = jaan_1.jill[if41 - 1];
++b_1.ip;
b_1.stack[b_1.ip - 1] = 24;
/* ! CALL FPUSH(24) */
goto L1600;
/* --R24 */
L1795:
if41 = jaan_1.jill[jaan_1.tops - 1];
jaan_1.jill[if41 - 1] = *ires;
goto L1790;
L1797:
b_1.arg = jaan_1.jill[jaan_1.tops - 2];
fpush_(&c__26);
goto L2000;
/* ! CALL EVLIS WITH LAST OR */
/* ! THE ONLY ARG */
/* R--26 */
L1799:
jaan_1.jill[jaan_1.tops - 2] = *ires;
goto L1785;
/* (SUBR . ATOM) */
L1810:
l = carcdr_1.cdr[ll - 1];
if (l > b_1.subr) {
goto L2210;
}
/* ! 2210=FAULTAPPLY(LL) */
if (l == b_1.nil) {
goto L2230;
}
goto L1680;
/* (FSUBR . ATOM) */
L1815:
l = carcdr_1.cdr[ll - 1];
if (l > b_1.fsubr) {
goto L2210;
}
if (l <= b_1.subr) {
goto L2210;
}
goto L18000;
/* ! 18000=MATCH ROUTINE FOR FSUBRS. */
/* FUNARG */
/* THIS CODE MUST BE REWRITEN IT WORKS BUT !! */
L1818:
b_1.temp1 = carcdr_1.cdr[ll - 1];
if (b_1.temp1 <= a_1.natom || b_1.temp1 > a_1.nfreet) {
b_1.temp1 = b_1.nil;
}
l = carcdr_1.car[b_1.temp1 - 1];
if (b_1.temp1 <= a_1.natom || b_1.temp1 > a_1.nfreet) {
b_1.temp1 = b_1.nil;
}
b_1.temp1 = carcdr_1.cdr[b_1.temp1 - 1];
b_1.temp2 = carcdr_1.car[b_1.temp1 - 1];
/* L1820: */
iprev = jaan_1.tops;
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = b_1.sform;
/* JILL(TOPS)=TEMP1 !! THIS LINE CHANGED TO BELOW LINE, 20 OCTOBER 84 */
jaan_1.jill[jaan_1.tops - 1] = ll;
L1821:
b_1.temp3 = carcdr_1.car[b_1.temp2 - 1];
if (b_1.temp3 <= a_1.natom || b_1.temp3 > a_1.nfreet) {
goto L1822;
}
++jaan_1.tops;
b_1.temp2 = carcdr_1.cdr[b_1.temp2 - 1];
jaan_1.jack[jaan_1.tops - 1] = carcdr_1.car[b_1.temp3 - 1];
jaan_1.jill[jaan_1.tops - 1] = carcdr_1.cdr[b_1.temp3 - 1];
goto L1821;
L1822:
++jaan_1.tops;
jaan_1.jack[jaan_1.tops - 1] = -jaan_1.env;
jaan_1.jill[jaan_1.tops - 1] = iprev;
jaan_1.env = jaan_1.tops;
aplyfl = FALSE_;
fpush_(&c__9);
goto L1671;
/* --R9 */
L1830:
k = jaan_1.jill[jaan_1.tops - 1] + 1;
b_1.temp1 = jaan_1.jill[k - 1];
if (b_1.temp1 <= a_1.natom || b_1.temp1 > a_1.nfreet) {
goto L2250;
}
b_1.temp1 = carcdr_1.cdr[b_1.temp1 - 1];
if (b_1.temp1 <= a_1.natom || b_1.temp1 > a_1.nfreet) {
goto L2250;
}
b_1.temp1 = carcdr_1.cdr[b_1.temp1 - 1];
if (b_1.temp1 <= a_1.natom || b_1.temp1 > a_1.nfreet) {
goto L2250;
}
b_1.temp1 = carcdr_1.car[b_1.temp1 - 1];
k1 = k;
L1832:
++k1;
if (k1 >= jaan_1.tops) {
goto L997;
}
if (b_1.temp1 <= a_1.natom || b_1.temp1 > a_1.nfreet) {
goto L2250;
}
b_1.temp2 = carcdr_1.car[b_1.temp1 - 1];
if (b_1.temp2 <= a_1.natom || b_1.temp2 > a_1.nfreet) {
goto L2250;
}
if (carcdr_1.car[b_1.temp2 - 1] != jaan_1.jack[k1 - 1]) {
goto L2250;
}
/* *SETC* CALL SETCDR(TEMP2,JILL(K1)) */
carcdr_1.cdr[b_1.temp2 - 1] = jaan_1.jill[k1 - 1];
b_1.temp1 = carcdr_1.cdr[b_1.temp1 - 1];
goto L1832;
/* RECURSIVE FUNCTION EVLIS(ARG) */
/* ----------------------------------------------------------------------- */
L2000:
if (b_1.arg <= a_1.natom || b_1.arg > a_1.nfreet) {
goto L999;
}
b_1.jp += -2;
b_1.stack[b_1.jp] = b_1.nil;
b_1.stack[b_1.jp - 1] = b_1.arg;
/* ! CALL APUSH2(NIL,ARG) */
L2010:
b_1.arg = carcdr_1.car[b_1.arg - 1];
++b_1.ip;
b_1.stack[b_1.ip - 1] = 2;
/* ! CALL FPUSH(2) */
goto L1600;
/* --R2 RETURN FROM EVAL(ARG) */
L2020:
b_1.temp1 = b_1.stack[b_1.jp];
b_1.stack[b_1.jp] = cons_(ires, &b_1.temp1);
icdr = b_1.stack[b_1.jp - 1];
b_1.arg = carcdr_1.cdr[icdr - 1];
if (b_1.arg <= a_1.natom || b_1.arg > a_1.nfreet) {
goto L2030;
}
b_1.stack[b_1.jp - 1] = b_1.arg;
goto L2010;
L2030:
*ires = b_1.stack[b_1.jp];
b_1.jp += 2;
/* DREVERSE IRES BEFORE RETURN. */
b_1.temp1 = b_1.nil;
L2040:
b_1.temp2 = carcdr_1.cdr[*ires - 1];
/* *SETC* CALL SETCDR(IRES,TEMP1) */
carcdr_1.cdr[*ires - 1] = b_1.temp1;
if (b_1.temp2 == b_1.nil) {
goto L999;
}
b_1.temp1 = *ires;
*ires = b_1.temp2;
goto L2040;
/* ----------------------------------------------------------------------- */
/* RECURSIVE FUNCTION EVCON */
L2100:
--b_1.jp;
L2110:
b_1.stack[b_1.jp - 1] = b_1.arg;
if (b_1.arg <= a_1.natom || b_1.arg > a_1.nfreet) {
goto L2140;
}
icar = carcdr_1.car[b_1.arg - 1];
if (icar <= a_1.natom || icar > a_1.nfreet) {
goto L25080;