MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
Macros | Functions
mgdl-assert.h File Reference

Different assert macros. More...

#include <mgdl/mgdl-types.h>

Go to the source code of this file.

Macros

#define mgdl_assert_printf(test, message, ...)
 
#define mgdl_assert_print(test, message)
 
#define mgdl_assert_test(test)
 

Functions

void AssertFunctionPrintf (const char *filename, int lineNumber, const char *message,...)
 If the assert fails, break into assert display loop and ask if assert should be ignored.
 
void AssertFunctionPrint (const char *filename, int lineNumber, const char *message)
 If the assert fails, break into assert display loop and ask if assert should be ignored.
 

Detailed Description

Different assert macros.

Macro Definition Documentation

◆ mgdl_assert_print

#define mgdl_assert_print (   test,
  message 
)
Value:
if ((test) == false) \
{ \
AssertFunctionPrint(__FILE__, __LINE__, message); \
}

◆ mgdl_assert_printf

#define mgdl_assert_printf (   test,
  message,
  ... 
)
Value:
if ((test) == false) \
{ \
AssertFunctionPrintf(__FILE__, __LINE__, message, __VA_ARGS__); \
}

◆ mgdl_assert_test

#define mgdl_assert_test (   test)
Value:
if ((test) == false) \
{ \
AssertFunctionPrint(__FILE__, __LINE__, #test); \
}

Function Documentation

◆ AssertFunctionPrint()

void AssertFunctionPrint ( const char *  filename,
int  lineNumber,
const char *  message 
)

If the assert fails, break into assert display loop and ask if assert should be ignored.

This function is called by the gdl_assert macro. It breaks normal execution and loops showing the provided error message until user selects to ignore the assert or quit the program.

Parameters
filenameThe filename of the code where assert happened. This is provided by FILE macro.
lineNumberLine in code where assert happened. This is provided by LINE macro.
messageThe message to show when assert fails.

◆ AssertFunctionPrintf()

void AssertFunctionPrintf ( const char *  filename,
int  lineNumber,
const char *  message,
  ... 
)

If the assert fails, break into assert display loop and ask if assert should be ignored.

This function is called by the gdl_assert macro. It breaks normal execution and loops showing the provided error message until user confirms

Parameters
filenameThe filename of the code where assert happened. This is provided by FILE macro.
lineNumberLine in code where assert happened. This is provided by LINE macro.
messageThe message to show when assert fails. Has to contain format specifiers.
__VA_ARGS__Arguments for the format specifiers in message.