aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan2
diff options
context:
space:
mode:
authorFilippos Karapetis2018-12-27 16:22:21 +0200
committerFilippos Karapetis2018-12-28 13:41:39 +0200
commitd96f9428b396be5342bfb0bdfe38a810a22e22fd (patch)
treedda487b50f293ed7978d9651efeea543af035a9a /engines/glk/alan2
parentc6d6f8de0a0347932cd6fd1ec8ef5e12ce5e9de9 (diff)
downloadscummvm-rg350-d96f9428b396be5342bfb0bdfe38a810a22e22fd.tar.gz
scummvm-rg350-d96f9428b396be5342bfb0bdfe38a810a22e22fd.tar.bz2
scummvm-rg350-d96f9428b396be5342bfb0bdfe38a810a22e22fd.zip
GLK: ALAN2: Formatting fixes
Diffstat (limited to 'engines/glk/alan2')
-rw-r--r--engines/glk/alan2/alan2.cpp15
-rw-r--r--engines/glk/alan2/decode.cpp4
-rw-r--r--engines/glk/alan2/decode.h3
-rw-r--r--engines/glk/alan2/execute.cpp2
-rw-r--r--engines/glk/alan2/parse.cpp5
-rw-r--r--engines/glk/alan2/rules.cpp2
-rw-r--r--engines/glk/alan2/types.h159
7 files changed, 92 insertions, 98 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp
index c29a124f9a..f9e65fc43a 100644
--- a/engines/glk/alan2/alan2.cpp
+++ b/engines/glk/alan2/alan2.cpp
@@ -84,30 +84,25 @@ bool Alan2::is_gamefile_valid() {
return true;
}
-void Alan2::output(const Common::String str)
-{
+void Alan2::output(const Common::String str) {
// TODO
}
-void Alan2::printMessage(MsgKind msg)
-{
+void Alan2::printMessage(MsgKind msg) {
// TODO
}
-void Alan2::printError(MsgKind msg)
-{
+void Alan2::printError(MsgKind msg) {
// TODO
}
-void Alan2::paragraph()
-{
+void Alan2::paragraph() {
if (col != 1)
newLine();
newLine();
}
-void Alan2::newLine()
-{
+void Alan2::newLine() {
// TODO
}
diff --git a/engines/glk/alan2/decode.cpp b/engines/glk/alan2/decode.cpp
index ba144123c6..aaf297b759 100644
--- a/engines/glk/alan2/decode.cpp
+++ b/engines/glk/alan2/decode.cpp
@@ -94,7 +94,7 @@ int Decode::decodeChar() {
// Save so much about the decoding process, so it is possible to restore
// and continue later.
-DecodeInfo* Decode::pushDecode() {
+DecodeInfo *Decode::pushDecode() {
DecodeInfo *info = new DecodeInfo();
info->fpos = _txtFile->pos();
@@ -109,7 +109,7 @@ DecodeInfo* Decode::pushDecode() {
// Restore enough info about the decoding process, so it is possible to
// continue after having decoded something else
-void Decode::popDecode (DecodeInfo *info){
+void Decode::popDecode (DecodeInfo *info) {
_txtFile->seek(info->fpos, SEEK_CUR);
_decodeBuffer = info->buffer;
_bitsToGo = info->bits;
diff --git a/engines/glk/alan2/decode.h b/engines/glk/alan2/decode.h
index fff6819878..1361badfa1 100644
--- a/engines/glk/alan2/decode.h
+++ b/engines/glk/alan2/decode.h
@@ -40,8 +40,7 @@ typedef struct DecodeInfo {
CodeValue low;
} DecodeInfo;
-class Decode
-{
+class Decode {
public:
Decode(Common::File *txtFile, Aword *freq): _txtFile(txtFile), _freq(freq) {}
void startDecoding();
diff --git a/engines/glk/alan2/execute.cpp b/engines/glk/alan2/execute.cpp
index 5b81b303d9..c60d927e98 100644
--- a/engines/glk/alan2/execute.cpp
+++ b/engines/glk/alan2/execute.cpp
@@ -22,6 +22,7 @@
#include "common/stack.h"
#include "glk/alan2/alan2.h"
+#include "glk/alan2/decode.h"
#include "glk/alan2/execute.h"
#include "glk/alan2/interpreter.h"
#include "glk/alan2/saveload.h"
@@ -29,7 +30,6 @@
#include "glk/alan2/util.h"
#include "common/debug.h"
#include "common/file.h"
-#include "decode.h"
namespace Glk {
namespace Alan2 {
diff --git a/engines/glk/alan2/parse.cpp b/engines/glk/alan2/parse.cpp
index ebb0af94bf..c0777e0aed 100644
--- a/engines/glk/alan2/parse.cpp
+++ b/engines/glk/alan2/parse.cpp
@@ -589,7 +589,7 @@ bool Parser::claCheck(ClaElem *cla) {
if ((cla->classes&(Aword)CLA_CACT) != 0)
ok = ok || (isCnt(params[cla->code-1].code) && isAct(params[cla->code-1].code));
- return ok;
+ return ok;
}
// In case the syntax did not indicate omnipotent powers (allowed
@@ -804,7 +804,8 @@ void Parser::tryMatch(ParamElem mlst[]) {
}
} else
params[paramidx++] = tlst[0];
- params[paramidx].code = EOF;
+
+ params[paramidx].code = EOF;
}
elms = (ElmElem *) addrTo(elms->next);
diff --git a/engines/glk/alan2/rules.cpp b/engines/glk/alan2/rules.cpp
index 14c867133f..04fc00a0b7 100644
--- a/engines/glk/alan2/rules.cpp
+++ b/engines/glk/alan2/rules.cpp
@@ -45,7 +45,7 @@ void Rules::parseRules() {
for (i = 1; !endOfTable(&_ruls[i - 1]); i++) {
if (!_ruls[i - 1].run) {
if (trcflg) {
- debug("\n<RULE %d (at ", i);
+ debug("\n<RULE %d (at ", i); // TODO: Debug output formatting?
//debugsay(cur.loc); // TODO
if (!stpflg)
debug("), Evaluating");
diff --git a/engines/glk/alan2/types.h b/engines/glk/alan2/types.h
index b403cf997c..aefe4517ae 100644
--- a/engines/glk/alan2/types.h
+++ b/engines/glk/alan2/types.h
@@ -67,163 +67,162 @@ namespace Alan2 {
// Amachine variables
typedef struct CurVars {
- int
- vrb,
- obj,
- loc,
- act,
- tick,
- score,
- visits;
+ int vrb;
+ int obj;
+ int loc;
+ int act;
+ int tick;
+ int score;
+ int visits;
} CurVars;
// The various tables
typedef struct WrdElem { // Dictionary
- Aaddr wrd; // ACODE address to string
+ Aaddr wrd; // ACODE address to string
Aword wordClass; // Word class
Aword code;
- Aaddr adjrefs; // Address to reference list
- Aaddr nounrefs; // Address to reference list
+ Aaddr adjrefs; // Address to reference list
+ Aaddr nounrefs; // Address to reference list
} WrdElem;
typedef struct ActElem { // ACTOR TABLE
- Aword loc; // Location
- Abool describe; // Description flag
- Aaddr nam; // Address to name printing code
- Aaddr atrs; // Address to attribute list
- Aword cont; // Code for the container props if any
+ Aword loc; // Location
+ Abool describe; // Description flag
+ Aaddr nam; // Address to name printing code
+ Aaddr atrs; // Address to attribute list
+ Aword cont; // Code for the container props if any
Aword script; // Which script is he using
Aaddr scradr; // Address to script table
Aword step;
Aword count;
Aaddr vrbs;
- Aaddr dscr; // Address of description code
+ Aaddr dscr; // Address of description code
} ActElem;
typedef struct ScrElem { // SCRIPT TABLE
- Aword code; // Script number
- Aaddr dscr; // Optional description statements
+ Aword code; // Script number
+ Aaddr dscr; // Optional description statements
Aaddr steps; // Address to steps
} ScrElem;
typedef struct StepElem { // STEP TABLE
Aword after; // After how many ticks?
- Aaddr exp; // Address to expression saying when
- Aaddr stm; // Address to the actual code
+ Aaddr exp; // Address to expression saying when
+ Aaddr stm; // Address to the actual code
} StepElem;
typedef struct LocElem { // LOCATION TABLE
- Aaddr nams; // Address of name printing code
- Aaddr dscr; // Address of description code
- Aaddr does; // Address of does code
- Aword describe; // Description flag & counter
- Aaddr atrs; // Address of attribute list
- Aaddr exts; // Address of exit list
- Aaddr vrbs; // Address of local verb list
+ Aaddr nams; // Address of name printing code
+ Aaddr dscr; // Address of description code
+ Aaddr does; // Address of does code
+ Aword describe; // Description flag & counter
+ Aaddr atrs; // Address of attribute list
+ Aaddr exts; // Address of exit list
+ Aaddr vrbs; // Address of local verb list
} LocElem;
typedef struct ExtElem { // EXIT TABLE structure
- Abool done; // Flag for reverse/convert process
- Aword code; // Direction code
+ 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
+ Aword next; // Number of next location
} ExtElem;
typedef struct ChkElem { // CHECK TABLE
- Aaddr exp; // ACODE address to expression code
- Aaddr stms; // ACODE address to statement code
+ Aaddr exp; // ACODE address to expression code
+ Aaddr stms; // ACODE address to statement code
} ChkElem;
typedef struct VrbElem { // VERB TABLE
- Aword code; // Code for the verb
- Aaddr alts; // Address to alternatives
+ Aword code; // Code for the verb
+ Aaddr alts; // Address to alternatives
} VrbElem;
typedef struct StxElem { // SYNTAX TABLE
- Aword code; // Code for verb word
- Aaddr elms; // Address to element tables
+ Aword code; // Code for verb word
+ Aaddr elms; // Address to element tables
} StxElem;
typedef 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
+ 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;
typedef struct ElmElem { // ELEMENT TABLES
- Aword code; // Code for this element, 0 -> parameter
+ 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
+ // CHANGED: v2.7 from Abool for multiple
+ Aaddr next; // Address to next element table ...
+ // ... or class check if EOS
} ElmElem;
typedef struct ClaElem { // CLASS DEFINITION TABLE
- Aword code; // Parameter number
- Aword classes; // Parameter classes
- Aaddr stms; // Exception statements
+ Aword code; // Parameter number
+ Aword classes; // Parameter classes
+ Aaddr stms; // Exception statements
} ClaElem;
typedef struct AltElem { // VERB ALTERNATIVE TABLE
- Abool done; // Flag for patching (reverse/convert) process
+ Abool done; // Flag for patching (reverse/convert) process
Aword param; // Parameter number
- Aword qual; // Verb execution qualifier
+ Aword qual; // Verb execution qualifier
Aaddr checks; // Address of the check table
Aaddr action; // Address of the action code
} AltElem;
typedef struct AtrElem { // ATTRIBUTE LIST
- Aword val; // Its value
+ Aword val; // Its value
Aaddr stradr; // Address to the name
} AtrElem;
typedef struct ObjElem25 { // OBJECT TABLE of 2.5 format
- Aword loc; // Current location
- Abool describe; // Describe flag
- Aaddr atrs; // Address of attribute list
- Aword cont; // Index to container properties if any
- Aaddr vrbs; // Address to local verb table
+ Aword loc; // Current location
+ Abool describe; // Describe flag
+ Aaddr atrs; // Address of attribute list
+ Aword cont; // Index to container properties if any
+ Aaddr vrbs; // Address to local verb table
Aaddr dscr1; // Address to Aword description code
Aaddr dscr2; // Address to short description code
} ObjElem25;
typedef struct ObjElem { // OBJECT TABLE
- Aword loc; // Current location
- Abool describe; // Describe flag
- Aaddr atrs; // Address of attribute list
- Aword cont; // Index to container properties if any
- Aaddr vrbs; // Address to local verb table
+ Aword loc; // Current location
+ Abool describe; // Describe flag
+ Aaddr atrs; // Address of attribute list
+ Aword cont; // Index to container properties if any
+ Aaddr vrbs; // Address to local verb table
Aaddr dscr1; // Address to Aword description code
- Aaddr art; // Article printing code? Else use default
- // INTRODUCED: v2.6
+ Aaddr art; // Article printing code? Else use default
+ // INTRODUCED: v2.6
Aaddr dscr2; // Address to short description code
} ObjElem;
typedef struct CntElem { // CONTAINER TABLE
- Aaddr lims; // Address to limit check code
+ 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
+ Aaddr nam; // Address to statement printing name
} CntElem;
typedef struct LimElem { // LIMIT Type
- Aword atr; // Attribute that limits
- Aword val; // And the limiting value
- Aaddr stms; // Statements if fail
+ Aword atr; // Attribute that limits
+ Aword val; // And the limiting value
+ Aaddr stms; // Statements if fail
} LimElem;
typedef struct RulElem { // RULE TABLE
- Abool run; // Is rule already run?
- Aaddr exp; // Address to expression code
- Aaddr stms; // Address to run
+ Abool run; // Is rule already run?
+ Aaddr exp; // Address to expression code
+ Aaddr stms; // Address to run
} RulElem;
typedef struct EvtElem { // EVENT TABLE
Aaddr stradr; // Address to name string
- Aaddr code; // Address of code to run
+ Aaddr code; // Address of code to run
} EvtElem;
typedef struct EvtqElem { // EVENT QUEUE ELEMENT
@@ -233,24 +232,24 @@ typedef struct EvtqElem { // EVENT QUEUE ELEMENT
} EvtqElem;
typedef struct IniElem { // STRING INITIALISATION TABLE
- Aword fpos; // File position
- Aword len; // Length
- Aword adr; // Where to store the string
+ Aword fpos; // File position
+ Aword len; // Length
+ Aword adr; // Where to store the string
} IniElem;
typedef struct MsgElem26 { // MESSAGE TABLE
- Aword fpos; // File position
- Aword len; // Length of message
+ Aword fpos; // File position
+ Aword len; // Length of message
} MsgElem26;
typedef struct MsgElem { // MESSAGE TABLE
- Aaddr stms; // Address to statements
- // Changed v2.7 from fpos+len in .dat
+ Aaddr stms; // Address to statements
+ // Changed v2.7 from fpos+len in .dat
} MsgElem;
typedef struct ParamElem { // PARAMETER
- Aword code; // Code for this parameter (0=multiple)
+ Aword code; // Code for this parameter (0=multiple)
Aword firstWord; // Index to first word used by player
Aword lastWord; // d:o to last
} ParamElem;