-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathparser.zil
2559 lines (2439 loc) · 76.2 KB
/
parser.zil
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
;******************************************************************************
; "game : SHERLOCK!"
; "file : PARSER.ZIL"
; "auth : $Author: DEB $"
; "date : $Date: 27 Oct 1987 19:00:52 $"
; "rev : $Revision: 1.55 $"
; "vers : 1.00"
;******************************************************************************
<GLOBAL INHIBIT-ROOMS <>>
<GLOBAL GL-FUNNY-CLAUSE? <>>
<CONSTANT SH 128> ; "held"
<CONSTANT SC 64> ; "carried"
<CONSTANT SIR 32> ; "in room"
<CONSTANT SOG 16> ; "on ground"
<CONSTANT STAKE 8> ; "take"
<CONSTANT SMANY 4> ; "many"
<CONSTANT SHAVE 2> ; "have"
<CONSTANT LAST-OBJECT 0> ; "the number of the last object"
;<CONSTANT K-CURRENCY-SYMBOL !\$>
<CONSTANT K-M-BEG 1> ; "room action context begin case"
<CONSTANT K-M-ENTERING 2> ; "room action context entering case"
<CONSTANT K-M-ENTERED 3> ; "room action routine entered case"
<CONSTANT K-M-EXIT 4> ; "room action routine exit case"
<CONSTANT K-M-END 5> ; "room action routine end case"
<CONSTANT K-M-FLOOK 6>
<CONSTANT K-M-NLOOK 7>
<CONSTANT K-M-WINNER 8>
<CONSTANT K-M-CONT 9> ; "for container routine general case"
<CONSTANT K-M-OBJDESC 10>
<CONSTANT K-M-CANT 11> ; "for container routine limitations"
<CONSTANT K-M-DESCFCN 12> ; "replaces DESCFCN property"
<CONSTANT K-M-SDESC 13> ; "replaces SDESC"
<CONSTANT K-M-DESC-1 14>
<CONSTANT K-M-DESC-2 15>
<CONSTANT K-M-DESC-3 16>
<CONSTANT K-P-LEXWORDS 1> ; "byte offset to # of entries in LEXV"
<CONSTANT K-P-LEXSTART 1> ; "word offset to start of LEXV entries"
<CONSTANT K-P-LEXELEN 2> ; "number of words per LEXV entry"
<CONSTANT K-P-WORDLEN 4>
<CONSTANT K-P-PSOFF 6> ; "offset to parts of speech byte"
<CONSTANT K-P-P1OFF 7> ; "offset to first parts of speech"
<CONSTANT K-P-P1BITS 3> ; "first part of speech mask in PSOFF byte"
<CONSTANT K-P-ITBLLEN 9>
<CONSTANT K-P-VERB 0>
<CONSTANT K-P-VERBN 1>
<CONSTANT K-P-PREP1 2>
<CONSTANT K-P-PREP1N 3>
<CONSTANT K-P-PREP2 4>
<CONSTANT K-P-NC1 6>
<CONSTANT K-P-NC1L 7>
<CONSTANT K-P-NC2 8>
<CONSTANT K-P-NC2L 9>
<CONSTANT K-O-PTR 0>
<CONSTANT K-O-START 1>
<CONSTANT K-O-LENGTH 2>
<CONSTANT K-O-END 3>
<CONSTANT K-P-MATCHLEN 0>
<CONSTANT K-P-ALL 1>
<CONSTANT K-P-ONE 2>
<CONSTANT K-P-INHIBIT 4>
<CONSTANT K-P-SRCBOT 2>
<CONSTANT K-P-SRCTOP 0>
<CONSTANT K-P-SRCALL 1>
<ROUTINE RT-CAPITALIZE (PTR)
<COND (<OR <MC-T? ,GL-P-ORPH>
<MC-T? ,GL-P-MERGED>>
<PRINTB <GET .PTR 0>>)
(T
<PRINTC <- <GETB ,GL-P-PIBUF <GETB .PTR 3>> 32>>
<RT-WORD-PRINT <- <GETB .PTR 2> 1> <+ <GETB .PTR 3> 1>>)>>
<ROUTINE RT-WORD-PRINT (CNT BUF)
<PRINTT <ZREST ,GL-P-PIBUF .BUF> .CNT>
;<REPEAT ()
<COND (<DLESS? CNT 0>
<RTRUE>)
(T
<PRINTC <GETB ,GL-P-PIBUF .BUF>>
<SET BUF <+ .BUF 1>>)>>>
<ROUTINE RT-VERB-PRINT ("AUX" TMP)
<SET TMP <GET ,GL-P-ITBL ,K-P-VERBN>>
<COND (<ZERO? .TMP>
<TELL "tell">)
(<ZERO? <GETB ,GL-P-VTBL 2>>
<PRINTB <GET .TMP 0>>)
(T
<RT-WORD-PRINT <GETB .TMP 2> <GETB .TMP 3>>
<PUTB ,GL-P-VTBL 2 0>)>>
<ROUTINE RT-PREP-PRINT (PREP "OPTIONAL" (SP? T) "AUX" WRD)
<COND (<AND <MC-T? .PREP>
<ZERO? ,GL-P-END-ON-PREP>>
<COND (<MC-T? .SP?>
<TELL " ">)>
<SET WRD <RT-PREP-FIND .PREP>>
<PRINTB .WRD>
<COND (<AND <EQUAL? ,W?SIT <GET <GET ,GL-P-ITBL ,K-P-VERBN> 0>>
<EQUAL? ,W?DOWN .WRD>>
<TELL " on">)>
<COND (<AND <EQUAL? ,W?GET <GET <GET ,GL-P-ITBL ,K-P-VERBN> 0>>
<EQUAL? ,W?OUT .WRD>>
<TELL " of">)>
<RTRUE>)>>
<ROUTINE RT-CLAUSE-PRINT (BPTR EPTR "OPTIONAL" (THE? T))
<RT-BUFFER-PRINT <GET ,GL-P-ITBL .BPTR> <GET ,GL-P-ITBL .EPTR> .THE?>>
<ROUTINE RT-BUFFER-PRINT (BEG END CP "AUX" (NOSP <>) WRD (FIRST?? T) (PN <>))
<REPEAT ()
<COND (<EQUAL? .BEG .END>
<RETURN>)
(T
<COND (<MC-T? .NOSP>
<SET NOSP <>>)
(T
<TELL " ">)>
<SET WRD <GET .BEG 0>>
<COND (<OR <AND <EQUAL? .WRD ,W?HIM>
<NOT <RT-VISIBLE? ,GL-P-HIM-OBJECT>>>
<AND <EQUAL? .WRD ,W?HER>
<NOT <RT-VISIBLE? ,GL-P-HER-OBJECT>>>
<AND <EQUAL? .WRD ,W?THEM>
<NOT <RT-VISIBLE? ,GL-P-THEM-OBJECT>>>>
<SET PN T>)>
<COND (<EQUAL? .WRD ,W?PERIOD>
<SET NOSP T>)
(<NOT <OR <EQUAL? .WRD ,W?ALL ,W?OF>
<NOT <WT? .WRD ,PS?BUZZ-WORD <> ,PS?PREPOSITION>>
<WT? .WRD ,PS?ADJECTIVE <> ,PS?OBJECT>>>
<SET NOSP T>)
(<EQUAL? .WRD ,W?ME>
<TELL D ,CH-PLAYER>
<SET PN T>)
(<INTBL? .WRD <ZREST ,K-CAPS 2> <ZGET ,K-CAPS 0>>
<RT-CAPITALIZE .BEG>
<SET PN T>)
(T
<COND (<AND <MC-T? .FIRST??>
<ZERO? .PN>
<MC-T? .CP>>
<TELL "the ">)>
<COND (<OR <MC-T? ,GL-P-ORPH>
<MC-T? ,GL-P-MERGED>>
<PRINTB .WRD>)
(<AND <EQUAL? .WRD ,W?IT>
<RT-VISIBLE? ,GL-P-IT-OBJECT>>
<TELL D ,GL-P-IT-OBJECT>)
(<AND <EQUAL? .WRD ,W?HER>
<ZERO? .PN>>
<TELL D ,GL-P-HER-OBJECT>)
(<AND <EQUAL? .WRD ,W?THEM>
<ZERO? .PN>>
<TELL D ,GL-P-THEM-OBJECT>)
(<AND <EQUAL? .WRD ,W?HIM>
<ZERO? .PN>>
<TELL D ,GL-P-HIM-OBJECT>)
(T
<RT-WORD-PRINT <GETB .BEG 2> <GETB .BEG 3>>)>
<SET FIRST?? <>>)>)>
<SET BEG <REST .BEG ,K-P-WORDLEN>>>>
<GLOBAL GL-LONG-OOPS 3>
<ROUTINE RT-DONT-KNOW-WORD-MSG (PTR "AUX" BUF MSG)
<COND (<0? ,GL-LONG-OOPS>
<TELL "[You don't need to use the word \"">)
(T
<SETG GL-LONG-OOPS <- ,GL-LONG-OOPS 1>>
<TELL "[You can play the game from start to finish, solve all the puzzles, get all the points, and STILL never need to use the word \"">)>
<RT-WORD-PRINT <GETB <REST ,GL-P-P-LEX <SET BUF <* .PTR 2>>> 2>
<GETB <REST ,GL-P-P-LEX .BUF> 3>>
<TELL "\".]" CR>
<PUT ,GL-OOPS-TABLE ,K-O-PTR .PTR>
<SETG GL-P-QUOT <>>
<SETG GL-P-ORPH <>>
<RTRUE>>
<ROUTINE RT-DONT-KNOW-WORD-USE-MSG (PTR "AUX" BUF)
<TELL "[This story cannot understand the word \"">
<RT-WORD-PRINT <GETB <REST ,GL-P-P-LEX <SET BUF <* .PTR 2>>> 2>
<GETB <REST ,GL-P-P-LEX .BUF> 3>>
<TELL "\" when you use it that way.]" CR>
<SETG GL-P-QUOT <>>
<SETG GL-P-ORPH <>>
<RTRUE>>
<ROUTINE RT-CANT-SEE-ANY-MSG ("OPTIONAL" (THING <>) (STRING? <>) (PRSO? T)
"AUX" WRD)
<RT-CYOU-MSG>
<TELL "cannot ">
<COND (<MC-VERB? LISTEN>
<TELL "hear">)
(<MC-VERB? SMELL>
<TELL "smell">)
(T
<TELL "see">)>
<COND (<MC-T? .STRING?>
<TELL .STRING?>)
(<AND <MC-T? .THING>
<NOT <EQUAL? .THING ,TH-NOT-HERE-OBJECT>>>
<TELL " ">
<TELL ANY .THING>)
(T
<COND (<AND .THING
<MC-PRSI? ,TH-NOT-HERE-OBJECT>>
<SET PRSO? <>>)>
<SET WRD <GET ,GL-P-NAMW <COND (.PRSO? 0) (T 1)>>>
<COND (<NOT <INTBL? .WRD <ZREST ,K-CAPS 2>
<ZGET ,K-CAPS 0>>>
<TELL " any">)>
<RT-NOT-HERE-PRINT .PRSO?>)>
<TELL " here." CR>
<SETG GL-P-IT-OBJECT ,TH-NOT-HERE-OBJECT>
<RT-P-CLEAR>
<RTRUE>>
<ROUTINE RT-TH-NOT-HERE-OBJECT ("AUX" TBL (PRSO? T) OBJ ; (X <>))
<COND (<AND <MC-PRSO? ,TH-NOT-HERE-OBJECT>
<MC-PRSI? ,TH-NOT-HERE-OBJECT>>
<TELL "Those things aren't here." CR>
<RTRUE>)
(<MC-PRSO? ,TH-NOT-HERE-OBJECT>
<SET TBL ,GL-P-PRSO>)
(T
<SET TBL ,GL-P-PRSI>
<SET PRSO? <>>)>
<COND (<MC-T? .PRSO?>
<COND (<OR <MC-VERB? FIND WHO WHAT WHERE WAIT-FOR WAIT SAY DRIVE
CALL MAKE PASSWORD WALK-TO>
<AND <MC-VERB? TAKE>
<OR <AND <MC-HERE? ,RM-DIOGENES-CLUB>
<==? ,GL-WINNER ,CH-BUTLER>>
<AND <MC-HERE? ,RM-SHERMANS-HOUSE>
<==? ,GL-WINNER ,CH-SHERMAN>>>>>
<SET OBJ <RT-FIND-NOT-HERE .TBL .PRSO?>>
<COND (<MC-T? .OBJ>
<COND (<NOT <EQUAL? .OBJ ,TH-NOT-HERE-OBJECT>>
<RFATAL>)>)
(T
<RFALSE>)>)>)
(T
<COND (<MC-VERB? TELL-ABOUT ASK-ABOUT ASK-FOR>
<SET OBJ <RT-FIND-NOT-HERE .TBL .PRSO?>>
<COND (<MC-T? .OBJ>
<COND (<NOT <EQUAL? .OBJ ,TH-NOT-HERE-OBJECT>>
<RFATAL>)>)
(T
<RFALSE>)>)>)>
<TELL "[">
<RT-CYOU-MSG>
<TELL "cannot ">
<COND (<MC-VERB? LISTEN>
<TELL "hear">)
(<MC-VERB? SMELL>
<TELL "smell">)
(T
<TELL "see">)>
<COND (<NOT <INTBL? ,GL-P-XNAM <ZREST ,K-CAPS 2>
<ZGET ,K-CAPS 0>>>
<TELL " any">)>
<RT-NOT-HERE-PRINT .PRSO?>
<TELL " here.]" CR>
<RT-P-CLEAR>
<RFATAL>>
<ROUTINE RT-FAKE-ORPHAN-MSG ("AUX" TMP)
<RT-ORPHAN ,GL-P-SYNTAX <>>
<TELL ,K-BE-SPECIFIC-MSG>
<SET TMP <GET ,GL-P-OTBL ,K-P-VERBN>>
<COND (<ZERO? .TMP>
<TELL "tell">)
(<ZERO? <GETB ,GL-P-VTBL 2>>
<PRINTB <GET .TMP 0>>)
(T
<RT-WORD-PRINT <GETB .TMP 2> <GETB .TMP 3>>
<PUTB ,GL-P-VTBL 2 0>)>
<TELL "?]" CR>
<SETG GL-P-ORPH T>
<SETG GL-P-GOOD <>>
<RTRUE>>
<ROUTINE RT-TIME-OF-DAY-MSG ("OPT" (WAIT? <>) "AUX" TOD)
<SET TOD <RT-TIME-OF-DAY>>
<COND (<NOT <MC-IS? ,GL-PLACE-CUR ,FL-INDOORS>>
<COND (<NOT <EQUAL? ,GL-LAST-OUT-TOD .TOD>>
<COND
(.WAIT?
<RT-WAIT-TOD-MSG .TOD>)
(T
<CRLF>
;<CRLF>
<RT-CYOU-MSG "notice" "notices">
<TELL "that ">
<COND
(<EQUAL? .TOD 1>
<TELL
"the sky is lighter. Soon it will be sunrise." CR>)
(<EQUAL? .TOD 2>
<TELL
"the sun has risen... as much as it ever does in England." CR>)
(<EQUAL? .TOD 3>
<TELL
"the setting sun marks the end of another day. Soon it will be dark." CR>)
(T
<TELL
"the sun has set and the mists have rolled in." CR>)>)>
<SETG GL-LAST-OUT-TOD .TOD>)>)>>
<ROUTINE RT-TIME-OF-DAY ("AUX" (TOD <>))
<COND
(<EQUAL? <RT-CLOCK-CMP 6 30 0> 1>
<SET TOD 0>)
(<EQUAL? <RT-CLOCK-CMP 7 0 0> 1>
<SET TOD 1>)
(<EQUAL? <RT-CLOCK-CMP 19 30 0> 1>
<SET TOD 2>)
(<EQUAL? <RT-CLOCK-CMP 20 0 0> 1>
<SET TOD 3>)
(T
<SET TOD 0>
)
>
<RETURN .TOD>
>
;------------------------------------------------------------------------------
; "RT-SPOKEN-TO-MSG"
;------------------------------------------------------------------------------
<ROUTINE RT-SPOKEN-TO-MSG (WHO)
<COND (<OR <NOT <EQUAL? .WHO ,GL-P-QCONTEXT-TH>>
<NOT <EQUAL? ,GL-PLACE-CUR ,GL-P-QCONTEXT-RM>>>
<SETG GL-P-QCONTEXT-TH .WHO>
<SETG GL-P-QCONTEXT-RM <LOC .WHO>>
<RT-THIS-IS-IT .WHO>
<TELL "[spoken to " THE .WHO "]" CR>)>
<RTRUE>>
;------------------------------------------------------------------------------
; "RT-SYNTAX-CHECK"
; "Perform syntax matching operations, using GL-P-ITBL as the source of"
; "the verb and adjectives for this input. Returns false if no"
; "syntax matches, and does it's own orphaning. If return is true,"
; "the syntax is saved in GL-P-SYNTAX"
;------------------------------------------------------------------------------
<ROUTINE RT-GET-PREP (SYN WHICH "AUX" PREP)
<COND (<1? .WHICH>
<SET PREP <GETB .SYN ,K-P-SPREP1>>)
(T
<SET PREP <GETB .SYN ,K-P-SPREP2>>)>
<COND (<0? <SET PREP <ANDB .PREP *77*>>> 0)
(T <+ .PREP *300*>)>>
<ROUTINE RT-SYNTAX-CHECK ("AUX" SYN LEN NUM OBJ (DRIVE1 <>) (DRIVE2 <>)
PREP VERB TPREP)
<SET VERB <GET ,GL-P-ITBL ,K-P-VERB>>
<COND (<ZERO? .VERB>
<RT-NOT-IN-SENTENCE-MSG "any verbs">
<RFALSE>)>
<SET SYN <GET ,VERBS <- 255 .VERB>>>
<SET LEN <GETB .SYN 0>>
<SET SYN <REST .SYN>>
<REPEAT ()
;<SET NUM <BAND <GETB .SYN ,K-P-SBITS> ,K-P-SONUMS>>
<SET NUM <P-SONUMS .SYN>>
<COND (<G? ,GL-P-NCN .NUM>
T)
(<AND <G=? .NUM 1>
<ZERO? ,GL-P-NCN>
<OR <ZERO? <SET PREP <GET ,GL-P-ITBL ,K-P-PREP1>>>
<EQUAL? .PREP ;<GETB .SYN ,K-P-SPREP1>
<RT-GET-PREP .SYN 1>>>>
<SET DRIVE1 .SYN>)
(<EQUAL? ;<GETB .SYN ,K-P-SPREP1>
<RT-GET-PREP .SYN 1>
<GET ,GL-P-ITBL ,K-P-PREP1>>
<COND (<AND <EQUAL? .NUM 2>
<EQUAL? ,GL-P-NCN 1>>
<SET DRIVE2 .SYN>)
(<AND <L=? .NUM 1>
<T? <GET ,GL-P-ITBL ,K-P-PREP2>>> T)
(<OR <L=? .NUM 1>
<EQUAL? ;<GETB .SYN ,K-P-SPREP2>
<RT-GET-PREP .SYN 2>
<GET ,GL-P-ITBL ,K-P-PREP2>>>
<RT-SYNTAX-FOUND .SYN>
<RTRUE>)>)>
<COND (<DLESS? LEN 1>
<COND (<OR <MC-T? .DRIVE1>
<MC-T? .DRIVE2>>
<RETURN>)
(<AND <==? ,GL-P-NCN 2>
,GL-FUNNY-CLAUSE?>
<SETG GL-P-NCN 1>
<SETG GL-FUNNY-CLAUSE? <>>
<PUT ,GL-P-ITBL ,K-P-NC1L <GET ,GL-P-ITBL ,K-P-NC2L>>
<RETURN <RT-SYNTAX-CHECK>>)
(T
<TELL ,K-DONT-UNDERSTAND-MSG CR>
<RFALSE>)>)
(T
<COND (<0? .NUM>
<SET SYN <REST .SYN ,K-P-SLEN-0>>)
(<1? .NUM>
<SET SYN <REST .SYN ,K-P-SLEN-1>>)
(T
<SET SYN <REST .SYN ,K-P-SLEN-2>>)>
;<SET SYN <REST .SYN ,K-P-SYNLEN>>)>>
<COND (<AND <MC-T? .DRIVE1>
<SET OBJ <RT-GET-WHAT-I-MEAN <GETB .DRIVE1 ,K-P-SFWIM1>
<GETB .DRIVE1 ,K-P-SLOC1>
<RT-GET-PREP .DRIVE1 1>
;<GETB .DRIVE1 ,K-P-SPREP1>>>>
<PUT ,GL-P-PRSO ,K-P-MATCHLEN 1>
<PUT ,GL-P-PRSO 1 .OBJ>
<RT-SYNTAX-FOUND .DRIVE1>
<RTRUE>)
(<AND <MC-T? .DRIVE2>
<SET OBJ <RT-GET-WHAT-I-MEAN <GETB .DRIVE2 ,K-P-SFWIM2>
<GETB .DRIVE2 ,K-P-SLOC2>
<RT-GET-PREP .DRIVE2 2>
;<GETB .DRIVE2 ,K-P-SPREP2>>>>
<PUT ,GL-P-PRSI ,K-P-MATCHLEN 1>
<PUT ,GL-P-PRSI 1 .OBJ>
<RT-SYNTAX-FOUND .DRIVE2>
<RTRUE>)
(<EQUAL? .VERB ,ACT?FIND ; ,ACT?WHAT>
<TELL ,K-DO-IT-YOURSELF-MSG CR>
<RFALSE>)
(T
<COND (<EQUAL? ,GL-WINNER ,CH-PLAYER>
<RT-ORPHAN .DRIVE1 .DRIVE2>
<TELL "[Wh">)
(T
<TELL "[Your command was not complete. Type wh">)>
<COND (<EQUAL? .VERB ,ACT?WALK ,ACT?GO>
<TELL "ere">)
(<OR <AND <MC-T? .DRIVE1>
<EQUAL? <GETB .DRIVE1 ,K-P-SFWIM1> ,FL-PERSON>>
<AND <MC-T? .DRIVE2>
<EQUAL? <GETB .DRIVE2 ,K-P-SFWIM2> ,FL-PERSON>>>
<TELL "om">)
(T
<TELL "at">)>
<COND (<EQUAL? ,GL-WINNER ,CH-PLAYER>
<TELL " do you want to ">)
(T
<TELL " you want " THE ,GL-WINNER " to ">)>
<RT-VERB-PRINT>
<COND (<MC-T? .DRIVE2>
<RT-CLAUSE-PRINT ,K-P-NC1 ,K-P-NC1L>)>
<SETG GL-P-END-ON-PREP <>>
<RT-PREP-PRINT <COND (<MC-T? .DRIVE1>
<RT-GET-PREP .DRIVE1 1>
;<GETB .DRIVE1 ,K-P-SPREP1>)
(T
<RT-GET-PREP .DRIVE2 2>
;<GETB .DRIVE2 ,K-P-SPREP2>)>>
<COND (<EQUAL? ,GL-WINNER ,CH-PLAYER>
<SETG GL-P-ORPH T>
<TELL "?]" CR>)
(T
<SETG GL-P-ORPH <>>
<TELL ".]" CR>)>
<RFALSE>)>>
;------------------------------------------------------------------------------
; "RT-CLAUSE"
; "scan through a noun phrase, leaving a pointer to its starting location"
;------------------------------------------------------------------------------
<ROUTINE RT-CLAUSE (PTR VAL WRD
"AUX" OFF NUM (ANDFLG <>) (FIRST?? T) NW (LW 0) TPTR
TMP)
<SET OFF <* <- ,GL-P-NCN 1> 2>>
<COND (<MC-T? .VAL>
<PUT ,GL-P-ITBL <SET NUM <+ ,K-P-PREP1 .OFF>> .VAL>
<PUT ,GL-P-ITBL <+ .NUM 1> .WRD>
<SET PTR <+ .PTR ,K-P-LEXELEN>>)
(T
<SETG GL-P-LEN <+ ,GL-P-LEN 1>>)>
<COND (<ZERO? ,GL-P-LEN>
<SETG GL-P-NCN <- ,GL-P-NCN 1>>
<RETURN -1>)>
<PUT ,GL-P-ITBL <SET NUM <+ ,K-P-NC1 .OFF>> <REST ,GL-P-P-LEX <* .PTR 2>>>
<COND (<EQUAL? <GET ,GL-P-P-LEX .PTR> ,W?THE ,W?A ,W?AN>
<PUT ,GL-P-ITBL .NUM <REST <GET ,GL-P-ITBL .NUM> 4>>)>
<REPEAT ()
<COND (<L? <SETG GL-P-LEN <- ,GL-P-LEN 1>> 0>
<PUT ,GL-P-ITBL <+ .NUM 1> <REST ,GL-P-P-LEX <* .PTR 2>>>
<RETURN -1>)>
<COND ;(<RT-BUZZ-WORD-MSG? <SET WRD <GET ,GL-P-P-LEX .PTR>>>
<RFALSE>)
(<OR <MC-T? <SET WRD <GET ,GL-P-P-LEX .PTR>>>
<SET WRD <RT-NUMBER? .PTR>>
;<SET WRD <NAME? .PTR>>>
<COND (<ZERO? ,GL-P-LEN>
<SET NW 0>)
(T
<COND (<F? <SET NW <GET ,GL-P-P-LEX
<SET TPTR <+ .PTR ,K-P-LEXELEN>>>>>
<COND (<N==? .WRD ,W?INTNUM>
<SET NW <RT-NUMBER? .TPTR>>
<PUT ,GL-P-P-LEX .TPTR .NW>)>)>)>
;<COND (<AND <EQUAL? .WRD ,W?OF>
<EQUAL? <GET ,GL-P-ITBL ,K-P-VERB>
,ACT?MAKE ,ACT?TAKE>>
<RT-CHANGE-LEXV .PTR ,W?WITH>
<SET WRD ,W?WITH>)>
<COND (<AND <EQUAL? .WRD ,W?PERIOD>
<OR <EQUAL? .LW ,W?MR ,W?MRS ,W?MISS>
<EQUAL? .LW ,W?DR>>>
<SET LW 0>)
(<EQUAL? .WRD ,W?AND ,W?COMMA>
<SET ANDFLG T>)
(<EQUAL? .WRD ,W?ALL ,W?BOTH ,W?EVERYTHING>
<COND (<EQUAL? .NW ,W?OF>
<SETG GL-P-LEN <- ,GL-P-LEN 1>>
<SET PTR <+ .PTR ,K-P-LEXELEN>>)>)
(<OR <EQUAL? .WRD ,W?THEN ,W?PERIOD>
<AND <WT? .WRD ,PS?PREPOSITION>
<GET ,GL-P-ITBL ,K-P-VERB>
<NOT .FIRST??>>>
<SETG GL-P-LEN <+ ,GL-P-LEN 1>>
<PUT ,GL-P-ITBL <+ .NUM 1>
<REST ,GL-P-P-LEX <* .PTR 2>>>
<RETURN <- .PTR ,K-P-LEXELEN>>)
(<AND <MC-T? .ANDFLG>
<OR <ZERO? <GET ,GL-P-ITBL ,K-P-VERBN>>
<RT-VERB-DIR-ONLY? .WRD>>>
<SET PTR <- .PTR 4>>
<RT-CHANGE-LEXV <+ .PTR 2> ,W?THEN>
<SETG GL-P-LEN <+ ,GL-P-LEN 2>>)
(<WT? .WRD ,PS?OBJECT>
<COND (<AND <G? ,GL-P-LEN 0>
<EQUAL? .NW ,W?OF>
<NOT <EQUAL? .WRD ,W?ALL ,W?EVERYTHING>>>
<PUT ,GL-P-OFW <- ,GL-P-NCN 1> .WRD>)
(<AND <WT? .WRD ,PS?ADJECTIVE>
<MC-T? .NW>
<WT? .NW ,PS?OBJECT>>
<COND (<AND <EQUAL? .WRD ,W?INTNUM>
<EQUAL? .NW ,W?HOUR ,W?HOURS
,W?MINUTE ,W?MINUTES>>
T)
(<==? .NW ,W?TOMB> T)
(T
<COND (<==? .WRD ,W?BOX>
<COND (<N==? .NW ,W?INTNUM>
<SET TMP T>)>)
(<==? .WRD ,W?TOMB>
<SET TMP T>)>
<COND
(.TMP
<SETG GL-FUNNY-CLAUSE? T>
<ZPUT ,GL-P-ITBL <SET NUM <+ .NUM 1>>
<ZREST ,GL-P-P-LEX
<* <+ .PTR 2> 2>>>
<RETURN .PTR>)>)>
T)
(<AND <ZERO? .ANDFLG>
<NOT <EQUAL? .NW ,W?BUT ,W?EXCEPT>>
<NOT <EQUAL? .NW ,W?AND ,W?COMMA>>>
<PUT ,GL-P-ITBL <+ .NUM 1>
<REST ,GL-P-P-LEX <* <+ .PTR 2> 2>>>
<RETURN .PTR>)
(T
<SET ANDFLG <>>)>)
(<AND <OR <MC-T? ,GL-P-MERGED>
<MC-T? ,GL-P-ORPH>
<MC-T? <GET ,GL-P-ITBL ,K-P-VERB>>>
<WT? .WRD ,PS?ADJECTIVE <> ,PS?BUZZ-WORD>>)
(<AND <MC-T? .ANDFLG>
<ZERO? <GET ,GL-P-ITBL ,K-P-VERB>>>
<SET PTR <- .PTR 4>>
<RT-CHANGE-LEXV <+ .PTR 2> ,W?THEN>
<SETG GL-P-LEN <+ ,GL-P-LEN 2>>)
(<WT? .WRD ,PS?PREPOSITION>
T)
(T
<RT-DONT-KNOW-WORD-USE-MSG .PTR>
<RFALSE>)>)
(T
<RT-DONT-KNOW-WORD-MSG .PTR>
<RFALSE>)>
<SET LW .WRD>
<SET FIRST?? <>>
<SET PTR <+ .PTR ,K-P-LEXELEN>>>>
;------------------------------------------------------------------------------
; "RT-GET-WHAT-I-MEAN"
;------------------------------------------------------------------------------
<ROUTINE RT-GET-WHAT-I-MEAN (GBIT LBIT PREP "OPT" (NO-ROOMS? <>)
(SILENT? <>) "AUX" OBJ)
<COND (<EQUAL? .GBIT ,FL-LOCATION>
<RETURN ,ROOMS>)
(<AND <MC-T? ,GL-P-IT-OBJECT>
<MC-IS? ,GL-P-IT-OBJECT .GBIT>>
<COND (<F? .SILENT?> <TELL "[" THE ,GL-P-IT-OBJECT "]" CR>)>
<RETURN ,GL-P-IT-OBJECT>)>
<SETG INHIBIT-ROOMS .NO-ROOMS?>
<SETG GL-P-GWIMBIT .GBIT>
<SETG GL-P-SLOCBITS .LBIT>
<PUT ,GL-P-MERGE ,K-P-MATCHLEN 0>
<COND (<RT-GET-OBJECT ,GL-P-MERGE <>>
<SETG GL-P-GWIMBIT 0>
<COND (<EQUAL? <GET ,GL-P-MERGE ,K-P-MATCHLEN> 1>
<SET OBJ <GET ,GL-P-MERGE 1>>
<COND (<AND <EQUAL? ,GL-WINNER ,CH-PLAYER>
<NOT <EQUAL? .OBJ ,TH-HANDS>>
<F? .SILENT?>>
<TELL "[">
<COND (<RT-PREP-PRINT .PREP <>>
<MC-SPACE>)>
<TELL THE .OBJ>
<TELL "]" CR>)>
<SETG INHIBIT-ROOMS <>>
<RETURN .OBJ>)>)
(T
<SETG GL-P-GWIMBIT 0>
<SETG INHIBIT-ROOMS <>>
<RFALSE>)>>
;*****************************************************************************
; "routines with no screen output"
;*****************************************************************************
;-----------------------------------------------------------------------------
; "RT-P-CLEAR"
;-----------------------------------------------------------------------------
<ROUTINE RT-P-CLEAR ()
<SETG GL-P-CONT <>>
<SETG GL-P-QUOT <>>
<RTRUE>
>
;------------------------------------------------------------------------------
; "RT-PICK-NEXT"
;------------------------------------------------------------------------------
<ROUTINE RT-PICK-NEXT (TBL "AUX" CNT STR NT)
<SET CNT <GETB .TBL 0>>
<SET NT <ZGET <REST .TBL 1> 0>>
<SET STR <ZGET .NT .CNT>>
<COND (<G? <SET CNT <+ .CNT 1>> <GET .NT 0>>
<SET CNT 1>)>
<PUTB .TBL 0 .CNT>
<RETURN .STR>>
<ROUTINE RT-QCONTEXT-GOOD? ()
<COND (<AND <F? ,GL-WHERE-TO-ORPH?>
<MC-T? ,GL-P-QCONTEXT-TH>
<MC-IS? ,GL-P-QCONTEXT-TH ,FL-PERSON>
<EQUAL? ,GL-PLACE-CUR ,GL-P-QCONTEXT-RM>
<RT-VISIBLE? ,GL-P-QCONTEXT-TH>>
<RTRUE>)
(T
<RFALSE>)>>
<ROUTINE RT-FIND-PERSON (THING "AUX" OBJ OBJ1 (WHO-P <>) (WHO-A <>))
<SET OBJ <FIRST? .THING>>
<REPEAT ()
<COND (<ZERO? .OBJ>
<RETURN>)
(<MC-IS? .OBJ ,FL-PERSON>
<COND (<AND <MC-ISNOT? .OBJ ,FL-PLURAL>
<NOT <EQUAL? .OBJ ,CH-PLAYER ,GL-WINNER>>>
<COND (<MC-IS? .OBJ ,FL-ASLEEP>) ;"RFP"
(<EQUAL? .OBJ ,GL-PUPPY>
<SET WHO-P .OBJ>)
(T
<RETURN>)>)>)
(<OR <MC-IS? .OBJ ,FL-SURFACE>
<AND <MC-IS? .OBJ ,FL-CONTAINER>
<MC-IS? .OBJ ,FL-OPENED>>>
<SET OBJ1 .OBJ>
<COND (<SET OBJ <RT-FIND-PERSON .OBJ>>
<COND (<MC-IS? .OBJ ,FL-ASLEEP>) ;"RFP"
(<EQUAL? .OBJ ,GL-PUPPY>
<SET WHO-P .OBJ>)
(T
<RETURN>)>)>
<SET OBJ .OBJ1>)>
<SET OBJ <NEXT? .OBJ>>>
<COND (<MC-T? .OBJ>
<RETURN .OBJ>)
(<MC-T? .WHO-P>
<RETURN .WHO-P>)
;(<MC-T? .WHO-A> ;"RFP"
<RETURN .WHO-A>)>
<RFALSE>>
<ROUTINE RT-ANYONE-HERE? ()
<COND (<RT-QCONTEXT-GOOD?>
<RETURN ,GL-P-QCONTEXT-TH>)
(T
<RETURN <RT-FIND-PERSON ,GL-PLACE-CUR>>)>>
<ROUTINE RT-MOVE-ALL (FROM TO "AUX" OBJ NXT)
<SET OBJ <FIRST? .FROM>>
<REPEAT ()
<COND (<ZERO? .OBJ>
<RTRUE>)>
<SET NXT <NEXT? .OBJ>>
<MOVE .OBJ .TO>
<SET OBJ .NXT>>
<RTRUE>>
<ROUTINE RT-GOT? (OBJ)
<COND (<ZERO? .OBJ>
<RFALSE>)
(<AND <EQUAL? ,GL-WINNER ,CH-PLAYER>
<IN? .OBJ ,TH-POCKET>>
<RTRUE>)
(<RT-HELD? .OBJ>
<RTRUE>)
(T
<RFALSE>)>>
<ROUTINE RT-HELD? (OBJ "AUX" L)
<COND (<ZERO? .OBJ>
<RFALSE>)
(<AND <NOT <MC-IS? .OBJ ,FL-TAKEABLE>>
<NOT <MC-IS? .OBJ ,FL-TRYTAKE>>>
<RFALSE>)>
<SET L <LOC .OBJ>>
<COND (<EQUAL? .L <> ,ROOMS ,GLOBAL-OBJECTS>
<RFALSE>)
(<EQUAL? .L ,GL-WINNER>
<RTRUE>)
(<AND <EQUAL? ,GL-WINNER ,CH-PLAYER>
<EQUAL? .L ,TH-POCKET>>
<RFALSE>)
(T
<RT-HELD? .L>)>>
<ROUTINE RT-THIS-IS-IT (OBJ)
<COND (<OR <EQUAL? .OBJ <> ,CH-PLAYER ,TH-NOT-HERE-OBJECT>
<EQUAL? .OBJ ,TH-INTDIR ,TH-INTNUM>
<EQUAL? .OBJ ,TH-LEFT ,TH-RIGHT>>
<RTRUE>)
(<AND <MC-VERB? WALK WALK-TO>
<EQUAL? .OBJ ,GL-PRSO>>
<RTRUE>)
(<AND <MC-IS? .OBJ ,FL-PERSON>
<MC-IS? .OBJ ,FL-FEMALE>>
<SETG GL-P-HER-OBJECT .OBJ>
<RTRUE>)
(<AND <MC-IS? .OBJ ,FL-PERSON>
<MC-ISNOT? .OBJ ,FL-FEMALE>>
<SETG GL-P-HIM-OBJECT .OBJ>
<RTRUE>)
(<MC-IS? .OBJ ,FL-COLLECTIVE>
<SETG GL-P-THEM-OBJECT .OBJ>
<SETG GL-P-IT-OBJECT .OBJ>
<RTRUE>)
(<MC-IS? .OBJ ,FL-PLURAL>
<SETG GL-P-THEM-OBJECT .OBJ>
<RTRUE>)
(T
<COND (<FSET? .OBJ ,FL-NEEDS-IDENTITY>
<PUTP ,TH-IT ,P?OBJ-NOUN <GETP .OBJ ,P?OBJ-NOUN>>
<PUTP ,TH-IT ,P?OBJ-ADJ <GETP .OBJ ,P?OBJ-ADJ>>)
(T
<PUTP ,TH-IT ,P?OBJ-NOUN 0>
<PUTP ,TH-IT ,P?OBJ-ADJ 0>)>
<SETG GL-P-IT-OBJECT .OBJ>
<RTRUE>)>>
<ROUTINE RT-CHANGE-LEXV (PTR WRD "OPTIONAL" (PTRS? <>) "AUX" X Y Z)
<COND (<MC-T? .PTRS?>
<SET X <+ 2 <* 2 <- .PTR ,K-P-LEXELEN>>>>
<SET Y <GETB ,GL-P-P-LEX .X>>
<SET Z <+ 2 <* 2 .PTR>>>
<PUTB ,GL-P-P-LEX .Z .Y>
<PUTB ,GL-P-S-LEX .Z .Y>
<SET Y <GETB ,GL-P-P-LEX <+ 1 .X>>>
<SET Z <+ 3 <* 2 .PTR>>>
<PUTB ,GL-P-P-LEX .Z .Y>
<PUTB ,GL-P-S-LEX .Z .Y>)>
<PUT ,GL-P-P-LEX .PTR .WRD>
<PUT ,GL-P-S-LEX .PTR .WRD>
<RTRUE>>
;------------------------------------------------------------------------------
; "RT-WT?"
; "Check whether word pointed at by PTR is the correct part of speech."
; "The second argument is the part of speech (,PS?<part of speech>). The"
; "3rd argument (,P1?<part of speech>), if given, causes the value"
; "for that part of speech to be returned."
;------------------------------------------------------------------------------
; "This is only called through the WT? macro, when it doesn't generate
a BTST directly..."
<ROUTINE RT-WT? (PTR BIT "OPTIONAL" (B1 5) "AUX" (OFFS ,K-P-P1OFF) TYP
TBL)
<COND (<BTST <SET TYP <GETB .PTR ,K-P-PSOFF>> .BIT>
<COND (<G? .B1 4>
<RTRUE>)
(<==? .BIT ,PS?PREPOSITION>
; "We have to get the preposition ID out of PREPOSITIONS
rather than the word"
<COND (<SET TBL <INTBL? .PTR <ZREST ,PREPOSITIONS 2>
<ZGET ,PREPOSITIONS 0> *203*>>
<GETB .TBL 2>)>)
(T
<SET TYP <BAND .TYP ,K-P-P1BITS>>
; "Following no longer applies, since there's only
one byte defined for all this"
;<COND (<NOT <EQUAL? .TYP .B1>>
<SET OFFS <+ .OFFS 1>>)>
<GETB .PTR .OFFS>)>)>>
;------------------------------------------------------------------------------
; "RT-VERB-DIR-ONLY?"
;------------------------------------------------------------------------------
<ROUTINE RT-VERB-DIR-ONLY? (WRD)
<COND
(<NOT <OR <WT? .WRD ,PS?OBJECT <> ,PS?ADJECTIVE>
<NOT <WT? .WRD ,PS?DIRECTION <> ,PS?VERB>>>>
<RTRUE>)
(T
<RFALSE>
)
>
>
;------------------------------------------------------------------------------
; "RT-STUFF"
; "for AGAIN purposes, put contents of one LEXV table into another"
;------------------------------------------------------------------------------
<ROUTINE RT-STUFF (DEST SRC "OPTIONAL" (MAX 29))
<COPYT .SRC .DEST <+ ,K-P-LEXSTART <* .MAX ,K-P-WORDLEN ;,K-P-LEXELEN>>>>
;------------------------------------------------------------------------------
; "RT-INBUF-ADD"
; "put the word in the positions specified from GL-P-PIBUF to the end of"
; "GL-OOPS-INBUF, leaving the appropriate pointers in GL-P-S-LEX"
;------------------------------------------------------------------------------
<ROUTINE RT-INBUF-ADD (LEN BEG SLOT "AUX" DBEG (CTR 0) TMP)
<SET TMP <GET ,GL-OOPS-TABLE ,K-O-END>>
<COND
(<MC-T? .TMP>
<SET DBEG .TMP>
)
(T
<SET DBEG <+ <GETB ,GL-P-S-LEX
<SET TMP <GET ,GL-OOPS-TABLE ,K-O-LENGTH>>>
<GETB ,GL-P-S-LEX <+ .TMP 1>>>>
)
>
<PUT ,GL-OOPS-TABLE ,K-O-END <+ .DBEG .LEN>>
<COPYT <ZREST ,GL-P-PIBUF .BEG> <ZREST ,GL-OOPS-INBUF .DBEG> .LEN>
;<REPEAT ()
<PUTB ,GL-OOPS-INBUF <+ .DBEG .CTR>
<GETB ,GL-P-PIBUF <+ .BEG .CTR>>>
<INC CTR>
<COND (<EQUAL? .CTR .LEN>
<RETURN>)>>
<PUTB ,GL-P-S-LEX .SLOT .DBEG>
<PUTB ,GL-P-S-LEX <- .SLOT 1> .LEN>
<RTRUE>
>
;------------------------------------------------------------------------------
; "RT-ACLAUSE-WIN"
;------------------------------------------------------------------------------
<ROUTINE RT-ACLAUSE-WIN (ADJ "AUX" X)
<PUT ,GL-P-ITBL ,K-P-VERB <GET ,GL-P-OTBL ,K-P-VERB>>
<SET X <+ ,GL-P-ACLAUSE 1>>
<RT-CLAUSE-COPY ,GL-P-OTBL ,GL-P-OTBL ,GL-P-ACLAUSE .X
,GL-P-ACLAUSE .X .ADJ
>
<AND <MC-T? <GET ,GL-P-OTBL ,K-P-NC2>> <SETG GL-P-NCN 2>>
<SETG GL-P-ACLAUSE <>>
<RTRUE>
>
;------------------------------------------------------------------------------
; "RT-NCLAUSE-WIN"
;------------------------------------------------------------------------------
<ROUTINE RT-NCLAUSE-WIN ()
<RT-CLAUSE-COPY ,GL-P-ITBL ,GL-P-OTBL ,K-P-NC1 ,K-P-NC1L
,GL-P-ACLAUSE <+ ,GL-P-ACLAUSE 1>
>
<AND <MC-T? <GET ,GL-P-OTBL ,K-P-NC2>> <SETG GL-P-NCN 2>>
<SETG GL-P-ACLAUSE <>>
<RTRUE>
>
;-----------------------------------------------------------------------------
; "RT-ORPHAN-VERB"
;-----------------------------------------------------------------------------
<ROUTINE RT-ORPHAN-VERB (VERB PREVERB)
<PUT ,GL-P-VTBL 0 .VERB>
<PUT ,GL-P-OTBL ,K-P-VERB .PREVERB>
<PUT ,GL-P-OTBL ,K-P-VERBN ,GL-P-VTBL>
<PUT ,GL-P-OTBL ,K-P-PREP1 0>
<PUT ,GL-P-OTBL ,K-P-PREP1N 0>
<PUT ,GL-P-OTBL ,K-P-PREP2 0>
<PUT ,GL-P-OTBL 5 0>
<PUT ,GL-P-OTBL ,K-P-NC1 1>
<PUT ,GL-P-OTBL ,K-P-NC1L 0>
<PUT ,GL-P-OTBL ,K-P-NC2 0>
<PUT ,GL-P-OTBL ,K-P-NC2L 0>
<SETG GL-P-ORPH T>
>
;------------------------------------------------------------------------------
; "RT-ORPHAN"
;------------------------------------------------------------------------------
<ROUTINE RT-ORPHAN (D1 D2 "AUX" (CNT -1))
<COND (<ZERO? ,GL-P-MERGED>
<PUT ,GL-P-OCLAUSE ,K-P-MATCHLEN 0>)>
<PUT ,GL-P-OVTBL 0 <GET ,GL-P-VTBL 0>>
<PUTB ,GL-P-OVTBL 2 <GETB ,GL-P-VTBL 2>>
<PUTB ,GL-P-OVTBL 3 <GETB ,GL-P-VTBL 3>>
<COPYT ,GL-P-ITBL ,GL-P-OTBL <* 2 <+ ,K-P-ITBLLEN 1>>>
;<REPEAT ()
<COND (<IGRTR? CNT ,K-P-ITBLLEN>
<RETURN>)
(T
<PUT ,GL-P-OTBL .CNT <GET ,GL-P-ITBL .CNT>>)>>
<COND (<EQUAL? ,GL-P-NCN 2>
<RT-CLAUSE-COPY ,GL-P-ITBL ,GL-P-OTBL ,K-P-NC2
,K-P-NC2L ,K-P-NC2 ,K-P-NC2L>)>
<COND (<NOT <L? ,GL-P-NCN 1>>
<RT-CLAUSE-COPY ,GL-P-ITBL ,GL-P-OTBL
,K-P-NC1 ,K-P-NC1L ,K-P-NC1 ,K-P-NC1L>)>
<COND (<MC-T? .D1>
<PUT ,GL-P-OTBL ,K-P-PREP1 <RT-GET-PREP .D1 1>>
<PUT ,GL-P-OTBL ,K-P-NC1 1>)
(<MC-T? .D2>
<PUT ,GL-P-OTBL ,K-P-PREP2 <RT-GET-PREP .D2 2>>
<PUT ,GL-P-OTBL ,K-P-NC2 1>)>>
;------------------------------------------------------------------------------
; "RT-ORPHAN-MERGE"
;------------------------------------------------------------------------------
<ROUTINE RT-ORPHAN-MERGE ("AUX" (CNT -1) TEMP VERB BEG END (ADJ <>) WRD)
<SETG GL-P-ORPH <>>
<COND (<OR <F? <SET WRD <GET ,GL-P-ITBL ,K-P-VERBN>>>
<F? <SET WRD <GET .WRD 0>>>>
T)
(<OR <EQUAL? <WT? <SET WRD <GET <GET ,GL-P-ITBL ,K-P-VERBN> 0>>
,PS?VERB ,P1?VERB>
<GET ,GL-P-OTBL ,K-P-VERB>>
<WT? .WRD ,PS?ADJECTIVE>>
<SET ADJ T>)
(<WT? <SET WRD <GET <GET ,GL-P-ITBL ,K-P-VERBN> 0>>
,PS?ADJECTIVE>
<SET ADJ T>)
(<AND <WT? .WRD ,PS?OBJECT>
<ZERO? ,GL-P-NCN>
<MC-T? <SET VERB <GET ,GL-P-ITBL ,K-P-VERB>>>
; "ADDED 8/24/87 PER SWG">
<PUT ,GL-P-ITBL ,K-P-VERB 0>
<PUT ,GL-P-ITBL ,K-P-VERBN 0>
<PUT ,GL-P-ITBL ,K-P-NC1 <REST ,GL-P-P-LEX 2>>
<PUT ,GL-P-ITBL ,K-P-NC1L <REST ,GL-P-P-LEX 6>>
<SETG GL-P-NCN 1>)>
<COND (<AND <MC-T? <SET VERB <GET ,GL-P-ITBL ,K-P-VERB>>>
<ZERO? .ADJ>
<NOT <EQUAL? .VERB <GET ,GL-P-OTBL ,K-P-VERB>>>>
<RFALSE>)
(<EQUAL? ,GL-P-NCN 2>
<COND (<T? ,GL-FUNNY-CLAUSE?>
<SETG GL-P-NCN 1>
<SETG GL-FUNNY-CLAUSE? <>>
<PUT ,GL-P-ITBL ,K-P-NC1L <GET ,GL-P-ITBL ,K-P-NC2L>>
<RETURN <RT-ORPHAN-MERGE>>)>