-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypemap
437 lines (386 loc) · 10 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# typemap for Perl 5 interface to Berkeley DB version 2 & 3
#
# SCCS: %I%, %G%
#
# written by Paul Marquess <pmqs@cpan.org>
#
#################################### DB SECTION
#
#
SVnull* T_SV_NULL
void * T_PV
db_seq_t T_PV_64
u_int T_U_INT
u_int32_t T_U_INT
int32_t T_U_INT
db_off_t T_INT
db_timeout_t T_U_INT
const char * T_PV_NULL
PV_or_NULL T_PV_NULL
IO_or_NULL T_IO_NULL
AV * T_AV
BerkeleyDB T_PTROBJ
BerkeleyDB::Common T_PTROBJ_AV
BerkeleyDB::Hash T_PTROBJ_AV
BerkeleyDB::Btree T_PTROBJ_AV
BerkeleyDB::Heap T_PTROBJ_AV
BerkeleyDB::Recno T_PTROBJ_AV
BerkeleyDB::Queue T_PTROBJ_AV
BerkeleyDB::Cursor T_PTROBJ_AV
BerkeleyDB::DbStream T_PTROBJ_AV
BerkeleyDB::TxnMgr T_PTROBJ_AV
BerkeleyDB::Txn T_PTROBJ_AV
BerkeleyDB::Log T_PTROBJ_AV
BerkeleyDB::Lock T_PTROBJ_AV
BerkeleyDB::Env T_PTROBJ_AV
BerkeleyDB::Sequence T_PTROBJ_NULL
BerkeleyDB::Raw T_RAW
BerkeleyDB::Common::Raw T_RAW
BerkeleyDB::Hash::Raw T_RAW
BerkeleyDB::Btree::Raw T_RAW
BerkeleyDB::Heap::Raw T_RAW
BerkeleyDB::Recno::Raw T_RAW
BerkeleyDB::Queue::Raw T_RAW
BerkeleyDB::Cursor::Raw T_RAW
BerkeleyDB::DbStream::Raw T_RAW
BerkeleyDB::TxnMgr::Raw T_RAW
BerkeleyDB::Txn::Raw T_RAW
BerkeleyDB::Log::Raw T_RAW
BerkeleyDB::Lock::Raw T_RAW
BerkeleyDB::Env::Raw T_RAW
BerkeleyDB::Env::Inner T_INNER
BerkeleyDB::Common::Inner T_INNER
BerkeleyDB::Txn::Inner T_INNER
BerkeleyDB::TxnMgr::Inner T_INNER
# BerkeleyDB__Env T_PTR
DBT T_dbtdatum
DBT_OPT T_dbtdatum_opt
DBT_B T_dbtdatum_btree
DBT_Blob T_dbtdatum_blob
DBTKEY T_dbtkeydatum
DBTKEY_B T_dbtkeydatum_btree
DBTKEY_B4Blob T_dbtkeydatum_btree_for_blob
DBTKEY_Br T_dbtkeydatum_btree_r
DBTKEY_Bpr T_dbtkeydatum_btree_pr
DBTKEY_seq T_dbtkeydatum_seq
DBTYPE T_U_INT
DualType T_DUAL
BerkeleyDB_type * T_IV
BerkeleyDB_ENV_type * T_IV
BerkeleyDB_TxnMgr_type * T_IV
BerkeleyDB_Txn_type * T_IV
BerkeleyDB__Cursor_type * T_IV
BerkeleyDB__DbStream_type * T_IV
DB * T_IV
DB_ENV * T_IV
INPUT
T_AV
if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV)
/* if (sv_isa($arg, \"${ntype}\")) */
$var = (AV*)SvRV($arg);
else
croak(\"$var is not an array reference\")
T_RAW
$var = INT2PTR($type,SvIV($arg)
T_U_INT
$var = SvUV($arg)
T_INT
$var = SvIV($arg)
T_SV_REF_NULL
if ($arg == &PL_sv_undef)
$var = NULL ;
else if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV *)GetInternalObject($arg));
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_SV_NULL
if ($arg == NULL || $arg == &PL_sv_undef)
$var = NULL ;
else
$var = $arg ;
T_HV_REF_NULL
if ($arg == &PL_sv_undef)
$var = NULL ;
else if (sv_derived_from($arg, \"${ntype}\")) {
HV * hv = (HV *)GetInternalObject($arg);
SV ** svp = hv_fetch(hv, \"db\", 2, FALSE);
IV tmp = SvIV(*svp);
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_HV_REF
if (sv_derived_from($arg, \"${ntype}\")) {
HV * hv = (HV *)GetInternalObject($arg);
SV ** svp = hv_fetch(hv, \"db\", 2, FALSE);
IV tmp = SvIV(*svp);
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_P_REF
if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_INNER
{
HV * hv = (HV *)SvRV($arg);
SV ** svp = hv_fetch(hv, \"db\", 2, FALSE);
IV tmp = SvIV(*svp);
$var = INT2PTR($type, tmp);
}
T_PV_NULL
if ($arg == &PL_sv_undef)
$var = NULL ;
else {
STRLEN len;
$var = ($type)SvPV($arg,len) ;
if (len == 0)
$var = NULL ;
}
T_PV_64
if ($arg == &PL_sv_undef)
$var = 0 ;
else {
STRLEN len;
$var = ($type)SvPV($arg,len) ;
if (len == 0)
$var = NULL ;
}
T_IO_NULL
if ($arg == &PL_sv_undef)
$var = NULL ;
else
$var = IoOFP(sv_2io($arg))
T_PTROBJ_NULL
if ($arg == &PL_sv_undef)
$var = NULL ;
else if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_PTROBJ_SELF
if ($arg == &PL_sv_undef)
$var = NULL ;
else if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_PTROBJ_AV
if ($arg == &PL_sv_undef || $arg == NULL)
$var = NULL ;
else if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV(getInnerObject($arg)) ;
$var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${ntype}\")
T_dbtkeydatum
if (! isHeapDb(db))
{
SV* my_sv = $arg ;
DBM_ckFilter(my_sv, filter_store_key, \"filter_store_key\");
DBT_clear($var) ;
SvGETMAGIC($arg) ;
if (db->recno_or_queue) {
Value = GetRecnoKey(db, SvIV(my_sv)) ;
$var.data = & Value;
$var.size = (int)sizeof(db_recno_t);
}
else {
STRLEN len;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
}
}
else
{
SvGETMAGIC($arg) ;
SvUPGRADE($arg, SVt_PV); SvOOK_off($arg); SvPOK_only($arg);
/* SvPOK_only($arg); */
SvGROW($arg, DB_HEAP_RID_SZ);
DBT_clear($var) ;
$var.data = SvPVX($arg);
$var.size = DB_HEAP_RID_SZ;
}
T_dbtkeydatum_seq
InputKey_seq($arg, $var)
T_dbtkeydatum_btree
{
SV* my_sv = $arg ;
if (! isHeapDb(db))
DBM_ckFilter(my_sv, filter_store_key, \"filter_store_key\");
DBT_clear($var) ;
SvGETMAGIC($arg) ;
if (db->recno_or_queue ||
(db->type == DB_BTREE && flagSet(DB_SET_RECNO))) {
Value = GetRecnoKey(db, SvIV(my_sv)) ;
$var.data = & Value;
$var.size = (int)sizeof(db_recno_t);
}
else {
STRLEN len;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
}
}
T_dbtkeydatum_btree_for_blob
{
SV* my_sv = $arg ;
if (! isHeapDb(db))
DBM_ckFilter(my_sv, filter_store_key, \"filter_store_key\");
DBT_clear($var) ;
SvGETMAGIC($arg) ;
STRLEN len;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
}
T_dbtdatum_blob
{
SV* my_sv = $arg ;
DBT_clear($var) ;
SvGETMAGIC($arg) ;
STRLEN len;
SvUPGRADE($arg, SVt_PV); SvOOK_off($arg); SvPOK_only($arg);
$var.data = SvPVbyte_force(my_sv, len);
$var.ulen = (int)len;
$var.flags = DB_DBT_APPMALLOC | DB_DBT_USERMEM;
}
T_dbtkeydatum_btree_r
{
SV* my_sv = $arg ;
DBM_ckFilter(my_sv, filter_store_key, \"filter_store_key\");
DBT_clear($var) ;
SvGETMAGIC($arg) ;
if (db->recno_or_queue ||
(db->type == DB_BTREE && flagSet(DB_SET_RECNO))) {
Value = GetRecnoKey(db, SvIV(my_sv)) ;
$var.data = & Value;
$var.size = (int)sizeof(db_recno_t);
}
else {
STRLEN len;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
}
}
T_dbtkeydatum_btree_pr
{
if(flagSet(DB_GET_BOTH))
{
SV* my_sv = $arg ;
DBM_ckFilter(my_sv, filter_store_key, \"filter_store_key\");
DBT_clear($var) ;
SvGETMAGIC($arg) ;
if (db->recno_or_queue ||
(db->type == DB_BTREE && flagSet(DB_SET_RECNO))) {
Value = GetRecnoKey(db, SvIV(my_sv)) ;
$var.data = & Value;
$var.size = (int)sizeof(db_recno_t);
}
else {
STRLEN len;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
}
}
else
{
DBT_clear($var) ;
}
}
T_dbtdatum
{
SV* my_sv = $arg ;
STRLEN len;
DBM_ckFilter(my_sv, filter_store_value, \"filter_store_value\");
DBT_clear($var) ;
SvGETMAGIC($arg) ;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
$var.flags = db->partial ;
$var.dlen = db->dlen ;
$var.doff = db->doff ;
}
T_dbtdatum_opt
DBT_clear($var) ;
if (flagSetBoth()) {
SV* my_sv = $arg ;
STRLEN len;
DBM_ckFilter(my_sv, filter_store_value, \"filter_store_value\");
SvGETMAGIC($arg) ;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
$var.flags = db->partial ;
$var.dlen = db->dlen ;
$var.doff = db->doff ;
}
T_dbtdatum_btree
DBT_clear($var) ;
if (flagSetBoth()) {
SV* my_sv = $arg ;
STRLEN len;
DBM_ckFilter(my_sv, filter_store_value, \"filter_store_value\");
SvGETMAGIC($arg) ;
$var.data = SvPV(my_sv, len);
$var.size = (int)len;
$var.flags = db->partial ;
$var.dlen = db->dlen ;
$var.doff = db->doff ;
}
OUTPUT
T_SV_NULL
$arg = $var;
T_RAW
sv_setiv($arg, PTR2IV($var));
T_SV_REF_NULL
sv_setiv($arg, PTR2IV($var));
T_HV_REF_NULL
sv_setiv($arg, PTR2IV($var));
T_HV_REF
sv_setiv($arg, PTR2IV($var));
T_P_REF
sv_setiv($arg, PTR2IV($var));
T_DUAL
setDUALerrno($arg, $var) ;
T_U_INT
sv_setuv($arg, (UV)$var);
T_INT
sv_setiv($arg, (UV)$var);
T_PV_NULL
sv_setpv((SV*)$arg, $var);
T_PV_64
sv_setpvn((SV*)$arg, (char*)&$var, sizeof(db_seq_t));
T_dbtkeydatum_btree
OutputKey_B($arg, $var)
T_dbtkeydatum_btree_for_blob
OutputKeyBlob($arg, $var)
T_dbtkeydatum_btree_r
OutputKey_Br($arg, $var)
T_dbtkeydatum_btree_pr
OutputKey_Bpr($arg, $var)
T_dbtkeydatum_seq
OutputKey_seq($arg, $var)
T_dbtkeydatum
OutputKey($arg, $var)
T_dbtdatum
OutputValue($arg, $var)
T_dbtdatum_blob
OutputValue($arg, $var)
T_dbtdatum_opt
OutputValue($arg, $var)
T_dbtdatum_btree
OutputValue_B($arg, $var)
T_PTROBJ_NULL
sv_setref_pv($arg, \"${ntype}\", (void*)$var);
T_PTROBJ_SELF
sv_setref_pv($arg, self, (void*)$var);