C3E: Complex Compute Core Engine v1.0
An engine for handling complex computational tasks
|
Header file for custom assertion handling functions. More...
#include <stdbool.h>
Go to the source code of this file.
Functions | |
void | c3e_assert (bool condition) |
Evaluates an assertion and triggers a custom handler if the condition is false. | |
void | c3e_assert_handler (void(*event)(const char *filename, int line)) |
Sets a custom assertion handler. | |
void | c3e_assert_remove_handle () |
Removes the currently set custom assertion handler. | |
bool | c3e_assert_has_handler () |
Checks if a custom assertion handler is currently set. | |
This header file provides functions for custom assertion handling in the C3E library. It allows setting up custom assertion handlers, removing them, and checking if a handler is currently set.
void c3e_assert | ( | bool | condition | ) |
This function evaluates the given condition and triggers the custom assertion handler if the condition evaluates to false
. If no custom handler is set, the default behavior is to print an assertion message and terminate the program.
condition | The condition to evaluate. If this condition evaluates to false , the assertion fails and the custom handler (if set) will be triggered. |
void c3e_assert_handler | ( | void(*)(const char *filename, int line) | event | ) |
This function sets a custom handler function that will be called when an assertion fails. The handler function should accept two parameters: a filename and a line number where the assertion failed.
event | A pointer to the custom handler function. This function will be called when an assertion fails. The handler function should have the signature: void handler(const char* filename, int line). |
bool c3e_assert_has_handler | ( | ) |
This function checks whether a custom assertion handler has been set using c3e_assert_handler()
.
true
if a custom assertion handler is currently set, false
otherwise. void c3e_assert_remove_handle | ( | ) |
This function removes the custom assertion handler that was previously set using c3e_assert_handler()
. After calling this function, assertions will use the default behavior, which is to terminate the program.