NAME
XS::JIT::Header::TypeMap - C to Perl type mappings for XS::JIT::Header
SYNOPSIS
use XS::JIT::Header::TypeMap;
# Resolve a C type
my $info = XS::JIT::Header::TypeMap::resolve('int');
# Returns: { perl => 'IV', c => 'int', convert => 'SvIV', create => 'newSViv' }
my $info = XS::JIT::Header::TypeMap::resolve('const char*');
# Returns: { perl => 'PV', c => 'const char*', convert => 'SvPV_nolen', ... }
# Register custom type
XS::JIT::Header::TypeMap::register('MyInt',
perl => 'IV',
c => 'MyInt',
convert => 'SvIV',
create => 'newSViv',
);
# Create alias
XS::JIT::Header::TypeMap::alias('BOOL', 'int');
DESCRIPTION
This module provides C to Perl type mappings used by XS::JIT::Header for generating XS wrapper code. It handles standard C types, fixed-width integers, pointers, and allows registration of custom types.
FUNCTIONS
resolve($type)
Resolves a C type string to its Perl mapping. Returns a hashref with:
- perl - Perl type category (IV, UV, NV, PV, void)
- c - Canonical C type string
- convert - Macro to convert SV to C value (e.g., SvIV)
- create - Macro to create SV from C value (e.g., newSViv)
- is_ptr - True if this is a pointer type
- is_string - True if this is a string type (char*)
- opaque - True if treated as opaque pointer
- unknown - True if type was not recognized
normalize_type($type)
Normalizes a C type string by removing extra whitespace and standardizing pointer notation.
is_known($type)
Returns true if the type is directly known (not inferred).
known_types()
Returns list of all known type names.
register($type, %info)
Registers a custom type mapping.
alias($new_type, $existing_type)
Creates a type alias.
AUTHOR
LNATION <email@lnation.org>