diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2012-09-20 22:13:50 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2012-09-20 22:13:50 +0200 |
commit | 83d0c72cbb99424c9f1e4a44c1449380bda845ea (patch) | |
tree | eef3aa159fa507e25f2fc7130ebdfea19e388899 | |
parent | f29f5ae191c88763bbff96f2a943d11238835bd2 (diff) |
add test/trie program
The test/trie program allows to create better packed tries to reduce
memory consumption of the hyphenation even further.
Usage:
trie <pattern file> > <prefix>/lib/dillo/hyphenation/<lang>.pat.trie
e.g:
./trie hyph-de-1996.pat > /usr/local/lib/dillo/hyphenation/de.pat.trie
If the <lang>.pat.trie is found, dillo will use this precompressed trie
instead of the <lang>.pat file.
-rw-r--r-- | test/Makefile.am | 10 | ||||
-rw-r--r-- | test/trie.cc | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 15ab227b..dbf2a25f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -23,6 +23,7 @@ noinst_PROGRAMS = \ shapes \ cookies \ liang \ + trie \ notsosimplevector dw_anchors_test_SOURCES = dw_anchors_test.cc @@ -171,6 +172,15 @@ liang_LDADD = \ $(top_builddir)/lout/liblout.a \ @LIBFLTK_LIBS@ +trie_SOURCES = trie.cc + +trie_LDADD = \ + $(top_builddir)/dw/libDw-widgets.a \ + $(top_builddir)/dw/libDw-fltk.a \ + $(top_builddir)/dw/libDw-core.a \ + $(top_builddir)/lout/liblout.a \ + @LIBFLTK_LIBS@ + notsosimplevector_SOURCES = notsosimplevector.cc notsosimplevector_LDADD = $(top_builddir)/lout/liblout.a diff --git a/test/trie.cc b/test/trie.cc new file mode 100644 index 00000000..943b8045 --- /dev/null +++ b/test/trie.cc @@ -0,0 +1,17 @@ +#include "../dw/fltkcore.hh" +#include "../dw/hyphenator.hh" + +int main (int argc, char *argv[]) +{ + dw::fltk::FltkPlatform p; + + if (argc < 2) { + fprintf(stderr, "Usage: trie <pattern file>\n"); + exit (1); + } + + /* Use pack = 1024 to create a really small trie - can take a while. + */ + dw::Hyphenator hyphenator (&p, argv[1], NULL, 1024); + hyphenator.saveTrie (stdout); +} |