99#define ecs_deprecated_(file, line, msg)\
104#define ecs_log_push_(level)
105#define ecs_log_pop_(level)
106#define ecs_should_log(level) false
108#define ecs_strerror(error_code)\
161 const char *condition_str,
168void ecs_parser_error_(
176void ecs_parser_errorv_(
191#define ecs_print(level, ...)\
192 ecs_print_(level, __FILE__, __LINE__, __VA_ARGS__)
194#define ecs_printv(level, fmt, args)\
195 ecs_printv_(level, __FILE__, __LINE__, fmt, args)
197#define ecs_log(level, ...)\
198 ecs_log_(level, __FILE__, __LINE__, __VA_ARGS__)
200#define ecs_logv(level, fmt, args)\
201 ecs_logv_(level, __FILE__, __LINE__, fmt, args)
204#define ecs_trace_(file, line, ...) ecs_log_(0, file, line, __VA_ARGS__)
205#define ecs_trace(...) ecs_trace_(__FILE__, __LINE__, __VA_ARGS__)
208#define ecs_warn_(file, line, ...) ecs_log_(-2, file, line, __VA_ARGS__)
209#define ecs_warn(...) ecs_warn_(__FILE__, __LINE__, __VA_ARGS__)
212#define ecs_err_(file, line, ...) ecs_log_(-3, file, line, __VA_ARGS__)
213#define ecs_err(...) ecs_err_(__FILE__, __LINE__, __VA_ARGS__)
216#define ecs_fatal_(file, line, ...) ecs_log_(-4, file, line, __VA_ARGS__)
217#define ecs_fatal(...) ecs_fatal_(__FILE__, __LINE__, __VA_ARGS__)
220#ifndef FLECS_NO_DEPRECATED_WARNINGS
221#define ecs_deprecated(...)\
222 ecs_deprecated_(__FILE__, __LINE__, __VA_ARGS__)
224#define ecs_deprecated(...)
228#if !(defined(FLECS_LOG_0) || defined(FLECS_LOG_1) || defined(FLECS_LOG_2) || defined(FLECS_LOG_3))
229#if !defined(FLECS_NDEBUG)
240#if defined(FLECS_LOG_3)
241#define ecs_dbg_1(...) ecs_log(1, __VA_ARGS__);
242#define ecs_dbg_2(...) ecs_log(2, __VA_ARGS__);
243#define ecs_dbg_3(...) ecs_log(3, __VA_ARGS__);
245#define ecs_log_push_1() ecs_log_push_(1);
246#define ecs_log_push_2() ecs_log_push_(2);
247#define ecs_log_push_3() ecs_log_push_(3);
249#define ecs_log_pop_1() ecs_log_pop_(1);
250#define ecs_log_pop_2() ecs_log_pop_(2);
251#define ecs_log_pop_3() ecs_log_pop_(3);
253#define ecs_should_log_1() ecs_should_log(1)
254#define ecs_should_log_2() ecs_should_log(2)
255#define ecs_should_log_3() ecs_should_log(3)
261#elif defined(FLECS_LOG_2)
262#define ecs_dbg_1(...) ecs_log(1, __VA_ARGS__);
263#define ecs_dbg_2(...) ecs_log(2, __VA_ARGS__);
264#define ecs_dbg_3(...)
266#define ecs_log_push_1() ecs_log_push_(1);
267#define ecs_log_push_2() ecs_log_push_(2);
268#define ecs_log_push_3()
270#define ecs_log_pop_1() ecs_log_pop_(1);
271#define ecs_log_pop_2() ecs_log_pop_(2);
272#define ecs_log_pop_3()
274#define ecs_should_log_1() ecs_should_log(1)
275#define ecs_should_log_2() ecs_should_log(2)
276#define ecs_should_log_3() false
281#elif defined(FLECS_LOG_1)
282#define ecs_dbg_1(...) ecs_log(1, __VA_ARGS__);
283#define ecs_dbg_2(...)
284#define ecs_dbg_3(...)
286#define ecs_log_push_1() ecs_log_push_(1);
287#define ecs_log_push_2()
288#define ecs_log_push_3()
290#define ecs_log_pop_1() ecs_log_pop_(1);
291#define ecs_log_pop_2()
292#define ecs_log_pop_3()
294#define ecs_should_log_1() ecs_should_log(1)
295#define ecs_should_log_2() false
296#define ecs_should_log_3() false
300#elif defined(FLECS_LOG_0)
301#define ecs_dbg_1(...)
302#define ecs_dbg_2(...)
303#define ecs_dbg_3(...)
305#define ecs_log_push_1()
306#define ecs_log_push_2()
307#define ecs_log_push_3()
309#define ecs_log_pop_1()
310#define ecs_log_pop_2()
311#define ecs_log_pop_3()
313#define ecs_should_log_1() false
314#define ecs_should_log_2() false
315#define ecs_should_log_3() false
319#define ecs_trace(...)
320#define ecs_dbg_1(...)
321#define ecs_dbg_2(...)
322#define ecs_dbg_3(...)
324#define ecs_log_push_1()
325#define ecs_log_push_2()
326#define ecs_log_push_3()
328#define ecs_log_pop_1()
329#define ecs_log_pop_2()
330#define ecs_log_pop_3()
335#define ecs_dbg ecs_dbg_1
338#define ecs_log_push() ecs_log_push_(0)
339#define ecs_log_pop() ecs_log_pop_(0)
343#define ecs_abort(error_code, ...)\
344 ecs_abort_(error_code, __FILE__, __LINE__, __VA_ARGS__);\
345 ecs_os_abort(); abort();
349#if defined(FLECS_NDEBUG) && !defined(FLECS_KEEP_ASSERT)
350#define ecs_assert(condition, error_code, ...)
352#define ecs_assert(condition, error_code, ...)\
354 ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
360#define ecs_assert_var(var, error_code, ...)\
361 ecs_assert(var, error_code, __VA_ARGS__);\
367#define ecs_dbg_assert(condition, error_code, ...) ecs_assert(condition, error_code, __VA_ARGS__)
369#define ecs_dbg_assert(condition, error_code, ...)
375#define ecs_san_assert(condition, error_code, ...) ecs_assert(condition, error_code, __VA_ARGS__)
377#define ecs_san_assert(condition, error_code, ...)
382#define ecs_dummy_check\
389#if defined(FLECS_NDEBUG) && !defined(FLECS_KEEP_ASSERT)
390#define ecs_check(condition, error_code, ...) ecs_dummy_check
392#ifdef FLECS_SOFT_ASSERT
393#define ecs_check(condition, error_code, ...)\
395 ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
399#define ecs_check(condition, error_code, ...)\
400 ecs_assert(condition, error_code, __VA_ARGS__);\
407#if defined(FLECS_NDEBUG) && !defined(FLECS_KEEP_ASSERT)
408#define ecs_throw(error_code, ...) ecs_dummy_check
410#ifdef FLECS_SOFT_ASSERT
411#define ecs_throw(error_code, ...)\
412 ecs_abort_(error_code, __FILE__, __LINE__, __VA_ARGS__);\
415#define ecs_throw(error_code, ...)\
416 ecs_abort(error_code, __VA_ARGS__);\
422#define ecs_parser_error(name, expr, column, ...)\
423 ecs_parser_error_(name, expr, column, __VA_ARGS__)
425#define ecs_parser_errorv(name, expr, column, fmt, args)\
426 ecs_parser_errorv_(name, expr, column, fmt, args)
515#define ECS_INVALID_OPERATION (1)
516#define ECS_INVALID_PARAMETER (2)
517#define ECS_CONSTRAINT_VIOLATED (3)
518#define ECS_OUT_OF_MEMORY (4)
519#define ECS_OUT_OF_RANGE (5)
520#define ECS_UNSUPPORTED (6)
521#define ECS_INTERNAL_ERROR (7)
522#define ECS_ALREADY_DEFINED (8)
523#define ECS_MISSING_OS_API (9)
524#define ECS_OPERATION_FAILED (10)
525#define ECS_INVALID_CONVERSION (11)
526#define ECS_ID_IN_USE (12)
527#define ECS_CYCLE_DETECTED (13)
528#define ECS_LEAK_DETECTED (14)
529#define ECS_DOUBLE_FREE (15)
531#define ECS_INCONSISTENT_NAME (20)
532#define ECS_NAME_IN_USE (21)
533#define ECS_NOT_A_COMPONENT (22)
534#define ECS_INVALID_COMPONENT_SIZE (23)
535#define ECS_INVALID_COMPONENT_ALIGNMENT (24)
536#define ECS_COMPONENT_NOT_REGISTERED (25)
537#define ECS_INCONSISTENT_COMPONENT_ID (26)
538#define ECS_INCONSISTENT_COMPONENT_ACTION (27)
539#define ECS_MODULE_UNDEFINED (28)
540#define ECS_MISSING_SYMBOL (29)
541#define ECS_ALREADY_IN_USE (30)
543#define ECS_ACCESS_VIOLATION (40)
544#define ECS_COLUMN_INDEX_OUT_OF_RANGE (41)
545#define ECS_COLUMN_IS_NOT_SHARED (42)
546#define ECS_COLUMN_IS_SHARED (43)
547#define ECS_COLUMN_TYPE_MISMATCH (45)
549#define ECS_INVALID_WHILE_READONLY (70)
550#define ECS_LOCKED_STORAGE (71)
551#define ECS_INVALID_FROM_WORKER (72)
558#define ECS_BLACK "\033[1;30m"
559#define ECS_RED "\033[0;31m"
560#define ECS_GREEN "\033[0;32m"
561#define ECS_YELLOW "\033[0;33m"
562#define ECS_BLUE "\033[0;34m"
563#define ECS_MAGENTA "\033[0;35m"
564#define ECS_CYAN "\033[0;36m"
565#define ECS_WHITE "\033[1;37m"
566#define ECS_GREY "\033[0;37m"
567#define ECS_NORMAL "\033[0;49m"
568#define ECS_BOLD "\033[1;49m"
FLECS_API int ecs_log_last_error(void)
Get last logged error code.
FLECS_API void ecs_log_pop_(int32_t level)
Decrease log stack.
FLECS_API bool ecs_should_log(int32_t level)
Should current level be logged.
FLECS_API const char * ecs_strerror(int32_t error_code)
Get description for error code.
FLECS_API void ecs_deprecated_(const char *file, int32_t line, const char *msg)
Log message indicating an operation is deprecated.
FLECS_API void ecs_log_push_(int32_t level)
Increase log stack.
FLECS_API bool ecs_log_enable_colors(bool enabled)
Enable/disable tracing with colors.
FLECS_API int ecs_log_get_level(void)
Get current log level.
FLECS_API int ecs_log_set_level(int level)
Enable or disable log.
FLECS_API bool ecs_log_enable_timestamp(bool enabled)
Enable/disable logging timestamp.
FLECS_API bool ecs_log_enable_timedelta(bool enabled)
Enable/disable logging time since last log.