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
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
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;
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);