Debian Codegraph @

terps/tads/tads3/lib/adv3/en_us/en_us.h

raw symbols SCIP
1 #charset "us-ascii"
2
3 /*
4 * Copyright (c) 2000, 2006 Michael J. Roberts. All Rights Reserved.
5 *
6 * TADS 3 Library - US English header
7 *
8 * This file defines common properties, macros, and other identifiers used
9 * throughout the US English modules of the TADS 3 library.
10 */
11
12
13 /* ------------------------------------------------------------------------ */
14 /*
15 * Vocabulary properties for parts of speech we use in the English parser.
16 *
17 * These properties are defined in the English-specific header because
18 * other languages might classify their parts of speech differently; for
19 * example, a French parser might distinguish nouns according to gender,
20 * and thus require masculineNoun and feminineNoun properties instead of a
21 * single noun property.
22 *
23 * adjApostS is a special adjective form for adjectives that are
24 * explicitly defined in vocabulary with a "'s" suffix. In most cases,
25 * it's not necessary to explicitly define possessive words explicitly in
26 * an object's vocabulary, because the parser's possessive qualifier
27 * phrase grammar allows any valid noun phrase to be used in a 's
28 * possessive form to indicate ownership. However, this only works when
29 * ownership is actually modeled in the game; that is, this only works
30 * when one object has an ownership relation with another object, using
31 * the owner/isOwnedBy mechanism in Thing. Sometimes, a possessive word
32 * is just a literal part of an object's name, and the nominal owner
33 * doesn't actually exist as an object in the game: "Mom's Old-Fashioned
34 * Robot Oil," for example. In these cases, the object can include the
35 * possessive word *without* the 's suffix ("Mom") as a vocabulary word
36 * for the object, using the adjApostS property.
37 *
38 * A literalAdjective is like an adjective, but behaves a little
39 * differently in the grammar. A literal adjective can be optionally
40 * enclosed in quotes (for example, we could refer to an elevator button
41 * labeled "G" as "'G' button" or simply "G button"). In addition, a
42 * literal adjective can be placed after the noun it modifies (hence
43 * "button 'G'" or "button G").
44 */
45 dictionary property noun, adjective, plural, adjApostS, literalAdjective;
46
47
48 /*
49 * Numeric parts of speech:
50 *
51 * digitWord - a name for a digit (zero through nine)
52 *
53 * teenWord - a name for a 'teen' (ten through nineteen) - we distinguish
54 * these because there's no general grammatical rule for constructing
55 * names for these numbers out of smaller lexical units. We include ten
56 * in this set, rather than in the teenWord set, because ten cannot be
57 * combined with digit words to form other numbers.
58 *
59 * tensWord - a name for a multiple of ten (twenty, thirty, ..., ninety).
60 * The words in this set can be used to construct the numbers from 20 to
61 * 99 by combining them with digit words using a hyphen (as in
62 * "twenty-two").
63 *
64 * ordinalWord - an ordinal, such as '1st' or 'first'.
65 */
66 dictionary property digitWord, teenWord, tensWord;
67 dictionary property ordinalWord;
68
69
70 /* ------------------------------------------------------------------------ */
71 /*
72 * Templates for the basic vocabulary object
73 */
74 VocabObject template 'vocabWords';
75
76 /*
77 * Define some templates that apply to ordinary objects (descendants of
78 * Thing).
79 */
80 Thing template 'vocabWords' 'name' @location? "desc"?;
81
82 /*
83 * For rooms, we normally have no vocabulary words, but we do have a name
84 * and description, and optionally a "destination name" to use to describe
85 * connectors from adjoining rooms.
86 */
87 Room template 'roomName' 'destName'? 'name'? "desc"?;
88
89 /*
90 * For actors, we generally override the npcDesc or pcDesc rather than the
91 * base desc. For the standard templates, set the npcDesc, since most
92 * actors are NPC's rather than the player character.
93 */
94 Actor template 'vocabWords' 'name' @location? "npcDesc";
95
96 /*
97 * For passages, allow special syntax to point to the master side of the
98 * passage.
99 */
100 Passage template ->masterObject inherited;
101
102 /*
103 * For one-way room connectors, provide special syntax to point to the
104 * destination room.
105 */
106 OneWayRoomConnector template ->destination;
107
108 /*
109 * For enterables, allow special syntax to point to the connector which an
110 * actor uses to traverse into the enterable.
111 */
112 Enterable template ->connector inherited;
113 Exitable template ->connector inherited;
114
115 /*
116 * For TravelMessage connectors, provide special syntax to specify the
117 * message and point to the destination.
118 */
119 TravelMessage template ->destination "travelDesc" | [eventList];
120
121 /*
122 * For connectors that don't go anywhere but do show a message on a travel
123 * attempt, we just need to specify the travel message.
124 */
125 NoTravelMessage template "travelDesc" | [eventList];
126 DeadEndConnector template 'apparentDestName'? "travelDesc" | [eventList];
127
128 /*
129 * Unthings are defined pretty much like Things, except they have no use
130 * for a desc, and frequently want a custom notHereMsg.
131 */
132 Unthing template 'vocabWords' 'name' @location? 'notHereMsg'?;
133
134 /* ThingState objects */
135 ThingState template 'listName_' +listingOrder?;
136
137
138
139 /* ------------------------------------------------------------------------ */
140 /*
141 * Convenience macros for defining command grammar.
142 *
143 * A command's grammar is defined via a 'grammar' rule definition for the
144 * 'predicate' production; the VerbRule macro can be used for better
145 * readability.
146 *
147 * Within a command grammar rule, there are several commonly-used object
148 * roles assigned to single-noun or noun-list phrases. We provide the
149 * singleDobj, dobjList, singleIobj, and iobjList macros to make these
150 * assignments more readable. In addition, number, topic, literal, and
151 * direction phrases can be assigned with singleNumber, singleTopic,
152 * singleLiteral, and singleDir, respectively.
153 */
154
155 #define VerbRule(tag) grammar predicate(tag):
156 #define singleDobj singleNoun->dobjMatch
157 #define singleIobj singleNoun->iobjMatch
158 #define dobjList nounList->dobjMatch
159 #define iobjList nounList->iobjMatch
160 #define singleNumber numberPhrase->numMatch
161 #define singleTopic topicPhrase->topicMatch
162 #define singleLiteral literalPhrase->literalMatch
163 #define singleDir directionName->dirMatch
164
165
166 /* ------------------------------------------------------------------------ */
167 /*
168 * Convenience macros for controlling the narrative tense.
169 */
170
171 /*
172 * Set the current narrative tense. Use val = true for past and
173 * val = nil for present.
174 */
175 #define setPastTense(val) (gameMain.usePastTense = (val))
176
177 /*
178 * Shorthand macro for selecting one of two values depending on the
179 * current narrative tense.
180 */
181 #define tSel(presVal, pastVal) \
182 (gameMain.usePastTense ? (pastVal) : (presVal))
183
184 /*
185 * Temporarily override the current narrative tense and invoke a callback
186 * function.
187 */
188 #define withPresent(callback) (withTense(nil, (callback)))
189 #define withPast(callback) (withTense(true, (callback)))