Browse Source

some move

blueloveTH 3 years ago
parent
commit
c274b812b2
3 changed files with 9 additions and 10 deletions
  1. 1 1
      amalgamate.py
  2. 8 6
      src/common.h
  3. 0 3
      src/pocketpy.h

+ 1 - 1
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()

+ 8 - 6
src/common.h

@@ -29,12 +29,6 @@
 // #include <filesystem>
 // 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<std::remove_reference_t<T>>
 

+ 0 - 3
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{