From a08efc0a6ab10f0c5f92d2e8b50c6357ce27c203 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 20 Apr 2024 12:25:51 +0800 Subject: [PATCH] move op_names --- amalgamate.py | 2 +- include/pocketpy/codeobject.h | 6 ------ src/vm.cpp | 6 ++++++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/amalgamate.py b/amalgamate.py index 0bb90308..ccfb0eb6 100644 --- a/amalgamate.py +++ b/amalgamate.py @@ -36,7 +36,7 @@ def remove_copied_include(text): key = key[9:] if key in ["user_config.h", "cJSONw.hpp"]: return m.group(0) - if key == "opcodes.h": + if "opcodes.h" in key: return OPCODES_TEXT assert key in copied, f"include {key} not found" return "" diff --git a/include/pocketpy/codeobject.h b/include/pocketpy/codeobject.h index 62601284..ee278eb7 100644 --- a/include/pocketpy/codeobject.h +++ b/include/pocketpy/codeobject.h @@ -13,12 +13,6 @@ enum Opcode: uint8_t { #undef OPCODE }; -inline const char* OP_NAMES[] = { - #define OPCODE(name) #name, - #include "opcodes.h" - #undef OPCODE -}; - struct Bytecode{ uint8_t op; uint16_t arg; diff --git a/src/vm.cpp b/src/vm.cpp index 59916b6e..b3459dd2 100644 --- a/src/vm.cpp +++ b/src/vm.cpp @@ -1,5 +1,11 @@ #include "pocketpy/vm.h" +static const char* OP_NAMES[] = { + #define OPCODE(name) #name, + #include "pocketpy/opcodes.h" + #undef OPCODE +}; + namespace pkpy{ struct JsonSerializer{