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