From 5c8c4b3b6e0ca5010420b31e3cd49549622104ec Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 27 Jun 2019 21:24:57 -0700 Subject: GLK: ALAN3: Standardize on using syserr for errors --- engines/glk/alan3/act.cpp | 8 ++++---- engines/glk/alan3/alan3.cpp | 2 +- engines/glk/alan3/exe.cpp | 7 +++---- engines/glk/alan3/main.cpp | 3 +-- engines/glk/alan3/scan.cpp | 4 ++-- engines/glk/alan3/syserr.cpp | 3 +++ engines/glk/alan3/syserr.h | 2 ++ 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/engines/glk/alan3/act.cpp b/engines/glk/alan3/act.cpp index 1b92234397..4874cb9663 100644 --- a/engines/glk/alan3/act.cpp +++ b/engines/glk/alan3/act.cpp @@ -22,11 +22,11 @@ #include "glk/alan3/act.h" #include "glk/alan3/alt_info.h" -#include "glk/alan3/output.h" -#include "glk/alan3/msg.h" #include "glk/alan3/exe.h" #include "glk/alan3/lists.h" -#include "common/textconsole.h" +#include "glk/alan3/msg.h" +#include "glk/alan3/output.h" +#include "glk/alan3/syserr.h" namespace Glk { namespace Alan3 { @@ -111,7 +111,7 @@ void action(int verb, Parameter parameters[], Parameter multipleMatches[]) { memcpy(returnLabel, savedReturnLabel, sizeof(returnLabel)); parameters[multiplePosition].instance = 0; #else - ::error("TODO: action"); + syserr("TODO: action"); #endif } else { setGlobalParameters(parameters); diff --git a/engines/glk/alan3/alan3.cpp b/engines/glk/alan3/alan3.cpp index 3958bf26af..10850f83cf 100644 --- a/engines/glk/alan3/alan3.cpp +++ b/engines/glk/alan3/alan3.cpp @@ -84,7 +84,7 @@ bool Alan3::initialize() { // first, open a window for error output glkMainWin = g_vm->glk_window_open(0, 0, 0, wintype_TextBuffer, 0); if (glkMainWin == nullptr) - ::error("FATAL ERROR: Cannot open initial window"); + syserr("FATAL ERROR: Cannot open initial window"); g_vm->glk_stylehint_set(wintype_TextGrid, style_User1, stylehint_ReverseColor, 1); glkStatusWin = g_vm->glk_window_open(glkMainWin, winmethod_Above | diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp index e3e0e0c60f..34c9c615d9 100644 --- a/engines/glk/alan3/exe.cpp +++ b/engines/glk/alan3/exe.cpp @@ -46,7 +46,6 @@ #include "glk/alan3/utils.h" #include "glk/alan3/word.h" #include "common/stream.h" -#include "common/textconsole.h" namespace Glk { namespace Alan3 { @@ -150,7 +149,7 @@ void print(Aword fpos, Aword len) { /*======================================================================*/ void sys(Aword fpos, Aword len) { - ::error("sys calls are unsupported"); + syserr("sys calls are unsupported"); } @@ -226,7 +225,7 @@ void undo(void) { #ifdef TODO longjmp(returnLabel, UNDO_RETURN); #else - ::error("TODO: undo longjmp"); + syserr("TODO: undo longjmp"); #endif } @@ -283,7 +282,7 @@ void restartGame(void) { } current.location = previousLocation; #else - ::error("TODO: restartGame"); + syserr("TODO: restartGame"); #endif } diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp index 06e5895dcc..6fc5e014a6 100644 --- a/engines/glk/alan3/main.cpp +++ b/engines/glk/alan3/main.cpp @@ -20,7 +20,6 @@ * */ -#include "common/textconsole.h" #include "glk/alan3/main.h" #include "glk/alan3/alan_version.h" #include "glk/alan3/args.h" @@ -674,7 +673,7 @@ static void moveActor(int theActor) { fail = FALSE; /* fail only aborts one actor */ } #else - ::error("TODO: moveActor setjmp"); + syserr("TODO: moveActor setjmp"); #endif } else if (admin[theActor].script != 0) { for (scr = (ScriptEntry *) pointerTo(header->scriptTableAddress); !isEndOfArray(scr); scr++) { diff --git a/engines/glk/alan3/scan.cpp b/engines/glk/alan3/scan.cpp index 8f823def98..dcfcc6f603 100644 --- a/engines/glk/alan3/scan.cpp +++ b/engines/glk/alan3/scan.cpp @@ -34,9 +34,9 @@ #include "glk/alan3/output.h" #include "glk/alan3/params.h" #include "glk/alan3/readline.h" +#include "glk/alan3/syserr.h" #include "glk/alan3/term.h" #include "glk/alan3/word.h" -#include "common/textconsole.h" namespace Glk { namespace Alan3 { @@ -166,7 +166,7 @@ static void getLine(void) { longjmp(forfeitLabel, 0); } #else - ::error("TODO: empty command"); + syserr("TODO: empty command"); #endif strcpy(isobuf, buf); diff --git a/engines/glk/alan3/syserr.cpp b/engines/glk/alan3/syserr.cpp index 31aa981e7e..559f104f5e 100644 --- a/engines/glk/alan3/syserr.cpp +++ b/engines/glk/alan3/syserr.cpp @@ -62,6 +62,8 @@ void setSyserrHandler(void (*f)(const char *)) { /*======================================================================*/ // TODO Make syserr() use ... as printf() void syserr(const char *description) { + ::error("%s", description); +#if 0 lin = 0; if (handler == NULL) { const char *blurb = ""; runtimeError("SYSTEM ERROR: ", description, blurb); } else handler(description); +#endif } diff --git a/engines/glk/alan3/syserr.h b/engines/glk/alan3/syserr.h index 3202600bd5..6112e883e4 100644 --- a/engines/glk/alan3/syserr.h +++ b/engines/glk/alan3/syserr.h @@ -25,6 +25,8 @@ /* Header file for syserr unit of ARUN Alan System interpreter */ +#include "common/textconsole.h" + namespace Glk { namespace Alan3 { -- cgit v1.2.3