start integrating milepost components to orca

This commit is contained in:
Martin Fouilleul 2023-04-17 10:55:19 +02:00
parent c347e10577
commit f36e144bc0
7 changed files with 39 additions and 31 deletions

View File

@ -16,6 +16,7 @@
#include"ringbuffer.h"
#include"memory.h"
#include"macro_helpers.h"
#include"debug_log.h"
#include"platform_clock.h"
#include"graphics_internal.h"

View File

@ -40,6 +40,8 @@
#define OS_MACOS 1
#elif defined(__gnu_linux__)
#define OS_LINUX 1
#elif defined(__ORCA__)
#define OS_ORCA 1
#else
#error "Can't identify OS"
#endif
@ -68,6 +70,8 @@
#define ARCH_ARM32 1
#elif defined(__aarch64__)
#define ARCH_ARM64 1
#elif defined(__ORCA__)
#define ARCH_WASM 1
#else
#error "Can't identify architecture"
#endif

View File

@ -33,9 +33,9 @@ extern "C" {
typedef enum { LOG_LEVEL_ERROR,
LOG_LEVEL_WARNING,
LOG_LEVEL_MESSAGE,
LOG_LEVEL_DEBUG,
LOG_LEVEL_COUNT } log_level;
LOG_LEVEL_MESSAGE,
LOG_LEVEL_DEBUG,
LOG_LEVEL_COUNT } log_level;
MP_API void LogGeneric(log_level level,
const char* subsystem,
@ -76,21 +76,6 @@ MP_API void LogFilter(const char* subsystem, log_level level);
#define LOG_DEBUG(msg, ...)
#endif
#ifndef NO_ASSERT
#include<assert.h>
#define _ASSERT_(x, msg) assert(x && msg)
#define ASSERT(x, ...) _ASSERT_(x, #__VA_ARGS__)
#ifdef DEBUG
#define DEBUG_ASSERT(x, ...) ASSERT(x, ##__VA_ARGS__ )
#else
#define DEBUG_ASSERT(x, ...)
#endif
#else
#define ASSERT(x, ...)
#define DEBUG_ASSERT(x, ...)
#endif
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -3,14 +3,13 @@
* @file: lists.h
* @author: Martin Fouilleul
* @date: 22/11/2017
* @revision: 28/04/2019 : deleted containers which are not used by BLITz
* @brief: Implements generic intrusive linked list and dynamic array
*
****************************************************************/
#ifndef __CONTAINERS_H_
#define __CONTAINERS_H_
#include"debug_log.h"
#include"macro_helpers.h"
#ifdef __cplusplus
extern "C" {
@ -116,7 +115,7 @@ static inline void list_insert(list_info* list, list_elt* afterElt, list_elt* el
}
afterElt->next = elt;
ASSERT(elt->next != elt, "list_insert(): can't insert an element into itself");
DEBUG_ASSERT(elt->next != elt, "list_insert(): can't insert an element into itself");
}
static inline void list_insert_before(list_info* list, list_elt* beforeElt, list_elt* elt)
@ -134,7 +133,7 @@ static inline void list_insert_before(list_info* list, list_elt* beforeElt, list
}
beforeElt->prev = elt;
ASSERT(elt->next != elt, "list_insert_before(): can't insert an element into itself");
DEBUG_ASSERT(elt->next != elt, "list_insert_before(): can't insert an element into itself");
}
static inline void list_remove(list_info* list, list_elt* elt)

View File

@ -9,7 +9,8 @@
#ifndef __MACRO_HELPERS_H_
#define __MACRO_HELPERS_H_
#include"typedefs.h"
#include"util/typedefs.h"
#include"platform/platform.h"
//NOTE(martin): macro concatenation
#define _cat2_(a, b) a##b
@ -124,4 +125,28 @@ static inline u64 next_pow2_u64(u64 x)
#define defer_loop(begin, end) begin; for(int __i__=0; __i__<1; __i__++, end)
//NOTE: assert macros
#ifndef NO_ASSERT
#ifdef OS_ORCA
//TODO add a runtime-provided assert
#define _ASSERT_(x, msg)
#else
#include<assert.h>
#define _ASSERT_(x, msg) assert(x && msg)
#endif
#define ASSERT(x, ...) _ASSERT_(x, #__VA_ARGS__)
#ifdef DEBUG
#define DEBUG_ASSERT(x, ...) ASSERT(x, ##__VA_ARGS__ )
#else
#define DEBUG_ASSERT(x, ...)
#endif
#else
#define ASSERT(x, ...)
#define DEBUG_ASSERT(x, ...)
#endif
#endif //__MACRO_HELPERS_H_

View File

@ -8,11 +8,9 @@
*****************************************************************/
#include<string.h> // strlen(), strcpy(), etc.
#include<stdarg.h> // va_list() etc.
#include"debug_log.h"
#include"macro_helpers.h"
#include"strings.h"
#define LOG_SUBSYSTEM "Strings"
//----------------------------------------------------------------------------------
// string slices as values
//----------------------------------------------------------------------------------
@ -345,7 +343,3 @@ str8 mp_path_base_name(str8 fullPath)
str8 basename = str8_slice(fullPath, lastSlashIndex+1, fullPath.len);
return(basename);
}
#undef LOG_SUBSYSTEM

View File

@ -9,7 +9,7 @@
#ifndef __STRINGS_H_
#define __STRINGS_H_
#include<string.h>
#include<string.h> // strlen
#include"typedefs.h"
#include"lists.h"
#include"memory.h"