forked from salortiz/LMDB_File
-
Notifications
You must be signed in to change notification settings - Fork 0
/
typemap
75 lines (71 loc) · 1.87 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
TYPEMAP
LMDB::Env T_PTROBJ
LMDB::Txn T_PTROBJ
TxnOrNull T_PTROBJ_N
LMDB::Cursor T_PTROBJ
#LMDB T_OPAQUE
LMDB T_UV
DBD T_datum
DBK T_keydatum
DBKC T_keydatumC
MDB_cursor_op T_IV
mdb_filehandle_t T_FD
HV * T_HVREF_REFCOUNT_FIXED
# Type to avoid warnings when a flag is undefined
flags_t T_UV_N
INPUT
T_datum
Sv2DBD($arg, $var);
T_keydatum
if (ISDBKINT) {
SvIV_please($arg);
$var.mv_data = &(((XPVIV*)SvANY($arg))->xiv_iv);
$var.mv_size = sizeof(MyInt);
}
else $var.mv_data = SvPV($arg, $var.mv_size);
T_keydatumC
if (ISDBKINT) {
if(SvOK($arg)) {
SvIV_please($arg);
$var.mv_data = &(((XPVIV*)SvANY($arg))->xiv_iv);
} else $var.mv_data = (MyInt *)\"\\0\\0\\0\\0\\0\\0\\0\\0\";
$var.mv_size = sizeof(MyInt);
}
else if(SvOK($arg)) $var.mv_data = SvPV($arg, $var.mv_size);
T_FD
$var = PerlIO_fileno(IoOFP(sv_2io($arg)));
T_PTROBJ_N
if(!SvTRUE($arg)) {
$var = ($type) NULL;
} else if (SvROK($arg) && sv_derived_from($arg, \"LMDB::Txn\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"%s: %s is not of type %s\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"LMDB::Txn\");
T_UV_N
$var = SvOK($arg) ? ($type)SvUV($arg) : 0;
####################################################################################
OUTPUT
T_datum
sv_setstatic(aTHX_ aMY_CXT_ $arg, &$var, 0);
T_keydatum
if(ISDBKINT) {
sv_setiv_mg($arg, *(MyInt *)$var.mv_data);
} else {
sv_setpvn_mg($arg, $var.mv_data, $var.mv_size);
SvUTF8_off($arg);
}
T_keydatumC
if(op != MDB_SET) {
if(ISDBKINT) {
sv_setiv_mg($arg, *(MyInt *)$var.mv_data);
} else {
sv_setpvn_mg($arg, $var.mv_data, $var.mv_size);
SvUTF8_off($arg);
}
}
T_HVREF_REFCOUNT_FIXED
$arg = newRV_noinc((SV*)$var);