559f412ef7e3610f8b6d1950ad80c5c1b519da27
[informlib.git] / parser.h
1 ! ==============================================================================
2 !   PARSER:  Front end to parser.
3 !
4 !   Supplied for use with Inform 6 -- Release 6.12.1 -- Serial number 160605
5 !
6 !   Copyright Graham Nelson 1993-2004 and David Griffith 2012-2016
7 !
8 !   This file is free software: you can redistribute it and/or modify
9 !   it under the terms of the GNU Affero General Public License as
10 !   published by the Free Software Foundation, either version 3 of the
11 !   License, or (at your option) any later version.
12 !
13 !   This file is distributed in the hope that it will be useful, but
14 !   WITHOUT ANY WARRANTY; without even the implied warranty of
15 !   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 !   Affero General Public License for more details.
17 !
18 !   You should have received a copy of the GNU Affero General Public
19 !   License along with this program. If not, see
20 !   https://gnu.org/licenses/
21 !
22 !   In your game file, Include three library files in this order:
23 !       Include "parser";
24 !       Include "verblib";
25 !       Include "grammar";
26 ! ==============================================================================
27
28 System_file;
29
30 #Ifndef LIBRARY_STAGE;  ! This file is the first one to define LIBRARY_STAGE.
31                 ! "This file already included" <=> "LIBRARY_STAGE exists"
32
33 ! ------------------------------------------------------------------------------
34
35 #Ifndef VN_1633;
36 Message fatalerror "*** Library 6.12.1 needs Inform v6.33 or later to work ***";
37 #Endif; ! VN_
38
39 Constant LibSerial       "160605";
40 Constant LibRelease      "6.12.1";
41 Constant LIBRARY_VERSION  612;
42 Constant Grammar__Version 2;
43
44 Constant BEFORE_PARSER   10;
45 Constant AFTER_PARSER    20;
46 Constant AFTER_VERBLIB   30;
47 Constant AFTER_GRAMMAR   40;
48
49 Constant LIBRARY_STAGE = BEFORE_PARSER;
50
51 Default COMMENT_CHARACTER '*';
52
53 #Ifdef INFIX;
54 Default DEBUG 0;
55 #Endif; ! INFIX
56
57 #Ifndef WORDSIZE;                   ! compiling with Z-code only compiler
58 Default TARGET_ZCODE 0;
59 Constant WORDSIZE 2;
60 #Endif; ! WORDSIZE
61
62 #Ifdef TARGET_ZCODE;                ! offsets into Z-machine header
63
64 Constant HDR_ZCODEVERSION  $00;     ! byte
65 Constant HDR_TERPFLAGS     $01;     ! byte
66 Constant HDR_GAMERELEASE   $02;     ! word
67 Constant HDR_HIGHMEMORY    $04;     ! word
68 Constant HDR_INITIALPC     $06;     ! word
69 Constant HDR_DICTIONARY    $08;     ! word
70 Constant HDR_OBJECTS       $0A;     ! word
71 Constant HDR_GLOBALS       $0C;     ! word
72 Constant HDR_STATICMEMORY  $0E;     ! word
73 Constant HDR_GAMEFLAGS     $10;     ! word
74 Constant HDR_GAMESERIAL    $12;     ! six ASCII characters
75 Constant HDR_ABBREVIATIONS $18;     ! word
76 Constant HDR_FILELENGTH    $1A;     ! word
77 Constant HDR_CHECKSUM      $1C;     ! word
78 Constant HDR_TERPNUMBER    $1E;     ! byte
79 Constant HDR_TERPVERSION   $1F;     ! byte
80 Constant HDR_SCREENHLINES  $20;     ! byte
81 Constant HDR_SCREENWCHARS  $21;     ! byte
82 Constant HDR_SCREENWUNITS  $22;     ! word
83 Constant HDR_SCREENHUNITS  $24;     ! word
84 Constant HDR_FONTWUNITS    $26;     ! byte
85 Constant HDR_FONTHUNITS    $27;     ! byte
86 Constant HDR_ROUTINEOFFSET $28;     ! word
87 Constant HDR_STRINGOFFSET  $2A;     ! word
88 Constant HDR_BGCOLOUR      $2C;     ! byte
89 Constant HDR_FGCOLOUR      $2D;     ! byte
90 Constant HDR_TERMCHARS     $2E;     ! word
91 Constant HDR_PIXELSTO3     $30;     ! word
92 Constant HDR_TERPSTANDARD  $32;     ! two bytes
93 Constant HDR_ALPHABET      $34;     ! word
94 Constant HDR_EXTENSION     $36;     ! word
95 Constant HDR_UNUSED        $38;     ! two words
96 Constant HDR_INFORMVERSION $3C;     ! four ASCII characters
97
98 #Ifnot; ! TARGET_GLULX              ! offsets into Glulx header and start of ROM
99
100 Constant HDR_MAGICNUMBER   $00;     ! long word
101 Constant HDR_GLULXVERSION  $04;     ! long word
102 Constant HDR_RAMSTART      $08;     ! long word
103 Constant HDR_EXTSTART      $0C;     ! long word
104 Constant HDR_ENDMEM        $10;     ! long word
105 Constant HDR_STACKSIZE     $14;     ! long word
106 Constant HDR_STARTFUNC     $18;     ! long word
107 Constant HDR_DECODINGTBL   $1C;     ! long word
108 Constant HDR_CHECKSUM      $20;     ! long word
109 Constant ROM_INFO          $24;     ! four ASCII characters
110 Constant ROM_MEMORYLAYOUT  $28;     ! long word
111 Constant ROM_INFORMVERSION $2C;     ! four ASCII characters
112 Constant ROM_COMPVERSION   $30;     ! four ASCII characters
113 Constant ROM_GAMERELEASE   $34;     ! short word
114 Constant ROM_GAMESERIAL    $36;     ! six ASCII characters
115
116 Include "infglk";
117
118 #Endif; ! TARGET_
119
120 Include "linklpa";
121
122 Fake_Action LetGo;
123 Fake_Action Receive;
124 Fake_Action ThrownAt;
125 Fake_Action Order;
126 Fake_Action TheSame;
127 Fake_Action PluralFound;
128 Fake_Action ListMiscellany;
129 Fake_Action Miscellany;
130 Fake_Action Prompt;
131 Fake_Action NotUnderstood;
132 Fake_Action Going;
133
134 #Ifdef NO_PLACES;
135 Fake_Action Places;
136 Fake_Action Objects;
137 #Endif; ! NO_PLACES
138
139 ! ------------------------------------------------------------------------------
140
141 [ Main; InformLibrary.play(); ];
142
143 ! ------------------------------------------------------------------------------
144
145 #Ifdef USE_MODULES;
146 Link "parserm";
147 #Ifnot;
148 Include "parserm";
149 #Endif; ! USE_MODULES
150
151 ! ==============================================================================
152
153 Undef LIBRARY_STAGE; Constant LIBRARY_STAGE = AFTER_PARSER;
154
155 #Ifnot;
156 Message "Warning: 'parser' included twice; ignoring second inclusion. (Ignore this if this is on purpose.)";
157 #Endif;
158 ! ==============================================================================