diff --git a/milepost b/milepost index 0d6fb19..86a16d3 160000 --- a/milepost +++ b/milepost @@ -1 +1 @@ -Subproject commit 0d6fb197fb5a4ec52dd65d4bd8fd52b7acf0e95e +Subproject commit 86a16d3775727fe2b9dfd51fbd62f3f63b087f2e diff --git a/samples/pong/src/main.c b/samples/pong/src/main.c index a89ef8f..f41db74 100644 --- a/samples/pong/src/main.c +++ b/samples/pong/src/main.c @@ -39,14 +39,13 @@ mem_arena arena; void OnInit(void) { - mem_arena_init(&arena); +// mem_arena_init(&arena); font = g_font_create_default(); } void OnFrameResize(u32 width, u32 height) { - ASSERT(width == 0, "assert if width different from 0"); - log_print("frame resize %u, %u\n", width, height); +// LOG_INFO("frame resize %u, %u\n", width, height); frameSize.x = width; frameSize.y = height; @@ -88,7 +87,7 @@ void OnKeyUp(int key) void OnFrameRefresh(void) { - char* tmp = mem_arena_alloc(&arena, 512); +// char* tmp = mem_arena_alloc(&arena, 512); f32 aspect = frameSize.x/frameSize.y; @@ -162,5 +161,5 @@ void OnFrameRefresh(void) g_matrix_pop(); - mem_arena_clear(&arena); +// mem_arena_clear(&arena); } diff --git a/sdk/orca.c b/sdk/orca.c index 6f294d8..d8bc68e 100644 --- a/sdk/orca.c +++ b/sdk/orca.c @@ -8,5 +8,4 @@ #include"platform/orca_memory.c" #include"util/memory.c" - -#include"orca_log.c" +#include"util/debug_log.c" diff --git a/sdk/orca.h b/sdk/orca.h index 1d39461..8715d81 100644 --- a/sdk/orca.h +++ b/sdk/orca.h @@ -11,7 +11,7 @@ #include"util/typedefs.h" #include"util/lists.h" #include"util/memory.h" +#include"util/debug_log.h" -#include"orca_log.h" #endif //__ORCA_H_ diff --git a/sdk/orca_log.c b/sdk/orca_log.c deleted file mode 100644 index 31b6f80..0000000 --- a/sdk/orca_log.c +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************//** -* -* @file: orca_log.c -* @author: Martin Fouilleul -* @date: 17/04/2023 -* -*****************************************************************/ -#include"orca_log.h" -#include"platform_varg.h" - -#define STB_SPRINTF_IMPLEMENTATION -#include"ext/stb_sprintf.h" - -extern void orca_log(size_t len, const char* ptr); - -//TODO: later, move this to orca_strings in milepost -size_t strlen(const char *s) -{ - size_t len = 0; - while(s[len] != '\0') - { - len++; - } - return(len); -} - -void log_print(const char* fmt, ...) -{ - char buf[4096]; - - va_list ap; - va_start(ap, fmt); - stbsp_vsnprintf(buf, 4096, fmt, ap); - va_end(ap); - - orca_log(strlen(buf), buf); -} diff --git a/sdk/orca_log.h b/sdk/orca_log.h deleted file mode 100644 index 93b9416..0000000 --- a/sdk/orca_log.h +++ /dev/null @@ -1,15 +0,0 @@ -/************************************************************//** -* -* @file: orca_log.h -* @author: Martin Fouilleul -* @date: 17/04/2023 -* -*****************************************************************/ -#ifndef __ORCA_LOG_H_ -#define __ORCA_LOG_H_ - -#include"typedefs.h" - -void log_print(const char* s, ...); - -#endif //__ORCA_LOG_H_ diff --git a/src/bindgen_core_api.txt b/src/bindgen_core_api.txt index c7ac912..9cce8cb 100644 --- a/src/bindgen_core_api.txt +++ b/src/bindgen_core_api.txt @@ -1,4 +1,5 @@ -orca_log v(ip) +orca_log_entry v(iipipi) +orca_log_append v(ip) cosf f(f) sinf f(f) floorf f(f) diff --git a/src/main.c b/src/main.c index 44d7986..b236ee2 100644 --- a/src/main.c +++ b/src/main.c @@ -19,11 +19,29 @@ #define LOG_SUBSYSTEM "Orca" - +/* void orca_log(int len, const char* ptr) { - LOG_MESSAGE("%.*s", len, ptr); + LOG_INFO("%.*s", len, ptr); } +*/ + +void orca_log_entry(log_level level, + int fileLen, + char* file, + int functionLen, + char* function, + int line) +{ + log_generic(level, file, function, line, ""); +} + +void orca_log_append(int msgLen, char* msg) +{ + printf("%s", msg); +} + + void mg_matrix_push_flat(float a11, float a12, float a13, float a21, float a22, float a23) @@ -222,7 +240,7 @@ void* orca_runloop(void* user) } //NOTE: align heap base on 16Bytes heapBase = AlignUpOnPow2(heapBase, 16); - LOG_MESSAGE("mem_size = %u, __heap_base = %u\n", m3_GetMemorySize(app->runtime.m3Runtime), heapBase); + LOG_INFO("mem_size = %u, __heap_base = %u\n", m3_GetMemorySize(app->runtime.m3Runtime), heapBase); //NOTE: Find and type check event handlers. @@ -402,7 +420,7 @@ void* orca_runloop(void* user) int main(int argc, char** argv) { - LogLevel(LOG_LEVEL_DEBUG); + log_set_level(LOG_LEVEL_INFO); mp_init(); mp_clock_init();