From 043093209ee3ff8a00b76885f7624ff349aff839 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 Sep 2019 20:20:35 -0700 Subject: GLK: ALAN3: Merge duplicate jumps.h --- engines/glk/alan3/act.h | 2 +- engines/glk/alan3/actor.h | 2 +- engines/glk/alan3/alt_info.h | 2 +- engines/glk/alan3/checkentry.h | 2 +- engines/glk/alan3/container.h | 2 +- engines/glk/alan3/debug.h | 2 +- engines/glk/alan3/exe.h | 2 +- engines/glk/alan3/glkio.h | 2 +- engines/glk/alan3/instance.h | 2 +- engines/glk/alan3/inter.h | 2 +- engines/glk/alan3/jumps.h | 87 ------------------------------------------ engines/glk/alan3/location.h | 2 +- engines/glk/alan3/main.cpp | 2 +- engines/glk/alan3/msg.h | 2 +- engines/glk/alan3/parse.cpp | 2 +- engines/glk/alan3/parse.h | 2 +- engines/glk/alan3/rules.h | 2 +- engines/glk/alan3/scan.h | 2 +- engines/glk/alan3/syntax.h | 2 +- engines/glk/alan3/syserr.h | 2 +- engines/glk/alan3/utils.h | 2 +- engines/glk/jumps.h | 14 +++++++ 22 files changed, 34 insertions(+), 107 deletions(-) delete mode 100644 engines/glk/alan3/jumps.h (limited to 'engines/glk') diff --git a/engines/glk/alan3/act.h b/engines/glk/alan3/act.h index b2daa25fb8..b24551b9ea 100644 --- a/engines/glk/alan3/act.h +++ b/engines/glk/alan3/act.h @@ -25,7 +25,7 @@ /* Header file for action unit of ARUN Alan System interpreter */ -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/params.h" namespace Glk { diff --git a/engines/glk/alan3/actor.h b/engines/glk/alan3/actor.h index 6ac20b24f7..9df5ae27c8 100644 --- a/engines/glk/alan3/actor.h +++ b/engines/glk/alan3/actor.h @@ -24,7 +24,7 @@ #define GLK_ALAN3_ACTOR #include "glk/alan3/acode.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/alt_info.h b/engines/glk/alan3/alt_info.h index a46d16b933..75a097f9c9 100644 --- a/engines/glk/alan3/alt_info.h +++ b/engines/glk/alan3/alt_info.h @@ -27,7 +27,7 @@ #include "glk/alan3/types.h" #include "glk/alan3/acode.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/params.h" #include "glk/alan3/parameter_position.h" diff --git a/engines/glk/alan3/checkentry.h b/engines/glk/alan3/checkentry.h index a0c3d25569..36e4fb7a05 100644 --- a/engines/glk/alan3/checkentry.h +++ b/engines/glk/alan3/checkentry.h @@ -25,7 +25,7 @@ #include "glk/alan3/types.h" #include "glk/alan3/acode.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/container.h b/engines/glk/alan3/container.h index 86d84c65e5..3196d4e528 100644 --- a/engines/glk/alan3/container.h +++ b/engines/glk/alan3/container.h @@ -25,7 +25,7 @@ #include "glk/alan3/types.h" #include "glk/alan3/acode.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/debug.h b/engines/glk/alan3/debug.h index 1f5e2c1ebf..64d2f52cb0 100644 --- a/engines/glk/alan3/debug.h +++ b/engines/glk/alan3/debug.h @@ -26,7 +26,7 @@ /* Header file for debug handler in Alan interpreter */ #include "glk/alan3/types.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/exe.h b/engines/glk/alan3/exe.h index df5892c159..333feeba36 100644 --- a/engines/glk/alan3/exe.h +++ b/engines/glk/alan3/exe.h @@ -27,7 +27,7 @@ /* IMPORTS */ #include "glk/alan3/sysdep.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/acode.h" #include "glk/alan3/types.h" #include "glk/alan3/set.h" diff --git a/engines/glk/alan3/glkio.h b/engines/glk/alan3/glkio.h index 333a24b055..5b54228c14 100644 --- a/engines/glk/alan3/glkio.h +++ b/engines/glk/alan3/glkio.h @@ -25,7 +25,7 @@ #include "glk/glk_api.h" #include "glk/windows.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/instance.h b/engines/glk/alan3/instance.h index 7c2b9cf03e..00932c5b77 100644 --- a/engines/glk/alan3/instance.h +++ b/engines/glk/alan3/instance.h @@ -25,7 +25,7 @@ #include "common/serializer.h" #include "glk/alan3/acode.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/types.h" #include "glk/alan3/set.h" diff --git a/engines/glk/alan3/inter.h b/engines/glk/alan3/inter.h index 887a06a504..7efb92d908 100644 --- a/engines/glk/alan3/inter.h +++ b/engines/glk/alan3/inter.h @@ -27,7 +27,7 @@ #include "glk/alan3/types.h" #include "glk/alan3/stack.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/jumps.h b/engines/glk/alan3/jumps.h deleted file mode 100644 index 10c33fa1d0..0000000000 --- a/engines/glk/alan3/jumps.h +++ /dev/null @@ -1,87 +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_ALAN2_JUMPS -#define GLK_ALAN2_JUMPS - -/* This provides a simplified version of the ScummVM coroutines to allow for automated - * breakouts to the main game loop from subroutinese rather than using unportable setjmps - */ - -#include "common/str.h" - -namespace Glk { -namespace Alan3 { - -/** - * Context used for flagging when a break to the outer game loop - */ -struct Context { - bool _break; - Common::String _label; - - /** - * Constructor - */ - Context() : _break(false) {} - - /** - * Clear - */ - void clear() { - _break = false; - _label = ""; - } -}; - -#define CALL0(METHOD) { METHOD(context); if (context._break) return; } -#define CALL1(METHOD, P1) { METHOD(context, P1); if (context._break) return; } -#define CALL2(METHOD, P1, P2) { METHOD(context, P1, P2); if (context._break) return; } -#define CALL3(METHOD, P1, P2, P3) { METHOD(context, P1, P2, P3); if (context._break) return; } -#define CALL4(METHOD, P1, P2, P3, P4) { METHOD(context, P1, P2, P3, P4); if (context._break) return; } -#define FUNC0(METHOD, RET) { RET = METHOD(context); if (context._break) return; } -#define FUNC1(METHOD, RET, P1) { RET = METHOD(context, P1); if (context._break) return; } -#define FUNC2(METHOD, RET, P1, P2) { RET = METHOD(context, P1, P2); if (context._break) return; } -#define FUNC3(METHOD, RET, P1, P2, P3) { RET = METHOD(context, P1, P2, P3); if (context._break) return; } -#define FUNC4(METHOD, RET, P1, P2, P3, P4) { RET = METHOD(context, P1, P2, P3, P4); if (context._break) return; } - -#define R0CALL0(METHOD) { METHOD(context); if (context._break) return 0; } -#define R0CALL1(METHOD, P1) { METHOD(context, P1); if (context._break) return 0; } -#define R0CALL2(METHOD, P1, P2) { METHOD(context, P1, P2); if (context._break) return 0; } -#define R0CALL3(METHOD, P1, P2, P3) { METHOD(context, P1, P2, P3); if (context._break) return 0; } -#define R0CALL4(METHOD, P1, P2, P3, P4) { METHOD(context, P1, P2, P3, P4); if (context._break) return 0; } -#define R0FUNC0(METHOD, RET) { RET = METHOD(context); if (context._break) return 0; } -#define R0FUNC1(METHOD, RET, P1) { RET = METHOD(context, P1); if (context._break) return 0; } -#define R0FUNC2(METHOD, RET, P1, P2) { RET = METHOD(context, P1, P2); if (context._break) return 0; } -#define R0FUNC3(METHOD, RET, P1, P2, P3) { RET = METHOD(context, P1, P2, P3); if (context._break) return 0; } -#define R0FUNC4(METHOD, RET, P1, P2, P3, P4) { RET = METHOD(context, P1, P2, P3, P4); if (context._break) return 0; } - -#define CONTEXT Context &context -#define LONG_JUMP { context._break = true; context._label = "turn"; return; } -#define LONG_JUMP0 { context._break = true; return 0; } -#define LONG_JUMP_LABEL(LBL) { context._break = true; context._label = LBL; return; } -#define LONG_JUMP_LABEL0(LBL) { context._break = true; context._label = LBL; return 0; } - -} // End of namespace Alan2 -} // End of namespace Glk - -#endif diff --git a/engines/glk/alan3/location.h b/engines/glk/alan3/location.h index 005f8bc0e8..e5dcd507d3 100644 --- a/engines/glk/alan3/location.h +++ b/engines/glk/alan3/location.h @@ -24,7 +24,7 @@ #define GLK_ALAN3_LOCATION #include "glk/alan3/types.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp index d20ec4469c..9939e3a682 100644 --- a/engines/glk/alan3/main.cpp +++ b/engines/glk/alan3/main.cpp @@ -34,7 +34,7 @@ #include "glk/alan3/glkio.h" #include "glk/alan3/instance.h" #include "glk/alan3/inter.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/lists.h" #include "glk/alan3/literal.h" #include "glk/alan3/location.h" diff --git a/engines/glk/alan3/msg.h b/engines/glk/alan3/msg.h index 6275c721a7..667c01aa6c 100644 --- a/engines/glk/alan3/msg.h +++ b/engines/glk/alan3/msg.h @@ -24,7 +24,7 @@ #define GLK_ALAN3_MSG #include "glk/alan3/acode.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/types.h" #include "glk/alan3/params.h" diff --git a/engines/glk/alan3/parse.cpp b/engines/glk/alan3/parse.cpp index efa5464c33..9ddd454bfb 100644 --- a/engines/glk/alan3/parse.cpp +++ b/engines/glk/alan3/parse.cpp @@ -31,7 +31,7 @@ #include "glk/alan3/glkio.h" #include "glk/alan3/instance.h" #include "glk/alan3/inter.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/lists.h" #include "glk/alan3/literal.h" #include "glk/alan3/location.h" diff --git a/engines/glk/alan3/parse.h b/engines/glk/alan3/parse.h index 2737183eaa..8ef11b121d 100644 --- a/engines/glk/alan3/parse.h +++ b/engines/glk/alan3/parse.h @@ -27,7 +27,7 @@ #include "glk/alan3/types.h" #include "glk/alan3/params.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/rules.h b/engines/glk/alan3/rules.h index abb5a2b065..ad8ed26ef9 100644 --- a/engines/glk/alan3/rules.h +++ b/engines/glk/alan3/rules.h @@ -25,7 +25,7 @@ /* Header file for rules handler in Alan interpreter */ -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/acode.h" namespace Glk { diff --git a/engines/glk/alan3/scan.h b/engines/glk/alan3/scan.h index 6f565c0559..06d9e97d04 100644 --- a/engines/glk/alan3/scan.h +++ b/engines/glk/alan3/scan.h @@ -26,7 +26,7 @@ /* Player input scanner for ALAN interpreter module. */ #include "glk/alan3/types.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/syntax.h b/engines/glk/alan3/syntax.h index 8aebc23e80..d5b48a6ed9 100644 --- a/engines/glk/alan3/syntax.h +++ b/engines/glk/alan3/syntax.h @@ -24,7 +24,7 @@ #define GLK_ALAN3_SYNTAX #include "glk/alan3/types.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" #include "glk/alan3/memory.h" namespace Glk { diff --git a/engines/glk/alan3/syserr.h b/engines/glk/alan3/syserr.h index fc80e72be6..1e6654c4be 100644 --- a/engines/glk/alan3/syserr.h +++ b/engines/glk/alan3/syserr.h @@ -25,7 +25,7 @@ /* Header file for syserr unit of ARUN Alan System interpreter */ -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/alan3/utils.h b/engines/glk/alan3/utils.h index 0c56e0a239..37cabda731 100644 --- a/engines/glk/alan3/utils.h +++ b/engines/glk/alan3/utils.h @@ -26,7 +26,7 @@ /* Utility functions for the Alan interpreter */ #include "glk/alan3/types.h" -#include "glk/alan3/jumps.h" +#include "glk/jumps.h" namespace Glk { namespace Alan3 { diff --git a/engines/glk/jumps.h b/engines/glk/jumps.h index f3438128f4..6da1a45041 100644 --- a/engines/glk/jumps.h +++ b/engines/glk/jumps.h @@ -23,6 +23,8 @@ #ifndef GLK_JUMPS #define GLK_JUMPS +#include "common/str.h" + /* This provides a simplified version of the ScummVM coroutines to allow for automated * breakouts to the main game loop from subroutinese rather than using unportable setjmps */ @@ -34,7 +36,17 @@ namespace Glk { */ struct Context { bool _break; + Common::String _label; + Context() : _break(false) {} + + /** + * Clear the context + */ + void clear() { + _break = false; + _label = ""; + } }; #define CALL0(METHOD) { METHOD(context); if (context._break) return; } @@ -62,6 +74,8 @@ struct Context { #define CONTEXT Context &context #define LONG_JUMP { context._break = true; return; } #define LONG_JUMP0 { context._break = true; return 0; } +#define LONG_JUMP_LABEL(LBL) { context._break = true; context._label = LBL; return; } +#define LONG_JUMP_LABEL0(LBL) { context._break = true; context._label = LBL; return 0; } } // End of namespace Glk -- cgit v1.2.3