Affix
view release on metacpan or search on metacpan
CODE_OF_CONDUCT.md view on Meta::CPAN
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://github.com/sanko/Affix.pm/discussions.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
infix/src/common/infix_internals.h view on Meta::CPAN
* @param system_code The OS-specific error code (e.g., from `errno` or `GetLastError`).
* @param msg An optional custom message from the OS (e.g., from `dlerror`).
*/
INFIX_INTERNAL void _infix_set_system_error(infix_error_category_t category,
infix_error_code_t code,
long system_code,
const char * msg);
/**
* @brief Clears the thread-local error state.
* @details Located in `src/core/error.c`. This is called at the beginning of every public
* API function to ensure that a prior error from an unrelated call is not accidentally returned.
*/
INFIX_INTERNAL void _infix_clear_error(void);
INFIX_INTERNAL void skip_whitespace(parser_state * state);
INFIX_INTERNAL void _infix_set_parser_error(parser_state * state, infix_error_code_t code);
INFIX_INTERNAL infix_type * parse_type(parser_state * state);
INFIX_INTERNAL infix_type * parse_primitive(parser_state * state);
/**
* @brief Recalculates the layout of a fully resolved type graph.
* @details Located in `src/core/types.c`. This is the "Layout" stage of the data pipeline.
infix/src/core/error.c view on Meta::CPAN
/**
* @file error.c
* @brief Implements the thread-local error reporting system.
* @ingroup internal_core
*
* @details This module provides the infrastructure for robust and thread-safe error
* handling within the `infix` library.
*
* The core principle is that all detailed error information is stored in
* **thread-local storage (TLS)**. This means that an error occurring in one thread
* will never interfere with or be accidentally reported by an operation in another
* thread.
*
* The workflow is as follows:
* 1. Every public API function calls `_infix_clear_error()` upon entry to reset the
* error state for the current thread.
* 2. If an internal function encounters an error, it calls `_infix_set_error()` or
* `_infix_set_system_error()` to record detailed diagnostic information, including
* an error code, category, and a descriptive message.
* 3. For parser errors, `_infix_set_error()` generates a rich, multi-line diagnostic
* message with a code snippet and a caret pointing to the error location, similar
infix/src/core/error.c view on Meta::CPAN
const char * default_msg = _get_error_message_for_code(code);
_INFIX_SAFE_STRNCPY(g_infix_last_error.message, default_msg, sizeof(g_infix_last_error.message) - 1);
}
}
/**
* @internal
* @brief Resets the error state for the current thread to "no error".
*
* This should be called at the beginning of every public API function to ensure
* that a prior error from an unrelated call on the same thread is not accidentally
* returned to the user.
*/
void _infix_clear_error(void) {
g_infix_last_error.category = INFIX_CATEGORY_NONE;
g_infix_last_error.code = INFIX_CODE_SUCCESS;
g_infix_last_error.position = 0;
g_infix_last_error.system_error_code = 0;
g_infix_last_error.message[0] = '\0';
g_infix_last_signature_context = nullptr;
}
infix/src/core/signature.c view on Meta::CPAN
return nullptr;
}
/**
* @internal
* @brief A lookahead function to disambiguate a grouped type `(type)` from a
* function signature `(...) -> type`.
*
* @details This is a classic parser "lookahead". When the parser encounters an opening
* parenthesis `(`, it calls this function to peek ahead in the string without
* consuming any input. By scanning for a matching `)` and checking if it is
* followed by a `->` token, it can decide whether to parse the content as a
* single, parenthesized type or as a full function signature.
*
* @param[in] state The current parser state (read-only).
* @return `true` if a `->` token follows the closing parenthesis.
*/
static bool is_function_signature_ahead(const parser_state * state) {
const char * p = state->p;
if (*p != '(')
return false;
p++;
t/028_pointer_indexing.t view on Meta::CPAN
# Compatibility: $$ptr should still work (points to index 0 usually)
# Wait, $$ptr for Array[T, N] currently returns an arrayref in Affix?
# Let's check.
is ref($$ptr), 'ARRAY', '$$ptr for Array returns an arrayref';
is $$ptr->[0], 42, 'Value in arrayref matches';
};
subtest 'Indexing (Void*)' => sub {
my $ptr = malloc(8);
#decided byte-indexed for void*
is $ptr->count, 8, 'count() for void* pin returns size';
$ptr->[0] = 65; # 'A'
$ptr->[1] = 66; # 'B'
is $ptr->[0], 65, 'Read byte 0';
is $ptr->[1], 66, 'Read byte 1';
# Compatibility: $$ptr for void* pin returns address
ok $$ptr == $ptr->address, '$$ptr for void* returns address';
};
subtest 'Compatibility' => sub {
( run in 5.082 seconds using v1.01-cache-2.11-cpan-98e64b0badf )