-
Notifications
You must be signed in to change notification settings - Fork 1
/
typemap
58 lines (50 loc) · 1.3 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
TYPEMAP
SDL_Overlay * O_OBJECT_SDL
SDL_Rect * O_OBJECT_SDL
AVFrame * O_OBJECT
OUTPUT
O_OBJECT
if ($var) {
void** pointers = malloc(1 * sizeof(void*));
pointers[0] = (void*)$var;
$arg = newSVpv( (void*)pointers, 1 );
}
else {
XSRETURN_UNDEF;
}
O_OBJECT_SDL
if ($var) {
void** pointers = malloc(3 * sizeof(void*));
pointers[0] = (void*)$var;
pointers[1] = (void*)PERL_GET_CONTEXT;
Uint32 *threadid = (Uint32 *)safemalloc(sizeof(Uint32));
*threadid = SDL_ThreadID();
pointers[2] = (void*)threadid;
sv_setref_pv( $arg, CLASS, (void*)pointers );
}
else {
XSRETURN_UNDEF;
}
INPUT
O_OBJECT
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
void** pointers = (void**)INT2PTR(void *, SvIV((SV *)SvRV( $arg )));
$var = ($type)(pointers[0]);
}
else if ($arg == 0) {
XSRETURN(0);
}
else {
XSRETURN_UNDEF;
}
O_OBJECT_SDL
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
void** pointers = (void**)INT2PTR(void *, SvIV((SV *)SvRV( $arg )));
$var = ($type)(pointers[0]);
}
else if ($arg == 0) {
XSRETURN(0);
}
else {
XSRETURN_UNDEF;
}