/[Search-TokyoDystopia]/lib/Search/TokyoDystopia.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/Search/TokyoDystopia.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Tue Sep 9 13:17:16 2008 UTC (15 years, 6 months ago) by dpavlin
File size: 5385 byte(s)
fix tcqdbtnum
1 package Search::TokyoDystopia;
2
3 use strict;
4 use warnings;
5
6 require Exporter;
7 require XSLoader;
8 use base qw(Exporter);
9 our $VERSION = '0.01';
10 our $debug = 0;
11 XSLoader::load('Search::TokyoDystopia', $VERSION);
12
13 our @EXPORT = qw(
14 tcidberrmsg
15 tcidbnew
16 tcidbdel
17 tcidbnew
18 tcidbecode
19 tcidbtune
20 IDBTLARGE
21 IDBTDEFLATE
22 IDBTTCBS
23 tcidbsetcache
24 tcidbsetfwmmax
25 tcidbopen
26 IDBOREADER
27 IDBOWRITER
28 IDBOCREAT
29 IDBOTRUNC
30 IDBONOLCK
31 IDBOLCKNB
32 tcidbclose
33 tcidbput
34 tcidbout
35 tcidbget
36 tcidbsearch
37 tcidbsearch2
38 IDBSSUBSTR
39 IDBSPREFIX
40 IDBSSUFFIX
41 IDBSFULL
42 IDBSTOKEN
43 IDBSTOKPRE
44 IDBSTOKSUF
45 tcidbiterinit
46 tcidbiternext
47 tcidbsync
48 tcidboptimize
49 tcidbvanish
50 tcidbcopy
51 tcidbpath
52 tcidbrnum
53 tcidbfsiz
54
55 tdversion
56 tcqdberrmsg
57 tcqdbnew
58 tcqdbdel
59 tcqdbnew
60 tcqdbecode
61 tcqdbtune
62 QDBTLARGE
63 QDBTDEFLATE
64 QDBTTCBS
65 tcqdbsetcache
66 tcqdbsetfwmmax
67 tcqdbopen
68 QDBOREADER
69 QDBOWRITER
70 QDBOCREAT
71 QDBOTRUNC
72 QDBONOLCK
73 QDBOLCKNB
74 tcqdbclose
75 tcqdbput
76 tcqdbout
77 tcqdbget
78 tcqdbsearch
79 tcqdbsearch2
80 QDBSSUBSTR
81 QDBSPREFIX
82 QDBSSUFFIX
83 QDBSFULL
84 QDBSTOKEN
85 QDBSTOKPRE
86 QDBSTOKSUF
87 tcqdbiterinit
88 tcqdbiternext
89 tcqdbsync
90 tcqdboptimize
91 tcqdbvanish
92 tcqdbcopy
93 tcqdbpath
94 tcqdbtnum
95 tcqdbfsiz
96
97 );
98
99 =head1 NAME
100
101 Search::TokyoDystopia - XS bindings for Tokyo Dystopia
102
103 =head1 Core API
104
105 If you don't prevent it, it will export all kind of stuff into your namespace to cut down on typing.
106 void
107 tcqdbget(qdb, id)
108 void * qdb
109 int id
110 PREINIT:
111 char *vbuf;
112 PPCODE:
113 vbuf = tcqdbget(qdb, id);
114 if(vbuf){
115 XPUSHs(sv_2mortal(newSVpvn(vbuf, strlen(vbuf))));
116 tcfree(vbuf);
117 } else {
118 XPUSHs((SV *)&PL_sv_undef);
119 }
120 XSRETURN(1);
121
122
123
124 =head2 tcidberrmsg
125
126 my $message = tcidberrmsg( $ecode );
127
128 =head2 tcidbnew
129
130 my $idb = tcidbnew;
131
132 =head2 tcidbdel
133
134 tcidbdel( $idb );
135
136 =head2 tcidbecode
137
138 my $ecode = tcidbecode( $idb );
139
140 =head2 tcidbtune
141
142 my $success = tcidbtune( $idb, $ernum, $etnum, $iusiz, IDBTLARGE | IDBTDEFLATE );
143
144 =cut
145
146 use constant {
147 IDBTLARGE => 1 << 0,
148 IDBTDEFLATE => 1 << 1,
149 IDBTTCBS => 1 << 2,
150 };
151
152 =head2 tcidbsetcache
153
154 my $success = tcidbsetcache( $idb, $icsiz, $lcnum );
155
156 =head2 tcidbsetfwmmax
157
158 my $success = tcidbsetfwmmax( $idb, $fwnum );
159
160 =head2 tcidbopen
161
162 my $success = tcidbopen( $idb, 'casket', IDBOWRITER | IDBOCREAT );
163
164 =cut
165
166 use constant {
167 IDBOREADER => 1 << 0,
168 IDBOWRITER => 1 << 1,
169 IDBOCREAT => 1 << 2,
170 IDBOTRUNC => 1 << 3,
171 IDBONOLCK => 1 << 4,
172 IDBOLCKNB => 1 << 5,
173 };
174
175 =head2 tcidbclose
176
177 my $success = tcidbclose( $idb );
178
179 =head2 tcidbput
180
181 my $success = tcidbput( $idb, $id, $text );
182
183 =head2 tcidbout
184
185 my $success = tcidbout( $idb, $id );
186
187 =head2 tcidbget
188
189 my $text = tcidbget( $idb, $id );
190
191 =head2 tcidbsearch
192
193 my $ids = tcidbsearch( $idb, $word, IDBSSUBSTR );
194
195 =cut
196
197 use constant {
198 IDBSSUBSTR => 0, # substring matching
199 IDBSPREFIX => 1, # prefix matching
200 IDBSSUFFIX => 2, # suffix matching
201 IDBSFULL => 3, # full matching
202 IDBSTOKEN => 4, # token matching
203 IDBSTOKPRE => 5, # token prefix matching
204 IDBSTOKSUF => 6, # token suffix matching
205 };
206
207 =head2 tcidbsearch2
208
209 my $ids = tcidbsearch2( $idb, $expr );
210
211 =head2 tcidbiterinit
212
213 my $success = tcidbiterinit( $idb );
214
215 =head2 tcidbiternext
216
217 my $id = tcidbiternext( $idb );
218
219 =head2 tcidbsync
220
221 my $success = tcidbsync( $idb );
222
223 =head2 tcidboptimize
224
225 my $success = tcidboptimize( $idb );
226
227 =head2 tcidbvanish
228
229 my $success = tcidbvanish( $idb );
230
231 =head2 tcidbcopy
232
233 my $success = tcidbcopy( $idb, '/path/of/copy' );
234
235 =head2 tcidbpath
236
237 my $path = tcidbpath( $idb );
238
239 =head2 tcidbrnum
240
241 my $number_of_records = tcidbrnum( $idb );
242
243 =head2 tcidbfsiz
244
245 my $file_size = tcidbfsiz( $idb );
246
247 =cut
248
249 =head1 Q-gram API
250
251 =head2 tcqdberrmsg
252
253 my $message = tcqdberrmsg( $ecode );
254
255 =head2 tcqdbnew
256
257 my $qdb = tcqdbnew;
258
259 =head2 tcqdbdel
260
261 tcqdbdel( $qdb );
262
263 =head2 tcqdbecode
264
265 my $ecode = tcqdbecode( $qdb );
266
267 =head2 tcqdbtune
268
269 my $success = tcqdbtune( $qdb, $etnum, QDBTLARGE | QDBTDEFLATE );
270
271 =cut
272
273 use constant {
274 QDBTLARGE => 1 << 0,
275 QDBTDEFLATE => 1 << 1,
276 QDBTTCBS => 1 << 2,
277 };
278
279 =head2 tcqdbsetcache
280
281 my $success = tcqdbsetcache( $qdb, $icsiz, $lcnum );
282
283 =head2 tcqdbsetfwmmax
284
285 my $success = tcqdbsetfwmmax( $qdb, $fwnum );
286
287 =head2 tcqdbopen
288
289 my $success = tcqdbopen( $qdb, 'casket', QDBOWRITER | QDBOCREAT );
290
291 =cut
292
293 use constant {
294 QDBOREADER => 1 << 0,
295 QDBOWRITER => 1 << 1,
296 QDBOCREAT => 1 << 2,
297 QDBOTRUNC => 1 << 3,
298 QDBONOLCK => 1 << 4,
299 QDBOLCKNB => 1 << 5,
300 };
301
302 =head2 tcqdbclose
303
304 my $success = tcqdbclose( $qdb );
305
306 =head2 tcqdbput
307
308 my $success = tcqdbput( $qdb, $id, $text );
309
310 =head2 tcqdbout
311
312 my $success = tcqdbout( $qdb, $id );
313
314 =head2 tcqdbsearch
315
316 my $ids = tcqdbsearch( $qdb, $word, QDBSSUBSTR );
317
318 =cut
319
320 use constant {
321 QDBSSUBSTR => 0, # substring matching
322 QDBSPREFIX => 1, # prefix matching
323 QDBSUFFIX => 2, # suffix matching
324 QDBFULL => 3, # full matching
325 QDBTOKEN => 4, # token matching
326 QDBTOKPRE => 5, # token prefix matching
327 QDBTOKSUF => 6, # token suffix matching
328 };
329
330 =head2 tcqdbsync
331
332 my $success = tcqdbsync( $qdb );
333
334 =head2 tcqdboptimize
335
336 my $success = tcqdboptimize( $qdb );
337
338 =head2 tcqdbvanish
339
340 my $success = tcqdbvanish( $qdb );
341
342 =head2 tcqdbcopy
343
344 my $success = tcqdbcopy( $qdb, '/path/of/copy' );
345
346 =head2 tcqdbpath
347
348 my $path = tcqdbpath( $qdb );
349
350 =head2 tcqdbtnum
351
352 my $number_of_records = tcqdbtnum( $qdb );
353
354 =head2 tcqdbfsiz
355
356 my $file_size = tcqdbtsiz( $qdb );
357
358 =cut
359
360 =head1 KNOWN BUGS
361
362 Low-level functions often just die when called on invalid (or deleted) database
363
364 =cut
365
366 1;

  ViewVC Help
Powered by ViewVC 1.1.26