/[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 42 - (show annotations)
Sat Feb 14 17:56:02 2009 UTC (15 years, 1 month ago) by dpavlin
File size: 7592 byte(s)
fix tcjdbput pod
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 tcjdberrmsg
98 tcjdbnew
99 tcjdbdel
100 tcjdbnew
101 tcjdbecode
102 tcjdbtune
103 JDBTLARGE
104 JDBTDEFLATE
105 JDBTTCBS
106 tcjdbsetcache
107 tcjdbsetfwmmax
108 tcjdbopen
109 JDBOREADER
110 JDBOWRITER
111 JDBOCREAT
112 JDBOTRUNC
113 JDBONOLCK
114 JDBOLCKNB
115 tcjdbclose
116 tcjdbput
117 tcjdbput2
118 tcjdbout
119 tcjdbget
120 tcjdbget2
121 tcjdbsearch
122 tcjdbsearch2
123 JDBSSUBSTR
124 JDBSPREFIX
125 JDBSSUFFIX
126 JDBSFULL
127 tcjdbiterinit
128 tcjdbiternext
129 tcjdbsync
130 tcjdboptimize
131 tcjdbvanish
132 tcjdbcopy
133 tcjdbpath
134 tcjdbrnum
135 tcjdbfsiz
136 );
137
138 =head1 NAME
139
140 Search::TokyoDystopia - XS bindings for Tokyo Dystopia
141
142 =head1 Core API
143
144 If you don't prevent it, it will export all kind of stuff into your namespace to cut down on typing.
145 void
146 tcqdbget(qdb, id)
147 void * qdb
148 int id
149 PREINIT:
150 char *vbuf;
151 PPCODE:
152 vbuf = tcqdbget(qdb, id);
153 if(vbuf){
154 XPUSHs(sv_2mortal(newSVpvn(vbuf, strlen(vbuf))));
155 tcfree(vbuf);
156 } else {
157 XPUSHs((SV *)&PL_sv_undef);
158 }
159 XSRETURN(1);
160
161
162
163 =head2 tcidberrmsg
164
165 my $message = tcidberrmsg( $ecode );
166
167 =head2 tcidbnew
168
169 my $idb = tcidbnew;
170
171 =head2 tcidbdel
172
173 tcidbdel( $idb );
174
175 =head2 tcidbecode
176
177 my $ecode = tcidbecode( $idb );
178
179 =head2 tcidbtune
180
181 my $success = tcidbtune( $idb, $ernum, $etnum, $iusiz, IDBTLARGE | IDBTDEFLATE );
182
183 =cut
184
185 use constant {
186 IDBTLARGE => 1 << 0,
187 IDBTDEFLATE => 1 << 1,
188 IDBTTCBS => 1 << 2,
189 };
190
191 =head2 tcidbsetcache
192
193 my $success = tcidbsetcache( $idb, $icsiz, $lcnum );
194
195 =head2 tcidbsetfwmmax
196
197 my $success = tcidbsetfwmmax( $idb, $fwmax );
198
199 =head2 tcidbopen
200
201 my $success = tcidbopen( $idb, 'casket', IDBOWRITER | IDBOCREAT );
202
203 =cut
204
205 use constant {
206 IDBOREADER => 1 << 0,
207 IDBOWRITER => 1 << 1,
208 IDBOCREAT => 1 << 2,
209 IDBOTRUNC => 1 << 3,
210 IDBONOLCK => 1 << 4,
211 IDBOLCKNB => 1 << 5,
212 };
213
214 =head2 tcidbclose
215
216 my $success = tcidbclose( $idb );
217
218 =head2 tcidbput
219
220 my $success = tcidbput( $idb, $id, $text );
221
222 =head2 tcidbout
223
224 my $success = tcidbout( $idb, $id );
225
226 =head2 tcidbget
227
228 my $text = tcidbget( $idb, $id );
229
230 =head2 tcidbsearch
231
232 my $ids = tcidbsearch( $idb, $word, IDBSSUBSTR );
233
234 =cut
235
236 use constant {
237 IDBSSUBSTR => 0, # substring matching
238 IDBSPREFIX => 1, # prefix matching
239 IDBSSUFFIX => 2, # suffix matching
240 IDBSFULL => 3, # full matching
241 IDBSTOKEN => 4, # token matching
242 IDBSTOKPRE => 5, # token prefix matching
243 IDBSTOKSUF => 6, # token suffix matching
244 };
245
246 =head2 tcidbsearch2
247
248 my $ids = tcidbsearch2( $idb, $expr );
249
250 =head2 tcidbiterinit
251
252 my $success = tcidbiterinit( $idb );
253
254 =head2 tcidbiternext
255
256 my $id = tcidbiternext( $idb );
257
258 =head2 tcidbsync
259
260 my $success = tcidbsync( $idb );
261
262 =head2 tcidboptimize
263
264 my $success = tcidboptimize( $idb );
265
266 =head2 tcidbvanish
267
268 my $success = tcidbvanish( $idb );
269
270 =head2 tcidbcopy
271
272 my $success = tcidbcopy( $idb, '/path/of/copy' );
273
274 =head2 tcidbpath
275
276 my $path = tcidbpath( $idb );
277
278 =head2 tcidbrnum
279
280 my $number_of_records = tcidbrnum( $idb );
281
282 =head2 tcidbfsiz
283
284 my $file_size = tcidbfsiz( $idb );
285
286 =cut
287
288
289 =head1 Q-gram API
290
291 =head2 tcqdberrmsg
292
293 my $message = tcqdberrmsg( $ecode );
294
295 =head2 tcqdbnew
296
297 my $qdb = tcqdbnew;
298
299 =head2 tcqdbdel
300
301 tcqdbdel( $qdb );
302
303 =head2 tcqdbecode
304
305 my $ecode = tcqdbecode( $qdb );
306
307 =head2 tcqdbtune
308
309 my $success = tcqdbtune( $qdb, $etnum, QDBTLARGE | QDBTDEFLATE );
310
311 =cut
312
313 use constant {
314 QDBTLARGE => 1 << 0,
315 QDBTDEFLATE => 1 << 1,
316 QDBTTCBS => 1 << 2,
317 };
318
319 =head2 tcqdbsetcache
320
321 my $success = tcqdbsetcache( $qdb, $icsiz, $lcnum );
322
323 =head2 tcqdbsetfwmmax
324
325 my $success = tcqdbsetfwmmax( $qdb, $fwmax );
326
327 =head2 tcqdbopen
328
329 my $success = tcqdbopen( $qdb, 'casket', QDBOWRITER | QDBOCREAT );
330
331 =cut
332
333 use constant {
334 QDBOREADER => 1 << 0,
335 QDBOWRITER => 1 << 1,
336 QDBOCREAT => 1 << 2,
337 QDBOTRUNC => 1 << 3,
338 QDBONOLCK => 1 << 4,
339 QDBOLCKNB => 1 << 5,
340 };
341
342 =head2 tcqdbclose
343
344 my $success = tcqdbclose( $qdb );
345
346 =head2 tcqdbput
347
348 my $success = tcqdbput( $qdb, $id, $text );
349
350 =head2 tcqdbout
351
352 my $success = tcqdbout( $qdb, $id );
353
354 =head2 tcqdbsearch
355
356 my $ids = tcqdbsearch( $qdb, $word, QDBSSUBSTR );
357
358 =cut
359
360 use constant {
361 QDBSSUBSTR => 0, # substring matching
362 QDBSPREFIX => 1, # prefix matching
363 QDBSUFFIX => 2, # suffix matching
364 QDBFULL => 3, # full matching
365 QDBTOKEN => 4, # token matching
366 QDBTOKPRE => 5, # token prefix matching
367 QDBTOKSUF => 6, # token suffix matching
368 };
369
370 =head2 tcqdbsync
371
372 my $success = tcqdbsync( $qdb );
373
374 =head2 tcqdboptimize
375
376 my $success = tcqdboptimize( $qdb );
377
378 =head2 tcqdbvanish
379
380 my $success = tcqdbvanish( $qdb );
381
382 =head2 tcqdbcopy
383
384 my $success = tcqdbcopy( $qdb, '/path/of/copy' );
385
386 =head2 tcqdbpath
387
388 my $path = tcqdbpath( $qdb );
389
390 =head2 tcqdbtnum
391
392 my $number_of_records = tcqdbtnum( $qdb );
393
394 =head2 tcqdbfsiz
395
396 my $file_size = tcqdbtsiz( $qdb );
397
398
399 =head1 Simple API
400
401 =head2 tcjdberrmsg
402
403 my $message = tcjdberrmsg( $ecode );
404
405 =head2 tcjdbnew
406
407 my $jdb = tcjdbnew;
408
409 =head2 tcjdbdel
410
411 tcjdbdel( $jdb );
412
413 =head2 tcjdbecode
414
415 my $ecode = tcjdbecode( $jdb );
416
417 =head2 tcjdbtune
418
419 my $success = tcjdbtune( $jdb, $ernum, $etnum, $iusiz, JDBTLARGE | JDBTDEFLATE );
420
421 =cut
422
423 use constant {
424 JDBTLARGE => 1 << 0,
425 JDBTDEFLATE => 1 << 1,
426 JDBTTCBS => 1 << 2,
427 };
428
429 =head2 tcjdbsetcache
430
431 my $success = tcjdbsetcache( $jdb, $icsiz, $lcnum );
432
433 =head2 tcjdbsetfwmmax
434
435 my $success = tcjdbsetfwmmax( $jdb, $fwmax );
436
437 =head2 tcjdbopen
438
439 my $success = tcjdbopen( $jdb, 'casket', JDBOWRITER | JDBOCREAT );
440
441 =cut
442
443 use constant {
444 JDBOREADER => 1 << 0,
445 JDBOWRITER => 1 << 1,
446 JDBOCREAT => 1 << 2,
447 JDBOTRUNC => 1 << 3,
448 JDBONOLCK => 1 << 4,
449 JDBOLCKNB => 1 << 5,
450 };
451
452 =head2 tcjdbclose
453
454 my $success = tcjdbclose( $jdb );
455
456 =head2 tcjdbput
457
458 my $success = tcjdbput( $jdb, $id, [ 'word', 'word2' ] );
459
460 =head2 tcjdbput2
461
462 my $success = tcjdbput2( $jdb, $id, $text );
463
464 =head2 tcjdbout
465
466 my $success = tcjdbout( $jdb, $id );
467
468 =head2 tcjdbsearch
469
470 my $ids = tcjdbsearch( $jdb, $word, JDBSSUBSTR );
471
472 =head2 tcjdbsearch2
473
474 my $ids = tcjdbsearch2( $jdb, $word );
475
476 =cut
477
478 use constant {
479 JDBSSUBSTR => 0, # substring matching
480 JDBSPREFIX => 1, # prefix matching
481 JDBSSUFFIX => 2, # suffix matching
482 JDBSFULL => 3, # full matching
483 };
484
485 =head2 tcjdbsync
486
487 my $success = tcjdbsync( $jdb );
488
489 =head2 tcjdboptimize
490
491 my $success = tcjdboptimize( $jdb );
492
493 =head2 tcjdbvanish
494
495 my $success = tcjdbvanish( $jdb );
496
497 =head2 tcjdbcopy
498
499 my $success = tcjdbcopy( $jdb, '/path/of/copy' );
500
501 =head2 tcjdbpath
502
503 my $path = tcjdbpath( $jdb );
504
505 =head2 tcjdbrnum
506
507 my $number_of_records = tcjdbrnum( $jdb );
508
509 =head2 tcjdbfsiz
510
511 my $file_size = tcjdbtsiz( $jdb );
512
513 =cut
514
515 =head1 KNOWN BUGS
516
517 Low-level functions often just die when called on invalid (or deleted) database
518
519 =cut
520
521 1;

  ViewVC Help
Powered by ViewVC 1.1.26