dlite-macros

dlite-macros#

A simple colledtion of convinient macros (internal use)

Defines

UNUSED(x)#

Macro for getting rid of unused parameter warnings…

STRINGIFY(s)#

Turns literal s into a C string

_STRINGIFY(s)#
countof(arr)#

Expands to number of elements of array arr

FAIL(msg)#

Convenient macros for failing

FAIL1(msg, a1)#
FAIL2(msg, a1, a2)#
FAIL3(msg, a1, a2, a3)#
FAIL4(msg, a1, a2, a3, a4)#
FAIL5(msg, a1, a2, a3, a4, a5)#
DFAIL0(code, d, msg)#

Error macros for when DLiteDataModel instance d is available

DFAIL1(code, d, msg, a1)#
DFAIL2(code, d, msg, a1, a2)#
DFAIL3(code, d, msg, a1, a2, a3)#
DFAIL4(code, d, msg, a1, a2, a3, a4)#
FAILCODE(code, msg)#

Failure macros with explicit error codes

FAILCODE1(code, msg, a1)#
FAILCODE2(code, msg, a1, a2)#
FAILCODE3(code, msg, a1, a2, a3)#
FAILCODE4(code, msg, a1, a2, a3, a4)#
FAILCODE5(code, msg, a1, a2, a3, a4, a5)#
WARN(msg)#

Convinient macros for warnings

WARN1(msg, a1)#
WARN2(msg, a1, a2)#
WARN3(msg, a1, a2, a3)#
WARN4(msg, a1, a2, a3, a4)#
WARN5(msg, a1, a2, a3, a4, a5)#
DEBUG_LOG(msg, ...)#

Debugging messages. Printed if compiled with WITH_DEBUG