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