Affix
view release on metacpan or search on metacpan
infix/include/infix/infix.h view on Meta::CPAN
* @endcode
*/
INFIX_API INFIX_NODISCARD infix_status infix_forward_create(infix_forward_t **,
const char *,
void *,
infix_registry_t *);
/**
* @brief Creates a "safe" bound forward trampoline that catches native exceptions.
* @details This is identical to `infix_forward_create`, but the generated trampoline
* is wrapped in a platform-specific exception handler (e.g., SEH on Windows).
* If the target function throws an exception, the trampoline will catch it
* and set the thread-local error to `INFIX_CODE_NATIVE_EXCEPTION`.
*
* @param[out] out_trampoline Receives the created handle.
* @param[in] signature The function signature.
* @param[in] target_function The address of the C function.
* @param[in] registry An optional type registry.
* @return `INFIX_SUCCESS` on success.
*/
INFIX_API INFIX_NODISCARD infix_status infix_forward_create_safe(infix_forward_t **,
const char *,
infix/include/infix/infix.h view on Meta::CPAN
} infix_error_category_t;
/**
* @brief Enumerates specific error codes.
*/
typedef enum {
// General Codes (0-99)
INFIX_CODE_SUCCESS = 0, /**< No error occurred. */
INFIX_CODE_UNKNOWN, /**< An unspecified error occurred. */
INFIX_CODE_NULL_POINTER, /**< A required pointer argument was NULL. */
INFIX_CODE_MISSING_REGISTRY, /**< A type registry was required but not provided. */
INFIX_CODE_NATIVE_EXCEPTION, /**< A native exception (C++/SEH) was thrown during execution. */
// Allocation Codes (100-199)
INFIX_CODE_OUT_OF_MEMORY = 100, /**< A call to `malloc`, `calloc`, etc. failed. */
INFIX_CODE_EXECUTABLE_MEMORY_FAILURE, /**< Failed to allocate executable memory from the OS. */
INFIX_CODE_PROTECTION_FAILURE, /**< Failed to change memory protection flags (e.g., `mprotect`). */
INFIX_CODE_INVALID_ALIGNMENT, /**< An invalid alignment (0 or not power-of-two) was requested. */
// Parser Codes (200-299)
INFIX_CODE_UNEXPECTED_TOKEN = 200, /**< Encountered an unexpected character or token. */
INFIX_CODE_UNTERMINATED_AGGREGATE, /**< A struct, union, or array was not properly closed. */
infix/src/core/error.c view on Meta::CPAN
switch (code) {
case INFIX_CODE_SUCCESS:
return "Success";
case INFIX_CODE_UNKNOWN:
return "An unknown error occurred";
case INFIX_CODE_NULL_POINTER:
return "A required pointer argument was NULL";
case INFIX_CODE_MISSING_REGISTRY:
return "A type registry was required but not provided";
case INFIX_CODE_NATIVE_EXCEPTION:
return "A native exception was thrown across the FFI boundary";
case INFIX_CODE_OUT_OF_MEMORY:
return "Out of memory";
case INFIX_CODE_EXECUTABLE_MEMORY_FAILURE:
return "Failed to allocate executable memory";
case INFIX_CODE_PROTECTION_FAILURE:
return "Failed to change memory protection flags";
case INFIX_CODE_INVALID_ALIGNMENT:
return "Invalid alignment requested (must be power of two > 0)";
case INFIX_CODE_UNEXPECTED_TOKEN:
return "Unexpected token or character";
( run in 1.813 second using v1.01-cache-2.11-cpan-39bf76dae61 )