Affix
view release on metacpan or search on metacpan
infix/include/infix/infix.h view on Meta::CPAN
size_t size; /**< The size of the type in bytes. */
size_t alignment; /**< The alignment requirement of the type in bytes. */
bool is_arena_allocated; /**< True if this type object lives in an arena and must be freed with it. */
bool is_incomplete; /**< True if this is a forward declaration that has not yet been defined. */
infix_arena_t * arena; /**< A pointer to the arena that owns this type object, or nullptr if static. */
size_t source_offset; /**< The byte offset in the source signature where this type was defined. */
/** @brief A union containing metadata specific to the type's category. */
union {
/** @brief Metadata for `INFIX_TYPE_PRIMITIVE`. */
infix_primitive_type_id primitive_id;
/** @brief Metadata for `INFIX_TYPE_POINTER`. */
struct {
struct infix_type_t * pointee_type; /**< The type that this pointer points to. */
} pointer_info;
/** @brief Metadata for `INFIX_TYPE_STRUCT` and `INFIX_TYPE_UNION`. */
struct {
infix_struct_member * members; /**< An array of the aggregate's members. */
size_t num_members; /**< The number of members in the array. */
bool is_packed; /**< True if the struct is packed (!{...}). */
} aggregate_info;
/** @brief Metadata for `INFIX_TYPE_ARRAY`. */
struct {
struct infix_type_t * element_type; /**< The type of each element in the array. */
size_t num_elements; /**< The number of elements in the array. */
bool is_flexible; /**< Indicates this is a flexible array member */
} array_info;
/** @brief Metadata for `INFIX_TYPE_REVERSE_TRAMPOLINE`. */
struct {
struct infix_type_t * return_type; /**< The return type of the function. */
infix_function_argument * args; /**< An array of the function's arguments. */
size_t num_args; /**< The total number of arguments. */
size_t num_fixed_args; /**< The number of non-variadic arguments. */
} func_ptr_info;
/** @brief Metadata for `INFIX_TYPE_ENUM`. */
struct {
struct infix_type_t * underlying_type; /**< The underlying integer type of the enum. */
} enum_info;
/** @brief Metadata for `INFIX_TYPE_COMPLEX`. */
struct {
struct infix_type_t * base_type; /**< The base floating-point type (`float` or `double`). */
} complex_info;
/** @brief Metadata for `INFIX_TYPE_VECTOR`. */
struct {
struct infix_type_t * element_type; /**< The primitive type of each element in the vector. */
size_t num_elements; /**< The number of elements in the vector. */
} vector_info;
/** @brief Metadata for `INFIX_TYPE_NAMED_REFERENCE`. */
struct {
const char * name; /**< The name to be looked up in a registry. */
infix_aggregate_category_t aggregate_category; /**< The expected kind of aggregate (struct or union). */
} named_reference;
} meta;
};
/**
* @struct infix_struct_member_t
* @brief Describes a single member of a C struct or union.
*/
struct infix_struct_member_t {
const char * name; /**< The name of the member, or `nullptr` if anonymous. */
infix_type * type; /**< The `infix_type` of the member. */
size_t offset; /**< The byte offset of the member from the start of the aggregate. */
uint8_t bit_width; /**< The width of the bitfield in bits. 0 for standard members. */
uint8_t bit_offset; /**< The bit offset within the byte (0-7). */
bool is_bitfield; /**< True if this member is a bitfield (even if width is 0). */
};
/**
* @struct infix_function_argument_t
* @brief Describes a single argument to a C function.
*/
struct infix_function_argument_t {
const char * name; /**< The name of the argument, or `nullptr` if anonymous. */
infix_type * type; /**< The `infix_type` of the argument. */
};
/** @} */ // end of type_system group
/**
* @defgroup memory_management Memory Management
* @brief APIs for memory management, including custom allocators and arenas.
* @{
*/
/**
* @def infix_malloc
* @brief A macro that can be defined to override the default `malloc` function.
* @details If you need to integrate `infix` with a custom memory allocator (e.g., for
* memory tracking or garbage collection), define this macro **before**
* including `infix.h`. You must also define the other `infix_*` memory macros.
* @code
* #define infix_malloc my_custom_malloc
* #define infix_calloc my_custom_calloc
* #define infix_free my_custom_free
* #define infix_realloc my_custom_realloc
* #include <infix/infix.h>
* @endcode
*/
#ifndef infix_malloc
#define infix_malloc malloc
#endif
/** @brief A macro that can be defined to override the default `calloc` function. */
#ifndef infix_calloc
#define infix_calloc calloc
#endif
/** @brief A macro that can be defined to override the default `realloc` function. */
#ifndef infix_realloc
#define infix_realloc realloc
#endif
/** @brief A macro that can be defined to override the default `free` function. */
#ifndef infix_free
#define infix_free free
#endif
/** @brief A macro that can be defined to override the default `memcpy` function. */
#ifndef infix_memcpy
#define infix_memcpy memcpy
#endif
/** @brief A macro that can be defined to override the default `memset` function. */
#ifndef infix_memset
#define infix_memset memset
#endif
/** @} */ // end of memory_management group
/**
* @addtogroup high_level_api
* @{
*/
( run in 0.302 second using v1.01-cache-2.11-cpan-f56aa216473 )