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.00'; |
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 |
IDBSSUBSTR |
38 |
IDBSPREFIX |
39 |
IDBSSUFFIX |
40 |
IDBSFULL |
41 |
IDBSTOKEN |
42 |
IDBSTOKPRE |
43 |
IDBSTOKSUF |
44 |
); |
45 |
|
46 |
=head1 NAME |
47 |
|
48 |
Search::TokyoDystopia - XS bindings for Tokyo Dystopia |
49 |
|
50 |
=head1 EXPORTS |
51 |
|
52 |
If you don't prevent it, it will export all kind of stuff into your namespace to cut down on typing. |
53 |
|
54 |
=head2 tcidberrmsg |
55 |
|
56 |
my $message = tcidberrmsg( $ecode ); |
57 |
|
58 |
=head2 tcidbnew |
59 |
|
60 |
my $idb = tcidbnew; |
61 |
|
62 |
=head2 tcidbdel |
63 |
|
64 |
tcidbdel( $idb ); |
65 |
|
66 |
=head2 tcidbecode |
67 |
|
68 |
my $ecode = tcidbecode( $idb ); |
69 |
|
70 |
=head2 tcidbtune |
71 |
|
72 |
my $success = tcidbtune( $idb, $ernum, $etnum, $iusiz, IDBTLARGE | IDBTDEFLATE ); |
73 |
|
74 |
=cut |
75 |
|
76 |
use constant { |
77 |
IDBTLARGE => 1 << 0, |
78 |
IDBTDEFLATE => 1 << 1, |
79 |
IDBTTCBS => 1 << 2, |
80 |
}; |
81 |
|
82 |
=head2 tcidbsetcache |
83 |
|
84 |
my $success = tcidbsetcache( $idb, $icsiz, $lcnum ); |
85 |
|
86 |
=head2 tcidbsetfwmmax |
87 |
|
88 |
my $success = tcidbsetfwmmax( $idb, $fwnum ); |
89 |
|
90 |
=head2 tcidbopen |
91 |
|
92 |
my $success = tcidbopen( $idb, 'casket', IDBOWRITER | IDBOCREAT ); |
93 |
|
94 |
=cut |
95 |
|
96 |
use constant { |
97 |
IDBOREADER => 1 << 0, |
98 |
IDBOWRITER => 1 << 1, |
99 |
IDBOCREAT => 1 << 2, |
100 |
IDBOTRUNC => 1 << 3, |
101 |
IDBONOLCK => 1 << 4, |
102 |
IDBOLCKNB => 1 << 5, |
103 |
}; |
104 |
|
105 |
=head2 tcidbclose |
106 |
|
107 |
my $success = tcidbclose( $idb ); |
108 |
|
109 |
=head2 tcidbput |
110 |
|
111 |
my $success = tcidbput( $idb, $id, $text ); |
112 |
|
113 |
=head2 tcidbout |
114 |
|
115 |
my $success = tcidbout( $idb, $id ); |
116 |
|
117 |
=head2 tcidbget |
118 |
|
119 |
my $text = tcidbget( $idb, $id ); |
120 |
|
121 |
=head2 tcidbsearch |
122 |
|
123 |
my @ids = tcidbsearch( $idb, $word, IDBSSUBSTR ) |
124 |
|
125 |
=cut |
126 |
|
127 |
use constant { |
128 |
IDBSSUBSTR => 0, # substring matching |
129 |
IDBSPREFIX => 1, # prefix matching |
130 |
IDBSSUFFIX => 2, # suffix matching |
131 |
IDBSFULL => 3, # full matching |
132 |
IDBSTOKEN => 4, # token matching |
133 |
IDBSTOKPRE => 5, # token prefix matching |
134 |
IDBSTOKSUF => 6, # token suffix matching |
135 |
}; |
136 |
|
137 |
=head1 KNOWN BUGS |
138 |
|
139 |
Low-level functions often just die when called on invalid (or deleted) database |
140 |
|
141 |
=cut |
142 |
|
143 |
1; |