Debian Codegraph @

terps/advsys/advdbs.h

raw symbols SCIP
1 /* advdbs.h - adventure database definitions */
2 /*
3 Copyright (c) 1986, by David Michael Betz
4 All rights reserved
5 */
6
7 /* useful constants */
8 #define T -1
9 #define NIL 0
10 #define WRDSIZE 6
11
12 /* data structure version number */
13 #define VERSION 102
14
15 /* file header offsets */
16 #define HDR_LENGTH 0 /* length of header in bytes */
17 #define HDR_MAGIC 2 /* magic information (6 bytes) */
18 #define HDR_VERSION 8 /* data structure version number */
19 #define HDR_ANAME 10 /* adventure name (18 bytes) */
20 #define HDR_AVERSION 28 /* adventure version number */
21 #define HDR_WTABLE 30 /* offset to word table */
22 #define HDR_WTYPES 32 /* offset to word type table */
23 #define HDR_OTABLE 34 /* offset to object table */
24 #define HDR_ATABLE 36 /* offset to action table */
25 #define HDR_VTABLE 38 /* offset to variable table */
26 #define HDR_DBASE 40 /* offset to base of data space */
27 #define HDR_CBASE 42 /* offset to base of code space */
28 #define HDR_DATBLK 44 /* first data block */
29 #define HDR_MSGBLK 46 /* first message text block */
30 #define HDR_INIT 48 /* initialization code */
31 #define HDR_UPDATE 50 /* update code */
32 #define HDR_BEFORE 52 /* code to execute before verb handler */
33 #define HDR_AFTER 54 /* code to execute after verb handler */
34 #define HDR_ERROR 56 /* error handler code */
35 #define HDR_SAVE 58 /* save area offset */
36 #define HDR_SLEN 60 /* save area length */
37 #define HDR_SIZE 62 /* size of header */
38
39 /* word types */
40 #define WT_UNKNOWN 0
41 #define WT_VERB 1
42 #define WT_NOUN 2
43 #define WT_ADJECTIVE 3
44 #define WT_PREPOSITION 4
45 #define WT_CONJUNCTION 5
46 #define WT_ARTICLE 6
47
48 /* object fields */
49 #define O_CLASS 0
50 #define O_NOUNS 2
51 #define O_ADJECTIVES 4
52 #define O_NPROPERTIES 6
53 #define O_PROPERTIES 8
54 #define O_SIZE 8
55
56 /* action fields */
57 #define A_VERBS 0
58 #define A_PREPOSITIONS 2
59 #define A_FLAG 4
60 #define A_MASK 5
61 #define A_CODE 6
62 #define A_SIZE 8
63
64 /* link fields */
65 #define L_DATA 0
66 #define L_NEXT 2
67 #define L_SIZE 4
68
69 /* property flags */
70 #define P_CLASS 0x8000 /* class property */
71
72 /* action flags */
73 #define A_ACTOR 0x01 /* actor */
74 #define A_DOBJECT 0x02 /* direct object */
75 #define A_IOBJECT 0x04 /* indirect object */
76
77 /* opcodes */
78 #define OP_BRT 0x01 /* branch on true */
79 #define OP_BRF 0x02 /* branch on false */
80 #define OP_BR 0x03 /* branch unconditionally */
81 #define OP_T 0x04 /* load top of stack with t */
82 #define OP_NIL 0x05 /* load top of stack with nil */
83 #define OP_PUSH 0x06 /* push nil onto stack */
84 #define OP_NOT 0x07 /* logical negate top of stack */
85 #define OP_ADD 0x08 /* add two numeric expressions */
86 #define OP_SUB 0x09 /* subtract two numeric expressions */
87 #define OP_MUL 0x0A /* multiply two numeric expressions */
88 #define OP_DIV 0x0B /* divide two numeric expressions */
89 #define OP_REM 0x0C /* remainder of two numeric expressions */
90 #define OP_BAND 0x0D /* bitwise and of two numeric expressions */
91 #define OP_BOR 0x0E /* bitwise or of two numeric expressions */
92 #define OP_BNOT 0x0F /* bitwise not of two numeric expressions */
93 #define OP_LT 0x10 /* less than */
94 #define OP_EQ 0x11 /* equal to */
95 #define OP_GT 0x12 /* greater than */
96 #define OP_LIT 0x13 /* load literal */
97 #define OP_VAR 0x14 /* load a variable value */
98 #define OP_GETP 0x15 /* get the value of an object property */
99 #define OP_SETP 0x16 /* set the value of an object property */
100 #define OP_SET 0x17 /* set the value of a variable */
101 #define OP_PRINT 0x18 /* print messages */
102 #define OP_TERPRI 0x19 /* terminate the print line */
103 #define OP_PNUMBER 0x1A /* print a number */
104 #define OP_FINISH 0x1B /* finish handling this command */
105 #define OP_CHAIN 0x1C /* chain to the next handler */
106 #define OP_ABORT 0x1D /* abort this command */
107 #define OP_EXIT 0x1E /* exit the program */
108 #define OP_RETURN 0x1F /* return from interpreter */
109 #define OP_CALL 0x20 /* call a function */
110 #define OP_SVAR 0x21 /* short load a variable */
111 #define OP_SSET 0x22 /* short set a variable */
112 #define OP_SPLIT 0x23 /* short load a positive literal */
113 #define OP_SNLIT 0x24 /* short load a negative literal */
114 #define OP_YORN 0x25 /* yes-or-no predicate */
115 #define OP_SAVE 0x26 /* save data structures */
116 #define OP_RESTORE 0x27 /* restore data structures */
117 #define OP_ARG 0x28 /* load an argument value */
118 #define OP_ASET 0x29 /* set an argument value */
119 #define OP_TMP 0x2A /* load a temporary variable value */
120 #define OP_TSET 0x2B /* set a temporary variable */
121 #define OP_TSPACE 0x2C /* allocate temporary variable space */
122 #define OP_CLASS 0x2D /* get the class of an object */
123 #define OP_MATCH 0x2E /* match a noun phrase with an object */
124 #define OP_PNOUN 0x2F /* print a noun phrase */
125 #define OP_RESTART 0x30 /* restart the current game */
126 #define OP_RAND 0x31 /* generate a random number */
127 #define OP_RNDMIZE 0x32 /* seed the random number generator */
128 #define OP_SEND 0x33 /* send a message to an object */
129 #define OP_VOWEL 0x34 /* check for vowel beginning string */
130
131 #define OP_XVAR 0x40 /* extra short load a variable */
132 #define OP_XSET 0x60 /* extra short set a variable */
133 #define OP_XPLIT 0x80 /* extra short load a positive literal */
134 #define OP_XNLIT 0xC0 /* extra short load a negative literal */
135
136 /* builtin variables */
137 #define V_ACTOR 1 /* actor noun phrase number */
138 #define V_ACTION 2 /* action from parse */
139 #define V_DOBJECT 3 /* first direct object noun phrase number */
140 #define V_NDOBJECTS 4 /* number of direct object noun phrases */
141 #define V_IOBJECT 5 /* indirect object noun phrase number */
142 #define V_OCOUNT 6 /* total object count */