aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/alan3/act.cpp12
-rw-r--r--engines/glk/alan3/container.cpp8
-rw-r--r--engines/glk/alan3/debug.cpp37
-rw-r--r--engines/glk/alan3/decode.cpp2
-rw-r--r--engines/glk/alan3/exe.cpp35
-rw-r--r--engines/glk/alan3/instance.cpp58
-rw-r--r--engines/glk/alan3/inter.cpp6
-rw-r--r--engines/glk/alan3/location.cpp8
-rw-r--r--engines/glk/alan3/main.cpp82
-rw-r--r--engines/glk/alan3/output.cpp6
-rw-r--r--engines/glk/alan3/params.cpp2
-rw-r--r--engines/glk/alan3/reverse.cpp154
-rw-r--r--engines/glk/alan3/rules.cpp49
-rw-r--r--engines/glk/alan3/state.cpp36
-rw-r--r--engines/glk/alan3/sysdep.cpp44
-rw-r--r--engines/glk/glulxe/serial.cpp7
16 files changed, 235 insertions, 311 deletions
diff --git a/engines/glk/alan3/act.cpp b/engines/glk/alan3/act.cpp
index 87366cd3dc..1c89e354d1 100644
--- a/engines/glk/alan3/act.cpp
+++ b/engines/glk/alan3/act.cpp
@@ -89,16 +89,18 @@ static void executeCommand(int verb, Parameter parameters[])
*/
void action(int verb, Parameter parameters[], Parameter multipleMatches[])
{
- int i, multiplePosition;
- char marker[10];
-
+ int multiplePosition;
+#ifdef TODO
+ char marker[10];
+#endif
+
multiplePosition = findMultiplePosition(parameters);
if (multiplePosition != -1) {
-#ifdef TODO
+#ifdef TODO
jmp_buf savedReturnLabel;
memcpy(savedReturnLabel, returnLabel, sizeof(returnLabel));
sprintf(marker, "($%d)", multiplePosition+1); /* Prepare a printout with $1/2/3 */
- for (i = 0; !isEndOfArray(&multipleMatches[i]); i++) {
+ for (int i = 0; !isEndOfArray(&multipleMatches[i]); i++) {
copyParameter(&parameters[multiplePosition], &multipleMatches[i]);
setGlobalParameters(parameters); /* Need to do this here since the marker use them */
output(marker);
diff --git a/engines/glk/alan3/container.cpp b/engines/glk/alan3/container.cpp
index 4b812c98d6..b9508f55db 100644
--- a/engines/glk/alan3/container.cpp
+++ b/engines/glk/alan3/container.cpp
@@ -71,7 +71,7 @@ static int sumAttributeInContainer(
/*----------------------------------------------------------------------*/
static bool containerIsEmpty(int container)
{
- int i;
+ uint i;
for (i = 1; i <= header->instanceMax; i++)
if (isDescribable(i) && isIn(i, container, TRANSITIVE))
@@ -102,7 +102,7 @@ bool passesContainerLimits(Aint theContainer, Aint theAddedInstance) {
if (containers[props].limits != 0) { /* Any limits at all? */
for (limit = (LimitEntry *) pointerTo(containers[props].limits); !isEndOfArray(limit); limit++)
if (limit->atr == 1-I_COUNT) { /* TODO This is actually some encoding of the attribute number, right? */
- if (countInContainer(theContainer) >= limit->val) {
+ if (countInContainer(theContainer) >= (int)limit->val) {
interpret(limit->stms);
return(FALSE);
}
@@ -119,7 +119,7 @@ bool passesContainerLimits(Aint theContainer, Aint theAddedInstance) {
/*======================================================================*/
int containerSize(int container, ATrans trans) {
- Aint i;
+ Aword i;
Aint count = 0;
for (i = 1; i <= header->instanceMax; i++) {
@@ -132,7 +132,7 @@ int containerSize(int container, ATrans trans) {
/*======================================================================*/
void list(int container)
{
- int i;
+ uint i;
Aword props;
Aword foundInstance[2] = {0,0};
int found = 0;
diff --git a/engines/glk/alan3/debug.cpp b/engines/glk/alan3/debug.cpp
index f368617e83..7e017ab9cf 100644
--- a/engines/glk/alan3/debug.cpp
+++ b/engines/glk/alan3/debug.cpp
@@ -54,17 +54,17 @@ Breakpoint breakpoint[BREAKPOINTMAX];
#define debugPrefix "adbg: "
/*----------------------------------------------------------------------*/
-static void showAttributes(AttributeEntry *attributes)
+static void showAttributes(AttributeEntry *attrib)
{
AttributeEntry *at;
int i;
char str[80];
- if (attributes == 0)
+ if (attrib == 0)
return;
i = 1;
- for (at = attributes; !isEndOfArray(at); at++) {
+ for (at = attrib; !isEndOfArray(at); at++) {
sprintf(str, "$i$t%s[%d] = %d", (char *) pointerTo(at->id), at->code, (int)at->value);
#if ISO == 0
fromIso(str, str);
@@ -78,7 +78,7 @@ static void showAttributes(AttributeEntry *attributes)
/*----------------------------------------------------------------------*/
static void showContents(int cnt)
{
- int i;
+ uint i;
char str[80];
Abool found = FALSE;
@@ -152,7 +152,7 @@ static void listInstance(int ins) {
/*----------------------------------------------------------------------*/
static void listInstances(char *pattern)
{
- int ins;
+ uint ins;
bool found = FALSE;
for (ins = 1; ins <= header->instanceMax; ins++) {
@@ -173,7 +173,7 @@ static void showInstance(int ins)
{
char str[80];
- if (ins > header->instanceMax || ins < 1) {
+ if (ins > (int)header->instanceMax || ins < 1) {
sprintf(str, "Instance index %d is out of range.", ins);
output(str);
return;
@@ -213,7 +213,7 @@ static void showInstance(int ins)
/*----------------------------------------------------------------------*/
static void listObjects(void)
{
- int obj;
+ uint obj;
output("Objects:");
for (obj = 1; obj <= header->instanceMax; obj++)
@@ -350,7 +350,7 @@ static void listClass(int c)
static void showClassHierarchy(int thisItem, int depth)
{
int i;
- int child;
+ uint child;
output("$i");
for (i=0; i < depth; i++)
@@ -368,7 +368,7 @@ static void showClassHierarchy(int thisItem, int depth)
/*----------------------------------------------------------------------*/
static void listLocations(void)
{
- int loc;
+ uint loc;
output("Locations:");
for (loc = 1; loc <= header->instanceMax; loc++)
@@ -402,7 +402,7 @@ static void showLocation(int loc)
/*----------------------------------------------------------------------*/
static void listActors(void)
{
- int act;
+ uint act;
output("Actors:");
for (act = 1; act <= header->instanceMax; act++)
@@ -429,7 +429,8 @@ static void showActor(int act)
/*----------------------------------------------------------------------*/
static void showEvents(void)
{
- int event, i;
+ uint event;
+ int i;
char str[80];
bool scheduled;
@@ -442,7 +443,7 @@ static void showEvents(void)
output(str);
scheduled = FALSE;
for (i = 0; i < eventQueueTop; i++)
- if ((scheduled = (eventQueue[i].event == event)))
+ if ((scheduled = (eventQueue[i].event == (int)event)))
break;
if (scheduled) {
sprintf(str, "Scheduled for +%d, at ", eventQueue[i].after);
@@ -529,14 +530,6 @@ static void listFiles() {
/*----------------------------------------------------------------------*/
-static void listLines() {
- SourceLineEntry *entry;
- for (entry = (SourceLineEntry *)pointerTo(header->sourceLineTable); *((Aword*)entry) != EOF; entry++)
- printf(" %s:%d\n", sourceFileName(entry->file), entry->line);
-}
-
-
-/*----------------------------------------------------------------------*/
static int findSourceLineIndex(SourceLineEntry *entry, int file, int line) {
/* Will return index to the closest line available */
int i = 0;
@@ -754,7 +747,7 @@ static void handleHelpCommand() {
int maxLength = 0;
for (entry = commandEntries; entry->command != NULL; entry++) {
- if (strlen(entry->command)+strlen(entry->parameter) > maxLength)
+ if (strlen(entry->command)+strlen(entry->parameter) > (uint)maxLength)
maxLength = strlen(entry->command)+strlen(entry->parameter);
}
@@ -1018,7 +1011,7 @@ static void handleObjectsCommand() {
/*----------------------------------------------------------------------*/
static void handleInstancesCommand() {
char *parameter = strtok(NULL, "");
- int i;
+ uint i;
if (parameter == NULL || strchr(parameter, '*') != 0)
listInstances(parameter);
diff --git a/engines/glk/alan3/decode.cpp b/engines/glk/alan3/decode.cpp
index c06d19aa48..233228bab2 100644
--- a/engines/glk/alan3/decode.cpp
+++ b/engines/glk/alan3/decode.cpp
@@ -93,7 +93,7 @@ int decodeChar(void)
f = (((long)(value-low)+1)*freq[0]-1)/range;
/* Find the symbol */
- for (symbol = 1; freq[symbol] > f; symbol++);
+ for (symbol = 1; (int)freq[symbol] > f; ++symbol) {}
high = low + range*freq[symbol-1]/freq[0]-1;
low = low + range*freq[symbol]/freq[0];
diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp
index eb01870e2f..7f0fe2b687 100644
--- a/engines/glk/alan3/exe.cpp
+++ b/engines/glk/alan3/exe.cpp
@@ -67,9 +67,6 @@ Common::SeekableReadStream *textFile;
#define WIDTH 80
-/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static char logFileName[256] = "";
-
/*======================================================================*/
void setStyle(int style)
{
@@ -88,7 +85,7 @@ void setStyle(int style)
void print(Aword fpos, Aword len)
{
char str[2*WIDTH]; /* String buffer */
- int outlen = 0; /* Current output length */
+ uint outlen = 0; /* Current output length */
int ch = 0;
int i;
long savfp = 0; /* Temporary saved text file position */
@@ -282,15 +279,15 @@ void quitGame(void)
/*======================================================================*/
void restartGame(void)
{
- Aint previousLocation = current.location;
#ifdef TODO
- current.location = where(HERO, DIRECT);
+ Aint previousLocation = current.location;
+ current.location = where(HERO, DIRECT);
para();
if (confirm(M_REALLY)) {
longjmp(restartLabel, TRUE);
}
current.location = previousLocation;
-#lse
+#else
::error("TODO: restartGame");
#endif
}
@@ -303,7 +300,7 @@ void cancelEvent(Aword theEvent)
int i;
for (i = eventQueueTop-1; i>=0; i--)
- if (eventQueue[i].event == theEvent) {
+ if (eventQueue[i].event == (int)theEvent) {
while (i < eventQueueTop-1) {
eventQueue[i].event = eventQueue[i+1].event;
eventQueue[i].after = eventQueue[i+1].after;
@@ -337,7 +334,7 @@ static void moveEvent(int to, int from) {
/*======================================================================*/
void schedule(Aword event, Aword where, Aword after)
{
- int i;
+ uint i;
if (event == 0) syserr("NULL event");
@@ -347,7 +344,7 @@ void schedule(Aword event, Aword where, Aword after)
increaseEventQueue();
/* Bubble this event down */
- for (i = eventQueueTop; i >= 1 && eventQueue[i-1].after <= after; i--) {
+ for (i = eventQueueTop; i >= 1 && eventQueue[i-1].after <= (int)after; i--) {
moveEvent(i, i-1);
}
@@ -378,7 +375,7 @@ static char *stripCharsFromStringForwards(int count, char *initialString, char *
char *strippedString;
char *rest;
- if (count > strlen(initialString))
+ if (count > (int)strlen(initialString))
stripPosition = strlen(initialString);
else
stripPosition = count;
@@ -395,7 +392,7 @@ static char *stripCharsFromStringBackwards(Aint count, char *initialString, char
char *strippedString;
char *rest;
- if (count > strlen(initialString))
+ if (count > (int)strlen(initialString))
stripPosition = 0;
else
stripPosition = strlen(initialString)-count;
@@ -419,7 +416,7 @@ static int skipWordForwards(char *string, int position)
{
char separators[] = " .,?";
- int i;
+ uint i;
for (i = position; i<=strlen(string) && strchr(separators, string[i]) == NULL; i++)
;
@@ -469,7 +466,7 @@ static int countTrailingBlanks(char *string, int position) {
int skippedChars, i;
skippedChars = 0;
- if (position > strlen(string)-1)
+ if (position > (int)strlen(string)-1)
syserr("position > length in countTrailingBlanks");
for (i = position; i >= 0 && string[i] == ' '; i--)
skippedChars++;
@@ -536,7 +533,7 @@ Aptr strip(bool stripFromBeginningNotEnd, int count, bool stripWordsNotChars, in
/*======================================================================*/
int getContainerMember(int container, int index, bool directly) {
- Aint i;
+ uint i;
Aint count = 0;
for (i = 1; i <= header->instanceMax; i++) {
@@ -599,7 +596,7 @@ void playSound(int sound)
/*======================================================================*/
void empty(int cnt, int whr)
{
- int i;
+ uint i;
for (i = 1; i <= header->instanceMax; i++)
if (isIn(i, cnt, DIRECT))
@@ -716,15 +713,13 @@ bool streq(char a[], char b[])
/*======================================================================*/
void startTranscript(void) {
- time_t tick;
-
if (logFile != NULL)
return;
- Common::String target = g_vm->getTargetName() + ".log";
+ Common::String filename = g_vm->getTargetName() + ".log";
uint fileUsage = transcriptOption ? fileusage_Transcript : fileusage_InputRecord;
- frefid_t logFileRef = g_vm->glk_fileref_create_by_name(fileUsage, logFileName, 0);
+ frefid_t logFileRef = g_vm->glk_fileref_create_by_name(fileUsage, filename.c_str(), 0);
logFile = g_vm->glk_stream_open_file(logFileRef, filemode_Write, 0);
if (logFile == NULL) {
diff --git a/engines/glk/alan3/instance.cpp b/engines/glk/alan3/instance.cpp
index 49bc72d703..761c74a4b4 100644
--- a/engines/glk/alan3/instance.cpp
+++ b/engines/glk/alan3/instance.cpp
@@ -93,7 +93,7 @@ bool isALocation(int instance)
bool isLiteral(int instance)
{
- return instance > header->instanceMax;
+ return instance > (int)header->instanceMax;
}
bool isANumeric(int instance)
@@ -118,7 +118,7 @@ void setInstanceAttribute(int instance, int attribute, Aptr value)
{
char str[80];
- if (instance > 0 && instance <= header->instanceMax) {
+ if (instance > 0 && instance <= (int)header->instanceMax) {
setAttribute(admin[instance].attributes, attribute, value);
if (isALocation(instance) && attribute != VISITSATTRIBUTE)
/* If it wasn't the VISITSATTRIBUTE the location may have
@@ -173,7 +173,7 @@ Aptr getInstanceAttribute(int instance, int attribute)
if (isLiteral(instance))
return literalAttribute(instance, attribute);
else {
- if (instance > 0 && instance <= header->instanceMax) {
+ if (instance > 0 && instance <= (int)header->instanceMax) {
if (attribute == -1)
return locationOf(instance);
else
@@ -208,7 +208,7 @@ static void verifyInstance(int instance, char *action) {
if (instance == 0) {
sprintf(message, "Can't %s instance (%d).", action, instance);
syserr(message);
- } else if (instance > header->instanceMax) {
+ } else if (instance > (int)header->instanceMax) {
sprintf(message, "Can't %s instance (%d > instanceMax).", action, instance);
syserr(message);
}
@@ -290,20 +290,20 @@ bool isAt(int instance, int other, ATrans trans)
if (isALocation(instance)) {
/* Nested locations */
/* TODO - What if the other is not a location? */
- int current = admin[instance].location;
+ int curr = admin[instance].location;
switch (trans) {
case DIRECT:
return admin[instance].location == other;
case INDIRECT:
- if (current == other)
+ if (curr == other)
return FALSE;
- current = admin[current].location;
+ curr = admin[curr].location;
case TRANSITIVE:
- while (current != 0) {
- if (current == other)
+ while (curr != 0) {
+ if (curr == other)
return TRUE;
else
- current = admin[current].location;
+ curr = admin[curr].location;
}
return FALSE;
}
@@ -321,12 +321,12 @@ bool isAt(int instance, int other, ATrans trans)
}
case TRANSITIVE: {
int location = locationOf(instance);
- int current = other;
- while (current != 0) {
- if (current == location)
+ int curr = other;
+ while (curr != 0) {
+ if (curr == location)
return TRUE;
else
- current = admin[current].location;
+ curr = admin[curr].location;
}
return FALSE;
}
@@ -340,28 +340,28 @@ bool isAt(int instance, int other, ATrans trans)
return positionOf(instance) == admin[other].location;
case INDIRECT: {
int location = locationOf(instance);
- int current = other;
- if (location == current)
+ int curr = other;
+ if (location == curr)
return FALSE;
else
- current = admin[current].location;
- while (current != 0) {
- if (current == location)
+ curr = admin[curr].location;
+ while (curr != 0) {
+ if (curr == location)
return TRUE;
else
- current = admin[current].location;
+ curr = admin[curr].location;
}
return FALSE;
}
case TRANSITIVE: {
int location = locationOf(other);
- int current = locationOf(instance);
+ int curr = locationOf(instance);
bool ok = FALSE;
- while (current != 0 && !ok) {
- if (current == location)
+ while (curr != 0 && !ok) {
+ if (curr == location)
ok = TRUE;
else
- current = admin[current].location;
+ curr = admin[curr].location;
}
return ok;
}
@@ -530,7 +530,7 @@ static char *wordWithCode(int classBit, int code) {
char str[50];
for (w = 0; w < dictionarySize; w++)
- if (dictionary[w].code == code && ((classBit&dictionary[w].classBits) != 0))
+ if (dictionary[w].code == (Aword)code && ((classBit&dictionary[w].classBits) != 0))
return (char *)pointerTo(dictionary[w].string);
sprintf(str, "Could not find word of class %d with code %d.", classBit, code);
syserr(str);
@@ -804,7 +804,7 @@ static bool descriptionCheck(int instance)
/*======================================================================*/
void describeInstances(void)
{
- int i;
+ uint i;
int lastInstanceFound = 0;
int found = 0;
@@ -899,7 +899,7 @@ static void locateLocation(Aword loc, Aword whr)
/* Ensure this does not create a recursive location chain */
while (l != 0) {
- if (admin[l].location == loc)
+ if (admin[l].location == (int)loc)
apperr("Locating a location that would create a recursive loop of locations containing each other.");
else
l = admin[l].location;
@@ -1011,7 +1011,7 @@ static void locateActor(Aint movingActor, Aint whr)
/* Before leaving, remember that we visited the location */
if (!isPreBeta5(header->version))
- if (movingActor == HERO)
+ if (movingActor == (int)HERO)
incrementVisits(where(HERO, DIRECT));
/* TODO Actors locating into containers is dubious, anyway as it
@@ -1035,7 +1035,7 @@ static void locateActor(Aint movingActor, Aint whr)
current.instance = previousInstance;
current.actor = previousActor;
- if (movingActor == HERO) {
+ if (movingActor == (int)HERO) {
if (shouldBeDescribed())
look();
else
diff --git a/engines/glk/alan3/inter.cpp b/engines/glk/alan3/inter.cpp
index 56f696658d..e4e98fd81c 100644
--- a/engines/glk/alan3/inter.cpp
+++ b/engines/glk/alan3/inter.cpp
@@ -975,10 +975,10 @@ void interpret(Aaddr adr)
break;
}
case I_SAYSTR: {
- Aptr adr = pop(stack);
+ Aptr sayAddr = pop(stack);
if (traceInstructionOption)
- printf("SAYSTR\t%7ld\t\ty\t", (long)adr);
- sayString((char *)fromAptr(adr));
+ printf("SAYSTR\t%7ld\t\ty\t", (long)sayAddr);
+ sayString((char *)fromAptr(sayAddr));
if (traceInstructionOption)
printf("\n\t\t\t\t\t\t");
break;
diff --git a/engines/glk/alan3/location.cpp b/engines/glk/alan3/location.cpp
index 59dccd9a07..eca958052d 100644
--- a/engines/glk/alan3/location.cpp
+++ b/engines/glk/alan3/location.cpp
@@ -58,7 +58,7 @@ void go(int location, int dir)
theExit = (ExitEntry *) pointerTo(instances[location].exits);
if (instances[location].exits != 0)
while (!isEndOfArray(theExit)) {
- if (theExit->code == dir) {
+ if (theExit->code == (uint)dir) {
ok = TRUE;
if (theExit->checks != 0) {
if (traceSectionOption)
@@ -73,7 +73,7 @@ void go(int location, int dir)
interpret(theExit->action);
}
/* Still at the same place? */
- if (where(HERO, TRANSITIVE) == oldloc) {
+ if (where(HERO, TRANSITIVE) == (int)oldloc) {
if (traceSectionOption)
traceExit(location, dir, "Moving");
locate(HERO, theExit->target);
@@ -97,7 +97,7 @@ bool exitto(int to, int from)
return FALSE; /* No exits */
for (theExit = (ExitEntry *) pointerTo(instances[from].exits); !isEndOfArray(theExit); theExit++)
- if (theExit->target == to)
+ if (theExit->target == (uint)to)
return TRUE;
return FALSE;
@@ -107,7 +107,7 @@ bool exitto(int to, int from)
/*======================================================================*/
void look(void)
{
- int i;
+ uint i;
/* Set describe flag for all objects and actors */
for (i = 1; i <= header->instanceMax; i++)
diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp
index a81082edaf..3697ac6009 100644
--- a/engines/glk/alan3/main.cpp
+++ b/engines/glk/alan3/main.cpp
@@ -217,17 +217,17 @@ static void setupHeader(ACodeHeader tmphdr) {
/*----------------------------------------------------------------------*/
static void loadAndCheckMemory(ACodeHeader tmphdr, Aword crc, char err[]) {
- int i;
+ int i;
/* No memory allocated yet? */
if (memory == NULL) {
memory = (Aword *)allocate(tmphdr.size * sizeof(Aword));
}
memTop = tmphdr.size;
- if (sizeof(Aword) * tmphdr.size > codfil->size())
+ if ((int)(sizeof(Aword) * tmphdr.size) > codfil->size())
syserr("Could not read all ACD code.");
- for (Aword i = 0; i < tmphdr.size; ++i)
+ for (i = 0; i < (int)tmphdr.size; ++i)
memory[i] = codfil->readUint32LE();
/* Calculate checksum */
@@ -280,13 +280,13 @@ char *decodedGameVersion(char version[]) {
}
/*----------------------------------------------------------------------*/
-static void incompatibleDevelopmentVersion(ACodeHeader *header) {
+static void incompatibleDevelopmentVersion(ACodeHeader *hdr) {
char str[80];
sprintf(str, "Incompatible version of ACODE program. Development versions always require exact match. Game is %ld.%ld%s%ld, interpreter %ld.%ld%s%ld!",
- (long)(header->version[0]),
- (long)(header->version[1]),
- decodeState(header->version[3]),
- (long)(header->version[2]),
+ (long)(hdr->version[0]),
+ (long)(hdr->version[1]),
+ decodeState(hdr->version[3]),
+ (long)(hdr->version[2]),
(long)alan.version.version,
(long)alan.version.revision,
alan.version.state,
@@ -296,11 +296,11 @@ static void incompatibleDevelopmentVersion(ACodeHeader *header) {
/*----------------------------------------------------------------------*/
-static void incompatibleVersion(ACodeHeader *header) {
+static void incompatibleVersion(ACodeHeader *hdr) {
char str[80];
sprintf(str, "Incompatible version of ACODE program. Game is %ld.%ld, interpreter %ld.%ld.",
- (long)(header->version[0]),
- (long)(header->version[1]),
+ (long)(hdr->version[0]),
+ (long)(hdr->version[1]),
(long)alan.version.version,
(long)alan.version.revision);
apperr(str);
@@ -332,7 +332,7 @@ static void nonDevelopmentRunningDevelopmentStateGame(char version[]) {
/*======================================================================*/
-void checkVersion(ACodeHeader *header)
+void checkVersion(ACodeHeader *hdr)
{
/* Strategy for version matching is:
1) Development interpreters/games require exact match
@@ -351,7 +351,7 @@ void checkVersion(ACodeHeader *header)
bool developmentVersion;
bool alphaVersion;
int compareLength;
- char gameState = header->version[3];
+ char gameState = hdr->version[3];
/* Construct our own version */
interpreterVersion[0] = alan.version.version;
@@ -363,10 +363,10 @@ void checkVersion(ACodeHeader *header)
if (debugOption && !regressionTestOption) {
printf("<Version of '%s' is %d.%d%s%d!>\n",
adventureFileName,
- (int)header->version[0],
- (int)header->version[1],
- decodeState(header->version[3]),
- (int)header->version[2]);
+ (int)hdr->version[0],
+ (int)hdr->version[1],
+ decodeState(hdr->version[3]),
+ (int)hdr->version[2]);
newline();
}
@@ -377,21 +377,21 @@ void checkVersion(ACodeHeader *header)
if (gameState == 'd' && !developmentVersion)
/* Development state game requires development state interpreter... */
- nonDevelopmentRunningDevelopmentStateGame(header->version);
+ nonDevelopmentRunningDevelopmentStateGame(hdr->version);
else {
/* Compatible if version, revision (and correction if dev state) match... */
- if (memcmp(header->version, interpreterVersion, compareLength) != 0) {
+ if (memcmp(hdr->version, interpreterVersion, compareLength) != 0) {
/* Mismatch! */
if (!ignoreErrorOption) {
if (developmentVersion)
- incompatibleDevelopmentVersion(header);
+ incompatibleDevelopmentVersion(hdr);
else
- incompatibleVersion(header);
+ incompatibleVersion(hdr);
} else
output("<WARNING! Incompatible version of ACODE program.>\n");
} else if (developmentVersion && gameState != 'd')
/* ... unless interpreter is development and game not */
- incompatibleDevelopmentVersion(header);
+ incompatibleDevelopmentVersion(hdr);
else if (alphaVersion && gameState != 'a') {
/* If interpreter is alpha version and the game is later, warn! */
alphaRunningLaterGame(gameState);
@@ -517,7 +517,7 @@ static void initStrings(void)
/*----------------------------------------------------------------------*/
static Aint sizeOfAttributeData(void)
{
- int i;
+ uint i;
int size = 0;
for (i=1; i<=header->instanceMax; i++) {
@@ -541,7 +541,7 @@ static AttributeEntry *initializeAttributes(int awordSize)
{
Aword *attributeArea = (Aword *)allocate(awordSize*sizeof(Aword));
Aword *currentAttributeArea = attributeArea;
- int i;
+ uint i;
for (i=1; i<=header->instanceMax; i++) {
AttributeHeaderEntry *originalAttribute = (AttributeHeaderEntry *)pointerTo(instances[i].initialAttributes);
@@ -566,7 +566,7 @@ static AttributeEntry *initializeAttributes(int awordSize)
/*----------------------------------------------------------------------*/
static void initDynamicData(void)
{
- int instanceId;
+ uint instanceId;
/* Allocate for administrative table */
admin = (AdminEntry *)allocate((header->instanceMax+1)*sizeof(AdminEntry));
@@ -603,7 +603,7 @@ static void runInitialize(Aint theInstance) {
/*----------------------------------------------------------------------*/
static void initializeInstances() {
- int instanceId;
+ uint instanceId;
/* Set initial locations */
for (instanceId = 1; instanceId <= header->instanceMax; instanceId++) {
@@ -642,28 +642,6 @@ static void start(void)
/*----------------------------------------------------------------------*/
static void openFiles(void)
{
- char str[256];
-
- /*
- Open Acode file
- strcpy(codfnm, adventureFileName);
- if ((codfil = fopen(codfnm, READ_MODE)) == NULL) {
- strcpy(str, "Can't open adventure code file '");
- strcat(str, codfnm);
- strcat(str, "'.");
- playererr(str);
- }
-
- // Open Text file
- strcpy(txtfnm, adventureFileName);
- if ((textFile = fopen(txtfnm, READ_MODE)) == NULL) {
- strcpy(str, "Can't open adventure text data file '");
- strcat(str, txtfnm);
- strcat(str, "'.");
- apperr(str);
- }
- */
-
/* If logging open log file */
if (transcriptOption || logOption) {
startTranscript();
@@ -744,7 +722,7 @@ static void moveActor(int theActor)
current.actor = theActor;
current.instance = theActor;
current.location = where(theActor, TRANSITIVE);
- if (theActor == HERO) {
+ if (theActor == (int)HERO) {
#ifdef TODO
/* Ask him! */
if (setjmp(forfeitLabel) == 0) {
@@ -815,9 +793,7 @@ static void moveActor(int theActor)
#define ERROR_RETURNED (setjmp(returnLabel) != NO_JUMP_RETURN)
/*======================================================================*/
-void run(void)
-{
- int i;
+void run(void) {
static Stack theStack = NULL; /* Needs to survive longjmp() */
openFiles();
@@ -879,7 +855,7 @@ void run(void)
resetAndEvaluateRules(rules, header->version);
/* Then all the other actors... */
- for (i = 1; i <= header->instanceMax; i++)
+ for (uint i = 1; i <= header->instanceMax; i++)
if (i != header->theHero && isAActor(i)) {
moveActor(i);
resetAndEvaluateRules(rules, header->version);
diff --git a/engines/glk/alan3/output.cpp b/engines/glk/alan3/output.cpp
index 20ab604228..efe4e31d3b 100644
--- a/engines/glk/alan3/output.cpp
+++ b/engines/glk/alan3/output.cpp
@@ -143,7 +143,7 @@ void clear(void)
/*----------------------------------------------------------------------*/
static void capitalizeFirst(char *str) {
- int i = 0;
+ uint i = 0;
/* Skip over space... */
while (i < strlen(str) && isSpace(str[i])) i++;
@@ -167,10 +167,10 @@ void printAndLog(const char *string)
if (!onStatusLine && transcriptOption) {
#ifdef HAVE_GLK
// TODO Is this assuming only 70-char wide windows for GLK?
- if (strlen(string) > 70-column) {
+ if ((int)strlen(string) > 70-column) {
stringCopy = strdup(string); /* Make sure we can write NULLs */
stringPart = stringCopy;
- while (strlen(stringPart) > 70-column) {
+ while ((int)strlen(stringPart) > 70-column) {
int p;
for (p = 70-column; p>0 && !isspace((int)stringPart[p]); p--);
stringPart[p] = '\0';
diff --git a/engines/glk/alan3/params.cpp b/engines/glk/alan3/params.cpp
index 3cbf05dd27..4b940099f8 100644
--- a/engines/glk/alan3/params.cpp
+++ b/engines/glk/alan3/params.cpp
@@ -207,7 +207,7 @@ void addParameterToParameterArray(ParameterArray theArray, Parameter *theParamet
{
if (theArray == NULL) syserr("Adding to null parameter array");
- int i;
+ uint i;
for (i = 0; !isEndOfArray(&theArray[i]) && i < MAXINSTANCE; i++)
;
diff --git a/engines/glk/alan3/reverse.cpp b/engines/glk/alan3/reverse.cpp
index 64e0ea0ad5..d31e7c3f2f 100644
--- a/engines/glk/alan3/reverse.cpp
+++ b/engines/glk/alan3/reverse.cpp
@@ -107,7 +107,7 @@ void reverse(Aword *w) /* IN - The ACODE word to reverse bytes in */
static void reverseTable(Aword adr, int elementSize)
{
Aword *e = &memory[adr];
- int i;
+ uint i;
if (elementSize < sizeof(Aword) || elementSize % sizeof(Aword) != 0)
syserr("***Wrong size in 'reverseTable()' ***");
@@ -531,30 +531,30 @@ static void reversePreAlpha5Header(Pre3_0alpha5Header *hdr)
/*----------------------------------------------------------------------*/
static void reversePreAlpha5() {
/* NOTE that the reversePreXXX() have different header definitions */
- Pre3_0alpha5Header *header = (Pre3_0alpha5Header *)memory;
+ Pre3_0alpha5Header *hdr = (Pre3_0alpha5Header *)memory;
- reversePreAlpha5Header(header);
- memorySize = header->size;
+ reversePreAlpha5Header(hdr);
+ memorySize = hdr->size;
- reverseDictionary(header->dictionary);
- reverseSyntaxTable(header->syntaxTableAddress, header->version);
- reverseParameterTable(header->parameterMapAddress);
- reverseVerbs(header->verbTableAddress);
- reverseClasses(header->classTableAddress);
- reverseInstances(header->instanceTableAddress);
- reverseScrs(header->scriptTableAddress);
- reverseContainers(header->containerTableAddress);
- reverseEvts(header->eventTableAddress);
- reverseRuls(header->ruleTableAddress);
- reverseTable(header->stringInitTable, sizeof(StringInitEntry));
- reverseSetInitTable(header->setInitTable);
- reverseTable(header->sourceFileTable, sizeof(SourceFileEntry));
- reverseTable(header->sourceLineTable, sizeof(SourceLineEntry));
- reverseStms(header->start);
- reverseMsgs(header->messageTableAddress);
+ reverseDictionary(hdr->dictionary);
+ reverseSyntaxTable(hdr->syntaxTableAddress, hdr->version);
+ reverseParameterTable(hdr->parameterMapAddress);
+ reverseVerbs(hdr->verbTableAddress);
+ reverseClasses(hdr->classTableAddress);
+ reverseInstances(hdr->instanceTableAddress);
+ reverseScrs(hdr->scriptTableAddress);
+ reverseContainers(hdr->containerTableAddress);
+ reverseEvts(hdr->eventTableAddress);
+ reverseRuls(hdr->ruleTableAddress);
+ reverseTable(hdr->stringInitTable, sizeof(StringInitEntry));
+ reverseSetInitTable(hdr->setInitTable);
+ reverseTable(hdr->sourceFileTable, sizeof(SourceFileEntry));
+ reverseTable(hdr->sourceLineTable, sizeof(SourceLineEntry));
+ reverseStms(hdr->start);
+ reverseMsgs(hdr->messageTableAddress);
- reverseTable(header->scores, sizeof(Aword));
- reverseTable(header->freq, sizeof(Aword));
+ reverseTable(hdr->scores, sizeof(Aword));
+ reverseTable(hdr->freq, sizeof(Aword));
}
@@ -572,30 +572,30 @@ static void reversePreBeta2Header(Pre3_0beta2Header *hdr)
/*----------------------------------------------------------------------*/
static void reversePreBeta2() {
/* NOTE that the reversePreXXX() have different header definitions */
- Pre3_0beta2Header *header = (Pre3_0beta2Header *)memory;
+ Pre3_0beta2Header *hdr = (Pre3_0beta2Header *)memory;
- reversePreBeta2Header(header);
- memorySize = header->size;
+ reversePreBeta2Header(hdr);
+ memorySize = hdr->size;
- reverseDictionary(header->dictionary);
- reverseSyntaxTable(header->syntaxTableAddress, header->version);
- reverseParameterTable(header->parameterMapAddress);
- reverseVerbs(header->verbTableAddress);
- reverseClasses(header->classTableAddress);
- reverseInstances(header->instanceTableAddress);
- reverseScrs(header->scriptTableAddress);
- reverseContainers(header->containerTableAddress);
- reverseEvts(header->eventTableAddress);
- reverseRuls(header->ruleTableAddress);
- reverseTable(header->stringInitTable, sizeof(StringInitEntry));
- reverseSetInitTable(header->setInitTable);
- reverseTable(header->sourceFileTable, sizeof(SourceFileEntry));
- reverseTable(header->sourceLineTable, sizeof(SourceLineEntry));
- reverseStms(header->start);
- reverseMsgs(header->messageTableAddress);
+ reverseDictionary(hdr->dictionary);
+ reverseSyntaxTable(hdr->syntaxTableAddress, hdr->version);
+ reverseParameterTable(hdr->parameterMapAddress);
+ reverseVerbs(hdr->verbTableAddress);
+ reverseClasses(hdr->classTableAddress);
+ reverseInstances(hdr->instanceTableAddress);
+ reverseScrs(hdr->scriptTableAddress);
+ reverseContainers(hdr->containerTableAddress);
+ reverseEvts(hdr->eventTableAddress);
+ reverseRuls(hdr->ruleTableAddress);
+ reverseTable(hdr->stringInitTable, sizeof(StringInitEntry));
+ reverseSetInitTable(hdr->setInitTable);
+ reverseTable(hdr->sourceFileTable, sizeof(SourceFileEntry));
+ reverseTable(hdr->sourceLineTable, sizeof(SourceLineEntry));
+ reverseStms(hdr->start);
+ reverseMsgs(hdr->messageTableAddress);
- reverseTable(header->scores, sizeof(Aword));
- reverseTable(header->freq, sizeof(Aword));
+ reverseTable(hdr->scores, sizeof(Aword));
+ reverseTable(hdr->freq, sizeof(Aword));
}
@@ -611,43 +611,43 @@ void reverseHdr(ACodeHeader *hdr)
/*----------------------------------------------------------------------*/
-static void reverseInstanceIdTable(ACodeHeader *header) {
- reverseTable(header->instanceTableAddress+header->instanceMax*sizeof(InstanceEntry)/sizeof(Aword)+1, sizeof(Aword));
+static void reverseInstanceIdTable(ACodeHeader *hdr) {
+ reverseTable(hdr->instanceTableAddress+hdr->instanceMax*sizeof(InstanceEntry)/sizeof(Aword)+1, sizeof(Aword));
}
/*----------------------------------------------------------------------*/
static void reverseNative() {
- /* NOTE that the reversePreXXX() have different header definitions */
- ACodeHeader *header = (ACodeHeader *)memory;
-
- reverseHdr(header);
- memorySize = header->size;
-
- reverseDictionary(header->dictionary);
- reverseSyntaxTable(header->syntaxTableAddress, header->version);
- if (header->debug && !isPreBeta3(header->version))
- reverseParameterNames(header->parameterMapAddress);
- reverseParameterTable(header->parameterMapAddress);
- reverseVerbs(header->verbTableAddress);
- reverseClasses(header->classTableAddress);
- reverseInstances(header->instanceTableAddress);
- if (header->debug && !isPreBeta3(header->version))
- reverseInstanceIdTable(header);
- reverseScrs(header->scriptTableAddress);
- reverseContainers(header->containerTableAddress);
- reverseEvts(header->eventTableAddress);
- reverseRuls(header->ruleTableAddress);
- reverseTable(header->stringInitTable, sizeof(StringInitEntry));
- reverseSetInitTable(header->setInitTable);
- reverseTable(header->sourceFileTable, sizeof(SourceFileEntry));
- reverseTable(header->sourceLineTable, sizeof(SourceLineEntry));
- reverseStms(header->prompt);
- reverseStms(header->start);
- reverseMsgs(header->messageTableAddress);
-
- reverseTable(header->scores, sizeof(Aword));
- reverseTable(header->freq, sizeof(Aword));
+ /* NOTE that the reversePreXXX() have different hdr definitions */
+ ACodeHeader *hdr = (ACodeHeader *)memory;
+
+ reverseHdr(hdr);
+ memorySize = hdr->size;
+
+ reverseDictionary(hdr->dictionary);
+ reverseSyntaxTable(hdr->syntaxTableAddress, hdr->version);
+ if (hdr->debug && !isPreBeta3(hdr->version))
+ reverseParameterNames(hdr->parameterMapAddress);
+ reverseParameterTable(hdr->parameterMapAddress);
+ reverseVerbs(hdr->verbTableAddress);
+ reverseClasses(hdr->classTableAddress);
+ reverseInstances(hdr->instanceTableAddress);
+ if (hdr->debug && !isPreBeta3(hdr->version))
+ reverseInstanceIdTable(hdr);
+ reverseScrs(hdr->scriptTableAddress);
+ reverseContainers(hdr->containerTableAddress);
+ reverseEvts(hdr->eventTableAddress);
+ reverseRuls(hdr->ruleTableAddress);
+ reverseTable(hdr->stringInitTable, sizeof(StringInitEntry));
+ reverseSetInitTable(hdr->setInitTable);
+ reverseTable(hdr->sourceFileTable, sizeof(SourceFileEntry));
+ reverseTable(hdr->sourceLineTable, sizeof(SourceLineEntry));
+ reverseStms(hdr->prompt);
+ reverseStms(hdr->start);
+ reverseMsgs(hdr->messageTableAddress);
+
+ reverseTable(hdr->scores, sizeof(Aword));
+ reverseTable(hdr->freq, sizeof(Aword));
}
@@ -662,13 +662,13 @@ static void reverseNative() {
*/
void reverseACD(void)
{
- ACodeHeader *header = (ACodeHeader *)memory;
+ ACodeHeader *hdr = (ACodeHeader *)memory;
char version[4];
int i;
/* Make a copy of the version marking to reverse */
for (i = 0; i <= 3; i++)
- version[i] = header->version[i];
+ version[i] = hdr->version[i];
reverseWord((Aword*)&version);
if (isPreAlpha5(version))
diff --git a/engines/glk/alan3/rules.cpp b/engines/glk/alan3/rules.cpp
index 4f2d60e2fc..29c98c8ec4 100644
--- a/engines/glk/alan3/rules.cpp
+++ b/engines/glk/alan3/rules.cpp
@@ -52,9 +52,9 @@ static int ruleCount;
static RulesAdmin *rulesAdmin; /* Table for administration of the rules */
/*----------------------------------------------------------------------*/
-static void clearRulesAdmin(int ruleCount) {
+static void clearRulesAdmin(int numRules) {
int r;
- for (r = 0; r < ruleCount; r++) {
+ for (r = 0; r < numRules; r++) {
rulesAdmin[r].lastEval = FALSE;
rulesAdmin[r].alreadyRun = FALSE;
}
@@ -62,11 +62,11 @@ static void clearRulesAdmin(int ruleCount) {
/*----------------------------------------------------------------------*/
-static void initRulesAdmin(int ruleCount) {
+static void initRulesAdmin(int numRules) {
int r;
- rulesAdmin = (RulesAdmin *)allocate(ruleCount*sizeof(RulesAdmin)+sizeof(EOF));
- for (r = 0; r < ruleCount; r++)
+ rulesAdmin = (RulesAdmin *)allocate(numRules*sizeof(RulesAdmin)+sizeof(EOF));
+ for (r = 0; r < numRules; r++)
;
setEndOfArray(&rulesAdmin[r]);
}
@@ -167,33 +167,6 @@ static void evaluateRulesPreBeta2(void)
/*----------------------------------------------------------------------*/
-static void evaluateRulesBeta2New(void) {
- int i;
-
- for (i = 1; !isEndOfArray(&rules[i-1]); i++)
- rules[i-1].alreadyRun = FALSE;
-
- current.location = NOWHERE;
- current.actor = 0;
-
- anyRuleRun = FALSE;
-
- for (i = 1; !isEndOfArray(&rules[i-1]); i++) {
- bool evaluated_value = evaluate(rules[i-1].exp);
- traceRuleEvaluation(i);
- rules[i-1].alreadyRun = evaluated_value;
- }
- for (i = 1; !isEndOfArray(&rules[i-1]); i++) {
- if (rules[i-1].alreadyRun) {
- traceRuleExecution(i);
- interpret(rules[i-1].stms);
- anyRuleRun = TRUE;
- }
- }
-}
-
-
-/*----------------------------------------------------------------------*/
/* This is how beta2 thought rules should be evaluated:
*/
static void evaluateRulesBeta2(void)
@@ -241,7 +214,7 @@ void resetRules() {
/*======================================================================*/
-void evaluateRules(RuleEntry rules[]) {
+void evaluateRules(RuleEntry ruleList[]) {
bool change = TRUE;
int rule;
@@ -250,15 +223,15 @@ void evaluateRules(RuleEntry rules[]) {
while (change) {
change = FALSE;
- for (rule = 1; !isEndOfArray(&rules[rule-1]); rule++) {
+ for (rule = 1; !isEndOfArray(&ruleList[rule-1]); rule++) {
traceRuleEvaluation(rule);
- bool evaluated_value = evaluate(rules[rule-1].exp);
+ bool evaluated_value = evaluate(ruleList[rule-1].exp);
traceRuleResult(rule, evaluated_value);
if (evaluated_value == true && rulesAdmin[rule-1].lastEval == false
&& !rulesAdmin[rule-1].alreadyRun) {
change = TRUE;
traceRuleExecution(rule);
- interpret(rules[rule-1].stms);
+ interpret(ruleList[rule-1].stms);
rulesAdmin[rule-1].alreadyRun = TRUE;
anyRuleRun = TRUE;
} else {
@@ -272,14 +245,14 @@ void evaluateRules(RuleEntry rules[]) {
/*=======================================================================*/
-void resetAndEvaluateRules(RuleEntry rules[], char *version) {
+void resetAndEvaluateRules(RuleEntry ruleList[], char *version) {
if (isPreBeta2(version))
evaluateRulesPreBeta2();
else if (isPreBeta3(version))
evaluateRulesBeta2();
else {
resetRules();
- evaluateRules(rules);
+ evaluateRules(ruleList);
}
}
diff --git a/engines/glk/alan3/state.cpp b/engines/glk/alan3/state.cpp
index 4112659201..3b8acffec8 100644
--- a/engines/glk/alan3/state.cpp
+++ b/engines/glk/alan3/state.cpp
@@ -99,42 +99,42 @@ static int countSets(void) {
/*----------------------------------------------------------------------*/
-static void deallocateSets(GameState *gameState) {
+static void deallocateSets(GameState *gState) {
int count = countSets();
int i;
for (i = 0; i < count; i++)
- freeSet(gameState->sets[i]);
- deallocate(gameState->sets);
+ freeSet(gState->sets[i]);
+ deallocate(gState->sets);
}
/*======================================================================*/
-void deallocateGameState(GameState *gameState) {
+void deallocateGameState(GameState *gState) {
- deallocate(gameState->admin);
- deallocate(gameState->attributes);
+ deallocate(gState->admin);
+ deallocate(gState->attributes);
- if (gameState->eventQueueTop > 0) {
- deallocate(gameState->eventQueue);
- gameState->eventQueue = NULL;
+ if (gState->eventQueueTop > 0) {
+ deallocate(gState->eventQueue);
+ gState->eventQueue = NULL;
}
- if (gameState->scores)
- deallocate(gameState->scores);
+ if (gState->scores)
+ deallocate(gState->scores);
- deallocateStrings(gameState);
- deallocateSets(gameState);
+ deallocateStrings(gState);
+ deallocateSets(gState);
- memset(gameState, 0, sizeof(GameState));
+ memset(gState, 0, sizeof(GameState));
}
/*======================================================================*/
void forgetGameState(void) {
- char *playerCommand;
- popGameState(stateStack, &gameState, &playerCommand);
+ char *playerCmd;
+ popGameState(stateStack, &gameState, &playerCmd);
deallocateGameState(&gameState);
- if (playerCommand != NULL)
- deallocate(playerCommand);
+ if (playerCmd != NULL)
+ deallocate(playerCmd);
}
diff --git a/engines/glk/alan3/sysdep.cpp b/engines/glk/alan3/sysdep.cpp
index 94132a7ae0..7e9dc48ce9 100644
--- a/engines/glk/alan3/sysdep.cpp
+++ b/engines/glk/alan3/sysdep.cpp
@@ -63,9 +63,6 @@ size_t strftime (
#endif
-
-#ifdef HAVE_GLK
-
/* Note to Glk maintainers: 'native' characters are used for output, in this
case, Glk's Latin-1. ISO characters are Alan's internal representation,
stored in the .A3C file, and must be converted to native before printing.
@@ -74,7 +71,7 @@ size_t strftime (
move to Unicode).
*/
-static char spaceCharacters[] =
+static const byte spaceCharacters[] =
{
0x0A, /* linefeed */
0x20, /* space */
@@ -82,7 +79,7 @@ static char spaceCharacters[] =
0x00
};
-static char lowerCaseCharacters[] =
+static const byte lowerCaseCharacters[] =
{
0x61, /* a */ 0x62, /* b */ 0x63, /* c */ 0x64, /* d */
0x65, /* e */ 0x66, /* f */ 0x67, /* g */ 0x68, /* h */
@@ -113,7 +110,7 @@ static char lowerCaseCharacters[] =
Are they really considered LC?
*/
-static char upperCaseCharacters[] =
+static const byte upperCaseCharacters[] =
{
0x41, /* A */ 0x42, /* B */ 0x43, /* C */ 0x44, /* D */
0x45, /* E */ 0x46, /* F */ 0x47, /* G */ 0x48, /* H */
@@ -140,18 +137,6 @@ static char upperCaseCharacters[] =
0x00
};
-#else
-
-/* Theses work on native character sets */
-
-static unsigned char spaceCharacters[] = " \t\n";
-
-/* Use native characters */
-static const char lowerCaseCharacters[] = "abcdefghijklmnopqrstuvwxyzàáâãäåæçéêëìíîïðñòóôõöøùúûüýþÿ";
-
-static const char upperCaseCharacters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÛÝÞß";
-
-#endif
int isSpace(unsigned int c) /* IN - Native character to test */
{
@@ -161,13 +146,13 @@ int isSpace(unsigned int c) /* IN - Native character to test */
int isLower(unsigned int c) /* IN - Native character to test */
{
- return (c != '\0' && strchr((char *)lowerCaseCharacters, c) != 0);
+ return (c != '\0' && strchr((const char *)lowerCaseCharacters, c) != 0);
}
int isUpper(unsigned int c) /* IN - Native character to test */
{
- return (c != '\0' && strchr((char *)upperCaseCharacters, c) != 0);
+ return (c != '\0' && strchr((const char *)upperCaseCharacters, c) != 0);
}
int isLetter(unsigned int c) /* IN - Native character to test */
@@ -203,7 +188,8 @@ int toLower(unsigned int c) /* IN - Native character to convert */
#endif
}
-int toUpper(unsigned int c) /* IN - Native character to convert */
+/* IN - Native character to convert */
+int toUpper(unsigned int c)
{
#ifdef HAVE_GLK
return g_vm->glk_char_to_upper(c);
@@ -254,9 +240,8 @@ char *strupp(char str[]) /* INOUT - Native string to convert */
int isLowerCase(unsigned int c) /* IN - ISO character to test */
{
- static char lowerCaseCharacters[] = "abcdefghijklmnopqrstuvwxyz\340\341\342\343\344\345\346\347\351\352\353\354\355\356\357\360\361\362\363\364\365\366\370\371\372\373\374\375\376\377";
- int i;
- for (i = 0; i < strlen(lowerCaseCharacters); i++)
+ uint i;
+ for (i = 0; i < strlen((const char *)lowerCaseCharacters); i++)
if (((unsigned int)lowerCaseCharacters[i]) == c) return 1;
return 0;
}
@@ -264,9 +249,8 @@ int isLowerCase(unsigned int c) /* IN - ISO character to test */
int isUpperCase(unsigned int c) /* IN - ISO character to test */
{
- //static char upperCaseCharacters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337";
- int i;
- for (i = 0; i < strlen(upperCaseCharacters); i++)
+ uint i;
+ for (i = 0; i < strlen((const char *)upperCaseCharacters); i++)
if (upperCaseCharacters[i] == c) return 1;
return 0;
}
@@ -337,7 +321,7 @@ void toIso(char copy[], /* OUT - Mapped string */
char original[], /* IN - string to convert */
int charset) /* IN - the current character set */
{
-static unsigned char macMap[256]
+static const unsigned char macMap[256]
= {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0A,0x0E,0x0F,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
@@ -356,7 +340,7 @@ static unsigned char macMap[256]
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F};
-static unsigned char dosMap[256]
+static const unsigned char dosMap[256]
= {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0A,0x0E,0x0F,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
@@ -407,7 +391,7 @@ void fromIso(char copy[], /* OUT - Mapped string */
char original[]) /* IN - string to convert */
{
#if ISO == 0
- static unsigned char map[256]
+ static const unsigned char map[256]
#if defined __mac__
= {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0D,0x0B,0x0C,0x0D,0x0E,0x0F,
diff --git a/engines/glk/glulxe/serial.cpp b/engines/glk/glulxe/serial.cpp
index 983053aae0..74685fb61a 100644
--- a/engines/glk/glulxe/serial.cpp
+++ b/engines/glk/glulxe/serial.cpp
@@ -233,12 +233,12 @@ uint Glulxe::perform_restoreundo() {
}
Common::Error Glulxe::writeGameData(Common::WriteStream *ws) {
+#ifdef TODO
dest_t dest;
int ix;
uint res = 0, lx, val;
uint memstart = 0, memlen = 0, stackstart = 0, stacklen = 0;
uint heapstart = 0, heaplen = 0, filestart = 0, filelen = 0;
-#ifdef TODO
stream_get_iosys(&val, &lx);
if (val != 2) {
/* Not using the Glk I/O system, so bail. This function only
@@ -357,11 +357,13 @@ Common::Error Glulxe::writeGameData(Common::WriteStream *ws) {
}
/* All done. */
-#endif
return res ? Common::kUnknownError : Common::kNoError;
+#endif
+ return Common::kUnknownError;
}
Common::Error Glulxe::readSaveData(Common::SeekableReadStream *rs) {
+#ifdef TODO
dest_t dest;
int ix;
uint lx = 0, res, val;
@@ -369,7 +371,6 @@ Common::Error Glulxe::readSaveData(Common::SeekableReadStream *rs) {
uint heapsumlen = 0;
uint *heapsumarr = nullptr;
bool fromshell = false;
-#ifdef TODO
/* If profiling is enabled and active then fail. */
#if VM_PROFILING
if (profile_profiling_active())