UnicodeTable - Create compressed Unicode tables for C programs
my $table = UnicodeTable->read( filename => $filename, type => 'Enumerated', map => \%map, ); my $comp = $table->compress($shift); $comp->dump;
This module creates compressed tables used to lookup Unicode properties in C programs. To compress a table, it's split into blocks of a fixed size. Identical blocks are discovered and only unique blocks are written to the compressed table. An additional map table is created to map original block indices to block ids.
The map tables can then be compressed again using the same algorithm.
Powers of two are used as block sizes, so the table indices to lookup values can be computed using bit operations.
my $table = UnicodeTable->new( values => \@values, default => $default, max => $max, shift => $shift, map_table => $map_table, );
\@values is an arrayref with the table values, $max is the maximum value. The default value for undefined table entries is $default or 0. $shift and $map_table are used for compressed tables.
my $table = UnicodeTable->table( filename => $filename, type => $type, map => \%map, default => $default, );
Reads a table from a Unicode data text file. $type is either 'Enumerated' or 'Boolean'. \%map is a hashref that maps property values to integers. For booleans, these integers are ORed. $default is the default value passed to new.
Accessors
$table->set($i, $value);
Set entry at index $i to $value. Don't use with compressed tables.
my $size = $table->size;
Storage size of the table in bytes.
my $value = $table->lookup($i);
Lookup value at index $i. Also works with compressed tables.
my $compressed_table = $table->compress($shift);
Returns a compressed version of this table which is linked to a second map table. Blocks of size (1 << $shift) are used.
my $map_table = $table->compress_map($shift);
Compress the map table of a table for multi stage lookup. Returns the compressed map table.
$table->dump($file, $name);
Dump the table as C code to filehandle $file. The table name is $name.
Nick Wellnhofer <wellnhofer@aevum.de>
To install LucyX::Search::Filter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LucyX::Search::Filter
CPAN shell
perl -MCPAN -e shell install LucyX::Search::Filter
For more information on module installation, please visit the detailed CPAN module installation guide.