1 /*************************************************************************************************
2  * Depot.c
3  *                                                      Copyright (C) 2000-2005 Mikio Hirabayashi
4  * This file is part of QDBM, Quick Database Manager.
5  * QDBM is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * Lesser General Public License as published by the Free Software Foundation; either version
7  * 2.1 of the License or any later version.  QDBM is distributed in the hope that it will be
8  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
10  * details.
11  * You should have received a copy of the GNU Lesser General Public License along with QDBM; if
12  * not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
13  * 02111-1307 USA.
14  *************************************************************************************************/
15 
16 
17 #include "EXTERN.h"
18 #include "perl.h"
19 #include "XSUB.h"
20 #include <depot.h>
21 #include <stdlib.h>
22 
23 
24 MODULE = Depot		PACKAGE = Depot
25 PROTOTYPES: DISABLE
26 
27 
28 
29 ##================================================================================================
30 ## public objects
31 ##================================================================================================
32 
33 
34 const char *
35 pldperrmsg()
36 CODE:
37 	RETVAL = dperrmsg(dpecode);
38 OUTPUT:
39 	RETVAL
40 
41 
42 void *
43 pldpopen(name, omode, bnum)
44 	char *	name
45 	int 	omode
46 	int 	bnum
47 CODE:
48 	RETVAL = dpopen(name, omode, bnum);
49 OUTPUT:
50 	RETVAL
51 
52 
53 int
54 pldpclose(depot)
55 	void *depot
56 CODE:
57 	RETVAL = dpclose(depot);
58 OUTPUT:
59 	RETVAL
60 
61 
62 int
63 pldpput(depot, kbuf, ksiz, vbuf, vsiz, dmode)
64 	void *	depot
65 	char *	kbuf
66 	int	ksiz
67 	char *	vbuf
68 	int	vsiz
69 	int	dmode
70 CODE:
71 	RETVAL = dpput(depot, kbuf, ksiz, vbuf, vsiz, dmode);
72 OUTPUT:
73 	RETVAL
74 
75 
76 int
77 pldpout(depot, kbuf, ksiz)
78 	void *	depot
79 	char *	kbuf
80 	int	ksiz
81 CODE:
82 	RETVAL = dpout(depot, kbuf, ksiz);
83 OUTPUT:
84 	RETVAL
85 
86 
87 void
88 pldpget(depot, kbuf, ksiz, start, max)
89 	void *	depot
90 	char *	kbuf
91 	int	ksiz
92 	int	start
93 	int	max
94 PREINIT:
95 	char *vbuf;
96 	int vsiz;
97 PPCODE:
98 	vbuf = dpget(depot, kbuf, ksiz, start, max, &vsiz);
99 	if(!vbuf) XSRETURN_UNDEF;
100 	XPUSHs(sv_2mortal(newSVpv(vbuf, vsiz)));
101 	free(vbuf);
102 	XSRETURN(1);
103 
104 
105 int
106 pldpvsiz(depot, kbuf, ksiz)
107 	void *	depot
108 	char *	kbuf
109 	int	ksiz
110 CODE:
111 	RETVAL = dpvsiz(depot, kbuf, ksiz);
112 OUTPUT:
113 	RETVAL
114 
115 
116 int
117 pldpiterinit(depot)
118 	void *	depot
119 CODE:
120 	RETVAL = dpiterinit(depot);
121 OUTPUT:
122 	RETVAL
123 
124 
125 void
126 pldpiternext(depot)
127 	void *	depot
128 PREINIT:
129 	char *kbuf;
130 	int ksiz;
131 PPCODE:
132 	kbuf = dpiternext(depot, &ksiz);
133 	if(!kbuf) XSRETURN_UNDEF;
134 	XPUSHs(sv_2mortal(newSVpv(kbuf, ksiz)));
135 	free(kbuf);
136 	XSRETURN(1);
137 
138 
139 int
140 pldpsetalign(depot, align)
141 	void *	depot
142 	int	align
143 CODE:
144 	RETVAL = dpsetalign(depot, align);
145 OUTPUT:
146 	RETVAL
147 
148 
149 int
150 pldpsetfbpsiz(depot, size)
151 	void *	depot
152 	int	size
153 CODE:
154 	RETVAL = dpsetfbpsiz(depot, size);
155 OUTPUT:
156 	RETVAL
157 
158 
159 int
160 pldpsync(depot)
161 	void *	depot
162 CODE:
163 	RETVAL = dpsync(depot);
164 OUTPUT:
165 	RETVAL
166 
167 
168 int
169 pldpoptimize(depot, bnum)
170 	void *	depot
171 	int	bnum
172 CODE:
173 	RETVAL = dpoptimize(depot, bnum);
174 OUTPUT:
175 	RETVAL
176 
177 
178 int
179 pldpfsiz(depot)
180 	void *	depot
181 CODE:
182 	RETVAL = dpfsiz(depot);
183 OUTPUT:
184 	RETVAL
185 
186 
187 int
188 pldpbnum(depot)
189 	void *	depot
190 CODE:
191 	RETVAL = dpbnum(depot);
192 OUTPUT:
193 	RETVAL
194 
195 
196 int
197 pldprnum(depot)
198 	void *	depot
199 CODE:
200 	RETVAL = dprnum(depot);
201 OUTPUT:
202 	RETVAL
203 
204 
205 int
206 pldpwritable(depot)
207 	void *	depot
208 CODE:
209 	RETVAL = dpwritable(depot);
210 OUTPUT:
211 	RETVAL
212 
213 
214 int
215 pldpfatalerror(depot)
216 	void *	depot
217 CODE:
218 	RETVAL = dpfatalerror(depot);
219 OUTPUT:
220 	RETVAL
221 
222 
223 
224 ## END OF FILE
225