| 1 | package ExtUtils::Typemaps::MagicExt; | ||
| 2 | 1 | $ExtUtils::Typemaps::MagicExt::VERSION = '0.009'; | |
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use parent 'ExtUtils::Typemaps'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | sub new { | ||
| 9 | 0 | ▶ | my $class = shift; |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 10 | 0 | my $self = $class->SUPER::new(@_); | |
| 11 | |||
| 12 | 0 | $self->add_inputmap(xstype => 'T_MAGICEXT', code => <<'END'); | |
| 13 | { | ||
| 14 | SV* arg = $arg; | ||
| 15 | MAGIC* magic = SvROK(arg) && SvMAGICAL(SvRV(arg)) ? mg_findext(SvRV(arg), PERL_MAGIC_ext, &${type}_magic) : NULL; | ||
| 16 | if (magic) | ||
| 17 | $var = ($type)magic->mg_ptr; | ||
| 18 | else | ||
| 19 | Perl_croak(aTHX_ \"%s object is lacking magic\", \"$ntype\"); | ||
| 20 | } | ||
| 21 | END | ||
| 22 | 0 | $self->add_inputmap(xstype => 'T_MAGICEXT_BASE', code => <<'END'); | |
| 23 | { | ||
| 24 | SV* arg = $arg; | ||
| 25 | MAGIC* magic = SvROK(arg) && SvMAGICAL(SvRV(arg)) ? mg_find(SvRV(arg), PERL_MAGIC_ext) : NULL; | ||
| 26 | if (magic && magic->mg_virtual) | ||
| 27 | $var = ($type)magic->mg_ptr; | ||
| 28 | else | ||
| 29 | Perl_croak(aTHX_ \"%s object is lacking magic\", \"$ntype\"); | ||
| 30 | } | ||
| 31 | END | ||
| 32 | |||
| 33 | |||
| 34 | 0 | $self->add_outputmap(xstype => 'T_MAGICEXT', code => <<'END'); | |
| 35 | { | ||
| 36 | MAGIC* magic = sv_magicext(newSVrv($arg, "$ntype"), NULL, PERL_MAGIC_ext, &${type}_magic, (const char*)$var, 0); | ||
| 37 | magic->mg_flags |= MGf_COPY|MGf_DUP; | ||
| 38 | } | ||
| 39 | END | ||
| 40 | |||
| 41 | 0 | return $self; | |
| 42 | } | ||
| 43 | |||
| 44 | sub minimum_pxs { | ||
| 45 | 0 | ▶ | return '3.50'; |
|
Subroutine
minimum_pxs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 46 | } | ||
| 47 | |||
| 48 | 1 | 1; | |
| 49 | |||
| 50 | # ABSTRACT: Typemap for storing objects in magic pointer | ||
| 51 | |||
| 52 | __END__ | ||