util.h¶
The util.h module contains additional functionality generally used
throughout a makinori project.
API¶
-
enum mn_error¶
A representation of some error encountered during normal operations.
-
unsigned int MN_ERROR_NONE = 0¶
No error.
-
unsigned int MN_ERROR_CONFIG = 1¶
An error was encountered when either loading or executing a Lua config.
-
unsigned int MN_ERROR_INVALID_ARG = 2¶
An invalid argument was supplied to an API function.
-
unsigned int MN_ERROR_IMMUTABLE = 3¶
An attempt was made to update an immutable object.
-
unsigned int MN_ERROR_DUPLICATE = 4¶
An attempt was made to create another instance of some object.
-
unsigned int MN_ERROR_SYSTEM = 900¶
A generic error, internal to makinori, occurred. Please file an issue.
-
unsigned int MN_ERROR_NOMEM = 901¶
Memory was requested that could not be allocated.
-
unsigned int MN_ERROR_NONE = 0¶
-
struct mn_status¶
A general status indicator. Many API functions provided by makinori prefer to type over e.g. integer status codes for clarity or additional context.
-
MN_FAILURE_EMIT(err, lvl, msg, ...)¶
Utility for logging a
msgat log levellvland then returning amn_statusinstance witherrorset toerr.
-
MN_WARN_EMIT(err, msg, ...)¶
Utility for logging a
msgat log levelMN_LOG_LEVEL_WARNand then returning amn_statusinstance witherrorset toerr.
-
MN_ERROR_EMIT(err, msg, ...)¶
Utility for logging a
msgat log levelMN_LOG_LEVEL_ERRORand then returning amn_statusinstance witherrorset toerr.
-
mn_assert(condition)¶
Asserts the provided
conditionat runtime. Callsabort()iffalse. Generally prefer this toassertsince it outputs error messages in the same format as other logs.Does nothing if
NDEBUGis defined.