MOS Source Code
Loading...
Searching...
No Matches
MOS Libraries

A platform-independent library of useful data structures and functions. More...

+ Collaboration diagram for MOS Libraries:

Topics

 libs.HashMap
 A simple hashmap.
 
 libs.LinkedList
 A circular, doubly-linked list.
 
 libs.RingBuffer
 A ring buffer.
 
 libs.DownStack
 A stack that grows down.
 
 libs.AnsiColors
 ANSI color codes.
 
 libs.Stdio
 Standard input/output functions.
 
 libs.Stdlib
 Some standard library functions.
 
 libs.String
 String manipulation functions, similar to the ones in the C standard library.
 

Macros

#define MOS_LIB_ASSERT(cond)   MOS_LIB_ASSERT_X(cond, "")
 
#define MOS_LIB_ASSERT_X(cond, msg, ...)
 
#define MOS_LIB_UNIMPLEMENTED(content)   fatal_abort("Unimplemented: %s", content)
 
#define MOS_LIB_UNREACHABLE()   fatal_abort("Unreachable code reached")
 
#define mos_panic(fmt, ...)   fatal_abort(fmt "\n", ##__VA_ARGS__)
 
#define mos_warn(fmt, ...)   fprintf(stderr, "WARN: " fmt "\n", ##__VA_ARGS__)
 

Functions

MOSAPI void (1, 2) fatal_abort(const char *fmt
 

Detailed Description

A platform-independent library of useful data structures and functions.

Macro Definition Documentation

◆ MOS_LIB_ASSERT

#define MOS_LIB_ASSERT ( cond)    MOS_LIB_ASSERT_X(cond, "")

Definition at line 14 of file moslib_global.h.

◆ MOS_LIB_ASSERT_X

#define MOS_LIB_ASSERT_X ( cond,
msg,
... )
Value:
do \
{ \
if (unlikely(!(cond))) \
fatal_abort("Assertion failed: '%s', " msg "\n", #cond, ##__VA_ARGS__); \
} while (0)
#define unlikely(x)
Definition mos_global.h:55

Definition at line 28 of file moslib_global.h.

◆ MOS_LIB_UNIMPLEMENTED

#define MOS_LIB_UNIMPLEMENTED ( content)    fatal_abort("Unimplemented: %s", content)

Definition at line 37 of file moslib_global.h.

Referenced by vsnprintf().

◆ MOS_LIB_UNREACHABLE

#define MOS_LIB_UNREACHABLE ( )    fatal_abort("Unreachable code reached")

Definition at line 38 of file moslib_global.h.

◆ mos_panic

#define mos_panic ( fmt,
... )   fatal_abort(fmt "\n", ##__VA_ARGS__)

Definition at line 39 of file moslib_global.h.

◆ mos_warn

#define mos_warn ( fmt,
... )   fprintf(stderr, "WARN: " fmt "\n", ##__VA_ARGS__)

Definition at line 40 of file moslib_global.h.

Function Documentation

◆ void()