108#define ecs_deprecated_(file, line, msg)\
113#define ecs_log_push_(level)
114#define ecs_log_pop_(level)
115#define ecs_should_log(level) false
117#define ecs_strerror(error_code)\
218 const
char *condition_str,
297#define ecs_print(level, ...)\
298 ecs_print_(level, __FILE__, __LINE__, __VA_ARGS__)
301#define ecs_printv(level, fmt, args)\
302 ecs_printv_(level, __FILE__, __LINE__, fmt, args)
305#define ecs_log(level, ...)\
306 ecs_log_(level, __FILE__, __LINE__, __VA_ARGS__)
309#define ecs_logv(level, fmt, args)\
310 ecs_logv_(level, __FILE__, __LINE__, fmt, args)
313#define ecs_trace_(file, line, ...) ecs_log_(0, file, line, __VA_ARGS__)
315#define ecs_trace(...) ecs_trace_(__FILE__, __LINE__, __VA_ARGS__)
318#define ecs_warn_(file, line, ...) ecs_log_(-2, file, line, __VA_ARGS__)
320#define ecs_warn(...) ecs_warn_(__FILE__, __LINE__, __VA_ARGS__)
323#define ecs_err_(file, line, ...) ecs_log_(-3, file, line, __VA_ARGS__)
325#define ecs_err(...) ecs_err_(__FILE__, __LINE__, __VA_ARGS__)
328#define ecs_fatal_(file, line, ...) ecs_log_(-4, file, line, __VA_ARGS__)
330#define ecs_fatal(...) ecs_fatal_(__FILE__, __LINE__, __VA_ARGS__)
333#ifndef FLECS_NO_DEPRECATED_WARNINGS
335#define ecs_deprecated(...)\
336 ecs_deprecated_(__FILE__, __LINE__, __VA_ARGS__)
338#define ecs_deprecated(...)
342#if !(defined(FLECS_LOG_0) || defined(FLECS_LOG_1) || defined(FLECS_LOG_2) || defined(FLECS_LOG_3))
343#if !defined(FLECS_NDEBUG)
354#if defined(FLECS_LOG_3)
356#define ecs_dbg_1(...) ecs_log(1, __VA_ARGS__);
358#define ecs_dbg_2(...) ecs_log(2, __VA_ARGS__);
360#define ecs_dbg_3(...) ecs_log(3, __VA_ARGS__);
363#define ecs_log_push_1() ecs_log_push_(1);
365#define ecs_log_push_2() ecs_log_push_(2);
367#define ecs_log_push_3() ecs_log_push_(3);
370#define ecs_log_pop_1() ecs_log_pop_(1);
372#define ecs_log_pop_2() ecs_log_pop_(2);
374#define ecs_log_pop_3() ecs_log_pop_(3);
377#define ecs_should_log_1() ecs_should_log(1)
379#define ecs_should_log_2() ecs_should_log(2)
381#define ecs_should_log_3() ecs_should_log(3)
387#elif defined(FLECS_LOG_2)
388#define ecs_dbg_1(...) ecs_log(1, __VA_ARGS__);
389#define ecs_dbg_2(...) ecs_log(2, __VA_ARGS__);
390#define ecs_dbg_3(...)
392#define ecs_log_push_1() ecs_log_push_(1);
393#define ecs_log_push_2() ecs_log_push_(2);
394#define ecs_log_push_3()
396#define ecs_log_pop_1() ecs_log_pop_(1);
397#define ecs_log_pop_2() ecs_log_pop_(2);
398#define ecs_log_pop_3()
400#define ecs_should_log_1() ecs_should_log(1)
401#define ecs_should_log_2() ecs_should_log(2)
402#define ecs_should_log_3() false
407#elif defined(FLECS_LOG_1)
408#define ecs_dbg_1(...) ecs_log(1, __VA_ARGS__);
409#define ecs_dbg_2(...)
410#define ecs_dbg_3(...)
412#define ecs_log_push_1() ecs_log_push_(1);
413#define ecs_log_push_2()
414#define ecs_log_push_3()
416#define ecs_log_pop_1() ecs_log_pop_(1);
417#define ecs_log_pop_2()
418#define ecs_log_pop_3()
420#define ecs_should_log_1() ecs_should_log(1)
421#define ecs_should_log_2() false
422#define ecs_should_log_3() false
426#elif defined(FLECS_LOG_0)
427#define ecs_dbg_1(...)
428#define ecs_dbg_2(...)
429#define ecs_dbg_3(...)
431#define ecs_log_push_1()
432#define ecs_log_push_2()
433#define ecs_log_push_3()
435#define ecs_log_pop_1()
436#define ecs_log_pop_2()
437#define ecs_log_pop_3()
439#define ecs_should_log_1() false
440#define ecs_should_log_2() false
441#define ecs_should_log_3() false
445#define ecs_trace(...)
446#define ecs_dbg_1(...)
447#define ecs_dbg_2(...)
448#define ecs_dbg_3(...)
450#define ecs_log_push_1()
451#define ecs_log_push_2()
452#define ecs_log_push_3()
454#define ecs_log_pop_1()
455#define ecs_log_pop_2()
456#define ecs_log_pop_3()
461#define ecs_dbg ecs_dbg_1
464#define ecs_log_push() ecs_log_push_(0)
466#define ecs_log_pop() ecs_log_pop_(0)
470#define ecs_abort(error_code, ...)\
471 ecs_abort_(error_code, __FILE__, __LINE__, __VA_ARGS__);\
472 ecs_os_abort(); abort();
476#if defined(FLECS_NDEBUG) && !defined(FLECS_KEEP_ASSERT)
477#define ecs_assert(condition, error_code, ...)
479#define ecs_assert(condition, error_code, ...)\
481 ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
490#define ecs_dbg_assert(condition, error_code, ...) ecs_assert(condition, error_code, __VA_ARGS__)
492#define ecs_dbg_assert(condition, error_code, ...)
498#define ecs_always_assert(condition, error_code, ...)\
500 ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
508#define ecs_san_assert(condition, error_code, ...) ecs_assert(condition, error_code, __VA_ARGS__)
510#define ecs_san_assert(condition, error_code, ...)
515#define ecs_dummy_check\
522#if defined(FLECS_NDEBUG) && !defined(FLECS_KEEP_ASSERT)
523#define ecs_check(condition, error_code, ...) ecs_dummy_check
525#ifdef FLECS_SOFT_ASSERT
526#define ecs_check(condition, error_code, ...)\
528 ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
533#define ecs_check(condition, error_code, ...)\
535 ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
545#if defined(FLECS_NDEBUG) && !defined(FLECS_KEEP_ASSERT)
546#define ecs_throw(error_code, ...) ecs_dummy_check
548#ifdef FLECS_SOFT_ASSERT
549#define ecs_throw(error_code, ...)\
550 ecs_abort_(error_code, __FILE__, __LINE__, __VA_ARGS__);\
553#define ecs_throw(error_code, ...)\
554 ecs_abort(error_code, __VA_ARGS__);\
560#define ecs_parser_error(name, expr, column, ...)\
561 ecs_parser_error_(name, expr, column, __VA_ARGS__)
564#define ecs_parser_errorv(name, expr, column, fmt, args)\
565 ecs_parser_errorv_(name, expr, column, fmt, args)
568#define ecs_parser_warning(name, expr, column, ...)\
569 ecs_parser_warning_(name, expr, column, __VA_ARGS__)
572#define ecs_parser_warningv(name, expr, column, fmt, args)\
573 ecs_parser_warningv_(name, expr, column, fmt, args)
702#define ECS_INVALID_OPERATION (1)
704#define ECS_INVALID_PARAMETER (2)
706#define ECS_CONSTRAINT_VIOLATED (3)
708#define ECS_OUT_OF_MEMORY (4)
710#define ECS_OUT_OF_RANGE (5)
712#define ECS_UNSUPPORTED (6)
714#define ECS_INTERNAL_ERROR (7)
716#define ECS_ALREADY_DEFINED (8)
718#define ECS_MISSING_OS_API (9)
720#define ECS_OPERATION_FAILED (10)
722#define ECS_INVALID_CONVERSION (11)
724#define ECS_CYCLE_DETECTED (13)
726#define ECS_LEAK_DETECTED (14)
728#define ECS_DOUBLE_FREE (15)
731#define ECS_INCONSISTENT_NAME (20)
733#define ECS_NAME_IN_USE (21)
735#define ECS_INVALID_COMPONENT_SIZE (23)
737#define ECS_INVALID_COMPONENT_ALIGNMENT (24)
739#define ECS_COMPONENT_NOT_REGISTERED (25)
741#define ECS_INCONSISTENT_COMPONENT_ID (26)
743#define ECS_INCONSISTENT_COMPONENT_ACTION (27)
745#define ECS_MODULE_UNDEFINED (28)
747#define ECS_MISSING_SYMBOL (29)
749#define ECS_ALREADY_IN_USE (30)
752#define ECS_ACCESS_VIOLATION (40)
754#define ECS_COLUMN_INDEX_OUT_OF_RANGE (41)
756#define ECS_COLUMN_IS_NOT_SHARED (42)
758#define ECS_COLUMN_IS_SHARED (43)
760#define ECS_COLUMN_TYPE_MISMATCH (45)
763#define ECS_INVALID_WHILE_READONLY (70)
765#define ECS_LOCKED_STORAGE (71)
767#define ECS_INVALID_FROM_WORKER (72)
775#define ECS_BLACK "\033[1;30m"
777#define ECS_RED "\033[0;31m"
779#define ECS_GREEN "\033[0;32m"
781#define ECS_YELLOW "\033[0;33m"
783#define ECS_BLUE "\033[0;34m"
785#define ECS_MAGENTA "\033[0;35m"
787#define ECS_CYAN "\033[0;36m"
789#define ECS_WHITE "\033[1;37m"
791#define ECS_GREY "\033[0;37m"
793#define ECS_NORMAL "\033[0;49m"
795#define ECS_BOLD "\033[1;49m"
FLECS_API void ecs_parser_warning_(const char *name, const char *expr, int64_t column, const char *fmt,...) ECS_FORMAT(4
Log a parser warning.
FLECS_API void FLECS_API void ecs_logv_(int32_t level, const char *file, int32_t line, const char *fmt, va_list args)
Log at the provided level (va_list).
FLECS_API char * ecs_log_stop_capture(void)
Stop capturing log output.
FLECS_API void FLECS_API void FLECS_API void ecs_parser_error_(const char *name, const char *expr, int64_t column, const char *fmt,...) ECS_FORMAT(4
Log a parser error.
FLECS_API void ecs_log_stop_collect_errors(void)
Stop collecting errors.
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 void FLECS_API void ecs_parser_warningv_(const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
Log a parser warning (va_list).
FLECS_API void ecs_log_start_collect_errors(ecs_vec_t *errors)
Start collecting errors.
FLECS_API void ecs_abort_(int32_t error_code, const char *file, int32_t line, const char *fmt,...) ECS_FORMAT(4
Abort with error code.
FLECS_API void ecs_print_(int32_t level, const char *file, int32_t line, const char *fmt,...) ECS_FORMAT(4
Print at the provided log level.
FLECS_API void FLECS_API void ecs_printv_(int32_t level, const char *file, int32_t line, const char *fmt, va_list args)
Print at the provided log level (va_list).
FLECS_API void ecs_log_start_capture(bool capture_try)
Start capturing log output.
FLECS_API bool ecs_should_log(int32_t level)
Should current level be logged.
FLECS_API void ecs_log_(int32_t level, const char *file, int32_t line, const char *fmt,...) ECS_FORMAT(4
Log at the provided level.
FLECS_API void FLECS_API void FLECS_API void FLECS_API void ecs_parser_errorv_(const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
Log a parser error (va_list).
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 void FLECS_API void ecs_assert_log_(int32_t error_code, const char *condition_str, const char *file, int32_t line, const char *fmt,...) ECS_FORMAT(5
Log an assertion failure.
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.