X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-perl/blobdiff_plain/68e68e18c457d31c1c61bc08dd14a56e7e7ac21e..a1a90aaf554eb974e39e34b513747eb666180776:/typemap diff --git a/typemap b/typemap index 0ffd393..e28ed73 100644 --- a/typemap +++ b/typemap @@ -1,5 +1,12 @@ TYPEMAP mp * T_MP +gf * T_MP +GE * T_CATSTRUCT +EC_Point * T_CATSTRUCT +EC_Curve * T_CATSTRUCT +EC_Info * T_CATSTRUCT +Field * T_CATSTRUCT +Group * T_CATSTRUCT gccipher * T_GCALG gchash * T_GCALG gcMAC * T_GCALG @@ -16,6 +23,8 @@ MP_Mont * T_CATSTRUCT MP_Barrett * T_CATSTRUCT MP_Mul * T_CATSTRUCT MP_CRT * T_CATSTRUCT +MP_Reduce * T_CATSTRUCT +GF_Reduce * T_CATSTRUCT MP_Prime_Filter * T_CATSTRUCT MP_Prime_Rabin * T_CATSTRUCT MP_Prime_Gen_Event * T_CATSTRUCT @@ -34,27 +43,15 @@ KeyErr T_KEYERR INPUT T_MP - $var = mp_fromsv($arg, \"$var\", 0, 0) + $var = mp_fromsv($arg, \"$var\", \"${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::\U$1/; $ntt =~ s/_/::/g; \$ntt}\", 0, 0) T_CATSTRUCT - if (sv_derived_from($arg, \"${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::$1/; $ntt =~ s/_/::/g; \$ntt}\")) - $var = ($type)SvIV((SV *)SvRV($arg)); - else - croak(\"$var is not of type ${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::$1/; $ntt =~ s/_/::/g; \$ntt}\") + $var = ptrfromsv($arg, \"${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::$1/; $ntt =~ s/_/::/g; \$ntt}\", \"$var\"); T_GALG - if (sv_derived_from($arg, \"${my $ntt = $ntype; $ntt =~ s/^g(.*)Ptr$/Catacomb::\u$1/; \$ntt}\")) - $var = ($type)SvIV((SV *)SvRV($arg)); - else - croak(\"$var is not of type ${my $ntt = $ntype; $ntt =~ s/^g(.*)Ptr$/Catacomb::\u$1/; \$ntt}\") + $var = ptrfromsv($arg, \"${my $ntt = $ntype; $ntt =~ s/^g(.*)Ptr$/Catacomb::\u$1/; \$ntt}\", \"$var\"); T_GCALG - if (sv_derived_from($arg, \"${my $ntt = $ntype; $ntt =~ s/^gc(.*)Ptr$/Catacomb::\u$1Class/; \$ntt}\")) - $var = ($type)SvIV((SV *)SvRV($arg)); - else - croak(\"$var is not of type ${my $ntt = $ntype; $ntt =~ s/^gc(.*)Ptr$/Catacomb::\u$1Class/; \$ntt}\") + $var = ptrfromsv($arg, \"${my $ntt = $ntype; $ntt =~ s/^gc(.*)Ptr$/Catacomb::\u$1Class/; \$ntt}\", \"$var\"); T_KEYSZ - if (sv_derived_from($arg, \"Catacomb::KeySize\")) - $var = (keysize *)SvIV((SV *)SvRV($arg)); - else - croak(\"$var is not of type Catacomb::KeySize\") + $var = ptrfromsv($arg, \"Catacomb::KeySize\", \"$var\"); T_PGENPROC if (sv_derived_from($arg, \"Catacomb::MP::Prime::Gen::Proc\")) $var = $arg; @@ -69,32 +66,16 @@ T_NULLPGENPROC OUTPUT T_MP - if ($var) - sv_setref_pv($arg, \"Catacomb::MP\", (void*)$var); - else - $arg = &PL_sv_undef; + ptrtosv(&$arg, $var, \"${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::\U$1/; $ntt =~ s/_/::/g; \$ntt}\"); T_CATSTRUCT - if ($var) - sv_setref_pv($arg, \"${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::$1/; $ntt =~ s/_/::/g; \$ntt}\", (void *)$var); - else - $arg = &PL_sv_undef; + ptrtosv(&$arg, $var, \"${my $ntt = $ntype; $ntt =~ s/^(.*)Ptr$/Catacomb::$1/; $ntt =~ s/_/::/g; \$ntt}\"); T_GALG - if ($var) - sv_setref_pv($arg, \"${my $ntt = $ntype; $ntt =~ s/^g(.*)Ptr$/Catacomb::\u$1/; \$ntt}\", (void *)$var); - else - $arg = &PL_sv_undef; + ptrtosv(&$arg, $var, \"${my $ntt = $ntype; $ntt =~ s/^g(.*)Ptr$/Catacomb::\u$1/; \$ntt}\"); T_GCALG - if ($var) - sv_setref_pv($arg, \"${my $ntt = $ntype; $ntt =~ s/^gc(.*)Ptr$/Catacomb::\u$1Class/; \$ntt}\", (void *)$var); - else - $arg = &PL_sv_undef; + ptrtosv(&$arg, $var, \"${my $ntt = $ntype; $ntt =~ s/^g(.*)Ptr$/Catacomb::\u$1Class/; \$ntt}\"); T_KEYSZ - if ($var) - sv_setref_pv($arg, \"Catacomb::KeySize\", (void *)$var); - else - $arg = &PL_sv_undef; + ptrtosv(&$arg, (octet *)$var, \"Catacomb::KeySize\"); T_PGENPROC $arg = $var; - T_KEYERR $arg = keyerr($var);