start integrating milepost components to orca
This commit is contained in:
parent
c347e10577
commit
f36e144bc0
|
@ -16,6 +16,7 @@
|
||||||
#include"ringbuffer.h"
|
#include"ringbuffer.h"
|
||||||
#include"memory.h"
|
#include"memory.h"
|
||||||
#include"macro_helpers.h"
|
#include"macro_helpers.h"
|
||||||
|
#include"debug_log.h"
|
||||||
#include"platform_clock.h"
|
#include"platform_clock.h"
|
||||||
#include"graphics_internal.h"
|
#include"graphics_internal.h"
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#define OS_MACOS 1
|
#define OS_MACOS 1
|
||||||
#elif defined(__gnu_linux__)
|
#elif defined(__gnu_linux__)
|
||||||
#define OS_LINUX 1
|
#define OS_LINUX 1
|
||||||
|
#elif defined(__ORCA__)
|
||||||
|
#define OS_ORCA 1
|
||||||
#else
|
#else
|
||||||
#error "Can't identify OS"
|
#error "Can't identify OS"
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,6 +70,8 @@
|
||||||
#define ARCH_ARM32 1
|
#define ARCH_ARM32 1
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
#define ARCH_ARM64 1
|
#define ARCH_ARM64 1
|
||||||
|
#elif defined(__ORCA__)
|
||||||
|
#define ARCH_WASM 1
|
||||||
#else
|
#else
|
||||||
#error "Can't identify architecture"
|
#error "Can't identify architecture"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -76,21 +76,6 @@ MP_API void LogFilter(const char* subsystem, log_level level);
|
||||||
#define LOG_DEBUG(msg, ...)
|
#define LOG_DEBUG(msg, ...)
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
* @file: lists.h
|
* @file: lists.h
|
||||||
* @author: Martin Fouilleul
|
* @author: Martin Fouilleul
|
||||||
* @date: 22/11/2017
|
* @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
|
* @brief: Implements generic intrusive linked list and dynamic array
|
||||||
*
|
*
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
#ifndef __CONTAINERS_H_
|
#ifndef __CONTAINERS_H_
|
||||||
#define __CONTAINERS_H_
|
#define __CONTAINERS_H_
|
||||||
|
|
||||||
#include"debug_log.h"
|
#include"macro_helpers.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -116,7 +115,7 @@ static inline void list_insert(list_info* list, list_elt* afterElt, list_elt* el
|
||||||
}
|
}
|
||||||
afterElt->next = elt;
|
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)
|
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;
|
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)
|
static inline void list_remove(list_info* list, list_elt* elt)
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#ifndef __MACRO_HELPERS_H_
|
#ifndef __MACRO_HELPERS_H_
|
||||||
#define __MACRO_HELPERS_H_
|
#define __MACRO_HELPERS_H_
|
||||||
|
|
||||||
#include"typedefs.h"
|
#include"util/typedefs.h"
|
||||||
|
#include"platform/platform.h"
|
||||||
|
|
||||||
//NOTE(martin): macro concatenation
|
//NOTE(martin): macro concatenation
|
||||||
#define _cat2_(a, b) a##b
|
#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)
|
#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_
|
#endif //__MACRO_HELPERS_H_
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
#include<string.h> // strlen(), strcpy(), etc.
|
#include<string.h> // strlen(), strcpy(), etc.
|
||||||
#include<stdarg.h> // va_list() etc.
|
#include<stdarg.h> // va_list() etc.
|
||||||
#include"debug_log.h"
|
#include"macro_helpers.h"
|
||||||
#include"strings.h"
|
#include"strings.h"
|
||||||
|
|
||||||
#define LOG_SUBSYSTEM "Strings"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// string slices as values
|
// string slices as values
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -345,7 +343,3 @@ str8 mp_path_base_name(str8 fullPath)
|
||||||
str8 basename = str8_slice(fullPath, lastSlashIndex+1, fullPath.len);
|
str8 basename = str8_slice(fullPath, lastSlashIndex+1, fullPath.len);
|
||||||
return(basename);
|
return(basename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef LOG_SUBSYSTEM
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#ifndef __STRINGS_H_
|
#ifndef __STRINGS_H_
|
||||||
#define __STRINGS_H_
|
#define __STRINGS_H_
|
||||||
|
|
||||||
#include<string.h>
|
#include<string.h> // strlen
|
||||||
#include"typedefs.h"
|
#include"typedefs.h"
|
||||||
#include"lists.h"
|
#include"lists.h"
|
||||||
#include"memory.h"
|
#include"memory.h"
|
||||||
|
|
Loading…
Reference in New Issue