f2x_err_impl.c

static jmp_buf f2x_err_jmp_buf

Holds the jmp_buf for the current call.

static bool f2x_err_active

Indicates wheather a call is currently active.

static int f2x_err_code

Holds an error code for the last call. Use f2x_err_get() to read status and f2x_err_reset() to reset it.

jmp_buf *f2x_prepare_jmp_buffer()

Prepare f2x_err_jmp_buf. If the buffer is already in use, indicate an error by setting f2x_err_code to -1.

Returns

Address of f2x_err_jmp_buf (or 0 if jump buffer is in use).

void f2x_clear_jmp_buffer()

Cleanup f2x_err_jmp_buf after a call finished and release all resources.

void f2x_err_handle(int code)

Trigger error handler. This will set the f2x_err_code to the given error and use f2x_err_jmp_buf to stop the execution of the current call.

f2x_err_jmp_buf will be clean up for next use.

Parameters
  • code – The error code that should be set.

void f2x_err_reset()

Reset f2x_err_code to 0 (no error).

int f2x_err_get()

Get current value of f2x_err_code.

Returns

Value of f2x_err_code.