diff options
| author | Li Jin <dragon-fly@qq.com> | 2022-08-19 18:05:31 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2022-08-19 18:05:31 +0800 |
| commit | 2ef8f936224fe8506673561d033142aeddcc44c1 (patch) | |
| tree | 274c816874b28cf363d3aec0ef7c9a9b1a630c02 /src/yue_wasm.cpp | |
| parent | a4d4893c77f9c48dedc88472a2e418bfd65e33a1 (diff) | |
| download | yuescript-2ef8f936224fe8506673561d033142aeddcc44c1.tar.gz yuescript-2ef8f936224fe8506673561d033142aeddcc44c1.tar.bz2 yuescript-2ef8f936224fe8506673561d033142aeddcc44c1.zip | |
fix format.
Diffstat (limited to '')
| -rw-r--r-- | src/yue_wasm.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/yue_wasm.cpp b/src/yue_wasm.cpp index 8c93eb1..395388b 100644 --- a/src/yue_wasm.cpp +++ b/src/yue_wasm.cpp | |||
| @@ -9,8 +9,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||
| 9 | #include "yuescript/yue_compiler.h" | 9 | #include "yuescript/yue_compiler.h" |
| 10 | 10 | ||
| 11 | extern "C" { | 11 | extern "C" { |
| 12 | #include "lua.h" | ||
| 13 | #include "lauxlib.h" | 12 | #include "lauxlib.h" |
| 13 | #include "lua.h" | ||
| 14 | #include "lualib.h" | 14 | #include "lualib.h" |
| 15 | int luaopen_yue(lua_State* L); | 15 | int luaopen_yue(lua_State* L); |
| 16 | } // extern "C" | 16 | } // extern "C" |
| @@ -23,15 +23,14 @@ static void openlibs(void* state) { | |||
| 23 | lua_pop(L, 1); | 23 | lua_pop(L, 1); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | #define YUE_ARGS nullptr,openlibs | 26 | #define YUE_ARGS nullptr, openlibs |
| 27 | 27 | ||
| 28 | #include <string_view> | 28 | #include <string_view> |
| 29 | using namespace std::string_view_literals; | 29 | using namespace std::string_view_literals; |
| 30 | #include <emscripten/bind.h> | 30 | #include <emscripten/bind.h> |
| 31 | using namespace emscripten; | 31 | using namespace emscripten; |
| 32 | 32 | ||
| 33 | struct YueResult | 33 | struct YueResult { |
| 34 | { | ||
| 35 | std::string codes; | 34 | std::string codes; |
| 36 | std::string err; | 35 | std::string err; |
| 37 | }; | 36 | }; |
| @@ -47,8 +46,8 @@ YueResult tolua(const std::string& codes, bool reserveLineNumber = true, bool im | |||
| 47 | 46 | ||
| 48 | std::string version() { return std::string(yue::version); } | 47 | std::string version() { return std::string(yue::version); } |
| 49 | 48 | ||
| 50 | #define _DEFER(code,line) std::shared_ptr<void> _defer_##line(nullptr, [&](auto){code;}) | 49 | #define _DEFER(code, line) std::shared_ptr<void> _defer_##line(nullptr, [&](auto) { code; }) |
| 51 | #define DEFER(code) _DEFER(code,__LINE__) | 50 | #define DEFER(code) _DEFER(code, __LINE__) |
| 52 | 51 | ||
| 53 | void pushYue(lua_State* L, std::string_view name) { | 52 | void pushYue(lua_State* L, std::string_view name) { |
| 54 | lua_getglobal(L, "package"); // package | 53 | lua_getglobal(L, "package"); // package |
| @@ -167,4 +166,3 @@ EMSCRIPTEN_BINDINGS(yue) { | |||
| 167 | function("exec", &exec); | 166 | function("exec", &exec); |
| 168 | function("version", &version); | 167 | function("version", &version); |
| 169 | } | 168 | } |
| 170 | |||
