aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-07-03 22:00:05 -0700
committerPaul Gilbert2019-07-06 15:27:09 -0700
commitb634a97f41877b233a654dc204a2c9760f9ad2f6 (patch)
tree48dfb80f4f345a3070c8c40b5a0d05ee89684e18 /engines
parentefdf25b3d28113b01e18ef0c69221194a1100e9e (diff)
downloadscummvm-rg350-b634a97f41877b233a654dc204a2c9760f9ad2f6.tar.gz
scummvm-rg350-b634a97f41877b233a654dc204a2c9760f9ad2f6.tar.bz2
scummvm-rg350-b634a97f41877b233a654dc204a2c9760f9ad2f6.zip
GLK: ALAN3: Move readline.cpp into glkio.cpp
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/alan3/debug.cpp1
-rw-r--r--engines/glk/alan3/exe.cpp1
-rw-r--r--engines/glk/alan3/glkio.cpp59
-rw-r--r--engines/glk/alan3/glkio.h2
-rw-r--r--engines/glk/alan3/output.cpp1
-rw-r--r--engines/glk/alan3/readline.cpp100
-rw-r--r--engines/glk/alan3/readline.h41
-rw-r--r--engines/glk/alan3/scan.cpp1
-rw-r--r--engines/glk/module.mk1
9 files changed, 61 insertions, 146 deletions
diff --git a/engines/glk/alan3/debug.cpp b/engines/glk/alan3/debug.cpp
index ec28d30772..94f5bb4a96 100644
--- a/engines/glk/alan3/debug.cpp
+++ b/engines/glk/alan3/debug.cpp
@@ -36,7 +36,6 @@
#include "glk/alan3/memory.h"
#include "glk/alan3/options.h"
#include "glk/alan3/output.h"
-#include "glk/alan3/readline.h"
#include "glk/alan3/sysdep.h"
#include "glk/alan3/utils.h"
#include "glk/streams.h"
diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp
index e2555f505c..499eaee4f9 100644
--- a/engines/glk/alan3/exe.cpp
+++ b/engines/glk/alan3/exe.cpp
@@ -35,7 +35,6 @@
#include "glk/alan3/msg.h"
#include "glk/alan3/output.h"
#include "glk/alan3/options.h"
-#include "glk/alan3/readline.h"
#include "glk/alan3/save.h"
#include "glk/alan3/score.h"
#include "glk/alan3/state.h"
diff --git a/engines/glk/alan3/glkio.cpp b/engines/glk/alan3/glkio.cpp
index f36c396ed0..ccf2a6716d 100644
--- a/engines/glk/alan3/glkio.cpp
+++ b/engines/glk/alan3/glkio.cpp
@@ -134,5 +134,64 @@ void statusline(CONTEXT) {
g_vm->glk_set_window(glkMainWin);
}
+
+/*======================================================================
+
+ readline()
+
+ Read a line from the user, with history and editing
+
+*/
+
+/* TODO - length of user buffer should be used */
+bool readline(CONTEXT, char *buffer, size_t maxLen) {
+ event_t event;
+ static bool readingCommands = FALSE;
+ static frefid_t commandFileRef;
+ static strid_t commandFile;
+
+ if (readingCommands) {
+ if (g_vm->glk_get_line_stream(commandFile, buffer, maxLen) == 0) {
+ g_vm->glk_stream_close(commandFile, NULL);
+ readingCommands = FALSE;
+ } else {
+ g_vm->glk_set_style(style_Input);
+ printf(buffer);
+ g_vm->glk_set_style(style_Normal);
+ }
+ } else {
+ g_vm->glk_request_line_event(glkMainWin, buffer, maxLen, 0);
+
+ do {
+ g_vm->glk_select(&event);
+ if (g_vm->shouldQuit())
+ LONG_JUMP0
+
+ switch (event.type) {
+ case evtype_Arrange:
+ R0CALL0(statusline)
+ break;
+
+ default:
+ break;
+ }
+ } while (event.type != evtype_LineInput);
+ if (buffer[0] == '@') {
+ buffer[event.val1] = 0;
+ commandFileRef = g_vm->glk_fileref_create_by_name(fileusage_InputRecord + fileusage_TextMode, &buffer[1], 0);
+ commandFile = g_vm->glk_stream_open_file(commandFileRef, filemode_Read, 0);
+ if (commandFile != NULL)
+ if (g_vm->glk_get_line_stream(commandFile, buffer, maxLen) != 0) {
+ readingCommands = TRUE;
+ g_vm->glk_set_style(style_Input);
+ printf(buffer);
+ g_vm->glk_set_style(style_Normal);
+ }
+ } else
+ buffer[event.val1] = 0;
+ }
+ return TRUE;
+}
+
} // End of namespace Alan3
} // End of namespace Glk
diff --git a/engines/glk/alan3/glkio.h b/engines/glk/alan3/glkio.h
index b0629ce8f8..8876aec821 100644
--- a/engines/glk/alan3/glkio.h
+++ b/engines/glk/alan3/glkio.h
@@ -46,6 +46,8 @@ extern void setStyle(int style);
extern void statusline(CONTEXT);
+extern bool readline(CONTEXT, char *usrBuf, size_t maxLen);
+
} // End of namespace Alan3
} // End of namespace Glk
diff --git a/engines/glk/alan3/output.cpp b/engines/glk/alan3/output.cpp
index 15d4ff4f04..405ca2e270 100644
--- a/engines/glk/alan3/output.cpp
+++ b/engines/glk/alan3/output.cpp
@@ -31,7 +31,6 @@
#include "glk/alan3/dictionary.h"
#include "glk/alan3/current.h"
#include "glk/alan3/msg.h"
-#include "glk/alan3/readline.h"
#include "glk/alan3/sysdep.h"
#include "glk/alan3/instance.h"
diff --git a/engines/glk/alan3/readline.cpp b/engines/glk/alan3/readline.cpp
deleted file mode 100644
index 7be20c7b9c..0000000000
--- a/engines/glk/alan3/readline.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "glk/alan3/readline.h"
-
-#include "glk/alan3/sysdep.h"
-#include "glk/alan3/output.h"
-#include "glk/alan3/exe.h"
-#include "glk/alan3/save.h"
-#include "glk/alan3/location.h"
-
-#include "glk/alan3/options.h"
-#include "glk/alan3/alan3.h"
-#include "glk/alan3/glkio.h"
-#include "glk/alan3/resources.h"
-
-namespace Glk {
-namespace Alan3 {
-
-#define LINELENGTH 1000
-
-/*======================================================================
-
- readline()
-
- Read a line from the user, with history and editing
-
-*/
-
-/* TODO - length of user buffer should be used */
-bool readline(CONTEXT, char *buffer, size_t maxLen) {
- event_t event;
- static bool readingCommands = FALSE;
- static frefid_t commandFileRef;
- static strid_t commandFile;
-
- if (readingCommands) {
- if (g_vm->glk_get_line_stream(commandFile, buffer, maxLen) == 0) {
- g_vm->glk_stream_close(commandFile, NULL);
- readingCommands = FALSE;
- } else {
- g_vm->glk_set_style(style_Input);
- printf(buffer);
- g_vm->glk_set_style(style_Normal);
- }
- } else {
- g_vm->glk_request_line_event(glkMainWin, buffer, maxLen, 0);
-
- do {
- g_vm->glk_select(&event);
- if (g_vm->shouldQuit())
- LONG_JUMP0
-
- switch (event.type) {
- case evtype_Arrange:
- R0CALL0(statusline)
- break;
-
- default:
- break;
- }
- } while (event.type != evtype_LineInput);
- if (buffer[0] == '@') {
- buffer[event.val1] = 0;
- commandFileRef = g_vm->glk_fileref_create_by_name(fileusage_InputRecord + fileusage_TextMode, &buffer[1], 0);
- commandFile = g_vm->glk_stream_open_file(commandFileRef, filemode_Read, 0);
- if (commandFile != NULL)
- if (g_vm->glk_get_line_stream(commandFile, buffer, maxLen) != 0) {
- readingCommands = TRUE;
- g_vm->glk_set_style(style_Input);
- printf(buffer);
- g_vm->glk_set_style(style_Normal);
- }
- } else
- buffer[event.val1] = 0;
- }
- return TRUE;
-}
-
-} // End of namespace Alan3
-} // End of namespace Glk
diff --git a/engines/glk/alan3/readline.h b/engines/glk/alan3/readline.h
deleted file mode 100644
index 624bf4a69d..0000000000
--- a/engines/glk/alan3/readline.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef GLK_ALAN3_READLINE
-#define GLK_ALAN3_READLINE
-
-/* Header file for user input, history and editing support */
-
-#include "glk/alan3/types.h"
-#include "glk/alan3/jumps.h"
-
-namespace Glk {
-namespace Alan3 {
-
-#define HISTORYLENGTH 20
-
-extern bool readline(CONTEXT, char *usrBuf, size_t maxLen);
-
-} // End of namespace Alan3
-} // End of namespace Glk
-
-#endif
diff --git a/engines/glk/alan3/scan.cpp b/engines/glk/alan3/scan.cpp
index 6cc1ef9076..0875acbcc6 100644
--- a/engines/glk/alan3/scan.cpp
+++ b/engines/glk/alan3/scan.cpp
@@ -33,7 +33,6 @@
#include "glk/alan3/options.h"
#include "glk/alan3/output.h"
#include "glk/alan3/params.h"
-#include "glk/alan3/readline.h"
#include "glk/alan3/syserr.h"
#include "glk/alan3/word.h"
diff --git a/engines/glk/module.mk b/engines/glk/module.mk
index 3d3c62b083..ad5e6659fc 100644
--- a/engines/glk/module.mk
+++ b/engines/glk/module.mk
@@ -83,7 +83,6 @@ MODULE_OBJS := \
alan3/parameter_position.o \
alan3/params.o \
alan3/parse.o \
- alan3/readline.o \
alan3/reverse.o \
alan3/rules.o \
alan3/save.o \