-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypemap
35 lines (30 loc) · 930 Bytes
/
typemap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
TYPEMAP
Parrot_Interp T_PTR
Parrot_PackFile T_PTR
Parrot_String T_PTR
Parrot_PMC T_PTROBJ_PARROT
Parrot_Interp T_PTROBJ_PARROT
Interpreter_struct* T_PTROBJ_PARROT_STRUCT
PMC_struct* T_PTROBJ_PARROT_STRUCT
INPUT
T_PTROBJ_PARROT_STRUCT
if (sv_derived_from($arg, \"${ (my $type = $ntype) =~ s/^(\w+)_struct.*$/Parrot::$1/; \$type}\"))
{
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type Parrot::$ntype\")
T_PTROBJ_PARROT
if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\"))
{
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")
OUTPUT
T_PTROBJ_PARROT
sv_setref_pv($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\", (void*)$var);
T_PTROBJ_PARROT_STRUCT
sv_setref_pv($arg, \"${ (my $type = $ntype) =~ s/^(\w+)_struct.*$/Parrot::$1/; \$type}\", (void*)$var);