--- lib/Search/TokyoDystopia.pm 2008/08/17 22:17:40 1 +++ lib/Search/TokyoDystopia.pm 2008/08/18 18:28:05 18 @@ -10,13 +10,134 @@ our $debug = 0; XSLoader::load('Search::TokyoDystopia', $VERSION); +our @EXPORT = qw( +tcidberrmsg +tcidbnew +tcidbdel +tcidbnew +tcidbecode +tcidbtune +IDBTLARGE +IDBTDEFLATE +IDBTTCBS +tcidbsetcache +tcidbsetfwmmax +tcidbopen +IDBOREADER +IDBOWRITER +IDBOCREAT +IDBOTRUNC +IDBONOLCK +IDBOLCKNB +tcidbclose +tcidbput +tcidbout +tcidbget +tcidbsearch +IDBSSUBSTR +IDBSPREFIX +IDBSSUFFIX +IDBSFULL +IDBSTOKEN +IDBSTOKPRE +IDBSTOKSUF +); + =head1 NAME Search::TokyoDystopia - XS bindings for Tokyo Dystopia -=head1 METHODS +=head1 EXPORTS + +If you don't prevent it, it will export all kind of stuff into your namespace to cut down on typing. + +=head2 tcidberrmsg + + my $message = tcidberrmsg( $ecode ); + +=head2 tcidbnew + + my $idb = tcidbnew; + +=head2 tcidbdel + + tcidbdel( $idb ); + +=head2 tcidbecode + + my $ecode = tcidbecode( $idb ); + +=head2 tcidbtune + + my $success = tcidbtune( $idb, $ernum, $etnum, $iusiz, IDBTLARGE | IDBTDEFLATE ); + +=cut + +use constant { + IDBTLARGE => 1 << 0, + IDBTDEFLATE => 1 << 1, + IDBTTCBS => 1 << 2, +}; + +=head2 tcidbsetcache + + my $success = tcidbsetcache( $idb, $icsiz, $lcnum ); + +=head2 tcidbsetfwmmax + + my $success = tcidbsetfwmmax( $idb, $fwnum ); + +=head2 tcidbopen + + my $success = tcidbopen( $idb, 'casket', IDBOWRITER | IDBOCREAT ); + +=cut + +use constant { + IDBOREADER => 1 << 0, + IDBOWRITER => 1 << 1, + IDBOCREAT => 1 << 2, + IDBOTRUNC => 1 << 3, + IDBONOLCK => 1 << 4, + IDBOLCKNB => 1 << 5, +}; + +=head2 tcidbclose + + my $success = tcidbclose( $idb ); + +=head2 tcidbput + + my $success = tcidbput( $idb, $id, $text ); + +=head2 tcidbout + + my $success = tcidbout( $idb, $id ); + +=head2 tcidbget + + my $text = tcidbget( $idb, $id ); + +=head2 tcidbsearch + + my @ids = tcidbsearch( $idb, $word, IDBSSUBSTR ) =cut +use constant { + IDBSSUBSTR => 0, # substring matching + IDBSPREFIX => 1, # prefix matching + IDBSSUFFIX => 2, # suffix matching + IDBSFULL => 3, # full matching + IDBSTOKEN => 4, # token matching + IDBSTOKPRE => 5, # token prefix matching + IDBSTOKSUF => 6, # token suffix matching +}; + +=head1 KNOWN BUGS + +Low-level functions often just die when called on invalid (or deleted) database + +=cut 1;