-
-
27 Feb 2018 08:40:23 UTC
- Distribution: Lucy
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Clone repository
- Issues
- Testers (1251 / 3 / 7)
- Kwalitee
Bus factor: 1- License: apache_2_0
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (1.12MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The Apache Lucy Project <dev at lucy dot apache dot org>
- Dependencies
- Clownfish
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
UnicodeTable - Create compressed Unicode tables for C programs
SYNOPSIS
my $table = UnicodeTable->read( filename => $filename, type => 'Enumerated', map => \%map, ); my $comp = $table->compress($shift); $comp->dump;
DESCRIPTION
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.
METHODS
new
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.
read
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.
shift
mask
max
map_table
Accessors
set
$table->set($i, $value);
Set entry at index $i to $value. Don't use with compressed tables.
size
my $size = $table->size;
Storage size of the table in bytes.
lookup
my $value = $table->lookup($i);
Lookup value at index $i. Also works with compressed tables.
compress
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.
compress_map
my $map_table = $table->compress_map($shift);
Compress the map table of a table for multi stage lookup. Returns the compressed map table.
dump
$table->dump($file, $name);
Dump the table as C code to filehandle $file. The table name is $name.
AUTHOR
Nick Wellnhofer <wellnhofer@aevum.de>
Module Install Instructions
To install Lucy, copy and paste the appropriate command in to your terminal.
cpanm Lucy
perl -MCPAN -e shell install Lucy
For more information on module installation, please visit the detailed CPAN module installation guide.