Debian Codegraph @

terps/alan3/types.h

raw symbols SCIP
1 #ifndef _ATYPES_H_
2 #define _ATYPES_H_
3 /*----------------------------------------------------------------------*\
4
5 types.h
6
7 Header file for the Alan interpreter module.
8
9 \*----------------------------------------------------------------------*/
10
11
12 #include "sysdep.h"
13 #include "acode.h"
14 #include "memory.h"
15
16
17 /* PREPROCESSOR */
18 #define FORWARD
19 #define protected
20 #define NEW(type) ((type *)allocate(sizeof(type)))
21
22
23 /* CONSTANTS */
24
25 #define HERO (header->theHero)
26 #define ENTITY (header->entityClassId)
27 #define OBJECT (header->objectClassId)
28 #define LOCATION (header->locationClassId)
29 #define THING (header->thingClassId)
30 #define ACTOR (header->actorClassId)
31
32 #define MAXPARAMS (header->maxParameters)
33 #define MAXINSTANCE (header->instanceMax)
34
35 #define pointerTo(x) ((void *)&memory[x])
36 #define addressOf(x) ((((long)x)-((long)memory))/sizeof(Aword))
37 #define stringAt(x) ((char *)pointerTo(x))
38
39 #define ASIZE(x) (sizeof(x)/sizeof(Aword))
40
41 /* TYPES */
42
43 #include <stdbool.h>
44
45 /* A char type that accepts 8-bit characters (ISO8859-1 and UTF-8) */
46 /* TODO: change all char arrays that are strings to uchar */
47 typedef unsigned char uchar;
48
49 /* The various tables */
50 typedef struct VerbEntry { /* VERB TABLE */
51 Aint code; /* Code for the verb */
52 Aaddr alts; /* Address to alternatives */
53 } VerbEntry;
54
55 typedef struct LimEntry { /* LIMIT Type */
56 Aword atr; /* Attribute that limits */
57 Aword val; /* And the limiting value */
58 Aaddr stms; /* Statements if fail */
59 } LimitEntry;
60
61 /* Functions: */
62 extern Aaddr addressAfterTable(Aaddr adr, int size);
63
64 #endif