aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-19 07:16:21 -0700
committerPaul Gilbert2019-06-22 14:40:49 -0700
commit35cfe001c24fea912d59bcb14ce72bd3411ce66a (patch)
treee4d3626bda107b5816f0796977939811e882fcab
parent2fba84bf0a220a3515efdaddb6aae4109d777935 (diff)
downloadscummvm-rg350-35cfe001c24fea912d59bcb14ce72bd3411ce66a.tar.gz
scummvm-rg350-35cfe001c24fea912d59bcb14ce72bd3411ce66a.tar.bz2
scummvm-rg350-35cfe001c24fea912d59bcb14ce72bd3411ce66a.zip
GLK: ALAN2: Add structure packing to types
These types map onto the uint32 memory array. Chances are that the default packing would be fine, since each structure field is always using four byte types, but better safe than sorry
-rw-r--r--engines/glk/alan2/types.h112
1 files changed, 58 insertions, 54 deletions
diff --git a/engines/glk/alan2/types.h b/engines/glk/alan2/types.h
index 2de31c06bf..11a17a539d 100644
--- a/engines/glk/alan2/types.h
+++ b/engines/glk/alan2/types.h
@@ -80,7 +80,7 @@ typedef int Boolean; /* Boolean values within interpreter */
#endif
/* Amachine variables */
-typedef struct CurVars {
+struct CurVars {
int
vrb,
obj,
@@ -89,18 +89,20 @@ typedef struct CurVars {
tick,
score,
visits;
-} CurVars;
+};
+
+#include "common/pack-start.h" // START STRUCT PACKING
/* The various tables */
-typedef struct WrdElem { /* Dictionary */
+struct WrdElem { /* Dictionary */
Aaddr wrd; /* ACODE address to string */
Aword _class; /* Word class */
Aword code;
Aaddr adjrefs; /* Address to reference list */
Aaddr nounrefs; /* Address to reference list */
-} WrdElem;
+} PACKED_STRUCT;
-typedef struct ActElem { /* ACTOR TABLE */
+struct ActElem { /* ACTOR TABLE */
Aword loc; /* Location */
Abool describe; /* Description flag */
Aaddr nam; /* Address to name printing code */
@@ -112,21 +114,21 @@ typedef struct ActElem { /* ACTOR TABLE */
Aword count;
Aaddr vrbs;
Aaddr dscr; /* Address of description code */
-} ActElem;
+} PACKED_STRUCT;
-typedef struct ScrElem { /* SCRIPT TABLE */
+struct ScrElem { /* SCRIPT TABLE */
Aword code; /* Script number */
Aaddr dscr; /* Optional description statements */
Aaddr steps; /* Address to steps */
-} ScrElem;
+} PACKED_STRUCT;
-typedef struct StepElem { /* STEP TABLE */
+struct StepElem { /* STEP TABLE */
Aword after; /* After how many ticks? */
Aaddr exp; /* Address to expression saying when */
Aaddr stm; /* Address to the actual code */
-} StepElem;
+} PACKED_STRUCT;
-typedef struct LocElem { /* LOCATION TABLE */
+struct LocElem { /* LOCATION TABLE */
Aaddr nams; /* Address of name printing code */
Aaddr dscr; /* Address of description code */
Aaddr does; /* Address of does code */
@@ -134,66 +136,66 @@ typedef struct LocElem { /* LOCATION TABLE */
Aaddr atrs; /* Address of attribute list */
Aaddr exts; /* Address of exit list */
Aaddr vrbs; /* Address of local verb list */
-} LocElem;
+} PACKED_STRUCT;
-typedef struct ExtElem { /* EXIT TABLE structure */
+struct ExtElem { /* EXIT TABLE structure */
Abool done; /* Flag for reverse/convert process */
Aword code; /* Direction code */
Aaddr checks; /* Address of check table */
Aaddr action; /* Address of action code */
Aword next; /* Number of next location */
-} ExtElem;
+} PACKED_STRUCT;
-typedef struct ChkElem { /* CHECK TABLE */
+struct ChkElem { /* CHECK TABLE */
Aaddr exp; /* ACODE address to expression code */
Aaddr stms; /* ACODE address to statement code */
-} ChkElem;
+} PACKED_STRUCT;
-typedef struct VrbElem { /* VERB TABLE */
+struct VrbElem { /* VERB TABLE */
Aword code; /* Code for the verb */
Aaddr alts; /* Address to alternatives */
-} VrbElem;
+} PACKED_STRUCT;
-typedef struct StxElem { /* SYNTAX TABLE */
+struct StxElem { /* SYNTAX TABLE */
Aword code; /* Code for verb word */
Aaddr elms; /* Address to element tables */
-} StxElem;
+} PACKED_STRUCT;
-typedef struct ElmElem26 { /* ELEMENT TABLES */
+struct ElmElem26 { /* ELEMENT TABLES */
Aword code; /* Code for this element, 0 -> parameter */
Abool multiple; /* May be multiple (if parameter) */
Aaddr next; /* Address to next element table ... */
/* ... or class check if EOS */
-} ElmElem26;
+} PACKED_STRUCT;
-typedef struct ElmElem { /* ELEMENT TABLES */
+struct ElmElem { /* ELEMENT TABLES */
Aword code; /* Code for this element, 0 -> parameter */
Aword flags; /* Flags for multiple/omni (if parameter) */
/* CHANGED: v2.7 from Abool for multiple */
Aaddr next; /* Address to next element table ... */
/* ... or class check if EOS */
-} ElmElem;
+} PACKED_STRUCT;
-typedef struct ClaElem { /* CLASS DEFINITION TABLE */
+struct ClaElem { /* CLASS DEFINITION TABLE */
Aword code; /* Parameter number */
Aword classes; /* Parameter classes */
Aaddr stms; /* Exception statements */
-} ClaElem;
+} PACKED_STRUCT;
-typedef struct AltElem { /* VERB ALTERNATIVE TABLE */
+struct AltElem { /* VERB ALTERNATIVE TABLE */
Abool done; /* Flag for patching (reverse/convert) process */
Aword param; /* Parameter number */
Aword qual; /* Verb execution qualifier */
Aaddr checks; /* Address of the check table */
Aaddr action; /* Address of the action code */
-} AltElem;
+} PACKED_STRUCT;
-typedef struct AtrElem { /* ATTRIBUTE LIST */
+struct AtrElem { /* ATTRIBUTE LIST */
Aword val; /* Its value */
Aaddr stradr; /* Address to the name */
-} AtrElem;
+} PACKED_STRUCT;
-typedef struct ObjElem25 { /* OBJECT TABLE of 2.5 format*/
+struct ObjElem25 { /* OBJECT TABLE of 2.5 format*/
Aword loc; /* Current location */
Abool describe; /* Describe flag */
Aaddr atrs; /* Address of attribute list */
@@ -201,9 +203,9 @@ typedef struct ObjElem25 { /* OBJECT TABLE of 2.5 format*/
Aaddr vrbs; /* Address to local verb table */
Aaddr dscr1; /* Address to Aword description code */
Aaddr dscr2; /* Address to short description code */
-} ObjElem25;
+} PACKED_STRUCT;
-typedef struct ObjElem { /* OBJECT TABLE */
+struct ObjElem { /* OBJECT TABLE */
Aword loc; /* Current location */
Abool describe; /* Describe flag */
Aaddr atrs; /* Address of attribute list */
@@ -213,68 +215,70 @@ typedef struct ObjElem { /* OBJECT TABLE */
Aaddr art; /* Article printing code? Else use default */
/* INTRODUCED: v2.6 */
Aaddr dscr2; /* Address to short description code */
-} ObjElem;
+} PACKED_STRUCT;
-typedef struct CntElem { /* CONTAINER TABLE */
+struct CntElem { /* CONTAINER TABLE */
Aaddr lims; /* Address to limit check code */
Aaddr header; /* Address to header code */
Aaddr empty; /* Address to empty code */
Aword parent; /* Object or actor index */
Aaddr nam; /* Address to statement printing name */
-} CntElem;
+} PACKED_STRUCT;
-typedef struct LimElem { /* LIMIT Type */
+struct LimElem { /* LIMIT Type */
Aword atr; /* Attribute that limits */
Aword val; /* And the limiting value */
Aaddr stms; /* Statements if fail */
-} LimElem;
+} PACKED_STRUCT;
-typedef struct RulElem { /* RULE TABLE */
+struct RulElem { /* RULE TABLE */
Abool run; /* Is rule already run? */
Aaddr exp; /* Address to expression code */
Aaddr stms; /* Address to run */
-} RulElem;
+} PACKED_STRUCT;
-typedef struct EvtElem { /* EVENT TABLE */
+struct EvtElem { /* EVENT TABLE */
Aaddr stradr; /* Address to name string */
Aaddr code; /* Address of code to run */
-} EvtElem;
+} PACKED_STRUCT;
-typedef struct EvtqElem { /* EVENT QUEUE ELEMENT */
+struct EvtqElem { /* EVENT QUEUE ELEMENT */
int time;
int event;
int where;
-} EvtqElem;
+} PACKED_STRUCT;
-typedef struct IniElem { /* STRING INITIALISATION TABLE */
+struct IniElem { /* STRING INITIALISATION TABLE */
Aword fpos; /* File position */
Aword len; /* Length */
Aword adr; /* Where to store the string */
-} IniElem;
+} PACKED_STRUCT;
-typedef struct MsgElem26 { /* MESSAGE TABLE */
+struct MsgElem26 { /* MESSAGE TABLE */
Aword fpos; /* File position */
Aword len; /* Length of message */
-} MsgElem26;
+} PACKED_STRUCT;
-typedef struct MsgElem { /* MESSAGE TABLE */
+struct MsgElem { /* MESSAGE TABLE */
Aaddr stms; /* Address to statements*/
/* Changed v2.7 from fpos+len in .dat */
-} MsgElem;
+} PACKED_STRUCT;
-typedef struct ParamElem { /* PARAMETER */
+struct ParamElem { /* PARAMETER */
Aword code; /* Code for this parameter (0=multiple) */
Aword firstWord; /* Index to first word used by player */
Aword lastWord; /* d:o to last */
-} ParamElem;
+} PACKED_STRUCT;
typedef enum Type {TYPNUM, TYPSTR} Type;
-typedef struct LitElem { /* LITERAL */
+struct LitElem { /* LITERAL */
Type type;
Aptr value;
-} LitElem;
+} PACKED_STRUCT;
+
+#include "common/pack-end.h" // END STRUCT PACKING
#define MAXPARAMS 9
#define MAXENTITY (header->actmax)