This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
User pragmas now accessible from B
[perl5.git] / ext / DB_File / typemap
1 # typemap for Perl 5 interface to Berkeley 
2 #
3 # written by Paul Marquess <Paul.Marquess@btinternet.com>
4 # last modified 20th June 2004
5 # version 1.809
6 #
7 #################################### DB SECTION
8 #
9
10
11 u_int                   T_U_INT
12 DB_File                 T_PTROBJ
13 DBT                     T_dbtdatum
14 DBTKEY                  T_dbtkeydatum
15
16 INPUT
17 T_dbtkeydatum
18     {
19         SV * my_sv = $arg;
20         DBM_ckFilter(my_sv, filter_store_key, \"filter_store_key\");
21         DBT_clear($var) ;
22         SvGETMAGIC(my_sv) ;
23         if (db->type == DB_RECNO) {
24             if (SvOK(my_sv))
25                 Value = GetRecnoKey(aTHX_ db, SvIV(my_sv)) ; 
26             else
27                 Value = 1 ;
28             $var.data = & Value; 
29             $var.size = (int)sizeof(recno_t);
30         }
31         else if (SvOK(my_sv)) {
32             $var.data = SvPVbyte(my_sv, PL_na);
33             $var.size = (int)PL_na;
34         }
35     }
36 T_dbtdatum
37     {
38         SV * my_sv = $arg;
39         DBM_ckFilter(my_sv, filter_store_value, \"filter_store_value\");
40         DBT_clear($var) ;
41         SvGETMAGIC(my_sv) ;
42         if (SvOK(my_sv)) {
43             $var.data = SvPVbyte(my_sv, PL_na);
44             $var.size = (int)PL_na;
45         }
46     }
47
48 OUTPUT
49
50 T_dbtkeydatum
51         OutputKey($arg, $var)
52 T_dbtdatum
53         OutputValue($arg, $var)
54 T_PTROBJ
55         sv_setref_pv($arg, dbtype, (void*)$var);