From 9abaa46a6785a7e5d81f8d68a204c5101da948ca Mon Sep 17 00:00:00 2001 From: Travis CI <> Date: Thu, 30 Jul 2020 16:28:59 +0000 Subject: [PATCH] Deploy to GitHub Pages: --- embedding/index.html | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/embedding/index.html b/embedding/index.html index 5883d308..1e05e065 100644 --- a/embedding/index.html +++ b/embedding/index.html @@ -234,32 +234,41 @@ them (which leaks memory) and you don’t try to use any of them after the V been freed.
Below is a complete example of the above. -You can find this file in the example folder.
+You can find this file in the example folder.//For more details, visit https://wren.io/embedding/ #include#include "wren.h" -static void writeFn(WrenVM* vm, const char* text) { +static void writeFn(WrenVM* vm, const char* text) +{ printf("%s", text); } -void errorFn(WrenVM* vm, WrenErrorType errorType, const char* module, const int line, const char* msg) { - switch (errorType) { - case WREN_ERROR_COMPILE: { +void errorFn(WrenVM* vm, WrenErrorType errorType, + const char* module, const int line, + const char* msg) +{ + switch (errorType) + { + case WREN_ERROR_COMPILE: + { printf("[%s line %d] [Error] %s\n", module, line, msg); } break; - case WREN_ERROR_STACK_TRACE: { + case WREN_ERROR_STACK_TRACE: + { printf("[%s line %d] in %s\n", module, line, msg); } break; - case WREN_ERROR_RUNTIME: { + case WREN_ERROR_RUNTIME: + { printf("[Runtime Error] %s\n", msg); } break; } } -int main() { +int main() +{ WrenConfiguration config; wrenInitConfiguration(&config); @@ -273,9 +282,12 @@ int main() { WrenInterpretResult result = wrenInterpret(vm, module, script); switch (result) { - case WREN_RESULT_COMPILE_ERROR: { printf("Compile Error!\n"); } break; - case WREN_RESULT_RUNTIME_ERROR: { printf("Runtime Error!\n"); } break; - case WREN_RESULT_SUCCESS: { printf("Success!\n"); } break; + case WREN_RESULT_COMPILE_ERROR: + { printf("Compile Error!\n"); } break; + case WREN_RESULT_RUNTIME_ERROR: + { printf("Runtime Error!\n"); } break; + case WREN_RESULT_SUCCESS: + { printf("Success!\n"); } break; } wrenFreeVM(vm);