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