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

TYPEMAP

PopplerDocument * T_PTROBJ
hPopplerDocument * T_OBJECT
hPopplerPage * T_OBJECT
hPopplerAttachment * T_OBJECT
hPageDimension * T_OBJECT

OutputDevData * T_OBJECT
# GooString * newSVGooString

PopplerPage * T_PTROBJ
cairo_t * T_OBJECT
cairo_surface_t * T_OBJECT

int * T_INT

INPUT

# newSVGooString
#     if (sv_isobject($arg) && SvTYPE(SvRV($arg)) == SVt_PVMG)
#     {
#         IV tmp = SvIV((SV*)SvRV($arg));
#         $var = INT2PTR($type, tmp);
#     }
#     else
#         Perl_croak(aTHX_ \"${Package}::$func_name(): $var is not a blessed SV reference\");


T_OBJECT
    if (sv_isobject($arg) && SvTYPE(SvRV($arg)) == SVt_PVMG)
    {
        IV tmp = SvIV((SV*)SvRV($arg));
        $var = INT2PTR($type, tmp);
    }
    else
        Perl_croak(aTHX_ \"${Package}::$func_name(): $var is not a blessed SV reference\");


T_POPPLERPERL_GENERIC_WRAPPER
    $var = Sv${;
      (my $ntype = $type) =~ s/(?:const\s+)?([:\w]+)(?:\s*\*)$/$1/x;
      my $result = $type;
      if ($ntype =~ m/(.+)_t(_.+)?/) {
        my ($name, $options) = ($1, $2);
        $name =~ s/([^_]+)/ucfirst $1/ge;
        $name =~ s/_//g;
        $result = $name . $options;
      }
      \$result} ($arg);

OUTPUT

# newSVGooString 
#     sv_setref_pv($arg, "Goo::String" , (void*)$var);


T_OBJECT
    sv_setref_pv($arg, class , (void*)$var);

T_POPPLERPERL_GENERIC_WRAPPER
    $arg = newSV${;
      (my $ntype = $type) =~ s/(?:const\s+)?([:\w]+)(?:\s*\*)$/$1/x;
      my $result = $type;
      if ($ntype =~ m/(.+)_t(_.+)?/) {
        my ($name, $options) = ($1, $2);
        $name =~ s/([^_]+)/ucfirst $1/ge;
        $name =~ s/_//g;
        $result = $name . $options;
      }
      \$result} ($var);