vhyl.h
Back to reference
1 /* Public declarations for vhyl: relations, vocabulary and verification ranks.
2 * Copyright (c) 2026 John Cunningham. MIT License; see LICENSE. */
3
4 enum token tokWord;
5 property firstTokenIndex, lastTokenIndex, tokenList;
6
7 property badness;
8 dictionary vhylDict;
9
10 property noun, adjective;
11
12 /*
13 * The three tables a world is made of. Containment is one_to_many read from
14 * either side; travel is a labelled family, one table per direction; vocabulary
15 * lives in the dictionary.
16 */
17 /** @api author
18 * Places an item in one container; read the inverse through location. */
19 relation contains(container: Entity, item: Entity) one_to_many reverse location;
20 /** @api author
21 * Connects rooms by a direction for travel. */
22 relation exits(from: Entity, to: Entity, way: Direction) one_to_one;
23 /** @api author
24 * Assigns noun and adjective words to an entity. */
25 relation vocab(entity: Entity, word: Text, part: Vocabulary) many_to_many;
26
27 /** @api author
28 * Associates a door with every room from which it can be used. */
29 relation connects(door: Entity, room: Entity) many_to_many;
30
31 /*
32 * Where a MultiLoc stands. Containment is one_to_many, so a thing has one
33 * container and that is the right rule for nearly everything. A sky, a hedge or
34 * a stretch of river is in several rooms at once and is not contained by any of
35 * them, so it gets a table of its own rather than bending the containment one.
36 */
37 /** @api author
38 * Places a MultiLoc in several rooms without changing containment. */
39 relation presentIn(thing: Entity, room: Entity) many_to_many;
40
41 /** @api author
42 * Records explicit knowledge of another entity. */
43 relation knows(knower: Entity, subject: Entity) many_to_many;
44
45 /** @api author
46 * Records attachment between two entities. */
47 relation attachedTo(one: Entity, other: Entity) many_to_many;
48
49 + property location;
50
51 enum Direction: north, south, east, west,
52 northeast, northwest, southeast, southwest,
53 up, down, inward, outward;
54
55 enum posIn, posOn, posUnder, posBehind;
56
57 enum standing, sitting, lying;
58
59 enum dobjRole, iobjRole;
60
61 #define TypeInt 7
62 #define TypeSString 8
63
64 #define FirstPerson 1
65 #define SecondPerson 2
66 #define ThirdPerson 3
67
68 #define rankLogical 100
69 #define rankDangerous 90
70 #define rankUnlikely 60
71 #define rankAlready 45
72 #define rankNotNow 40
73 #define rankIllogical 30
74 #define rankSelf 20
75
76 #define rankNonObvious 10
77 #define rankNever 0
78
79 #define rankImplicit rankLogical
80
81 /*
82 * These live in the header rather than beside the Action class because `#define`
83 * is textual and sequential: a rank named in a class declared earlier in the
84 * library would not be defined yet.
85 */