|
| static uint64_t | _registry_hash_string (const char *str) |
| |
| static _infix_registry_entry_t * | _registry_lookup (infix_registry_t *registry, const char *name) |
| |
| static _infix_registry_entry_t * | _registry_insert (infix_registry_t *registry, const char *name) |
| |
| c23_nodiscard infix_registry_t * | infix_registry_create (void) |
| | Creates a new, empty named type registry.
|
| |
| c23_nodiscard infix_registry_t * | infix_registry_create_in_arena (infix_arena_t *arena) |
| | Creates a new, empty named type registry that allocates from a user-provided arena.
|
| |
| void | infix_registry_destroy (infix_registry_t *registry) |
| | Destroys a type registry and frees all associated memory.
|
| |
| static infix_status | _resolve_type_graph_inplace_recursive (infix_arena_t *temp_arena, infix_type **type_ptr, infix_registry_t *registry, resolve_memo_node_t **memo_head) |
| |
| c23_nodiscard infix_status | _infix_resolve_type_graph_inplace (infix_type **type_ptr, infix_registry_t *registry) |
| | Resolves all named type references in a type graph in-place.
|
| |
| static void | _registry_parser_skip_whitespace (_registry_parser_state_t *state) |
| |
| static char * | _registry_parser_parse_name (_registry_parser_state_t *state, char *buffer, size_t buf_size) |
| |
| c23_nodiscard infix_status | infix_register_types (infix_registry_t *registry, const char *definitions) |
| | Parses a string of type definitions and adds them to a registry.
|
| |
| c23_nodiscard infix_registry_iterator_t | infix_registry_iterator_begin (const infix_registry_t *registry) |
| | Initializes an iterator for traversing the types in a registry.
|
| |
| c23_nodiscard bool | infix_registry_iterator_next (infix_registry_iterator_t *iter) |
| | Advances the iterator to the next defined type in the registry.
|
| |
| c23_nodiscard const char * | infix_registry_iterator_get_name (const infix_registry_iterator_t *iter) |
| | Gets the name of the type at the iterator's current position.
|
| |
| c23_nodiscard const infix_type * | infix_registry_iterator_get_type (const infix_registry_iterator_t *iter) |
| | Gets the infix_type object of the type at the iterator's current position.
|
| |
| c23_nodiscard bool | infix_registry_is_defined (const infix_registry_t *registry, const char *name) |
| | Checks if a type with the given name is fully defined in the registry.
|
| |
| c23_nodiscard const infix_type * | infix_registry_lookup_type (const infix_registry_t *registry, const char *name) |
| | Retrieves the canonical infix_type object for a given name from the registry.
|
| |
Implements the named type registry system.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
This module provides the functionality for defining, storing, and resolving complex C types by name. It is a critical component for handling recursive types (e.g., linked lists) and mutually-dependent types, making the signature string syntax much more powerful and manageable.
The registry is built on a hash table for efficient lookups. Its most important functions are:
infix_register_types(): This function uses a robust three-pass algorithm to parse a string of definitions. This approach allows for out-of-order definitions and forward declarations, which is essential for complex type graphs.
_infix_resolve_type_graph_inplace(): This internal function implements the **"Resolve"** stage of the library's core "Parse -> Copy -> Resolve -> Layout" data pipeline. It traverses a type graph and replaces all named placeholders (@MyType) with direct pointers to the canonical type objects stored in the registry.