From 873ece3d559d6ccc3edcebc9ba381678b6ecb814 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 14 Feb 2010 20:16:05 +0000 Subject: [PATCH] - Added a vmengine console command to switch the VM engine at runtime. SVN r2164 (scripting) --- src/c_cmds.cpp | 28 ++++++++++++++++++++++++++++ src/zscript/vmexec.cpp | 9 +++++++++ 2 files changed, 37 insertions(+) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index ed27e2d27..c61c98f8e 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -923,3 +923,31 @@ CCMD(nextsecret) Printf("no next secret map!\n"); } } + +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- +CCMD(vmengine) +{ + if (argv.argc() == 2) + { + if (stricmp(argv[1], "default") == 0) + { + VMSelectEngine(VMEngine_Default); + return; + } + else if (stricmp(argv[1], "checked") == 0) + { + VMSelectEngine(VMEngine_Checked); + return; + } + else if (stricmp(argv[1], "unchecked") == 0) + { + VMSelectEngine(VMEngine_Unchecked); + return; + } + } + Printf("Usage: vmengine \n"); +} diff --git a/src/zscript/vmexec.cpp b/src/zscript/vmexec.cpp index 21f897d0d..8ad349cf7 100644 --- a/src/zscript/vmexec.cpp +++ b/src/zscript/vmexec.cpp @@ -114,6 +114,15 @@ VMExec_Checked::Exec #endif ; +//=========================================================================== +// +// VMSelectEngine +// +// Selects the VM engine, either checked or unchecked. Default will decide +// based on the NDEBUG preprocessor definition. +// +//=========================================================================== + void VMSelectEngine(EVMEngine engine) { switch (engine)