Every C source file and header must include the file lib/lib.h. This file contains basic definitions, datatypes and functions, which should be common for all modules.
The programmer can be sure that he gets the following types always defined correctly (by the build/configure script, see Configure script).
byte
: Exactly 8 bits, unsigned.
u8
: Dtto.
sbyte
: Exactly 8 bits, signed.
s8
: Dtto.
word
: Exactly 16 bits, unsigned.
sword
: Exactly 16 bits, signed.
u16
: Exactly 16 bits, unsigned.
s16
: Exactly 16 bits, signed.
u32
: Exactly 32 bits, unsigned.
s32
: Exactly 32 bits, signed.
uns
: At least 32 bits.
u64
: Exactly 64 bits, unsigned.
s64
: Exactly 64 bits, signed.
addr_int_t
: For converting pointers into integers.
real
: Preferred floating-point type
In the header there also useful macros (for example for handling
complicated struct
s),
memory allocation prototypes (see Memory allocation)
and logging and debugging function prototypes (see Logging and debugging).