-
Notifications
You must be signed in to change notification settings - Fork 23
/
parser.zil
2913 lines (2693 loc) · 79.9 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
"PARSER for TRINITY: (C)1986 Infocom, Inc. All rights reserved."
<SETG SIBREAKS ".,\"!?">
<GLOBAL PRSA:VERB 0>
<GLOBAL PRSI:OBJECT 0>
<GLOBAL PRSO:OBJECT 0>
<GLOBAL P-TABLE:NUMBER 0>
<GLOBAL P-SYNTAX:NUMBER 0>
<GLOBAL P-LEN:NUMBER 0>
<GLOBAL P-DIR:NUMBER 0>
<GLOBAL HERE:OBJECT 0>
<GLOBAL P-LEXV:TABLE <ITABLE BYTE 120>>
<GLOBAL P-INBUF:TABLE <ITABLE BYTE 100>>
<GLOBAL RESERVE-INBUF:TABLE <ITABLE BYTE 100>> ; "RETROFIX #36"
"Parse-cont variable"
<GLOBAL P-CONT:FLAG <>>
<GLOBAL P-IT-OBJECT:OBJECT <>>
<GLOBAL P-HER-OBJECT:OBJECT <>>
<GLOBAL P-HIM-OBJECT:OBJECT <>>
<GLOBAL P-THEM-OBJECT:OBJECT <>>
"Orphan flag"
<GLOBAL P-OFLAG:FLAG <>>
<GLOBAL P-MERGED <>>
<GLOBAL P-ACLAUSE <>>
<GLOBAL P-ANAM <>>
<GLOBAL P-AADJ <>>
"Byte offset to # of entries in LEXV"
<CONSTANT P-LEXWORDS 1>
"Word offset to start of LEXV entries"
<CONSTANT P-LEXSTART 1>
"Number of words per LEXV entry"
<CONSTANT P-LEXELEN 2>
<CONSTANT P-WORDLEN 4>
"Offset to parts of speech byte"
<CONSTANT P-PSOFF 6>
"Offset to first part of speech"
<CONSTANT P-P1OFF 7>
"First part of speech bit mask in PSOFF byte"
<CONSTANT P-P1BITS 3>
<CONSTANT P-ITBLLEN 9>
<GLOBAL P-ITBL:TABLE <TABLE 0 0 0 0 0 0 0 0 0 0>>
<GLOBAL P-OTBL:TABLE <TABLE 0 0 0 0 0 0 0 0 0 0>>
<GLOBAL P-VTBL:TABLE <TABLE 0 0 0 0>>
<GLOBAL P-OVTBL:TABLE <TABLE 0 0 0 0>>
<GLOBAL P-NCN 0>
<CONSTANT P-VERB 0>
<CONSTANT P-VERBN 1>
<CONSTANT P-PREP1 2>
<CONSTANT P-PREP1N 3>
<CONSTANT P-PREP2 4>
<CONSTANT P-NC1 6>
<CONSTANT P-NC1L 7>
<CONSTANT P-NC2 8>
<CONSTANT P-NC2L 9>
<GLOBAL QUOTE-FLAG:FLAG <>>
<GLOBAL P-WON:FLAG <>>
<CONSTANT M-FATAL 2>
<CONSTANT M-BEG 1>
<CONSTANT M-ENTERING 2>
<CONSTANT M-LOOK 3>
<CONSTANT M-ENTERED 4>
<CONSTANT M-OBJDESC 5>
<CONSTANT M-END 6>
<CONSTANT M-CONT 7>
<CONSTANT M-WINNER 8>
<CONSTANT M-EXIT 9>
<GLOBAL P-WALK-DIR:DIRECTION <>>
<GLOBAL P-END-ON-PREP <>>
<GLOBAL AGAIN-LEXV:TABLE <ITABLE BYTE 120>>
<GLOBAL RESERVE-LEXV:TABLE <ITABLE BYTE 120>>
<GLOBAL RESERVE-PTR <>>
<GLOBAL OOPS-INBUF:TABLE <ITABLE BYTE 100>>
<GLOBAL OOPS-TABLE:TABLE <TABLE <> <> <> <>>>
<GLOBAL AGAIN-DIR:DIRECTION <>> ; "FIX #44"
<CONSTANT O-PTR 0>
<CONSTANT O-START 1>
<CONSTANT O-LENGTH 2>
<CONSTANT O-END 3>
<GLOBAL P-PRSA-WORD:WORD <>>
<GLOBAL P-DIR-WORD:WORD <>>
<GLOBAL INLEN:NUMBER 0> "For MAGPIE."
<GLOBAL DO-WINDOW <>>
" Grovel down the input finding the verb, prepositions, and noun clauses.
If the input is <direction> or <walk> <direction>, fall out immediately
setting PRSA to ,V?WALK and PRSO to <direction>. Otherwise, perform
all required orphaning, syntax checking, and noun clause lookup."
<ROUTINE PARSER ("AUX" (PTR ,P-LEXSTART) WRD (VAL 0) (VERB <>) (OF-FLAG <>)
(LEN 0) (DIR <>) (NW 0) (LW 0) (CNT -1) OWINNER
OMERGED (TMP1 0))
<REPEAT ()
<SET CNT <+ .CNT 1>>
<COND (<G? .CNT ,P-ITBLLEN>
<RETURN>)
(T
<COND (<ZERO? ,P-OFLAG>
<PUT ,P-OTBL .CNT <GET ,P-ITBL .CNT>>)>
<PUT ,P-ITBL .CNT 0>)>>
<SETG P-NAM <>>
<SETG P-ADJ <>>
<SETG P-XNAM <>>
<SETG P-XADJ <>>
<SETG P-DIR-WORD <>>
<COND (<ZERO? ,P-OFLAG>
<PUT ,P-NAMW 0 <>>
<PUT ,P-NAMW 1 <>>
<PUT ,P-ADJW 0 <>>
<PUT ,P-ADJW 1 <>>
<PUT ,P-OFW 0 <>>
<PUT ,P-OFW 1 <>>)>
<SET OMERGED ,P-MERGED>
<SETG P-MERGED <>>
<SETG P-END-ON-PREP <>>
<PUT ,P-PRSO ,P-MATCHLEN 0>
<PUT ,P-PRSI ,P-MATCHLEN 0>
<PUT ,P-BUTS ,P-MATCHLEN 0>
<SET OWINNER ,WINNER>
<COND (<AND <ZERO? ,QUOTE-FLAG>
<NOT <EQUAL? ,WINNER ,PLAYER>>>
<SETG WINNER ,PLAYER>
<SETG HERE <LOC ,WINNER>>
; <COND (T ;<NOT <IS? <LOC ,WINNER> ,VEHBIT>>
; <SETG LAST-PLAYER-LOC ,HERE>
<SETG HERE <LOC ,WINNER>>)>
<SETG LIT? <IS-LIT?>>)>
<COND (<T? ,RESERVE-PTR>
<SET PTR ,RESERVE-PTR>
<STUFF ,P-LEXV ,RESERVE-LEXV>
<INBUF-STUFF ,P-INBUF ,RESERVE-INBUF> ; "FIX #36"
<COND (<AND <T? ,VERBOSITY>
<EQUAL? ,PLAYER ,WINNER>>
<CRLF>)>
<SETG RESERVE-PTR <>>
<SETG P-CONT <>>)
(<T? ,P-CONT>
<SET PTR ,P-CONT>
<SETG P-CONT <>>
<COND (<AND <T? ,VERBOSITY>
<EQUAL? ,PLAYER ,WINNER>>
<CRLF>)>)
(T
<SETG WINNER ,PLAYER>
<SETG QUOTE-FLAG <>>
<SETG HERE <LOC ,WINNER>>
; <COND (T ;<NOT <IS? <LOC ,WINNER> ,VEHBIT>>
<SETG LAST-PLAYER-LOC ,HERE>
<SETG HERE <LOC ,WINNER>>)>
<SETG LIT? <IS-LIT?>>
<DISPLAY-PLACE>
<COND (<T? ,DO-WINDOW>
<WINDOW ,DO-WINDOW>
<SETG DO-WINDOW <>>
<CRLF>)
(<T? ,VERBOSITY>
<CRLF>)>
<TELL ">">
<PUTB ,P-LEXV 0 59>
<READ ,P-INBUF ,P-LEXV>
<SAVE-INPUT>)>
<SETG P-LEN <GETB ,P-LEXV ,P-LEXWORDS>>
; <PUT ,P-LEXV <+ 1 <* ,P-LEN ,P-LEXELEN>> 0>
<COND (<VISIBLE? ,MAGPIE>
<SETG INLEN ,P-LEN>)
(T
<SETG INLEN 0>)>
<COND (<EQUAL? <GET ,P-LEXV .PTR> ,W?QUOTE> ; "Quote first token?"
<SET PTR <+ .PTR ,P-LEXELEN>> ; "If so, ignore it."
<SETG P-LEN <- ,P-LEN 1>>)>
<COND (<EQUAL? <GET ,P-LEXV .PTR> ,W?THEN ,W?PLEASE ,W?SO>
<SET PTR <+ .PTR ,P-LEXELEN>> ; "Ignore boring 1st words."
<SETG P-LEN <- ,P-LEN 1>>)>
<SET TMP1 <GET ,P-LEXV .PTR>>
<COND (<AND <L? 1 ,P-LEN>
<EQUAL? <GET ,P-LEXV .PTR> ,W?GO> ; "GO first input word?"
<SET NW <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>>
<WT? .NW ,PS?VERB ;,P1?VERB> ;" followed by verb?">
<SET PTR <+ .PTR ,P-LEXELEN>> ;"If so, ignore it."
<SETG P-LEN <- ,P-LEN 1>>)>
<COND (<ZERO? ,P-LEN>
<TELL "[What?]" CR>
<RFALSE>)
(<EQUAL? <GET ,P-LEXV .PTR> ,W?OOPS>
<SETG INLEN 0>
<COND (<EQUAL? <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>
,W?PERIOD ,W?COMMA>
<SET PTR <+ .PTR ,P-LEXELEN>>
<SETG P-LEN <- ,P-LEN 1>>)> ; "FIX #38"
<COND (<NOT <G? ,P-LEN 1>>
<TELL "[" ,CANT "use OOPS that way.]" CR>
<RFALSE>)
(<GET ,OOPS-TABLE ,O-PTR>
<COND (<G? ,P-LEN 2> ; "FIX #39"
<TELL
"[Only the first word after OOPS is used.]" CR>)>
<PUT ,AGAIN-LEXV <GET ,OOPS-TABLE ,O-PTR>
<GET ,P-LEXV <+ .PTR ,P-LEXELEN>>>
<SETG WINNER .OWINNER> ;"Fixes OOPS w/chars"
<INBUF-ADD <GETB ,P-LEXV <+ <* .PTR ,P-LEXELEN> 6>>
<GETB ,P-LEXV <+ <* .PTR ,P-LEXELEN> 7>>
<+ <* <GET ,OOPS-TABLE ,O-PTR> ,P-LEXELEN> 3>>
<STUFF ,P-LEXV ,AGAIN-LEXV>
<SETG P-LEN <GETB ,P-LEXV ,P-LEXWORDS>>
<SET PTR <GET ,OOPS-TABLE ,O-START>>
<INBUF-STUFF ,P-INBUF ,OOPS-INBUF>)
(T
<PUT ,OOPS-TABLE ,O-END <>>
<TELL
"[There was no word to replace in that sentence.]" CR>
<RFALSE>)>)
(T
<PUT ,OOPS-TABLE ,O-END <>>)>
<COND (<EQUAL? <GET ,P-LEXV .PTR> ,W?AGAIN ,W?G>
<SETG INLEN 0>
<COND (<OR <T? ,P-OFLAG>
<ZERO? ,P-WON>
<ZERO? <GETB ,OOPS-INBUF 1>>> ; "FIX #50"
<TELL "[" ,CANT "use AGAIN that way.]" CR>
<RFALSE>)
(<G? ,P-LEN 1>
<COND (<OR <EQUAL? <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>
,W?PERIOD ,W?COMMA ,W?THEN>
<EQUAL? <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>
,W?AND>>
<SET PTR <+ .PTR <* 2 ,P-LEXELEN>>>
<PUTB ,P-LEXV ,P-LEXWORDS
<- <GETB ,P-LEXV ,P-LEXWORDS> 2>>)
(T
<DONT-UNDERSTAND>
<RFALSE>)>)
(T
<SET PTR <+ .PTR ,P-LEXELEN>>
<PUTB ,P-LEXV ,P-LEXWORDS
<- <GETB ,P-LEXV ,P-LEXWORDS> 1>>)>
<COND (<G? <GETB ,P-LEXV ,P-LEXWORDS> 0>
<STUFF ,RESERVE-LEXV ,P-LEXV>
<INBUF-STUFF ,RESERVE-INBUF ,P-INBUF> ; "FIX #36"
<SETG RESERVE-PTR .PTR>)
(T
<SETG RESERVE-PTR <>>)>
; <SETG P-LEN <GETB ,AGAIN-LEXV ,P-LEXWORDS>>
<SETG WINNER .OWINNER>
<SETG P-MERGED .OMERGED>
<INBUF-STUFF ,P-INBUF ,OOPS-INBUF>
<STUFF ,P-LEXV ,AGAIN-LEXV>
<SET CNT -1>
<SET DIR ,AGAIN-DIR> ; "FIX #44"
<REPEAT ()
<COND (<IGRTR? CNT ,P-ITBLLEN>
<RETURN>)
(T
<PUT ,P-ITBL .CNT <GET ,P-OTBL .CNT>>)>>)
(T
<SETG P-NUMBER -1> ; "Fixed BM 2/28/86"
<STUFF ,AGAIN-LEXV ,P-LEXV>
<INBUF-STUFF ,OOPS-INBUF ,P-INBUF>
<PUT ,OOPS-TABLE ,O-START .PTR>
<PUT ,OOPS-TABLE ,O-LENGTH <* 4 ,P-LEN>> ; "FIX #37"
<SET LEN ; "FIX #43"
<* 2 <+ .PTR <* ,P-LEXELEN <GETB ,P-LEXV ,P-LEXWORDS>>>>>
<PUT ,OOPS-TABLE ,O-END <+ <GETB ,P-LEXV <- .LEN 1>>
<GETB ,P-LEXV <- .LEN 2>>>>
<SETG RESERVE-PTR <>>
<SET LEN ,P-LEN>
<SETG P-DIR <>>
<SETG P-NCN 0>
<SETG P-GETFLAGS 0>
<PUT ,P-ITBL ,P-VERBN 0>
<REPEAT ()
<COND (<L? <SETG P-LEN <- ,P-LEN 1>> 0>
<SETG QUOTE-FLAG <>>
<RETURN>)
(<BUZZER-WORD? <SET WRD <GET ,P-LEXV .PTR>>>
<RFALSE>)
(<OR <T? .WRD>
<SET WRD <NUMBER? .PTR>>>
<COND (<ZERO? ,P-LEN> <SET NW 0>)
(T <SET NW <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>>)>
<COND (<AND <EQUAL? .WRD ,W?TO>
<EQUAL? .VERB ,ACT?TELL ,ACT?ASK>>
<PUT ,P-ITBL ,P-VERB ,ACT?TELL>
; <SET VERB ,ACT?TELL>
<SET WRD ,W?QUOTE>)
(<AND <EQUAL? .WRD ,W?THEN ; ,W?PERIOD>
; <NOT <EQUAL? .NW ,W?THEN ,W?PERIOD>>
<G? ,P-LEN 0> ; "FIX #40"
<ZERO? .VERB>
<ZERO? ,QUOTE-FLAG>>
<PUT ,P-ITBL ,P-VERB ,ACT?TELL>
<PUT ,P-ITBL ,P-VERBN 0>
<SET WRD ,W?QUOTE>)
(<AND <EQUAL? .WRD ,W?PERIOD>
<OR <EQUAL? .LW ,W?DR ,W?MR ,W?MRS>
<EQUAL? .LW ,W?J>>>
<SETG P-NCN <- ,P-NCN 1>>
<CHANGE-LEXV .PTR .LW T>
<SET WRD .LW>
<SET LW 0>)> ; "FIX #40"
<COND ; (<AND <EQUAL? .WRD ,W?PERIOD>
<EQUAL? .LW ,W?DR ,W?MR ,W?MRS>>
<SET LW 0>)
(<EQUAL? .WRD ,W?THEN ,W?PERIOD ,W?QUOTE>
<COND (<EQUAL? .WRD ,W?QUOTE>
<COND (<T? ,QUOTE-FLAG>
<SETG QUOTE-FLAG <>>)
(T
<SETG QUOTE-FLAG T>)>)>
<OR <ZERO? ,P-LEN>
<SETG P-CONT <+ .PTR ,P-LEXELEN>>>
<PUTB ,P-LEXV ,P-LEXWORDS ,P-LEN>
<RETURN>)
(<AND <SET VAL
<WT? .WRD
,PS?DIRECTION
,P1?DIRECTION>>
<EQUAL? .VERB <> ,ACT?WALK ,ACT?GO>
<OR <EQUAL? .LEN 1>
<AND <EQUAL? .LEN 2>
<EQUAL? .VERB ,ACT?WALK ,ACT?GO>>
<AND <EQUAL? .NW ,W?THEN ,W?PERIOD
,W?QUOTE>
<G? .LEN 1 ;2>>
; <AND <EQUAL? .NW ,W?PERIOD>
<G? .LEN 1>>
<AND <T? ,QUOTE-FLAG>
<EQUAL? .LEN 2>
<EQUAL? .NW ,W?QUOTE>>
<AND <G? .LEN 2>
<EQUAL? .NW ,W?COMMA ,W?AND>>>>
<SET DIR .VAL>
<SETG P-DIR-WORD .WRD>
<COND (<EQUAL? .NW ,W?COMMA ,W?AND>
<CHANGE-LEXV <+ .PTR ,P-LEXELEN>
,W?THEN>)>
<COND (<NOT <G? .LEN 2>>
<SETG QUOTE-FLAG <>>
<RETURN>)>)
(<AND <SET VAL <WT? .WRD ,PS?VERB ,P1?VERB>>
<ZERO? .VERB>>
<SETG P-PRSA-WORD .WRD> ; "For RUN, etc."
<SET VERB .VAL>
<PUT ,P-ITBL ,P-VERB .VAL>
<PUT ,P-ITBL ,P-VERBN ,P-VTBL>
<PUT ,P-VTBL 0 .WRD>
<PUTB ,P-VTBL 2 <GETB ,P-LEXV
<SET TMP1
<+ <* .PTR 2> 2>>>>
<PUTB ,P-VTBL 3 <GETB ,P-LEXV <+ .TMP1 1>>>)
(<OR <SET VAL <WT? .WRD ,PS?PREPOSITION 0>>
<EQUAL? .WRD ,W?A ,W?EVERYTHING>
<EQUAL? .WRD ,W?BOTH ,W?ALL>
<WT? .WRD ,PS?ADJECTIVE>
<WT? .WRD ,PS?OBJECT>>
<COND (<AND <G? ,P-LEN 1> ; "1 IN RETROFIX #34"
<EQUAL? .NW ,W?OF>
<NOT <EQUAL? .VERB
;,ACT?MAKE ,ACT?TAKE>>
<ZERO? .VAL>
<NOT <EQUAL? .WRD ,W?A>>
<NOT <EQUAL? .WRD ,W?ALL ,W?BOTH
,W?EVERYTHING>>>
; <COND (<EQUAL? .WRD ,W?BOTTOM>
<SET BOTTOM T>)>
<PUT ,P-OFW ,P-NCN .WRD> ; "Save OF-word"
<SET OF-FLAG T>)
(<AND <T? .VAL>
<OR <ZERO? ,P-LEN>
<EQUAL? .NW ,W?THEN ,W?PERIOD>>>
<SETG P-END-ON-PREP T>
<COND (<L? ,P-NCN 2>
<PUT ,P-ITBL ,P-PREP1 .VAL>
<PUT ,P-ITBL ,P-PREP1N .WRD>)>)
(<EQUAL? ,P-NCN 2>
<TELL
"[There are too many nouns in that sentence.]" CR>
<RFALSE>)
(T
<SETG P-NCN <+ ,P-NCN 1>>
<OR <SET PTR <CLAUSE .PTR .VAL .WRD>>
<RFALSE>>
<COND (<L? .PTR 0>
<SETG QUOTE-FLAG <>>
<RETURN>)>)>)
(<EQUAL? .WRD ,W?OF> ; "RETROFIX #34"
<COND (<OR <ZERO? .OF-FLAG>
<EQUAL? .NW ,W?PERIOD ,W?THEN>>
<CANT-USE .PTR>
<RFALSE>)
(T
<SET OF-FLAG <>>)>)
(<WT? .WRD ,PS?BUZZ-WORD>)
(<AND <EQUAL? .VERB ,ACT?TELL>
<WT? .WRD ,PS?VERB ;,P1?VERB>>
<WAY-TO-TALK>
<RFALSE>)
(T
<CANT-USE .PTR>
<RFALSE>)>)
(T
<UNKNOWN-WORD .PTR>
<RFALSE>)>
<SET LW .WRD>
<SET PTR <+ .PTR ,P-LEXELEN>>>)>
<PUT ,OOPS-TABLE ,O-PTR <>>
<COND (<T? .DIR>
<SETG PRSA ,V?WALK>
<SETG P-WALK-DIR .DIR>
<SETG AGAIN-DIR .DIR> ; "FIX #44"
<SETG PRSO .DIR>
<SETG P-OFLAG <>>
<RTRUE>)>
<SETG P-WALK-DIR <>>
<SETG AGAIN-DIR <>> ; "FIX #44"
<COND (<AND <T? ,P-OFLAG>
<ORPHAN-MERGE>>
<SETG WINNER .OWINNER>)
; (T
<SETG BOTTOM? .BOTTOM>)>
; <COND (<ZERO? <GET ,P-ITBL ,P-VERB>>
<PUT ,P-ITBL ,P-VERB ,ACT?TELL>)> ; "Why was this here?"
<COND (<AND <SYNTAX-CHECK>
<SNARF-OBJECTS>
<MANY-CHECK>
; <TAKE-CHECK>
<ITAKE-CHECK ,P-PRSO <GETB ,P-SYNTAX ,P-SLOC1>>
<ITAKE-CHECK ,P-PRSI <GETB ,P-SYNTAX ,P-SLOC2>>>
<RTRUE>)>>
<ROUTINE CHANGE-LEXV (PTR WRD "OPTIONAL" (PTRS? <>) "AUX" X Y Z)
<COND (<T? .PTRS?>
<SET X <+ 2 <* 2 <- .PTR ,P-LEXELEN>>>>
<SET Y <GETB ,P-LEXV .X>>
<SET Z <+ 2 <* 2 .PTR>>>
<PUTB ,P-LEXV .Z .Y>
<PUTB ,AGAIN-LEXV .Z .Y>
<SET Y <GETB ,P-LEXV <+ 1 .X>>>
<SET Z <+ 3 <* 2 .PTR>>>
<PUTB ,P-LEXV .Z .Y>
<PUTB ,AGAIN-LEXV .Z .Y>)>
<PUT ,P-LEXV .PTR .WRD>
<PUT ,AGAIN-LEXV .PTR .WRD>
<RTRUE>>
<OBJECT HELLO-OBJECT
(LOC GLOBAL-OBJECTS)
(DESC "that")
(FLAGS NODESC NOARTICLE)
(SYNONYM HELLO GOODBYE HI BYE)
(ACTION WAY-TO-TALK)>
<ROUTINE WAY-TO-TALK ("OPTIONAL" (Q? <>))
<PCLEAR>
<TELL "[Refer to your ">
<ITALICIZE "Trinity">
<TELL " manual for the correct way to address characters.]" CR>
<RFATAL>>
"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."
<ROUTINE WT? (PTR BIT "OPTIONAL" (B1 5) "AUX" (OFFS ,P-P1OFF) TYP)
<COND (<BTST <SET TYP <GETB .PTR ,P-PSOFF>> .BIT>
<COND (<G? .B1 4>
<RTRUE>)
(T
<SET TYP <BAND .TYP ,P-P1BITS>>
<COND (<NOT <EQUAL? .TYP .B1>>
<SET OFFS <+ .OFFS 1>>)>
<GETB .PTR .OFFS>)>)>>
"Scan through a noun phrase, leaving a pointer to its starting location:"
<ROUTINE CLAUSE (PTR VAL WRD "AUX" OFF NUM (ANDFLG <>) (FIRST?? T) NW (LW 0))
<SET OFF <* <- ,P-NCN 1> 2>>
<COND (<T? .VAL>
<PUT ,P-ITBL <SET NUM <+ ,P-PREP1 .OFF>> .VAL>
<PUT ,P-ITBL <+ .NUM 1> .WRD>
<SET PTR <+ .PTR ,P-LEXELEN>>)
(T
<SETG P-LEN <+ ,P-LEN 1>>)>
<COND (<ZERO? ,P-LEN>
<SETG P-NCN <- ,P-NCN 1>>
<RETURN -1>)>
<PUT ,P-ITBL <SET NUM <+ ,P-NC1 .OFF>> <REST ,P-LEXV <* .PTR 2>>>
<COND (<EQUAL? <GET ,P-LEXV .PTR> ,W?THE ,W?A ,W?AN>
<PUT ,P-ITBL .NUM <REST <GET ,P-ITBL .NUM> 4>>)>
<REPEAT ()
<COND (<L? <SETG P-LEN <- ,P-LEN 1>> 0>
<PUT ,P-ITBL <+ .NUM 1> <REST ,P-LEXV <* .PTR 2>>>
<RETURN -1>)>
<COND (<BUZZER-WORD? <SET WRD <GET ,P-LEXV .PTR>>>
<RFALSE>)
(<OR <T? .WRD>
<SET WRD <NUMBER? .PTR>>>
<COND (<ZERO? ,P-LEN>
<SET NW 0>)
(T
<SET NW <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>>)>
; <COND (<AND <EQUAL? .WRD ,W?OF>
<EQUAL? <GET ,P-ITBL ,P-VERB>
,ACT?MAKE ,ACT?TAKE>>
<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?J>>>
<SET LW 0>)
(<EQUAL? .WRD ,W?AND ,W?COMMA>
<SET ANDFLG T>)
(<EQUAL? .WRD ,W?ALL ,W?BOTH ,W?EVERYTHING>
; <OR <EQUAL? .WRD ,W?ALL ,W?BOTH ,W?ONE>
<EQUAL? .WRD ,W?EVERYTHING>>
<COND (<EQUAL? .NW ,W?OF>
<SETG P-LEN <- ,P-LEN 1>>
<SET PTR <+ .PTR ,P-LEXELEN>>)>)
(<OR <EQUAL? .WRD ,W?THEN ,W?PERIOD>
<AND <WT? .WRD ,PS?PREPOSITION>
<GET ,P-ITBL ,P-VERB>
<NOT .FIRST??>>>
<SETG P-LEN <+ ,P-LEN 1>>
<PUT ,P-ITBL
<+ .NUM 1>
<REST ,P-LEXV <* .PTR 2>>>
<RETURN <- .PTR ,P-LEXELEN>>)
;"3/16/83: This clause used to be later."
(<AND <T? .ANDFLG>
<OR ;"3/25/83: next statement added."
<ZERO? <GET ,P-ITBL ,P-VERBN>>
;"10/26/84: next stmt changed"
<VERB-DIR-ONLY? .WRD>>>
<SET PTR <- .PTR 4>>
<CHANGE-LEXV <+ .PTR 2> ,W?THEN>
<SETG P-LEN <+ ,P-LEN 2>>)
(<WT? .WRD ,PS?OBJECT>
<COND (<AND <G? ,P-LEN 0>
<EQUAL? .NW ,W?OF>
<NOT <EQUAL? .WRD ,W?ALL ; ,W?ONE
,W?EVERYTHING>>>
<PUT ,P-OFW <- ,P-NCN 1> .WRD>)
(<AND <WT? .WRD ,PS?ADJECTIVE
;,P1?ADJECTIVE>
<T? .NW>
<WT? .NW ,PS?OBJECT>>
T)
(<AND <ZERO? .ANDFLG>
<NOT <EQUAL? .NW ,W?BUT ,W?EXCEPT>>
<NOT <EQUAL? .NW ,W?AND ,W?COMMA>>>
<PUT ,P-ITBL
<+ .NUM 1>
<REST ,P-LEXV <* <+ .PTR 2> 2>>>
<RETURN .PTR>)
(T
<SET ANDFLG <>>)>)
; "Next clause replaced by following one to enable OLD WOMAN, HELLO"
; (<AND <OR <T? ,P-MERGED>
<T? ,P-OFLAG>
<T? <GET ,P-ITBL ,P-VERB>>>
<OR <WT? .WRD ,PS?ADJECTIVE>
<WT? .WRD ,PS?BUZZ-WORD>>>)
(<OR <WT? .WRD ,PS?ADJECTIVE>
<WT? .WRD ,PS?BUZZ-WORD>>
T)
(<AND <T? .ANDFLG>
<ZERO? <GET ,P-ITBL ,P-VERB>>>
<SET PTR <- .PTR 4>>
<CHANGE-LEXV <+ .PTR 2> ,W?THEN>
<SETG P-LEN <+ ,P-LEN 2>>)
(<WT? .WRD ,PS?PREPOSITION>
T)
(T
<CANT-USE .PTR>
<RFALSE>)>)
(T
<UNKNOWN-WORD .PTR>
<RFALSE>)>
<SET LW .WRD>
<SET FIRST?? <>>
<SET PTR <+ .PTR ,P-LEXELEN>>>>
<ROUTINE SPOKEN-TO (WHO)
<COND (<OR <NOT <EQUAL? .WHO ,QCONTEXT>>
<NOT <EQUAL? ,HERE ,QCONTEXT-ROOM>>>
<SETG QCONTEXT .WHO>
<SETG QCONTEXT-ROOM <LOC .WHO>>
<THIS-IS-IT .WHO>
<TELL "[spoken to " THE .WHO ,BRACKET>)>
<RTRUE>>
<ROUTINE THIS-IS-IT (OBJ)
<COND (<OR <EQUAL? .OBJ <> ,PLAYER ,NOT-HERE-OBJECT>
<EQUAL? .OBJ ,INTDIR ,INTNUM ,RIGHT>
<EQUAL? .OBJ ,LEFT>>
<RTRUE>)
(<AND <VERB? WALK WALK-TO>
<EQUAL? .OBJ ,PRSO>>
<RTRUE>)
(<EQUAL? .OBJ ,BWOMAN ,JWOMAN ,GIRL>
<SETG P-HER-OBJECT .OBJ>
<RTRUE>)
(<OR <EQUAL? .OBJ ,GIANT ,GOON ,CHARON>
<EQUAL? .OBJ ,BOY ,PHOTO>>
<SETG P-HIM-OBJECT .OBJ>
<RTRUE>)
(<IS? .OBJ ,PLURAL>
<SETG P-THEM-OBJECT .OBJ>
<RTRUE>)
(T
<SETG P-IT-OBJECT .OBJ>
<RTRUE>)>>
<ROUTINE FAKE-ORPHAN ("AUX" TMP)
<ORPHAN ,P-SYNTAX <>>
<BE-SPECIFIC>
<SET TMP <GET ,P-OTBL ,P-VERBN>>
<COND (<ZERO? .TMP>
<TELL "tell">)
(<ZERO? <GETB ,P-VTBL 2>>
<PRINTB <GET .TMP 0>>)
(T
<WORD-PRINT <GETB .TMP 2> <GETB .TMP 3>>
<PUTB ,P-VTBL 2 0>)>
<SETG P-OFLAG T>
<SETG P-WON <>>
<TELL "?]" CR>
<RTRUE>>
<GLOBAL NOW-PRSI?:FLAG <>>
<CONSTANT NSVERBS 20> "Number of SEEVERBS"
<GLOBAL SEEVERBS:TABLE
<PTABLE V?EXAMINE V?LOOK V?LOOK-INSIDE V?LOOK-ON V?READ V?FIND
V?SEARCH V?SHOW V?LOOK-UNDER V?LOOK-BEHIND V?LOOK-THRU
V?LOOK-DOWN V?LOOK-UP V?READ-TO V?LOOK-OUTSIDE V?COUNT
V?WATCH V?FOCUS-ON V?ADJUST V?POINT>>
<ROUTINE PERFORM (A "OPTIONAL" (O <>) (I <>)
"AUX" (V <>) OA OO OI ONP (WHO <>) (TUCH <>))
#DECL ((A) FIX (O) <OR FALSE OBJECT FIX> (I) <OR FALSE OBJECT>)
<COND (<AND <NOT <EQUAL? ,WINNER ,PLAYER>>
<NOT <IS? ,WINNER ,PERSON>>>
<NOT-LIKELY ,WINNER "would respond">
<PCLEAR>
<RFATAL>)>
<SET OA ,PRSA>
<SET OO ,PRSO>
<SET OI ,PRSI>
<SET ONP ,NOW-PRSI?>
<SET WHO <ANYONE-HERE?>>
<SETG PRSA .A>
<COND (<AND <ZERO? ,LIT?>
<INTBL? .A ,SEEVERBS ,NSVERBS>>
<TOO-DARK>
<RFATAL>)
(<NOT <EQUAL? .A ,V?WALK>>
<COND (<AND <EQUAL? ,WINNER ,PLAYER>
<VERB? WHO WHAT WHERE>>
<COND (<ZERO? .WHO>
<NOBODY-TO-ASK>
<RFATAL>)
(T
<SETG WINNER .WHO>
<SPOKEN-TO .WHO>)>)
(<AND <EQUAL? ,WINNER ,PLAYER>
<EQUAL? .O ,ME>
<VERB? TELL TELL-ABOUT ASK-ABOUT ASK-FOR
QUESTION REPLY THANK YELL HELLO GOODBYE
SAY ALARM>>
<COND (<ZERO? .WHO>
<TALK-TO-SELF>
<RFATAL>)
(T
<SETG WINNER .WHO>
<SPOKEN-TO .WHO>)>)>
<COND (<EQUAL? ,YOU .I .O>
<COND (<EQUAL? ,WINNER ,PLAYER>
<COND (<ZERO? .WHO>
<TALK-TO-SELF>
<RFATAL>)
(T
<SETG WINNER .WHO>
<SPOKEN-TO .WHO>)>)
(T
<SETG QCONTEXT ,WINNER>
<SETG QCONTEXT-ROOM <LOC ,WINNER>>
<SET WHO ,WINNER>)>
<COND (<EQUAL? .I ,YOU>
<SET I .WHO>)>
<COND (<EQUAL? .O ,YOU>
<SET O .WHO>)>)>
<COND (<AND <EQUAL? ,IT .I .O>
<NOT <ACCESSIBLE? ,P-IT-OBJECT>>>
<COND (<ZERO? .I>
<FAKE-ORPHAN>)
(T
<CANT-SEE-ANY ,P-IT-OBJECT>)>
<RFATAL>)>
<COND (<EQUAL? ,THEM .I .O>
<COND (<VISIBLE? ,P-THEM-OBJECT>
<COND (<EQUAL? ,THEM .O>
<SET O ,P-THEM-OBJECT>)>
<COND (<EQUAL? ,THEM .I>
<SET I ,P-THEM-OBJECT>)>)
(T
<COND (<ZERO? .I>
<FAKE-ORPHAN>)
(T
<CANT-SEE-ANY ,P-THEM-OBJECT>)>
<RFATAL>)>)>
<COND (<EQUAL? ,HER .I .O>
<COND (<VISIBLE? ,P-HER-OBJECT>
<COND (<AND <EQUAL? ,P-HER-OBJECT ,WINNER>
<NO-OTHER? T>>
<RFATAL>)>
<COND (<EQUAL? ,HER .O>
<SET O ,P-HER-OBJECT>)>
<COND (<EQUAL? ,HER .I>
<SET I ,P-HER-OBJECT>)>)
(T
<COND (<ZERO? .I>
<FAKE-ORPHAN>)
(T
<CANT-SEE-ANY ,P-HER-OBJECT>)>
<RFATAL>)>)>
<COND (<EQUAL? ,HIM .I .O>
<COND (<VISIBLE? ,P-HIM-OBJECT>
<COND (<AND <EQUAL? ,P-HIM-OBJECT ,WINNER>
<NO-OTHER?>>
<RFATAL>)>
<COND (<EQUAL? ,HIM .O>
<SET O ,P-HIM-OBJECT>)>
<COND (<EQUAL? ,HIM .I>
<SET I ,P-HIM-OBJECT>)>)
(T
<COND (<ZERO? .I>
<FAKE-ORPHAN>)
(T
<CANT-SEE-ANY ,P-HIM-OBJECT>)>
<RFATAL>)>)>
<COND (<EQUAL? .O ,IT>
<SET O ,P-IT-OBJECT>)>
<COND (<EQUAL? .I ,IT>
<SET I ,P-IT-OBJECT>)>)>
<SETG PRSI .I>
<SETG PRSO .O>
<SET V <>>
<COND (<AND <NOT <EQUAL? .A ,V?WALK>>
<EQUAL? ,NOT-HERE-OBJECT ,PRSO ,PRSI>>
<SET V <APPLY ,NOT-HERE-OBJECT-F>>
<COND (<T? .V>
<SETG P-WON <>>)>)>
; <THIS-IS-IT ,PRSI>
<THIS-IS-IT ,PRSO>
<SET O ,PRSO>
<SET I ,PRSI>
; <COND (<T? ,DEBUG?>
<TELL "[PRSO = ">
<SAY-IT .O>
<TELL ", PRSI = ">
<SAY-IT .I>
; <TELL ", WINNER = ">
; <SAY-IT ,WINNER>
; <TELL "]|
[DIR-WORD = ">
; <SAY-WORD ,P-DIR-WORD>
<TELL ", A-WORD = ">
<SAY-WORD ,P-PRSA-WORD>
<TELL ", O-NOUN = ">
<SAY-WORD <GET ,P-NAMW 0>>
; <TELL ", O-ADJ = ">
; <SAY-WORD <GET ,P-ADJW 0>>
<TELL ", I-NOUN = ">
<SAY-WORD <GET ,P-NAMW 1>>
; <TELL ", I-ADJ = ">
; <SAY-WORD <GET ,P-ADJW 1>>
<TELL ", P-MULT? = ">
<COND (<ZERO? ,P-MULT?> <TELL "<>">) (T <TELL "T">)>
<TELL "]" CR>)>
<COND (<ZERO? .V>
<SET V <APPLY <GETP ,WINNER ,P?ACTION> ,M-WINNER>>)>
<COND (<ZERO? .V>
<SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-BEG>>)>
<COND (<ZERO? .V>
<SET V <APPLY <GET ,PREACTIONS .A>>>)>
<COND (<OR <INTBL? .A ,TOUCHVERBS ,NTOUCHES>
<INTBL? .A ,HURTVERBS ,NHVERBS>>
<SET TUCH T>)>
<COND (<AND <ZERO? .V>
<T? ,IN-PRAM?>
<EQUAL? ,WINNER ,PLAYER>
<OR <AND <VERB? WALK>
<NOT <EQUAL? ,P-WALK-DIR ,P?OUT ,P?IN>>>
<AND <NOT <EQUAL? .O <> ,PRAM ,POCKET>>
<LOC .O>
<NOT <IN? .O ,GLOBAL-OBJECTS>>
<ZERO? ,P-WALK-DIR>
<T? .TUCH>
<NOT <GOT? .O>>
<NOT <IN? .O ,PRAM>>
<NOT <IN? <LOC .O> ,PRAM>>>
<AND <NOT <EQUAL? .I <> ,PRAM ,POCKET>>
<LOC .I>
<NOT <IN? .I ,GLOBAL-OBJECTS>>
<T? .TUCH>
<NOT <GOT? .I>>
<NOT <IN? .I ,PRAM>>
<NOT <IN? <LOC .I> ,PRAM>>>>>
<CANT-WHILE-IN-PRAM>
<SET V T>)>
<COND (<AND <ZERO? .V>
<T? ,IN-DISH?>
<EQUAL? ,WINNER ,PLAYER>
<OR <AND <VERB? WALK>
<NOT <EQUAL? ,P-WALK-DIR ,P?OUT ,P?IN>>>
<AND <NOT <EQUAL? .O <> ,DISH ,POCKET>>
<LOC .O>
<NOT <IN? .O ,GLOBAL-OBJECTS>>
<ZERO? ,P-WALK-DIR>
<T? .TUCH>
<NOT <GOT? .O>>
<NOT <IN? .O ,DISH>>>
<AND <NOT <EQUAL? .I <> ,DISH ,POCKET>>
<LOC .I>
<NOT <IN? .I ,GLOBAL-OBJECTS>>
<T? .TUCH>
<NOT <GOT? .I>>
<NOT <IN? .I ,DISH>>>>>
<EXIT-DISH-FIRST>
<SET V T>)>
<COND (<AND <ZERO? .V>
<T? ,SUITED?>
<EQUAL? ,WINNER ,PLAYER>
<OR <AND <T? .O>
<NOT <EQUAL? .O ,FILM ,LUMP ,POCKET>>
<LOC .O>
<NOT <IN? .O ,GLOBAL-OBJECTS>>
<ZERO? ,P-WALK-DIR>
<NOT <IN? .O ,LUMP>>
<T? .TUCH>
<NOT <GOT? .O>>>
<AND <T? .I>
<NOT <EQUAL? .I ,FILM ,LUMP ,POCKET>>
<LOC .I>
<NOT <IN? .I ,GLOBAL-OBJECTS>>
<NOT <IN? .I ,LUMP>>
<OR <T? .TUCH>
<EQUAL? .A ,V?THROW ,V?THROW-OVER>>
<NOT <GOT? .I>>>>>
<CANT-REACH-THRU-FILM>
<SET V T>)>
<COND (<AND <ZERO? .V>
<T? ,IN-DORY?>
<EQUAL? ,WINNER ,PLAYER>
<OR <AND <VERB? WALK>
<NOT <EQUAL? ,P-WALK-DIR ,P?OUT ,P?IN>>>
<AND <NOT <EQUAL? .O <> ,DORY ,POCKET>>
<LOC .O>
<NOT <IN? .O ,GLOBAL-OBJECTS>>
<ZERO? ,P-WALK-DIR>
<T? .TUCH>
<NOT <GOT? .O>>
<NOT <IN? .O ,DORY>>
<NOT <IN? <LOC .O> ,DORY>>>
<AND <NOT <EQUAL? .I <> ,DORY ,POCKET>>
<LOC .I>
<NOT <IN? .I ,GLOBAL-OBJECTS>>
<T? .TUCH>
<NOT <GOT? .I>>
<NOT <IN? .I ,DORY>>
<NOT <IN? <LOC .I> ,DORY>>>>>
<TELL "You couldn't do that while you're in the dory." CR>
<SET V T>)>
<COND (<NOT <EQUAL? .A ,V?TELL-ABOUT ,V?ASK-ABOUT ,V?ASK-FOR>>
<SETG NOW-PRSI? T>
<COND (<AND <ZERO? .V>
<T? .I>
<NOT <EQUAL? .A ,V?WALK>>
<LOC .I>>
<SET V <GETP <LOC .I> ,P?CONTFCN>>
<COND (<T? .V>
<SET V <APPLY .V ,M-CONT>>)>)>
<SETG NOW-PRSI? <>>
<COND (<AND <ZERO? .V>
<T? .O>
<NOT <EQUAL? .A ,V?WALK>>
<LOC .O>>
<SET V <GETP <LOC .O> ,P?CONTFCN>>
<COND (<T? .V>
<SET V <APPLY .V ,M-CONT>>)>)>
<SETG NOW-PRSI? T>
<COND (<AND <ZERO? .V>
<T? .I>>
<SET V <APPLY <GETP .I ,P?ACTION>>>)>)>
<SETG NOW-PRSI? <>>
; <COND (<AND <ZERO? .V>
<T? .O>
<NOT <EQUAL? .A ,V?WALK>>
<LOC .O>>
<SET V <GETP <LOC .O> ,P?CONTFCN>>
<COND (<T? .V>
<SET V <APPLY .V ,M-CONT>>)>)>
<COND (<AND <ZERO? .V>
<T? .O>
<NOT <EQUAL? .A ,V?WALK>>>
<SET V <APPLY <GETP .O ,P?ACTION>>>
; <COND (<T? .V>
<THIS-IS-IT .O>)>)>
<COND (<ZERO? .V>
<SET V <APPLY <GET ,ACTIONS .A>>>)>
<SETG PRSA .OA>
<SETG PRSO .OO>
<SETG PRSI .OI>
<SETG NOW-PRSI? .ONP>
<RETURN .V>>
<ROUTINE NO-OTHER? ("OPTIONAL" (FEMALE? <>) "AUX" OBJ)
<SET OBJ <FIRST? ,HERE>>
<REPEAT ()
<COND (<T? .OBJ>
<COND (<AND <NOT <EQUAL? .OBJ ,WINNER>>
<IS? .OBJ ,PERSON>>
<COND (<T? .FEMALE?>
<COND (<IS? .OBJ ,FEMALE>
<RETURN>)>)
(<NOT <IS? .OBJ ,FEMALE>>
<RETURN>)>)>
<SET OBJ <NEXT? .OBJ>>)
(T
<RETURN>)>>
<COND (<ZERO? .OBJ>
<LOOKS-PUZZLED ,WINNER>
<TELL "To whom are you referring?\"" CR>
<RTRUE>)
(T
<RFALSE>)>>
<ROUTINE NOBODY-TO-ASK ()
<PCLEAR>
<TELL "[There's nobody here to ask.]" CR>
<RTRUE>>
<ROUTINE CANT-REACH-THRU-FILM ()
<TELL ,CANT "reach through the " D ,FILM ,PERIOD>
<RTRUE>>
<ROUTINE TALK-TO-SELF ()
<PCLEAR>
<TELL "[You must address characters directly.]" CR>