From c274b812b24d812dc73a9a27e3662c0339385ad3 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 26 Feb 2023 17:13:37 +0800 Subject: [PATCH] some move --- amalgamate.py | 2 +- src/common.h | 14 ++++++++------ src/pocketpy.h | 3 --- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/amalgamate.py b/amalgamate.py index cf7ba819..b12b931d 100644 --- a/amalgamate.py +++ b/amalgamate.py @@ -5,7 +5,7 @@ pipeline = [ ["common.h", "memory.h", "str.h", "tuplelist.h", "namedict.h", "builtins.h", "error.h"], ["obj.h", "parser.h", "ref.h", "codeobject.h", "frame.h"], ["vm.h", "ceval.h", "compiler.h", "repl.h"], - ["iter.h", "pocketpy.h"] + ["iter.h", "cffi.h", "pocketpy.h"] ] copied = set() diff --git a/src/common.h b/src/common.h index c3703a9a..d6a79d44 100644 --- a/src/common.h +++ b/src/common.h @@ -29,12 +29,6 @@ // #include // namespace fs = std::filesystem; -#ifdef POCKETPY_H -#define UNREACHABLE() throw std::runtime_error( "L" + std::to_string(__LINE__) + " UNREACHABLE()!"); -#else -#define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!"); -#endif - #define PK_VERSION "0.9.1" #if defined(__EMSCRIPTEN__) || defined(__arm__) || defined(__i386__) @@ -69,6 +63,14 @@ struct Type { //#define THREAD_LOCAL thread_local #define THREAD_LOCAL +#define CPP_LAMBDA(x) ([](VM* vm, pkpy::Args& args) { return x; }) +#define CPP_NOT_IMPLEMENTED() ([](VM* vm, pkpy::Args& args) { vm->NotImplementedError(); return vm->None; }) + +#ifdef POCKETPY_H +#define UNREACHABLE() throw std::runtime_error( "L" + std::to_string(__LINE__) + " UNREACHABLE()!"); +#else +#define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!"); +#endif #define RAW(T) std::remove_const_t> diff --git a/src/pocketpy.h b/src/pocketpy.h index 353de01b..e12e9cfd 100644 --- a/src/pocketpy.h +++ b/src/pocketpy.h @@ -5,9 +5,6 @@ #include "repl.h" #include "iter.h" -#define CPP_LAMBDA(x) ([](VM* vm, pkpy::Args& args) { return x; }) -#define CPP_NOT_IMPLEMENTED() ([](VM* vm, pkpy::Args& args) { vm->NotImplementedError(); return vm->None; }) - CodeObject_ VM::compile(Str source, Str filename, CompileMode mode) { Compiler compiler(this, source.c_str(), filename, mode); try{