| LEFT | RIGHT |
| 1 #pragma once | 1 #pragma once |
| 2 | 2 |
| 3 #include <emscripten.h> | 3 #include <emscripten.h> |
| 4 #include <emscripten/trace.h> | 4 #include <emscripten/trace.h> |
| 5 | 5 |
| 6 #if defined(assert) | 6 #if defined(assert) |
| 7 #undef assert | 7 #undef assert |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 class String; | 10 class String; |
| 11 | 11 |
| 12 struct console_type | 12 struct console_type |
| 13 { | 13 { |
| 14 static void log(const String& str) | 14 static void log(const String& str) |
| 15 { | 15 { |
| 16 EM_ASM_ARGS(console.log(getStringData($0)), &str); | 16 EM_ASM_ARGS(console.log(readString($0)), &str); |
| 17 } | 17 } |
| 18 | 18 |
| 19 static void log(int i) | 19 static void log(int i) |
| 20 { | 20 { |
| 21 EM_ASM_ARGS(console.log($0), i); | 21 EM_ASM_ARGS(console.log($0), i); |
| 22 } | 22 } |
| 23 | 23 |
| 24 static void log(void* ptr) | 24 static void log(void* ptr) |
| 25 { | 25 { |
| 26 EM_ASM_ARGS(console.log($0), ptr); | 26 EM_ASM_ARGS(console.log($0), ptr); |
| 27 } | 27 } |
| 28 | 28 |
| 29 static void error(const String& str) | 29 static void error(const String& str) |
| 30 { | 30 { |
| 31 EM_ASM_ARGS(console.error(new Error(getStringData($0)).stack), &str); | 31 EM_ASM_ARGS(console.error(new Error(readString($0)).stack), &str); |
| 32 } | 32 } |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 static console_type console; | 35 static console_type console; |
| 36 | 36 |
| 37 #if defined(DEBUG) | 37 #if defined(DEBUG) |
| 38 inline void assert(bool condition, const String& str) | 38 inline void assert(bool condition, const String& str) |
| 39 { | 39 { |
| 40 if (!condition) | 40 if (!condition) |
| 41 console.error(str); | 41 console.error(str); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 57 emscripten_trace_enter_context(context); | 57 emscripten_trace_enter_context(context); |
| 58 #endif | 58 #endif |
| 59 } | 59 } |
| 60 | 60 |
| 61 inline void exit_context() | 61 inline void exit_context() |
| 62 { | 62 { |
| 63 #if defined(__EMSCRIPTEN_TRACING__) | 63 #if defined(__EMSCRIPTEN_TRACING__) |
| 64 emscripten_trace_exit_context(); | 64 emscripten_trace_exit_context(); |
| 65 #endif | 65 #endif |
| 66 } | 66 } |
| LEFT | RIGHT |