The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

typemap - A tool for manipulating typemaps

VERSION

version 0.001

SYNOPSIS

 typemap --merge +Magic

DESCRIPTION

This script can modify, create and write Perl XS typemap files. If you don't know what a typemap is, please confer the perlxstut and perlxs manuals.

ARGUMENTS

  • file <filename>

    The file that we're manipulating, this defaults to typemap.

  • merge <module-name>

    This option takes an ExtUtils::Typemaps module name as argument, and will merge that into the current typemap. The prefix + is replaced with ExtUtils::Typemaps:: for convenience. This may be passed multiple times.

  • no-replace

    This will disable replacing existing entries.

  • add-string <content>

    This will parse a string entry and merge it into the typemap.

  • add-file <filename>

    This will parse a file and merge it into the typemap.

  • add-type <c-type> <xs-type>

    This will add a type mapping entry to the typemap. It takes two arguments: a C type (e.g. double) and an XS type (e.g. T_NV).

  • add-input <xs-type> <code>

    This will add an input entry to the typemap. It takes two arguments: an XS type (e.g. T_NV) and a piece of code to associate with it (e.g. '$var = ($type)SvNV($arg);').

  • add-output <xs-type> <code>

    This will add an output entry to the typemap. It takes two arguments: an XS type (e.g. T_NV) and a piece of code to associate with it (e.g. 'sv_setnv($arg, (NV)$var);').

  • remove-type <c-type>

    This takes a C type as its only argument, and will remove the type mapping for that type.

  • remove-input <xs-type>

    This takes an XS type as its only argument and will remove the associated input entry.

  • remove-output <xs-type>

    This takes an XS type as its only argument and will remove the associated output entry.

AUTHOR

Leon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.