| 1 |
#ifndef _ACODE_H_ |
| 2 |
#define _ACODE_H_ |
| 3 |
|
| 4 |
#include <stddef.h> |
| 5 |
#include <stdint.h> |
| 6 |
|
| 7 |
typedef size_t Aptr; |
| 8 |
|
| 9 |
typedef uint32_t Aword; |
| 10 |
typedef uint32_t Aaddr; |
| 11 |
typedef uint32_t Abool; |
| 12 |
typedef int32_t Aint; |
| 13 |
|
| 14 |
|
| 15 |
#define BLOCKLEN 256L |
| 16 |
#define BLOCKSIZE (BLOCKLEN*sizeof(Aword)) |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
typedef int32_t CodeValue; |
| 21 |
#define VALUEBITS 16 |
| 22 |
|
| 23 |
#define EOFChar 256 |
| 24 |
#define TOPVALUE (((CodeValue)1<<VALUEBITS) - 1) |
| 25 |
|
| 26 |
|
| 27 |
#define ONEQUARTER (TOPVALUE/4+1) |
| 28 |
#define HALF (2*ONEQUARTER) |
| 29 |
#define THREEQUARTER (3*ONEQUARTER) |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
typedef int WrdKind; |
| 34 |
#define WRD_SYN 0 |
| 35 |
#define WRD_ADJ 1 |
| 36 |
#define WRD_ALL 2 |
| 37 |
#define WRD_BUT 3 |
| 38 |
#define WRD_CONJ 4 |
| 39 |
#define WRD_PREP 5 |
| 40 |
#define WRD_DIR 6 |
| 41 |
#define WRD_IT 7 |
| 42 |
#define WRD_NOISE 8 |
| 43 |
#define WRD_NOUN 9 |
| 44 |
#define WRD_ACT 10 |
| 45 |
#define WRD_THEM 11 |
| 46 |
#define WRD_VRB 12 |
| 47 |
#define WRD_CLASSES 13 |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#define EOS (-2) |
| 53 |
|
| 54 |
|
| 55 |
#define MULTIPLEBIT 0x1 |
| 56 |
#define OMNIBIT 0x2 |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
typedef enum ClaKind { |
| 61 |
CLA_OBJ = 1, |
| 62 |
CLA_CNT = (int)CLA_OBJ<<1, |
| 63 |
CLA_ACT = (int)CLA_CNT<<1, |
| 64 |
CLA_NUM = (int)CLA_ACT<<1, |
| 65 |
CLA_STR = (int)CLA_NUM<<1, |
| 66 |
CLA_COBJ = (int)CLA_STR<<1, |
| 67 |
CLA_CACT = (int)CLA_COBJ<<1 |
| 68 |
} ClaKind; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
typedef enum QualClass { |
| 73 |
Q_DEFAULT, |
| 74 |
Q_AFTER, |
| 75 |
Q_BEFORE, |
| 76 |
Q_ONLY |
| 77 |
} QualClass; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
typedef enum OpClass { |
| 82 |
C_CONST, |
| 83 |
C_STMOP, |
| 84 |
C_CURVAR |
| 85 |
} OpClass; |
| 86 |
|
| 87 |
typedef enum InstClass { |
| 88 |
I_PRINT, |
| 89 |
I_QUIT, |
| 90 |
I_LOOK, |
| 91 |
I_SAVE, |
| 92 |
I_RESTORE, |
| 93 |
I_LIST, |
| 94 |
I_EMPTY, |
| 95 |
I_SCORE, |
| 96 |
I_VISITS, |
| 97 |
I_SCHEDULE, |
| 98 |
I_CANCEL, |
| 99 |
I_LOCATE, |
| 100 |
I_MAKE, |
| 101 |
I_SET, |
| 102 |
|
| 103 |
I_STRSET, |
| 104 |
|
| 105 |
|
| 106 |
I_GETSTR, |
| 107 |
|
| 108 |
|
| 109 |
I_INCR, |
| 110 |
I_DECR, |
| 111 |
I_USE, |
| 112 |
I_IN, |
| 113 |
I_DESCRIBE, |
| 114 |
I_SAY, |
| 115 |
I_SAYINT, |
| 116 |
I_SAYSTR, |
| 117 |
I_IF, |
| 118 |
I_ELSE, |
| 119 |
I_ENDIF, |
| 120 |
I_ATTRIBUTE, |
| 121 |
I_STRATTR, |
| 122 |
I_HERE, |
| 123 |
I_NEAR, |
| 124 |
I_WHERE, |
| 125 |
I_AND, |
| 126 |
I_OR, |
| 127 |
I_NE, |
| 128 |
I_EQ, |
| 129 |
I_STREQ, |
| 130 |
I_STREXACT, |
| 131 |
I_LE, |
| 132 |
I_GE, |
| 133 |
I_LT, |
| 134 |
I_GT, |
| 135 |
I_PLUS, |
| 136 |
I_MINUS, |
| 137 |
I_MULT, |
| 138 |
I_DIV, |
| 139 |
I_NOT, |
| 140 |
I_UMINUS, |
| 141 |
I_RND, |
| 142 |
I_SUM, |
| 143 |
I_MAX, |
| 144 |
I_COUNT, |
| 145 |
I_RETURN, |
| 146 |
I_SYSTEM, |
| 147 |
I_RESTART, |
| 148 |
I_BTW, |
| 149 |
I_CONTAINS, |
| 150 |
I_DEPSTART, |
| 151 |
I_DEPCASE, |
| 152 |
I_DEPEXEC, |
| 153 |
I_DEPELSE, |
| 154 |
I_DEPEND |
| 155 |
} InstClass; |
| 156 |
|
| 157 |
|
| 158 |
typedef enum VarClass { |
| 159 |
V_PARAM, |
| 160 |
V_CURLOC, |
| 161 |
V_CURACT, |
| 162 |
V_CURVRB, |
| 163 |
V_SCORE |
| 164 |
} VarClass; |
| 165 |
|
| 166 |
|
| 167 |
#define I_CLASS(x) ((x)>>28) |
| 168 |
#define I_OP(x) ((x&0x8000000)?(x)|0x0f0000000:(x)&0x0fffffff) |
| 169 |
|
| 170 |
|
| 171 |
typedef struct AcdHdr { |
| 172 |
|
| 173 |
char vers[4]; |
| 174 |
Aword size; |
| 175 |
|
| 176 |
Abool pack; |
| 177 |
Aword paglen; |
| 178 |
Aword pagwidth; |
| 179 |
Aword debug; |
| 180 |
|
| 181 |
Aaddr dict; |
| 182 |
Aaddr oatrs; |
| 183 |
Aaddr latrs; |
| 184 |
Aaddr aatrs; |
| 185 |
Aaddr acts; |
| 186 |
Aaddr objs; |
| 187 |
Aaddr locs; |
| 188 |
Aaddr stxs; |
| 189 |
Aaddr vrbs; |
| 190 |
Aaddr evts; |
| 191 |
Aaddr cnts; |
| 192 |
Aaddr ruls; |
| 193 |
Aaddr init; |
| 194 |
Aaddr start; |
| 195 |
Aword msgs; |
| 196 |
|
| 197 |
Aword objmin, objmax; |
| 198 |
Aword actmin, actmax; |
| 199 |
Aword cntmin, cntmax; |
| 200 |
Aword locmin, locmax; |
| 201 |
Aword dirmin, dirmax; |
| 202 |
Aword evtmin, evtmax; |
| 203 |
Aword rulmin, rulmax; |
| 204 |
Aword maxscore; |
| 205 |
Aaddr scores; |
| 206 |
Aaddr freq; |
| 207 |
Aword acdcrc; |
| 208 |
Aword txtcrc; |
| 209 |
} AcdHdr; |
| 210 |
|
| 211 |
|
| 212 |
typedef enum MsgKind { |
| 213 |
M_HUH, |
| 214 |
M_WHAT, |
| 215 |
M_WHAT_ALL, |
| 216 |
M_WHAT_IT, |
| 217 |
M_WHAT_THEM, |
| 218 |
M_MULTIPLE, |
| 219 |
M_WANT, |
| 220 |
M_NOUN, |
| 221 |
M_AFTER_BUT, |
| 222 |
M_BUT_ALL, |
| 223 |
M_NOT_MUCH, |
| 224 |
M_WHICH_ONE, |
| 225 |
M_NO_SUCH, |
| 226 |
M_NO_WAY, |
| 227 |
M_CANT0, |
| 228 |
M_CANT, |
| 229 |
M_NOTHING, |
| 230 |
M_SEEOBJ1, |
| 231 |
M_SEEOBJ2, |
| 232 |
M_SEEOBJ3, |
| 233 |
M_SEEOBJ4, |
| 234 |
M_SEEACT, |
| 235 |
M_CONTAINS1, |
| 236 |
M_CONTAINS2, |
| 237 |
M_CONTAINS3, |
| 238 |
M_CONTAINS4, |
| 239 |
M_CONTAINS5, |
| 240 |
M_EMPTY1, |
| 241 |
M_EMPTY2, |
| 242 |
M_SCORE1, |
| 243 |
M_SCORE2, |
| 244 |
M_UNKNOWN_WORD, |
| 245 |
M_MORE, |
| 246 |
M_AGAIN, |
| 247 |
M_SAVEWHERE, |
| 248 |
M_SAVEOVERWRITE, |
| 249 |
M_SAVEFAILED, |
| 250 |
M_SAVEMISSING, |
| 251 |
M_SAVEVERS, |
| 252 |
M_SAVENAME, |
| 253 |
M_RESTOREFROM, |
| 254 |
M_REALLY, |
| 255 |
M_QUITACTION, |
| 256 |
M_ARTICLE, |
| 257 |
MSGMAX |
| 258 |
} MsgKind; |
| 259 |
|
| 260 |
#define M_ARTICLE26 M_QUITACTION |
| 261 |
#define M_MSGMAX26 M_ARTICLE |
| 262 |
|
| 263 |
#endif |