libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 97a02ac7d6a4e45d2679b4b9bbdaff184a913b11
parent b28e3305f6d78e2c3dc3c15eb549b05f4455166c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 13 Sep 2005 15:19:30 +0000

trying to fix build process

Diffstat:
Mconfigure.ac | 17+++++++++--------
Dsrc/plugins/ASF_SYMBOLS | 1-
Dsrc/plugins/DEB_SYMBOLS | 1-
Dsrc/plugins/DVI_SYMBOLS | 1-
Dsrc/plugins/ELF_SYMBOLS | 1-
Dsrc/plugins/FILENAME_SYMBOLS | 1-
Dsrc/plugins/GIF_SYMBOLS | 1-
Dsrc/plugins/HTML_SYMBOLS | 1-
Dsrc/plugins/ID3V23_SYMBOLS | 1-
Dsrc/plugins/ID3V24_SYMBOLS | 1-
Dsrc/plugins/ID3V2_SYMBOLS | 1-
Dsrc/plugins/JPEG_SYMBOLS | 1-
Dsrc/plugins/LOWER_SYMBOLS | 1-
Dsrc/plugins/MAN_SYMBOLS | 1-
Dsrc/plugins/MIME_SYMBOLS | 1-
Dsrc/plugins/MP3_SYMBOLS | 1-
Dsrc/plugins/MPEG_SYMBOLS | 1-
Msrc/plugins/Makefile-plugins.am | 8++++----
Msrc/plugins/Makefile.am | 30------------------------------
Dsrc/plugins/OGG_SYMBOLS | 1-
Dsrc/plugins/PNG_SYMBOLS | 1-
Dsrc/plugins/PS_SYMBOLS | 1-
Dsrc/plugins/QT_SYMBOLS | 1-
Dsrc/plugins/REAL_SYMBOLS | 1-
Dsrc/plugins/RIFF_SYMBOLS | 1-
Dsrc/plugins/SPLIT_SYMBOLS | 1-
Asrc/plugins/SYMBOLS | 28++++++++++++++++++++++++++++
Dsrc/plugins/TAR_SYMBOLS | 1-
Dsrc/plugins/TIFF_SYMBOLS | 1-
Dsrc/plugins/TRANSLIT_SYMBOLS | 1-
Dsrc/plugins/WAV_SYMBOLS | 1-
Dsrc/plugins/ZIP_SYMBOLS | 1-
Msrc/plugins/exiv2/Makefile.am | 2--
Dsrc/plugins/hash/MD5_SYMBOLS | 1-
Msrc/plugins/hash/Makefile.am | 11+++--------
Dsrc/plugins/hash/RMD160_SYMBOLS | 1-
Dsrc/plugins/hash/SHA1_SYMBOLS | 1-
Asrc/plugins/hash/SYMBOLS | 3+++
Msrc/plugins/ole2/Makefile.am | 15++-------------
Msrc/plugins/oo/Makefile.am | 14++------------
Dsrc/plugins/pdf/FontInfo.h | 2070-------------------------------------------------------------------------------
Msrc/plugins/pdf/Makefile.am | 93++++++++++++++++++++++++-------------------------------------------------------
Dsrc/plugins/pdf/darwin.lt.rb | 84-------------------------------------------------------------------------------
Dsrc/plugins/printable/DA_SYMBOLS | 1-
Dsrc/plugins/printable/DE_SYMBOLS | 1-
Dsrc/plugins/printable/EN_SYMBOLS | 1-
Dsrc/plugins/printable/ES_SYMBOLS | 1-
Dsrc/plugins/printable/IT_SYMBOLS | 1-
Msrc/plugins/printable/Makefile.am | 46+++++++++++++---------------------------------
Dsrc/plugins/printable/NO_SYMBOLS | 1-
Asrc/plugins/printable/SYMBOLS | 6++++++
Asrc/plugins/printable/bloomfilter-def.h | 41+++++++++++++++++++++++++++++++++++++++++
Dsrc/plugins/printable/bloomfilter.c | 372-------------------------------------------------------------------------------
Msrc/plugins/printable/bloomfilter.h | 344++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Msrc/plugins/printable/dictionary-builder.c | 4++--
Msrc/plugins/printable/peXX.c | 2+-
Dsrc/plugins/printable/printableextractor.c | 523-------------------------------------------------------------------------------
Asrc/plugins/printable/printableextractor.h | 524+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/plugins/rpm/Makefile.am | 14++------------
Msrc/plugins/thumbnail/Makefile.am | 18+++---------------
60 files changed, 1006 insertions(+), 3300 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -33,37 +33,38 @@ case "$host_os" in linux*) AC_DEFINE(LINUX,1,[This is a Linux system]) AC_DEFINE_UNQUOTED(LINUX,1,[This is a LINUX system]) - AM_CONDITIONAL(HAVE_GNU_LD, 1) + AM_CONDITIONAL(HAVE_GNU_LD, true) XTRA_CPPLIBS=-lstdc++ ;; freebsd*) AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) AC_CHECK_LIB(c_r, pthread_create) - AM_CONDITIONAL(HAVE_GNU_LD, 1) + AM_CONDITIONAL(HAVE_GNU_LD, true) ;; openbsd*) AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) AC_CHECK_LIB(c_r, pthread_create) - AM_CONDITIONAL(HAVE_GNU_LD, 1) + AM_CONDITIONAL(HAVE_GNU_LD, true) ;; netbsd*) AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) AC_CHECK_LIB(c_r, pthread_create) - AM_CONDITIONAL(HAVE_GNU_LD, 1) + AM_CONDITIONAL(HAVE_GNU_LD, true) ;; *solaris*) AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system]) AC_CHECK_LIB(resolv, res_init) XTRA_CPPLIBS=-lstdc++ - AM_CONDITIONAL(HAVE_GNU_LD, 0) + AM_CONDITIONAL(HAVE_GNU_LD, false) ;; darwin*) AC_DEFINE_UNQUOTED(DARWIN,1,[This is a Darwin system]) - AM_CONDITIONAL(HAVE_GNU_LD, 0) + AM_CONDITIONAL(HAVE_GNU_LD, false) ;; cygwin*) AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a CYGWIN system]) LDFLAGS="$LDFLAGS -no-undefined" + AM_CONDITIONAL(HAVE_GNU_LD, false) ;; mingw*) AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) @@ -72,13 +73,13 @@ mingw*) AC_CHECK_LIB(ws2_32, _head_libws2_32_a,,[AC_MSG_ERROR([libextractor requires Winsock2])]) AC_CHECK_LIB(plibc, plibc_init,,[AC_MSG_ERROR([libextractor requires PlibC])]) LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols" - AM_CONDITIONAL(HAVE_GNU_LD, 1) + AM_CONDITIONAL(HAVE_GNU_LD, true) ;; *) AC_MSG_RESULT(Unrecognised OS $host_os) AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) AC_MSG_RESULT(otheros) - AM_CONDITIONAL(HAVE_GNU_LD, 0) + AM_CONDITIONAL(HAVE_GNU_LD, false) ;; esac diff --git a/src/plugins/ASF_SYMBOLS b/src/plugins/ASF_SYMBOLS @@ -1 +0,0 @@ -libextractor_asf_extract diff --git a/src/plugins/DEB_SYMBOLS b/src/plugins/DEB_SYMBOLS @@ -1 +0,0 @@ -libextractor_deb_extract diff --git a/src/plugins/DVI_SYMBOLS b/src/plugins/DVI_SYMBOLS @@ -1 +0,0 @@ -libextractor_dvi_extract diff --git a/src/plugins/ELF_SYMBOLS b/src/plugins/ELF_SYMBOLS @@ -1 +0,0 @@ -libextractor_elf_extract diff --git a/src/plugins/FILENAME_SYMBOLS b/src/plugins/FILENAME_SYMBOLS @@ -1 +0,0 @@ -libextractor_filename_extract diff --git a/src/plugins/GIF_SYMBOLS b/src/plugins/GIF_SYMBOLS @@ -1 +0,0 @@ -libextractor_gif_extract diff --git a/src/plugins/HTML_SYMBOLS b/src/plugins/HTML_SYMBOLS @@ -1 +0,0 @@ -libextractor_html_extract diff --git a/src/plugins/ID3V23_SYMBOLS b/src/plugins/ID3V23_SYMBOLS @@ -1 +0,0 @@ -libextractor_id3v23_extract diff --git a/src/plugins/ID3V24_SYMBOLS b/src/plugins/ID3V24_SYMBOLS @@ -1 +0,0 @@ -libextractor_id3v24_extract diff --git a/src/plugins/ID3V2_SYMBOLS b/src/plugins/ID3V2_SYMBOLS @@ -1 +0,0 @@ -libextractor_id3v2_extract diff --git a/src/plugins/JPEG_SYMBOLS b/src/plugins/JPEG_SYMBOLS @@ -1 +0,0 @@ -libextractor_jpeg_extract diff --git a/src/plugins/LOWER_SYMBOLS b/src/plugins/LOWER_SYMBOLS @@ -1 +0,0 @@ -libextractor_lower_extract diff --git a/src/plugins/MAN_SYMBOLS b/src/plugins/MAN_SYMBOLS @@ -1 +0,0 @@ -libextractor_man_extract diff --git a/src/plugins/MIME_SYMBOLS b/src/plugins/MIME_SYMBOLS @@ -1 +0,0 @@ -libextractor_mime_extract diff --git a/src/plugins/MP3_SYMBOLS b/src/plugins/MP3_SYMBOLS @@ -1 +0,0 @@ -libextractor_mp3_extract diff --git a/src/plugins/MPEG_SYMBOLS b/src/plugins/MPEG_SYMBOLS @@ -1 +0,0 @@ -libextractor_mpeg_extract diff --git a/src/plugins/Makefile-plugins.am b/src/plugins/Makefile-plugins.am @@ -3,15 +3,15 @@ INCLUDES = -I$(top_srcdir)/src/include # install plugins under: plugindir = $(libdir)/libextractor +EXTRA_DIST = \ + SYMBOLS LIBS = \ @LTLIBINTL@ @LIBS@ if HAVE_GNU_LD - makesymbolic="-Wl,-s -Wl,-Bsymbolic" - retaincommand="\#" -else - retaincommand="-Wl,--retain-symbols-file -Wl," + makesymbolic=-Wl,-Bsymbolic + retaincommand=-Wl,--retain-symbols-file -Wl,SYMBOLS endif PLUGINFLAGS = $(makesymbolic) -avoid-version -module -no-undefined diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am @@ -1,35 +1,5 @@ include Makefile-plugins.am -EXTRA_DIST = \ - ASF_SYMBOLS \ - DEB_SYMBOLS \ - DVI_SYMBOLS \ - ELF_SYMBOLS \ - FILENAME_SYMBOLS \ - GIF_SYMBOLS \ - HTML_SYMBOLS \ - ID3V2_SYMBOLS \ - ID3V23_SYMBOLS \ - ID3V24_SYMBOLS \ - JPEG_SYMBOLS \ - LOWER_SYMBOLS \ - MAN_SYMBOLS \ - MIME_SYMBOLS \ - MP3_SYMBOLS \ - MPEG_SYMBOLS \ - OGG_SYMBOLS \ - PNG_SYMBOLS \ - PS_SYMBOLS \ - QT_SYMBOLS \ - REAL_SYMBOLS \ - RIFF_SYMBOLS \ - SPLIT_SYMBOLS \ - TAR_SYMBOLS \ - TIFF_SYMBOLS \ - TRANSLIT_SYMBOLS \ - WAV_SYMBOLS \ - ZIP_SYMBOLS - if HAVE_GLIB oledir=ole2 if HAVE_GTK diff --git a/src/plugins/OGG_SYMBOLS b/src/plugins/OGG_SYMBOLS @@ -1 +0,0 @@ -libextractor_ogg_extract diff --git a/src/plugins/PNG_SYMBOLS b/src/plugins/PNG_SYMBOLS @@ -1 +0,0 @@ -libextractor_png_extract diff --git a/src/plugins/PS_SYMBOLS b/src/plugins/PS_SYMBOLS @@ -1 +0,0 @@ -libextractor_ps_extract diff --git a/src/plugins/QT_SYMBOLS b/src/plugins/QT_SYMBOLS @@ -1 +0,0 @@ -libextractor_qt_extract diff --git a/src/plugins/REAL_SYMBOLS b/src/plugins/REAL_SYMBOLS @@ -1 +0,0 @@ -libextractor_real_extract diff --git a/src/plugins/RIFF_SYMBOLS b/src/plugins/RIFF_SYMBOLS @@ -1 +0,0 @@ -libextractor_riff_extract diff --git a/src/plugins/SPLIT_SYMBOLS b/src/plugins/SPLIT_SYMBOLS @@ -1 +0,0 @@ -libextractor_split_extract diff --git a/src/plugins/SYMBOLS b/src/plugins/SYMBOLS @@ -0,0 +1,28 @@ +libextractor_asf_extract +libextractor_deb_extract +libextractor_dvi_extract +libextractor_elf_extract +libextractor_filename_extract +libextractor_gif_extract +libextractor_html_extract +libextractor_id3v23_extract +libextractor_id3v24_extract +libextractor_id3v2_extract +libextractor_jpeg_extract +libextractor_lower_extract +libextractor_man_extract +libextractor_mime_extract +libextractor_mp3_extract +libextractor_mpeg_extract +libextractor_ogg_extract +libextractor_png_extract +libextractor_ps_extract +libextractor_qt_extract +libextractor_real_extract +libextractor_riff_extract +libextractor_split_extract +libextractor_tar_extract +libextractor_tiff_extract +libextractor_translit_extract +libextractor_wav_extract +libextractor_zip_extract diff --git a/src/plugins/TAR_SYMBOLS b/src/plugins/TAR_SYMBOLS @@ -1 +0,0 @@ -libextractor_tar_extract diff --git a/src/plugins/TIFF_SYMBOLS b/src/plugins/TIFF_SYMBOLS @@ -1 +0,0 @@ -libextractor_tiff_extract diff --git a/src/plugins/TRANSLIT_SYMBOLS b/src/plugins/TRANSLIT_SYMBOLS @@ -1 +0,0 @@ -libextractor_translit_extract diff --git a/src/plugins/WAV_SYMBOLS b/src/plugins/WAV_SYMBOLS @@ -1 +0,0 @@ -libextractor_wav_extract diff --git a/src/plugins/ZIP_SYMBOLS b/src/plugins/ZIP_SYMBOLS @@ -1 +0,0 @@ -libextractor_zip_extract diff --git a/src/plugins/exiv2/Makefile.am b/src/plugins/exiv2/Makefile.am @@ -1,7 +1,5 @@ include ../Makefile-plugins.am -EXTRA_DIST = SYMBOLS - SUBDIRS = . plugin_LTLIBRARIES = \ diff --git a/src/plugins/hash/MD5_SYMBOLS b/src/plugins/hash/MD5_SYMBOLS @@ -1 +0,0 @@ -libextractor_md5_extract diff --git a/src/plugins/hash/Makefile.am b/src/plugins/hash/Makefile.am @@ -1,10 +1,5 @@ include ../Makefile-plugins.am -EXTRA_DIST = \ - MD5_SYMBOLS \ - SHA1_SYMBOLS \ - RMD160_SYMBOLS - SUBDIRS = . plugin_LTLIBRARIES = \ @@ -15,14 +10,14 @@ plugin_LTLIBRARIES = \ libextractor_hash_md5_la_SOURCES = \ md5extractor.c libextractor_hash_md5_la_LDFLAGS = \ - $(PLUGINFLAGS) $(retaincommand)MD5_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_hash_sha1_la_SOURCES = \ sha1extractor.c libextractor_hash_sha1_la_LDFLAGS = \ - $(PLUGINFLAGS) $(retaincommand)SHA1_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_hash_rmd160_la_SOURCES = \ rmd160extractor.c libextractor_hash_rmd160_la_LDFLAGS = \ - $(PLUGINFLAGS) $(retaincommand)RMD160_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) diff --git a/src/plugins/hash/RMD160_SYMBOLS b/src/plugins/hash/RMD160_SYMBOLS @@ -1 +0,0 @@ -libextractor_rmd160_extract diff --git a/src/plugins/hash/SHA1_SYMBOLS b/src/plugins/hash/SHA1_SYMBOLS @@ -1 +0,0 @@ -libextractor_sha1_extract diff --git a/src/plugins/hash/SYMBOLS b/src/plugins/hash/SYMBOLS @@ -0,0 +1,3 @@ +libextractor_md5_extract +libextractor_sha1_extract +libextractor_rmd160_extract diff --git a/src/plugins/ole2/Makefile.am b/src/plugins/ole2/Makefile.am @@ -1,15 +1,4 @@ -INCLUDES = \ - -I$(top_srcdir)/src/include - -EXTRA_DIST = SYMBOLS - -LIBS = \ - @LTLIBINTL@ @LIBS@ - -# install plugins under: -plugindir = $(libdir)/libextractor - -PLUGINFLAGS = -Wl,-Bsymbolic -avoid-version -module -no-undefined +include ../Makefile-plugins.am plugin_LTLIBRARIES = \ @@ -23,6 +12,6 @@ libextractor_ole2_la_LIBADD = \ $(LIBADD) $(GLIB_LIBS) -lgobject-2.0 \ $(top_builddir)/src/main/libextractor.la libextractor_ole2_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_ole2_la_SOURCES = \ ole2extractor.c diff --git a/src/plugins/oo/Makefile.am b/src/plugins/oo/Makefile.am @@ -1,14 +1,4 @@ -INCLUDES = -I$(top_srcdir)/src/include - -EXTRA_DIST = SYMBOLS - -LIBS = \ - @LTLIBINTL@ @LIBS@ - -# install plugins under: -plugindir = $(libdir)/libextractor - -PLUGINFLAGS = -Wl,-Bsymbolic -avoid-version -module -no-undefined +include ../Makefile-plugins.am SUBDIRS = . @@ -19,7 +9,7 @@ libextractor_oo_la_SOURCES = \ ooextractor.c libextractor_oo_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_oo_la_LIBADD = \ $(top_builddir)/src/main/libextractor.la \ diff --git a/src/plugins/pdf/FontInfo.h b/src/plugins/pdf/FontInfo.h @@ -1,2070 +0,0 @@ -//======================================================================== -// -// FontInfo.h -// -// This file was automatically generated by makeFontInfo. -// -// Copyright 1996 Derek B. Noonburg -// -//======================================================================== - -#ifndef FONTINFO_H -#define FONTINFO_H - -//------------------------------------------------------------------------ -// Character encodings. -//------------------------------------------------------------------------ - -#define standardEncodingSize 335 -static char *standardEncodingNames[standardEncodingSize] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "space", - "exclam", - "quotedbl", - "numbersign", - "dollar", - "percent", - "ampersand", - "quoteright", - "parenleft", - "parenright", - "asterisk", - "plus", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "bracketleft", - "backslash", - "bracketright", - "asciicircum", - "underscore", - "quoteleft", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "braceleft", - "bar", - "braceright", - "asciitilde", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "exclamdown", - "cent", - "sterling", - "fraction", - "yen", - "florin", - "section", - "currency", - "quotesingle", - "quotedblleft", - "guillemotleft", - "guilsinglleft", - "guilsinglright", - "fi", - "fl", - NULL, - "endash", - "dagger", - "daggerdbl", - "periodcentered", - NULL, - "paragraph", - "bullet", - "quotesinglbase", - "quotedblbase", - "quotedblright", - "guillemotright", - "ellipsis", - "perthousand", - NULL, - "questiondown", - NULL, - "grave", - "acute", - "circumflex", - "tilde", - "macron", - "breve", - "dotaccent", - "dieresis", - NULL, - "ring", - "cedilla", - NULL, - "hungarumlaut", - "ogonek", - "caron", - "emdash", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "AE", - NULL, - "ordfeminine", - NULL, - NULL, - NULL, - NULL, - "Lslash", - "Oslash", - "OE", - "ordmasculine", - NULL, - NULL, - NULL, - NULL, - NULL, - "ae", - NULL, - NULL, - NULL, - "dotlessi", - NULL, - NULL, - "lslash", - "oslash", - "oe", - "germandbls", - NULL, - NULL, - NULL, - NULL, - "Aacute", - "Acircumflex", - "Adieresis", - "Agrave", - "Aring", - "Atilde", - "Ccedilla", - "Eacute", - "Ecircumflex", - "Edieresis", - "Egrave", - "Eth", - "Iacute", - "Icircumflex", - "Idieresis", - "Igrave", - "Ntilde", - "Oacute", - "Ocircumflex", - "Odieresis", - "Ograve", - "Otilde", - "Scaron", - "Thorn", - "Uacute", - "Ucircumflex", - "Udieresis", - "Ugrave", - "Yacute", - "Ydieresis", - "Zcaron", - "aacute", - "acircumflex", - "adieresis", - "agrave", - "aring", - "atilde", - "brokenbar", - "ccedilla", - "copyright", - "degree", - "divide", - "eacute", - "ecircumflex", - "edieresis", - "egrave", - "eth", - "iacute", - "icircumflex", - "idieresis", - "igrave", - "logicalnot", - "minus", - "mu", - "multiply", - "ntilde", - "oacute", - "ocircumflex", - "odieresis", - "ograve", - "onehalf", - "onequarter", - "onesuperior", - "otilde", - "plusminus", - "registered", - "scaron", - "thorn", - "threequarters", - "threesuperior", - "trademark", - "twosuperior", - "uacute", - "ucircumflex", - "udieresis", - "ugrave", - "yacute", - "ydieresis", - "zcaron" -}; -static FontEncoding standardEncoding(standardEncodingNames, - standardEncodingSize); - -#define symbolEncodingSize 257 -static char *symbolEncodingNames[symbolEncodingSize] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "space", - "exclam", - "universal", - "numbersign", - "existential", - "percent", - "ampersand", - "suchthat", - "parenleft", - "parenright", - "asteriskmath", - "plus", - "comma", - "minus", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "congruent", - "Alpha", - "Beta", - "Chi", - "Delta", - "Epsilon", - "Phi", - "Gamma", - "Eta", - "Iota", - "theta1", - "Kappa", - "Lambda", - "Mu", - "Nu", - "Omicron", - "Pi", - "Theta", - "Rho", - "Sigma", - "Tau", - "Upsilon", - "sigma1", - "Omega", - "Xi", - "Psi", - "Zeta", - "bracketleft", - "therefore", - "bracketright", - "perpendicular", - "underscore", - "radicalex", - "alpha", - "beta", - "chi", - "delta", - "epsilon", - "phi", - "gamma", - "eta", - "iota", - "phi1", - "kappa", - "lambda", - "mu", - "nu", - "omicron", - "pi", - "theta", - "rho", - "sigma", - "tau", - "upsilon", - "omega1", - "omega", - "xi", - "psi", - "zeta", - "braceleft", - "bar", - "braceright", - "similar", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "Upsilon1", - "minute", - "lessequal", - "fraction", - "infinity", - "florin", - "club", - "diamond", - "heart", - "spade", - "arrowboth", - "arrowleft", - "arrowup", - "arrowright", - "arrowdown", - "degree", - "plusminus", - "second", - "greaterequal", - "multiply", - "proportional", - "partialdiff", - "bullet", - "divide", - "notequal", - "equivalence", - "approxequal", - "ellipsis", - "arrowvertex", - "arrowhorizex", - "carriagereturn", - "aleph", - "Ifraktur", - "Rfraktur", - "weierstrass", - "circlemultiply", - "circleplus", - "emptyset", - "intersection", - "union", - "propersuperset", - "reflexsuperset", - "notsubset", - "propersubset", - "reflexsubset", - "element", - "notelement", - "angle", - "gradient", - "registerserif", - "copyrightserif", - "trademarkserif", - "product", - "radical", - "dotmath", - "logicalnot", - "logicaland", - "logicalor", - "arrowdblboth", - "arrowdblleft", - "arrowdblup", - "arrowdblright", - "arrowdbldown", - "lozenge", - "angleleft", - "registersans", - "copyrightsans", - "trademarksans", - "summation", - "parenlefttp", - "parenleftex", - "parenleftbt", - "bracketlefttp", - "bracketleftex", - "bracketleftbt", - "bracelefttp", - "braceleftmid", - "braceleftbt", - "braceex", - NULL, - "angleright", - "integral", - "integraltp", - "integralex", - "integralbt", - "parenrighttp", - "parenrightex", - "parenrightbt", - "bracketrighttp", - "bracketrightex", - "bracketrightbt", - "bracerighttp", - "bracerightmid", - "bracerightbt", - NULL, - "apple" -}; -static FontEncoding symbolEncoding(symbolEncodingNames, - symbolEncodingSize); - -#define zapfDingbatsEncodingSize 270 -static char *zapfDingbatsEncodingNames[zapfDingbatsEncodingSize] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "space", - "a1", - "a2", - "a202", - "a3", - "a4", - "a5", - "a119", - "a118", - "a117", - "a11", - "a12", - "a13", - "a14", - "a15", - "a16", - "a105", - "a17", - "a18", - "a19", - "a20", - "a21", - "a22", - "a23", - "a24", - "a25", - "a26", - "a27", - "a28", - "a6", - "a7", - "a8", - "a9", - "a10", - "a29", - "a30", - "a31", - "a32", - "a33", - "a34", - "a35", - "a36", - "a37", - "a38", - "a39", - "a40", - "a41", - "a42", - "a43", - "a44", - "a45", - "a46", - "a47", - "a48", - "a49", - "a50", - "a51", - "a52", - "a53", - "a54", - "a55", - "a56", - "a57", - "a58", - "a59", - "a60", - "a61", - "a62", - "a63", - "a64", - "a65", - "a66", - "a67", - "a68", - "a69", - "a70", - "a71", - "a72", - "a73", - "a74", - "a203", - "a75", - "a204", - "a76", - "a77", - "a78", - "a79", - "a81", - "a82", - "a83", - "a84", - "a97", - "a98", - "a99", - "a100", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "a101", - "a102", - "a103", - "a104", - "a106", - "a107", - "a108", - "a112", - "a111", - "a110", - "a109", - "a120", - "a121", - "a122", - "a123", - "a124", - "a125", - "a126", - "a127", - "a128", - "a129", - "a130", - "a131", - "a132", - "a133", - "a134", - "a135", - "a136", - "a137", - "a138", - "a139", - "a140", - "a141", - "a142", - "a143", - "a144", - "a145", - "a146", - "a147", - "a148", - "a149", - "a150", - "a151", - "a152", - "a153", - "a154", - "a155", - "a156", - "a157", - "a158", - "a159", - "a160", - "a161", - "a163", - "a164", - "a196", - "a165", - "a192", - "a166", - "a167", - "a168", - "a169", - "a170", - "a171", - "a172", - "a173", - "a162", - "a174", - "a175", - "a176", - "a177", - "a178", - "a179", - "a193", - "a180", - "a199", - "a181", - "a200", - "a182", - NULL, - "a201", - "a183", - "a184", - "a197", - "a185", - "a194", - "a198", - "a186", - "a195", - "a187", - "a188", - "a189", - "a190", - "a191", - NULL, - "a205", - "a206", - "a85", - "a86", - "a87", - "a88", - "a89", - "a90", - "a91", - "a92", - "a93", - "a94", - "a95", - "a96" -}; -static FontEncoding zapfDingbatsEncoding(zapfDingbatsEncodingNames, - zapfDingbatsEncodingSize); - -#define macRomanEncodingSize 256 -static char *macRomanEncodingNames[macRomanEncodingSize] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "space", - "exclam", - "quotedbl", - "numbersign", - "dollar", - "percent", - "ampersand", - "quotesingle", - "parenleft", - "parenright", - "asterisk", - "plus", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "bracketleft", - "backslash", - "bracketright", - "asciicircum", - "underscore", - "grave", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "braceleft", - "bar", - "braceright", - "asciitilde", - NULL, - "Adieresis", - "Aring", - "Ccedilla", - "Eacute", - "Ntilde", - "Odieresis", - "Udieresis", - "aacute", - "agrave", - "acircumflex", - "adieresis", - "atilde", - "aring", - "ccedilla", - "eacute", - "egrave", - "ecircumflex", - "edieresis", - "iacute", - "igrave", - "icircumflex", - "idieresis", - "ntilde", - "oacute", - "ograve", - "ocircumflex", - "odieresis", - "otilde", - "uacute", - "ugrave", - "ucircumflex", - "udieresis", - "dagger", - "degree", - "cent", - "sterling", - "section", - "bullet", - "paragraph", - "germandbls", - "registered", - "copyright", - "trademark", - "acute", - "dieresis", - NULL, - "AE", - "Oslash", - NULL, - "plusminus", - NULL, - NULL, - "yen", - "mu", - NULL, - NULL, - NULL, - NULL, - NULL, - "ordfeminine", - "ordmasculine", - NULL, - "ae", - "oslash", - "questiondown", - "exclamdown", - "logicalnot", - NULL, - "florin", - NULL, - NULL, - "guillemotleft", - "guillemotright", - "ellipsis", - "space", - "Agrave", - "Atilde", - "Otilde", - "OE", - "oe", - "endash", - "emdash", - "quotedblleft", - "quotedblright", - "quoteleft", - "quoteright", - "divide", - NULL, - "ydieresis", - "Ydieresis", - "fraction", - "currency", - "guilsinglleft", - "guilsinglright", - "fi", - "fl", - "daggerdbl", - "periodcentered", - "quotesinglbase", - "quotedblbase", - "perthousand", - "Acircumflex", - "Ecircumflex", - "Aacute", - "Edieresis", - "Egrave", - "Iacute", - "Icircumflex", - "Idieresis", - "Igrave", - "Oacute", - "Ocircumflex", - NULL, - "Ograve", - "Uacute", - "Ucircumflex", - "Ugrave", - "dotlessi", - "circumflex", - "tilde", - "macron", - "breve", - "dotaccent", - "ring", - "cedilla", - "hungarumlaut", - "ogonek", - "caron" -}; -static FontEncoding macRomanEncoding(macRomanEncodingNames, - macRomanEncodingSize); - -#define winAnsiEncodingSize 256 -static char *winAnsiEncodingNames[winAnsiEncodingSize] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "space", - "exclam", - "quotedbl", - "numbersign", - "dollar", - "percent", - "ampersand", - "quotesingle", - "parenleft", - "parenright", - "asterisk", - "plus", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "bracketleft", - "backslash", - "bracketright", - "asciicircum", - "underscore", - "grave", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "braceleft", - "bar", - "braceright", - "asciitilde", - "bullet", - "bullet", - "bullet", - "quotesinglbase", - "florin", - "quotedblbase", - "ellipsis", - "dagger", - "daggerdbl", - "circumflex", - "perthousand", - "Scaron", - "guilsinglleft", - "OE", - "bullet", - "bullet", - "bullet", - "bullet", - "quoteleft", - "quoteright", - "quotedblleft", - "quotedblright", - "bullet", - "endash", - "emdash", - "tilde", - "trademark", - "scaron", - "guilsinglright", - "oe", - "bullet", - "bullet", - "Ydieresis", - "space", - "exclamdown", - "cent", - "sterling", - "currency", - "yen", - "brokenbar", - "section", - "dieresis", - "copyright", - "ordfeminine", - "guillemotleft", - "logicalnot", - "hyphen", - "registered", - "macron", - "degree", - "plusminus", - "twosuperior", - "threesuperior", - "acute", - "mu", - "paragraph", - "periodcentered", - "cedilla", - "onesuperior", - "ordmasculine", - "guillemotright", - "onequarter", - "onehalf", - "threequarters", - "questiondown", - "Agrave", - "Aacute", - "Acircumflex", - "Atilde", - "Adieresis", - "Aring", - "AE", - "Ccedilla", - "Egrave", - "Eacute", - "Ecircumflex", - "Edieresis", - "Igrave", - "Iacute", - "Icircumflex", - "Idieresis", - "Eth", - "Ntilde", - "Ograve", - "Oacute", - "Ocircumflex", - "Otilde", - "Odieresis", - "multiply", - "Oslash", - "Ugrave", - "Uacute", - "Ucircumflex", - "Udieresis", - "Yacute", - "Thorn", - "germandbls", - "agrave", - "aacute", - "acircumflex", - "atilde", - "adieresis", - "aring", - "ae", - "ccedilla", - "egrave", - "eacute", - "ecircumflex", - "edieresis", - "igrave", - "iacute", - "icircumflex", - "idieresis", - "eth", - "ntilde", - "ograve", - "oacute", - "ocircumflex", - "otilde", - "odieresis", - "divide", - "oslash", - "ugrave", - "uacute", - "ucircumflex", - "udieresis", - "yacute", - "thorn", - "ydieresis" -}; -static FontEncoding winAnsiEncoding(winAnsiEncodingNames, - winAnsiEncodingSize); - -//------------------------------------------------------------------------ -// Character widths for built-in fonts. -//------------------------------------------------------------------------ - -static Gushort courierWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 0, 600, 600, 600, 600, 0, 600, 600, - 600, 600, 600, 600, 600, 600, 0, 600, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 0, 600, 600, 0, 600, 600, 600, - 600, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 0, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 0, 600, 0, 0, 0, 600, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600 -}; - -static Gushort courierBoldWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 0, 600, 600, 600, 600, 0, 600, 600, - 600, 600, 600, 600, 600, 600, 0, 600, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 0, 600, 600, 0, 600, 600, 600, - 600, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 0, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 0, 600, 0, 0, 0, 600, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600 -}; - -static Gushort courierBoldObliqueWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 0, 600, 600, 600, 600, 0, 600, 600, - 600, 600, 600, 600, 600, 600, 0, 600, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 0, 600, 600, 0, 600, 600, 600, - 600, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 0, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 0, 600, 0, 0, 0, 600, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600 -}; - -static Gushort courierObliqueWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 0, 600, 600, 600, 600, 0, 600, 600, - 600, 600, 600, 600, 600, 600, 0, 600, - 0, 600, 600, 600, 600, 600, 600, 600, - 600, 0, 600, 600, 0, 600, 600, 600, - 600, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 600, 0, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 0, 600, 0, 0, 0, 600, 0, 0, - 600, 600, 600, 600, 0, 0, 0, 0, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600 -}; - -static Gushort helveticaWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 278, 278, 355, 556, 556, 889, 667, 222, - 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, - 556, 556, 278, 278, 584, 584, 584, 556, - 1015, 667, 667, 722, 722, 667, 611, 778, - 722, 278, 500, 667, 556, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, - 667, 667, 611, 278, 278, 278, 469, 556, - 222, 556, 556, 500, 556, 556, 278, 556, - 556, 222, 222, 500, 222, 833, 556, 556, - 556, 556, 333, 500, 278, 556, 500, 722, - 500, 500, 500, 334, 260, 334, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, - 556, 191, 333, 556, 333, 333, 500, 500, - 0, 556, 556, 556, 278, 0, 537, 350, - 222, 333, 333, 556, 1000, 1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1000, 0, 370, 0, 0, 0, 0, - 556, 778, 1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, - 222, 611, 944, 611, 0, 0, 0, 0, - 667, 667, 667, 667, 667, 667, 722, 667, - 667, 667, 667, 722, 278, 278, 278, 278, - 722, 778, 778, 778, 778, 778, 667, 667, - 722, 722, 722, 722, 667, 667, 611, 556, - 556, 556, 556, 556, 556, 260, 500, 737, - 400, 584, 556, 556, 556, 556, 556, 278, - 278, 278, 278, 584, 584, 556, 584, 556, - 556, 556, 556, 556, 834, 834, 333, 556, - 584, 737, 500, 556, 834, 333, 1000, 333, - 556, 556, 556, 556, 500, 500, 500 -}; - -static Gushort helveticaBoldWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 278, 333, 474, 556, 556, 889, 722, 278, - 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, - 556, 556, 333, 333, 584, 584, 584, 611, - 975, 722, 722, 722, 722, 667, 611, 778, - 722, 278, 556, 722, 611, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, - 667, 667, 611, 333, 278, 333, 584, 556, - 278, 556, 611, 556, 611, 556, 333, 611, - 611, 278, 278, 556, 278, 889, 611, 611, - 611, 611, 389, 556, 333, 611, 556, 778, - 556, 556, 500, 389, 280, 389, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, - 556, 238, 500, 556, 333, 333, 611, 611, - 0, 556, 556, 556, 278, 0, 556, 350, - 278, 500, 500, 556, 1000, 1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1000, 0, 370, 0, 0, 0, 0, - 611, 778, 1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, - 278, 611, 944, 611, 0, 0, 0, 0, - 722, 722, 722, 722, 722, 722, 722, 667, - 667, 667, 667, 722, 278, 278, 278, 278, - 722, 778, 778, 778, 778, 778, 667, 667, - 722, 722, 722, 722, 667, 667, 611, 556, - 556, 556, 556, 556, 556, 280, 556, 737, - 400, 584, 556, 556, 556, 556, 611, 278, - 278, 278, 278, 584, 584, 611, 584, 611, - 611, 611, 611, 611, 834, 834, 333, 611, - 584, 737, 556, 611, 834, 333, 1000, 333, - 611, 611, 611, 611, 556, 556, 500 -}; - -static Gushort helveticaBoldObliqueWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 278, 333, 474, 556, 556, 889, 722, 278, - 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, - 556, 556, 333, 333, 584, 584, 584, 611, - 975, 722, 722, 722, 722, 667, 611, 778, - 722, 278, 556, 722, 611, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, - 667, 667, 611, 333, 278, 333, 584, 556, - 278, 556, 611, 556, 611, 556, 333, 611, - 611, 278, 278, 556, 278, 889, 611, 611, - 611, 611, 389, 556, 333, 611, 556, 778, - 556, 556, 500, 389, 280, 389, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, - 556, 238, 500, 556, 333, 333, 611, 611, - 0, 556, 556, 556, 278, 0, 556, 350, - 278, 500, 500, 556, 1000, 1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1000, 0, 370, 0, 0, 0, 0, - 611, 778, 1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, - 278, 611, 944, 611, 0, 0, 0, 0, - 722, 722, 722, 722, 722, 722, 722, 667, - 667, 667, 667, 722, 278, 278, 278, 278, - 722, 778, 778, 778, 778, 778, 667, 667, - 722, 722, 722, 722, 667, 667, 611, 556, - 556, 556, 556, 556, 556, 280, 556, 737, - 400, 584, 556, 556, 556, 556, 611, 278, - 278, 278, 278, 584, 584, 611, 584, 611, - 611, 611, 611, 611, 834, 834, 333, 611, - 584, 737, 556, 611, 834, 333, 1000, 333, - 611, 611, 611, 611, 556, 556, 500 -}; - -static Gushort helveticaObliqueWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 278, 278, 355, 556, 556, 889, 667, 222, - 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, - 556, 556, 278, 278, 584, 584, 584, 556, - 1015, 667, 667, 722, 722, 667, 611, 778, - 722, 278, 500, 667, 556, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, - 667, 667, 611, 278, 278, 278, 469, 556, - 222, 556, 556, 500, 556, 556, 278, 556, - 556, 222, 222, 500, 222, 833, 556, 556, - 556, 556, 333, 500, 278, 556, 500, 722, - 500, 500, 500, 334, 260, 334, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, - 556, 191, 333, 556, 333, 333, 500, 500, - 0, 556, 556, 556, 278, 0, 537, 350, - 222, 333, 333, 556, 1000, 1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1000, 0, 370, 0, 0, 0, 0, - 556, 778, 1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, - 222, 611, 944, 611, 0, 0, 0, 0, - 667, 667, 667, 667, 667, 667, 722, 667, - 667, 667, 667, 722, 278, 278, 278, 278, - 722, 778, 778, 778, 778, 778, 667, 667, - 722, 722, 722, 722, 667, 667, 611, 556, - 556, 556, 556, 556, 556, 260, 500, 737, - 400, 584, 556, 556, 556, 556, 556, 278, - 278, 278, 278, 584, 584, 556, 584, 556, - 556, 556, 556, 556, 834, 834, 333, 556, - 584, 737, 500, 556, 834, 333, 1000, 333, - 556, 556, 556, 556, 500, 500, 500 -}; - -static Gushort symbolWidths[257] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 713, 500, 549, 833, 778, 439, - 333, 333, 500, 549, 250, 549, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, - 500, 500, 278, 278, 549, 549, 549, 444, - 549, 722, 667, 722, 612, 611, 763, 603, - 722, 333, 631, 722, 686, 889, 722, 722, - 768, 741, 556, 592, 611, 690, 439, 768, - 645, 795, 611, 333, 863, 333, 658, 500, - 500, 631, 549, 549, 494, 439, 521, 411, - 603, 329, 603, 549, 549, 576, 521, 549, - 549, 521, 549, 603, 439, 576, 713, 686, - 493, 686, 494, 480, 200, 480, 549, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 620, 247, 549, 167, 713, 500, 753, - 753, 753, 753, 1042, 987, 603, 987, 603, - 400, 549, 411, 549, 549, 713, 494, 460, - 549, 549, 549, 549, 1000, 603, 1000, 658, - 823, 686, 795, 987, 768, 768, 823, 768, - 768, 713, 713, 713, 713, 713, 713, 713, - 768, 713, 790, 790, 890, 823, 549, 250, - 713, 603, 603, 1042, 987, 603, 987, 603, - 494, 329, 790, 790, 786, 713, 384, 384, - 384, 384, 384, 384, 494, 494, 494, 494, - 0, 329, 274, 686, 686, 686, 384, 384, - 384, 384, 384, 384, 494, 494, 494, 0, - 790 -}; - -static Gushort timesBoldWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 555, 500, 500, 1000, 833, 333, - 333, 333, 500, 570, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, - 500, 500, 333, 333, 570, 570, 570, 500, - 930, 722, 667, 722, 722, 667, 611, 778, - 778, 389, 500, 778, 667, 944, 722, 778, - 611, 778, 722, 556, 667, 722, 722, 1000, - 722, 722, 667, 333, 278, 333, 581, 500, - 333, 500, 556, 444, 556, 444, 333, 500, - 556, 278, 333, 556, 278, 833, 556, 500, - 556, 556, 444, 389, 333, 556, 500, 722, - 500, 500, 444, 394, 220, 394, 520, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 500, 500, 167, 500, 500, 500, - 500, 278, 500, 500, 333, 333, 556, 556, - 0, 500, 500, 500, 250, 0, 540, 350, - 333, 500, 500, 500, 1000, 1000, 0, 500, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1000, 0, 300, 0, 0, 0, 0, - 667, 778, 1000, 330, 0, 0, 0, 0, - 0, 722, 0, 0, 0, 278, 0, 0, - 278, 500, 722, 556, 0, 0, 0, 0, - 722, 722, 722, 722, 722, 722, 722, 667, - 667, 667, 667, 722, 389, 389, 389, 389, - 722, 778, 778, 778, 778, 778, 556, 611, - 722, 722, 722, 722, 722, 722, 667, 500, - 500, 500, 500, 500, 500, 220, 444, 747, - 400, 570, 444, 444, 444, 444, 500, 278, - 278, 278, 278, 570, 570, 556, 570, 556, - 500, 500, 500, 500, 750, 750, 300, 500, - 570, 747, 389, 556, 750, 300, 1000, 300, - 556, 556, 556, 556, 500, 500, 444 -}; - -static Gushort timesBoldItalicWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 250, 389, 555, 500, 500, 833, 778, 333, - 333, 333, 500, 570, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, - 500, 500, 333, 333, 570, 570, 570, 500, - 832, 667, 667, 667, 722, 667, 667, 722, - 778, 389, 500, 667, 611, 889, 722, 722, - 611, 722, 667, 556, 611, 722, 667, 889, - 667, 611, 611, 333, 278, 333, 570, 500, - 333, 500, 500, 444, 500, 444, 333, 500, - 556, 278, 278, 500, 278, 778, 556, 500, - 500, 500, 389, 389, 278, 556, 444, 667, - 500, 444, 389, 348, 220, 348, 570, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 389, 500, 500, 167, 500, 500, 500, - 500, 278, 500, 500, 333, 333, 556, 556, - 0, 500, 500, 500, 250, 0, 500, 350, - 333, 500, 500, 500, 1000, 1000, 0, 500, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 944, 0, 266, 0, 0, 0, 0, - 611, 722, 944, 300, 0, 0, 0, 0, - 0, 722, 0, 0, 0, 278, 0, 0, - 278, 500, 722, 500, 0, 0, 0, 0, - 667, 667, 667, 667, 667, 667, 667, 667, - 667, 667, 667, 722, 389, 389, 389, 389, - 722, 722, 722, 722, 722, 722, 556, 611, - 722, 722, 722, 722, 611, 611, 611, 500, - 500, 500, 500, 500, 500, 220, 444, 747, - 400, 570, 444, 444, 444, 444, 500, 278, - 278, 278, 278, 606, 606, 576, 570, 556, - 500, 500, 500, 500, 750, 750, 300, 500, - 570, 747, 389, 500, 750, 300, 1000, 300, - 556, 556, 556, 556, 444, 444, 389 -}; - -static Gushort timesItalicWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 420, 500, 500, 833, 778, 333, - 333, 333, 500, 675, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, - 500, 500, 333, 333, 675, 675, 675, 500, - 920, 611, 611, 667, 722, 611, 611, 722, - 722, 333, 444, 667, 556, 833, 667, 722, - 611, 722, 611, 500, 556, 722, 611, 833, - 611, 556, 556, 389, 278, 389, 422, 500, - 333, 500, 500, 444, 500, 444, 278, 500, - 500, 278, 278, 444, 278, 722, 500, 500, - 500, 500, 389, 389, 278, 500, 444, 667, - 444, 444, 389, 400, 275, 400, 541, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 389, 500, 500, 167, 500, 500, 500, - 500, 214, 556, 500, 333, 333, 500, 500, - 0, 500, 500, 500, 250, 0, 523, 350, - 333, 556, 556, 500, 889, 1000, 0, 500, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 889, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 889, 0, 276, 0, 0, 0, 0, - 556, 722, 944, 310, 0, 0, 0, 0, - 0, 667, 0, 0, 0, 278, 0, 0, - 278, 500, 667, 500, 0, 0, 0, 0, - 611, 611, 611, 611, 611, 611, 667, 611, - 611, 611, 611, 722, 333, 333, 333, 333, - 667, 722, 722, 722, 722, 722, 500, 611, - 722, 722, 722, 722, 556, 556, 556, 500, - 500, 500, 500, 500, 500, 275, 444, 760, - 400, 675, 444, 444, 444, 444, 500, 278, - 278, 278, 278, 675, 675, 500, 675, 500, - 500, 500, 500, 500, 750, 750, 300, 500, - 675, 760, 389, 500, 750, 300, 980, 300, - 500, 500, 500, 500, 444, 444, 389 -}; - -static Gushort timesRomanWidths[335] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 408, 500, 500, 833, 778, 333, - 333, 333, 500, 564, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, - 500, 500, 278, 278, 564, 564, 564, 444, - 921, 722, 667, 667, 722, 611, 556, 722, - 722, 333, 389, 722, 611, 889, 722, 722, - 556, 722, 667, 556, 611, 722, 722, 944, - 722, 722, 611, 333, 278, 333, 469, 500, - 333, 444, 500, 444, 500, 444, 333, 500, - 500, 278, 278, 500, 278, 778, 500, 500, - 500, 500, 333, 389, 278, 500, 500, 722, - 500, 500, 444, 480, 200, 480, 541, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 500, 500, 167, 500, 500, 500, - 500, 180, 444, 500, 333, 333, 556, 556, - 0, 500, 500, 500, 250, 0, 453, 350, - 333, 444, 444, 500, 1000, 1000, 0, 444, - 0, 333, 333, 333, 333, 333, 333, 333, - 333, 0, 333, 333, 0, 333, 333, 333, - 1000, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 889, 0, 276, 0, 0, 0, 0, - 611, 722, 889, 310, 0, 0, 0, 0, - 0, 667, 0, 0, 0, 278, 0, 0, - 278, 500, 722, 500, 0, 0, 0, 0, - 722, 722, 722, 722, 722, 722, 667, 611, - 611, 611, 611, 722, 333, 333, 333, 333, - 722, 722, 722, 722, 722, 722, 556, 556, - 722, 722, 722, 722, 722, 722, 611, 444, - 444, 444, 444, 444, 444, 200, 444, 760, - 400, 564, 444, 444, 444, 444, 500, 278, - 278, 278, 278, 564, 564, 500, 564, 500, - 500, 500, 500, 500, 750, 750, 300, 500, - 564, 760, 389, 500, 750, 300, 980, 300, - 500, 500, 500, 500, 500, 500, 444 -}; - -static Gushort zapfDingbatsWidths[270] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 278, 974, 961, 974, 980, 719, 789, 790, - 791, 690, 960, 939, 549, 855, 911, 933, - 911, 945, 974, 755, 846, 762, 761, 571, - 677, 763, 760, 759, 754, 494, 552, 537, - 577, 692, 786, 788, 788, 790, 793, 794, - 816, 823, 789, 841, 823, 833, 816, 831, - 923, 744, 723, 749, 790, 792, 695, 776, - 768, 792, 759, 707, 708, 682, 701, 826, - 815, 789, 789, 707, 687, 696, 689, 786, - 787, 713, 791, 785, 791, 873, 761, 762, - 762, 759, 759, 892, 892, 788, 784, 438, - 138, 277, 415, 392, 392, 668, 668, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 732, 544, 544, 910, 667, 760, 760, - 776, 595, 694, 626, 788, 788, 788, 788, - 788, 788, 788, 788, 788, 788, 788, 788, - 788, 788, 788, 788, 788, 788, 788, 788, - 788, 788, 788, 788, 788, 788, 788, 788, - 788, 788, 788, 788, 788, 788, 788, 788, - 788, 788, 788, 788, 894, 838, 1016, 458, - 748, 924, 748, 918, 927, 928, 928, 834, - 873, 828, 924, 924, 917, 930, 931, 463, - 883, 836, 836, 867, 867, 696, 696, 874, - 0, 874, 760, 946, 771, 865, 771, 888, - 967, 888, 831, 873, 927, 970, 918, 0, - 509, 410, 509, 410, 234, 234, 390, 390, - 276, 276, 317, 317, 334, 334 -}; - -//------------------------------------------------------------------------ -// Built-in font table. -//------------------------------------------------------------------------ - -struct BuiltinFont { - char *name; - Gushort *widths; - FontEncoding *encoding; - short ascent; - short descent; -}; - -#define numBuiltinFonts ((int)(sizeof(builtinFonts)/sizeof(BuiltinFont))) - -static BuiltinFont builtinFonts[] = { - {"Courier", courierWidths, &standardEncoding, 624, -207}, - {"Courier-Bold", courierBoldWidths, &standardEncoding, 674, -257}, - {"Courier-BoldOblique", courierBoldObliqueWidths, &standardEncoding, 674, -257}, - {"Courier-Oblique", courierObliqueWidths, &standardEncoding, 624, -207}, - {"Helvetica", helveticaWidths, &standardEncoding, 729, -219}, - {"Helvetica-Bold", helveticaBoldWidths, &standardEncoding, 729, -219}, - {"Helvetica-BoldOblique", helveticaBoldObliqueWidths, &standardEncoding, 729, -219}, - {"Helvetica-Oblique", helveticaObliqueWidths, &standardEncoding, 729, -219}, - {"Symbol", symbolWidths, &symbolEncoding, 1010, -293}, - {"Times-Bold", timesBoldWidths, &standardEncoding, 670, -210}, - {"Times-BoldItalic", timesBoldItalicWidths, &standardEncoding, 682, -203}, - {"Times-Italic", timesItalicWidths, &standardEncoding, 684, -206}, - {"Times-Roman", timesRomanWidths, &standardEncoding, 682, -217}, - {"ZapfDingbats", zapfDingbatsWidths, &zapfDingbatsEncoding, 820, -143} -}; - -#endif diff --git a/src/plugins/pdf/Makefile.am b/src/plugins/pdf/Makefile.am @@ -1,22 +1,12 @@ -INCLUDES = -I$(top_srcdir)/src/include - -# install plugins under: -plugindir = $(libdir)/libextractor - -SUBDIRS = . - -LIBS = \ - @LTLIBINTL@ @LIBS@ +include ../Makefile-plugins.am plugin_LTLIBRARIES = \ libextractor_pdf.la -PLUGINFLAGS = -Wl,-Bsymbolic -avoid-version -module -no-undefined - libextractor_pdf_la_LINK = \ /bin/sh ../../../libtool --mode=link $(CXXLD) -o libextractor_pdf.la libextractor_pdf_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,SYMBOLS \ + $(PLUGINFLAGS) $(retaincommand) \ $(XTRA_CPPLIBS) libextractor_pdf_la_LIBADD = \ $(top_builddir)/src/main/libextractor.la \ @@ -24,28 +14,33 @@ libextractor_pdf_la_LIBADD = \ -lm libextractor_pdf_la_SOURCES = \ - Array.cc\ - Catalog.cc\ - Decrypt.cc\ - Dict.cc\ - Error.cc\ - FontEncoding.cc\ - FontFile.cc\ - Function.cc\ - GString.cc\ - Lexer.cc\ - Link.cc\ - Object.cc\ - PDFDoc.cc\ - Page.cc\ - Params.cc\ - Parser.cc\ - Stream.cc\ - XRef.cc\ - gfile.cc\ - gmem.cc\ + aconf.h \ + aconf2.h \ + ErrorCodes.h \ + Stream-CCITT.h\ + gtypes.h \ + Array.cc Array.h \ + Catalog.cc Catalog.h \ + Decrypt.cc Decrypt.h \ + Dict.cc Dict.h \ + Error.cc Error.h\ + FontEncoding.cc FontEncoding.h\ + FontFile.cc FontFile.h StdFontInfo.h CompactFontInfo.h \ + Function.cc Function.h\ + GString.cc GString.h\ + Lexer.cc Lexer.h \ + Link.cc Link.h\ + Object.cc Object.h\ + PDFDoc.cc PDFDoc.h \ + Page.cc Page.h\ + Params.cc Params.h\ + Parser.cc Parser.h\ + Stream.cc Stream.h Stream-CCITT.h \ + XRef.cc XRef.h\ + gfile.cc gfile.h\ + gmem.cc gmem.h\ gmempp.cc\ - parseargs.cc\ + parseargs.cc parseargs.h \ pdfextractor.cc # gcc 3.3 produces BROKEN code for -O1 and -O2 (PDF extraction @@ -53,35 +48,3 @@ libextractor_pdf_la_SOURCES = \ # which may contain -O1 or -O2! CXXFLAGS = -O0 -EXTRA_DIST = \ - SYMBOLS \ - darwin.lt.rb \ - aconf.h \ - aconf2.h \ - ErrorCodes.h \ - Array.h\ - Catalog.h\ - CompactFontInfo.h\ - Decrypt.h\ - Dict.h\ - Error.h\ - FontEncoding.h\ - FontFile.h\ - FontInfo.h\ - Function.h\ - GString.h\ - Lexer.h\ - Link.h\ - Object.h\ - PDFDoc.h\ - Page.h\ - Params.h\ - Parser.h\ - StdFontInfo.h \ - Stream-CCITT.h\ - Stream.h\ - XRef.h\ - gfile.h\ - gmem.h\ - gtypes.h\ - parseargs.h diff --git a/src/plugins/pdf/darwin.lt.rb b/src/plugins/pdf/darwin.lt.rb @@ -1,84 +0,0 @@ -#!/usr/bin/ruby - -unless system(ARGV[0]+ - ' -bundle -o .libs/libextractor_pdf.so '+ - ARGV[3..-1].join(' ')) - exit 1 -end - -File.open('libextractor_pdf.la','w') { - | io | - io.print <<EOF -# libextractor_pdf.la - a libtool library file -# Generated by ltmain.sh - GNU libtool 1.4.3 (1.922.2.110 2002/10/23 01:39:54) -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libextractor_pdf.so' - -# Names of this library. -library_names='libextractor_pdf.so libextractor_pdf.so libextractor_pdf.so' - -# The name of the static archive. -old_library='' - -# Libraries that this one depends upon. -dependency_libs='' - -# Version information for libextractor_rpm. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='#{ARGV[2]}' -EOF -} - -File.open('.libs/libextractor_pdf.lai','w') { - | io | - io.print <<EOF -# libextractor_pdf.la - a libtool library file -# Generated by ltmain.sh - GNU libtool 1.4.3 (1.922.2.110 2002/10/23 01:39:54) -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libextractor_pdf.so' - -# Names of this library. -library_names='libextractor_pdf.so libextractor_pdf.so libextractor_pdf.so' - -# The name of the static archive. -old_library='' - -# Libraries that this one depends upon. -dependency_libs='' - -# Version information for libextractor_rpm. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='#{ARGV[2]}' -EOF -} - diff --git a/src/plugins/printable/DA_SYMBOLS b/src/plugins/printable/DA_SYMBOLS @@ -1 +0,0 @@ -libextractor_da_extract diff --git a/src/plugins/printable/DE_SYMBOLS b/src/plugins/printable/DE_SYMBOLS @@ -1 +0,0 @@ -libextractor_de_extract diff --git a/src/plugins/printable/EN_SYMBOLS b/src/plugins/printable/EN_SYMBOLS @@ -1 +0,0 @@ -libextractor_en_extract diff --git a/src/plugins/printable/ES_SYMBOLS b/src/plugins/printable/ES_SYMBOLS @@ -1 +0,0 @@ -libextractor_es_extract diff --git a/src/plugins/printable/IT_SYMBOLS b/src/plugins/printable/IT_SYMBOLS @@ -1 +0,0 @@ -libextractor_it_extract diff --git a/src/plugins/printable/Makefile.am b/src/plugins/printable/Makefile.am @@ -1,25 +1,7 @@ -INCLUDES = -I$(top_srcdir)/src/include - -LIBS = \ - @LTLIBINTL@ @LIBS@ - -# install plugins under: -plugindir = $(libdir)/libextractor +include ../Makefile-plugins.am noinst_PROGRAMS = dictionary-builder -EXTRA_DIST = \ - en.txt de.txt es.txt da.txt no.txt it.txt \ - peXX.c \ - printableextractor.c \ - bloomfilter.c bloomfilter.h \ - DA_SYMBOLS \ - DE_SYMBOLS \ - EN_SYMBOLS \ - ES_SYMBOLS \ - IT_SYMBOLS \ - NO_SYMBOLS - CLEANFILES = en.c de.c es.c da.c no.c it.c peen.c pede.c pees.c peda.c peit.c en.c: dictionary-builder$(EXEEXT) @@ -61,8 +43,6 @@ plugin_LTLIBRARIES = \ libextractor_printable_no.la -PLUGINFLAGS = \ - -Wl,-Bsymbolic -avoid-version -module -no-undefined libextractor_printable_en_la_LIBADD = \ $(top_builddir)/src/main/libextractor.la libextractor_printable_it_la_LIBADD = \ @@ -77,31 +57,31 @@ libextractor_printable_no_la_LIBADD = \ $(top_builddir)/src/main/libextractor.la libextractor_printable_en_la_SOURCES = \ - en.c peen.c + en.c peen.c bloomfilter.h printableextractor.h libextractor_printable_en_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,EN_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_printable_es_la_SOURCES = \ - es.c pees.c + es.c pees.c bloomfilter.h printableextractor.h libextractor_printable_es_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,ES_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_printable_de_la_SOURCES = \ - de.c pede.c + de.c pede.c bloomfilter.h printableextractor.h libextractor_printable_de_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,DE_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_printable_it_la_SOURCES = \ - it.c peit.c + it.c peit.c bloomfilter.h printableextractor.h libextractor_printable_it_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,IT_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_printable_da_la_SOURCES = \ - da.c peda.c + da.c peda.c bloomfilter.h printableextractor.h libextractor_printable_da_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,DA_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_printable_no_la_SOURCES = \ - no.c peno.c + no.c peno.c bloomfilter.h printableextractor.h libextractor_printable_no_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,NO_SYMBOLS + $(PLUGINFLAGS) $(retaincommand) diff --git a/src/plugins/printable/NO_SYMBOLS b/src/plugins/printable/NO_SYMBOLS @@ -1 +0,0 @@ -libextractor_no_extract diff --git a/src/plugins/printable/SYMBOLS b/src/plugins/printable/SYMBOLS @@ -0,0 +1,6 @@ +libextractor_da_extract +libextractor_de_extract +libextractor_en_extract +libextractor_es_extract +libextractor_it_extract +libextractor_no_extract diff --git a/src/plugins/printable/bloomfilter-def.h b/src/plugins/printable/bloomfilter-def.h @@ -0,0 +1,41 @@ +/* + This file is part of libextractor. + (C) 2002, 2003, 2005 Christian Grothoff (and other contributing authors) + + libextractor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + libextractor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libextractor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +/** + * @author Igor Wronsky + * @author Christian Grothoff + * @file bloomfilter.h + */ +#ifndef BLOOMFILTER_DEF_H +#define BLOOMFILTER_DEF_H + +#include "platform.h" +#include <string.h> + +typedef struct { + /** How many bits we set for each stored element */ + unsigned int addressesPerElement; + /** The actual bloomfilter bit array */ + unsigned char * bitArray; + /** Size of bitArray in bytes */ + unsigned int bitArraySize; +} Bloomfilter; + + +#endif diff --git a/src/plugins/printable/bloomfilter.c b/src/plugins/printable/bloomfilter.c @@ -1,372 +0,0 @@ -/* - This file is part of libextractor. - (C) 2002, 2003 Christian Grothoff (and other contributing authors) - - libextractor is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your - option) any later version. - - libextractor is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with libextractor; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ -/** - * @file bloomfilter.c - * @brief data structure used for spell checking - * - * The idea basically: Create a signature for each element in the - * database. Add those signatures to a bit array. When doing a lookup, - * check if the bit array matches the signature of the requested - * element. If yes, address the disk, otherwise return 'not found'. - * - * A property of the bloom filter is that sometimes we will have - * a match even if the element is not on the disk (then we do - * an unnecessary disk access), but what's most important is that - * we never get a single "false negative". - * - * @author Igor Wronsky - * @author Christian Grothoff - */ - -#include "bloomfilter.h" - -struct sha1_context -{ - unsigned int total[2]; - unsigned int state[5]; - unsigned char buffer[64]; -}; - -#define GET_UINT32(n,b,i) \ -{ \ - (n) = (unsigned int) ((unsigned char *) b)[(i)+3] \ - | (((unsigned int) ((unsigned char *) b)[(i)+2]) << 8) \ - | (((unsigned int) ((unsigned char *) b)[(i)+1]) << 16) \ - | (((unsigned int) ((unsigned char *) b)[(i)] ) << 24); \ -} - -#define PUT_UINT32(n,b,i) \ -{ \ - (((unsigned char *) b)[(i)+3]) = (unsigned char) (((n) ) & 0xFF); \ - (((unsigned char *) b)[(i)+2]) = (unsigned char) (((n) >> 8) & 0xFF); \ - (((unsigned char *) b)[(i)+1]) = (unsigned char) (((n) >> 16) & 0xFF); \ - (((unsigned char *) b)[(i)] ) = (unsigned char) (((n) >> 24) & 0xFF); \ -} - -static void sha1_starts( struct sha1_context *ctx ) -{ - ctx->total[0] = 0; - ctx->total[1] = 0; - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xC3D2E1F0; -} - -static void sha1_process( struct sha1_context *ctx, const unsigned char data[64] ) -{ - unsigned int temp, A, B, C, D, E, W[16]; - - GET_UINT32( W[0], data, 0 ); - GET_UINT32( W[1], data, 4 ); - GET_UINT32( W[2], data, 8 ); - GET_UINT32( W[3], data, 12 ); - GET_UINT32( W[4], data, 16 ); - GET_UINT32( W[5], data, 20 ); - GET_UINT32( W[6], data, 24 ); - GET_UINT32( W[7], data, 28 ); - GET_UINT32( W[8], data, 32 ); - GET_UINT32( W[9], data, 36 ); - GET_UINT32( W[10], data, 40 ); - GET_UINT32( W[11], data, 44 ); - GET_UINT32( W[12], data, 48 ); - GET_UINT32( W[13], data, 52 ); - GET_UINT32( W[14], data, 56 ); - GET_UINT32( W[15], data, 60 ); - -#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) - -#define R(t) \ -( \ - temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ - W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ - ( W[t & 0x0F] = S(temp,1) ) \ -) - -#define P(a,b,c,d,e,x) \ -{ \ - e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ -} - - A = ctx->state[0]; - B = ctx->state[1]; - C = ctx->state[2]; - D = ctx->state[3]; - E = ctx->state[4]; - -#define F(x,y,z) (z ^ (x & (y ^ z))) -#define K 0x5A827999 - - P( A, B, C, D, E, W[0] ); - P( E, A, B, C, D, W[1] ); - P( D, E, A, B, C, W[2] ); - P( C, D, E, A, B, W[3] ); - P( B, C, D, E, A, W[4] ); - P( A, B, C, D, E, W[5] ); - P( E, A, B, C, D, W[6] ); - P( D, E, A, B, C, W[7] ); - P( C, D, E, A, B, W[8] ); - P( B, C, D, E, A, W[9] ); - P( A, B, C, D, E, W[10] ); - P( E, A, B, C, D, W[11] ); - P( D, E, A, B, C, W[12] ); - P( C, D, E, A, B, W[13] ); - P( B, C, D, E, A, W[14] ); - P( A, B, C, D, E, W[15] ); - P( E, A, B, C, D, R(16) ); - P( D, E, A, B, C, R(17) ); - P( C, D, E, A, B, R(18) ); - P( B, C, D, E, A, R(19) ); - -#undef K -#undef F - -#define F(x,y,z) (x ^ y ^ z) -#define K 0x6ED9EBA1 - - P( A, B, C, D, E, R(20) ); - P( E, A, B, C, D, R(21) ); - P( D, E, A, B, C, R(22) ); - P( C, D, E, A, B, R(23) ); - P( B, C, D, E, A, R(24) ); - P( A, B, C, D, E, R(25) ); - P( E, A, B, C, D, R(26) ); - P( D, E, A, B, C, R(27) ); - P( C, D, E, A, B, R(28) ); - P( B, C, D, E, A, R(29) ); - P( A, B, C, D, E, R(30) ); - P( E, A, B, C, D, R(31) ); - P( D, E, A, B, C, R(32) ); - P( C, D, E, A, B, R(33) ); - P( B, C, D, E, A, R(34) ); - P( A, B, C, D, E, R(35) ); - P( E, A, B, C, D, R(36) ); - P( D, E, A, B, C, R(37) ); - P( C, D, E, A, B, R(38) ); - P( B, C, D, E, A, R(39) ); - -#undef K -#undef F - -#define F(x,y,z) ((x & y) | (z & (x | y))) -#define K 0x8F1BBCDC - - P( A, B, C, D, E, R(40) ); - P( E, A, B, C, D, R(41) ); - P( D, E, A, B, C, R(42) ); - P( C, D, E, A, B, R(43) ); - P( B, C, D, E, A, R(44) ); - P( A, B, C, D, E, R(45) ); - P( E, A, B, C, D, R(46) ); - P( D, E, A, B, C, R(47) ); - P( C, D, E, A, B, R(48) ); - P( B, C, D, E, A, R(49) ); - P( A, B, C, D, E, R(50) ); - P( E, A, B, C, D, R(51) ); - P( D, E, A, B, C, R(52) ); - P( C, D, E, A, B, R(53) ); - P( B, C, D, E, A, R(54) ); - P( A, B, C, D, E, R(55) ); - P( E, A, B, C, D, R(56) ); - P( D, E, A, B, C, R(57) ); - P( C, D, E, A, B, R(58) ); - P( B, C, D, E, A, R(59) ); - -#undef K -#undef F - -#define F(x,y,z) (x ^ y ^ z) -#define K 0xCA62C1D6 - - P( A, B, C, D, E, R(60) ); - P( E, A, B, C, D, R(61) ); - P( D, E, A, B, C, R(62) ); - P( C, D, E, A, B, R(63) ); - P( B, C, D, E, A, R(64) ); - P( A, B, C, D, E, R(65) ); - P( E, A, B, C, D, R(66) ); - P( D, E, A, B, C, R(67) ); - P( C, D, E, A, B, R(68) ); - P( B, C, D, E, A, R(69) ); - P( A, B, C, D, E, R(70) ); - P( E, A, B, C, D, R(71) ); - P( D, E, A, B, C, R(72) ); - P( C, D, E, A, B, R(73) ); - P( B, C, D, E, A, R(74) ); - P( A, B, C, D, E, R(75) ); - P( E, A, B, C, D, R(76) ); - P( D, E, A, B, C, R(77) ); - P( C, D, E, A, B, R(78) ); - P( B, C, D, E, A, R(79) ); - -#undef K -#undef F - - ctx->state[0] += A; - ctx->state[1] += B; - ctx->state[2] += C; - ctx->state[3] += D; - ctx->state[4] += E; -} - -static void sha1_update(struct sha1_context *ctx, - const unsigned char *input, unsigned int length ) -{ - unsigned int left, fill; - - if( ! length ) return; - - left = ( ctx->total[0] >> 3 ) & 0x3F; - fill = 64 - left; - - ctx->total[0] += length << 3; - ctx->total[1] += length >> 29; - - ctx->total[0] &= 0xFFFFFFFF; - ctx->total[1] += ctx->total[0] < ( length << 3 ); - - if( left && length >= fill ) - { - memcpy( (void *) (ctx->buffer + left), (void *) input, fill ); - sha1_process( ctx, ctx->buffer ); - length -= fill; - input += fill; - left = 0; - } - - while( length >= 64 ) - { - sha1_process( ctx, input ); - length -= 64; - input += 64; - } - - if( length ) - { - memcpy( (void *) (ctx->buffer + left), (void *) input, length ); - } -} - -static unsigned char sha1_padding[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static void sha1_finish( struct sha1_context *ctx, unsigned char digest[20] ) -{ - unsigned int last, padn; - unsigned char msglen[8]; - - PUT_UINT32( ctx->total[1], msglen, 0 ); - PUT_UINT32( ctx->total[0], msglen, 4 ); - - last = ( ctx->total[0] >> 3 ) & 0x3F; - padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); - - sha1_update( ctx, sha1_padding, padn ); - sha1_update( ctx, msglen, 8 ); - - PUT_UINT32( ctx->state[0], digest, 0 ); - PUT_UINT32( ctx->state[1], digest, 4 ); - PUT_UINT32( ctx->state[2], digest, 8 ); - PUT_UINT32( ctx->state[3], digest, 12 ); - PUT_UINT32( ctx->state[4], digest, 16 ); -} - -void static hash(const void * data, - int size, - HashCode160 * hc) { - struct sha1_context ctx; - - sha1_starts( &ctx ); - sha1_update( &ctx, - data, - size); - - sha1_finish( &ctx, hc->data ); -} - - - -/* ************** Bloomfilter hash iterator ********* */ - -/** - * Iterator (callback) method to be called by the - * bloomfilter iterator on each bit that is to be - * set or tested for the key. - * - * @param bf the filter to manipulate - * @param bit the current bit - * @param additional context specific argument - */ -typedef void (*BitIterator)(Bloomfilter * bf, - unsigned int bit, - void * arg); - -/** - * Call an iterator for each bit that the bloomfilter - * must test or set for this element. - * - * @param bf the filter - * @param callback the method to call - * @param arg extra argument to callback - * @param key the key for which we iterate over the BF bits - */ -static void iterateBits(Bloomfilter * bf, - BitIterator callback, - void * arg, - const HashCode160 * key) { - HashCode160 tmp[2]; - int bitCount; - int round; - int slot=0; - - bitCount = bf->addressesPerElement; - memcpy(&tmp[0], - key, - sizeof(HashCode160)); - round = 0; - while (bitCount > 0) { - while (slot < (sizeof(HashCode160)/ - sizeof(unsigned int))) { - callback(bf, - (((unsigned int*)&tmp[round&1])[slot]) % (bf->bitArraySize*8), - arg); - slot++; - bitCount--; - if (bitCount == 0) - break; - } - if (bitCount > 0) { - hash(&tmp[round & 1], - sizeof(HashCode160), - &tmp[(round+1) & 1]); - round++; - slot = 0; - } - } -} - - -/* ******************** end of bloomfilter.c *********** */ diff --git a/src/plugins/printable/bloomfilter.h b/src/plugins/printable/bloomfilter.h @@ -1,6 +1,6 @@ /* This file is part of libextractor. - (C) 2002, 2003 Christian Grothoff (and other contributing authors) + (C) 2002, 2003, 2005 Christian Grothoff (and other contributing authors) libextractor is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -25,17 +25,343 @@ #ifndef BLOOMFILTER_H #define BLOOMFILTER_H +#include "platform.h" +#include <string.h> +#include "bloomfilter-def.h" + typedef struct { char data[20]; } HashCode160; -typedef struct { - /** How many bits we set for each stored element */ - unsigned int addressesPerElement; - /** The actual bloomfilter bit array */ - unsigned char * bitArray; - /** Size of bitArray in bytes */ - unsigned int bitArraySize; -} Bloomfilter; +struct sha1_context +{ + unsigned int total[2]; + unsigned int state[5]; + unsigned char buffer[64]; +}; + +#define GET_UINT32(n,b,i) \ +{ \ + (n) = (unsigned int) ((unsigned char *) b)[(i)+3] \ + | (((unsigned int) ((unsigned char *) b)[(i)+2]) << 8) \ + | (((unsigned int) ((unsigned char *) b)[(i)+1]) << 16) \ + | (((unsigned int) ((unsigned char *) b)[(i)] ) << 24); \ +} + +#define PUT_UINT32(n,b,i) \ +{ \ + (((unsigned char *) b)[(i)+3]) = (unsigned char) (((n) ) & 0xFF); \ + (((unsigned char *) b)[(i)+2]) = (unsigned char) (((n) >> 8) & 0xFF); \ + (((unsigned char *) b)[(i)+1]) = (unsigned char) (((n) >> 16) & 0xFF); \ + (((unsigned char *) b)[(i)] ) = (unsigned char) (((n) >> 24) & 0xFF); \ +} + +static void sha1_starts( struct sha1_context *ctx ) +{ + ctx->total[0] = 0; + ctx->total[1] = 0; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; + ctx->state[4] = 0xC3D2E1F0; +} + +static void sha1_process( struct sha1_context *ctx, const unsigned char data[64] ) +{ + unsigned int temp, A, B, C, D, E, W[16]; + + GET_UINT32( W[0], data, 0 ); + GET_UINT32( W[1], data, 4 ); + GET_UINT32( W[2], data, 8 ); + GET_UINT32( W[3], data, 12 ); + GET_UINT32( W[4], data, 16 ); + GET_UINT32( W[5], data, 20 ); + GET_UINT32( W[6], data, 24 ); + GET_UINT32( W[7], data, 28 ); + GET_UINT32( W[8], data, 32 ); + GET_UINT32( W[9], data, 36 ); + GET_UINT32( W[10], data, 40 ); + GET_UINT32( W[11], data, 44 ); + GET_UINT32( W[12], data, 48 ); + GET_UINT32( W[13], data, 52 ); + GET_UINT32( W[14], data, 56 ); + GET_UINT32( W[15], data, 60 ); + +#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define R(t) \ +( \ + temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ + W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ + ( W[t & 0x0F] = S(temp,1) ) \ +) + +#define P(a,b,c,d,e,x) \ +{ \ + e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ +} + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; + +#define F(x,y,z) (z ^ (x & (y ^ z))) +#define K 0x5A827999 + + P( A, B, C, D, E, W[0] ); + P( E, A, B, C, D, W[1] ); + P( D, E, A, B, C, W[2] ); + P( C, D, E, A, B, W[3] ); + P( B, C, D, E, A, W[4] ); + P( A, B, C, D, E, W[5] ); + P( E, A, B, C, D, W[6] ); + P( D, E, A, B, C, W[7] ); + P( C, D, E, A, B, W[8] ); + P( B, C, D, E, A, W[9] ); + P( A, B, C, D, E, W[10] ); + P( E, A, B, C, D, W[11] ); + P( D, E, A, B, C, W[12] ); + P( C, D, E, A, B, W[13] ); + P( B, C, D, E, A, W[14] ); + P( A, B, C, D, E, W[15] ); + P( E, A, B, C, D, R(16) ); + P( D, E, A, B, C, R(17) ); + P( C, D, E, A, B, R(18) ); + P( B, C, D, E, A, R(19) ); + +#undef K +#undef F + +#define F(x,y,z) (x ^ y ^ z) +#define K 0x6ED9EBA1 + + P( A, B, C, D, E, R(20) ); + P( E, A, B, C, D, R(21) ); + P( D, E, A, B, C, R(22) ); + P( C, D, E, A, B, R(23) ); + P( B, C, D, E, A, R(24) ); + P( A, B, C, D, E, R(25) ); + P( E, A, B, C, D, R(26) ); + P( D, E, A, B, C, R(27) ); + P( C, D, E, A, B, R(28) ); + P( B, C, D, E, A, R(29) ); + P( A, B, C, D, E, R(30) ); + P( E, A, B, C, D, R(31) ); + P( D, E, A, B, C, R(32) ); + P( C, D, E, A, B, R(33) ); + P( B, C, D, E, A, R(34) ); + P( A, B, C, D, E, R(35) ); + P( E, A, B, C, D, R(36) ); + P( D, E, A, B, C, R(37) ); + P( C, D, E, A, B, R(38) ); + P( B, C, D, E, A, R(39) ); + +#undef K +#undef F + +#define F(x,y,z) ((x & y) | (z & (x | y))) +#define K 0x8F1BBCDC + + P( A, B, C, D, E, R(40) ); + P( E, A, B, C, D, R(41) ); + P( D, E, A, B, C, R(42) ); + P( C, D, E, A, B, R(43) ); + P( B, C, D, E, A, R(44) ); + P( A, B, C, D, E, R(45) ); + P( E, A, B, C, D, R(46) ); + P( D, E, A, B, C, R(47) ); + P( C, D, E, A, B, R(48) ); + P( B, C, D, E, A, R(49) ); + P( A, B, C, D, E, R(50) ); + P( E, A, B, C, D, R(51) ); + P( D, E, A, B, C, R(52) ); + P( C, D, E, A, B, R(53) ); + P( B, C, D, E, A, R(54) ); + P( A, B, C, D, E, R(55) ); + P( E, A, B, C, D, R(56) ); + P( D, E, A, B, C, R(57) ); + P( C, D, E, A, B, R(58) ); + P( B, C, D, E, A, R(59) ); + +#undef K +#undef F + +#define F(x,y,z) (x ^ y ^ z) +#define K 0xCA62C1D6 + + P( A, B, C, D, E, R(60) ); + P( E, A, B, C, D, R(61) ); + P( D, E, A, B, C, R(62) ); + P( C, D, E, A, B, R(63) ); + P( B, C, D, E, A, R(64) ); + P( A, B, C, D, E, R(65) ); + P( E, A, B, C, D, R(66) ); + P( D, E, A, B, C, R(67) ); + P( C, D, E, A, B, R(68) ); + P( B, C, D, E, A, R(69) ); + P( A, B, C, D, E, R(70) ); + P( E, A, B, C, D, R(71) ); + P( D, E, A, B, C, R(72) ); + P( C, D, E, A, B, R(73) ); + P( B, C, D, E, A, R(74) ); + P( A, B, C, D, E, R(75) ); + P( E, A, B, C, D, R(76) ); + P( D, E, A, B, C, R(77) ); + P( C, D, E, A, B, R(78) ); + P( B, C, D, E, A, R(79) ); + +#undef K +#undef F + + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; + ctx->state[4] += E; +} + +static void sha1_update(struct sha1_context *ctx, + const unsigned char *input, unsigned int length ) +{ + unsigned int left, fill; + + if( ! length ) return; + + left = ( ctx->total[0] >> 3 ) & 0x3F; + fill = 64 - left; + + ctx->total[0] += length << 3; + ctx->total[1] += length >> 29; + + ctx->total[0] &= 0xFFFFFFFF; + ctx->total[1] += ctx->total[0] < ( length << 3 ); + + if( left && length >= fill ) + { + memcpy( (void *) (ctx->buffer + left), (void *) input, fill ); + sha1_process( ctx, ctx->buffer ); + length -= fill; + input += fill; + left = 0; + } + + while( length >= 64 ) + { + sha1_process( ctx, input ); + length -= 64; + input += 64; + } + + if( length ) + { + memcpy( (void *) (ctx->buffer + left), (void *) input, length ); + } +} + +static unsigned char sha1_padding[64] = +{ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static void sha1_finish( struct sha1_context *ctx, unsigned char digest[20] ) +{ + unsigned int last, padn; + unsigned char msglen[8]; + + PUT_UINT32( ctx->total[1], msglen, 0 ); + PUT_UINT32( ctx->total[0], msglen, 4 ); + + last = ( ctx->total[0] >> 3 ) & 0x3F; + padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); + + sha1_update( ctx, sha1_padding, padn ); + sha1_update( ctx, msglen, 8 ); + + PUT_UINT32( ctx->state[0], digest, 0 ); + PUT_UINT32( ctx->state[1], digest, 4 ); + PUT_UINT32( ctx->state[2], digest, 8 ); + PUT_UINT32( ctx->state[3], digest, 12 ); + PUT_UINT32( ctx->state[4], digest, 16 ); +} + +void static hash(const void * data, + int size, + HashCode160 * hc) { + struct sha1_context ctx; + + sha1_starts( &ctx ); + sha1_update( &ctx, + data, + size); + + sha1_finish( &ctx, hc->data ); +} + + + +/* ************** Bloomfilter hash iterator ********* */ + +/** + * Iterator (callback) method to be called by the + * bloomfilter iterator on each bit that is to be + * set or tested for the key. + * + * @param bf the filter to manipulate + * @param bit the current bit + * @param additional context specific argument + */ +typedef void (*BitIterator)(Bloomfilter * bf, + unsigned int bit, + void * arg); + +/** + * Call an iterator for each bit that the bloomfilter + * must test or set for this element. + * + * @param bf the filter + * @param callback the method to call + * @param arg extra argument to callback + * @param key the key for which we iterate over the BF bits + */ +static void iterateBits(Bloomfilter * bf, + BitIterator callback, + void * arg, + const HashCode160 * key) { + HashCode160 tmp[2]; + int bitCount; + int round; + int slot=0; + + bitCount = bf->addressesPerElement; + memcpy(&tmp[0], + key, + sizeof(HashCode160)); + round = 0; + while (bitCount > 0) { + while (slot < (sizeof(HashCode160)/ + sizeof(unsigned int))) { + callback(bf, + (((unsigned int*)&tmp[round&1])[slot]) % (bf->bitArraySize*8), + arg); + slot++; + bitCount--; + if (bitCount == 0) + break; + } + if (bitCount > 0) { + hash(&tmp[round & 1], + sizeof(HashCode160), + &tmp[(round+1) & 1]); + round++; + slot = 0; + } + } +} #endif diff --git a/src/plugins/printable/dictionary-builder.c b/src/plugins/printable/dictionary-builder.c @@ -27,8 +27,8 @@ */ #include "platform.h" +#include <string.h> #include "bloomfilter.h" -#include "bloomfilter.c" /** * Sets a bit active in the bitArray. Increment bit-specific @@ -149,7 +149,7 @@ int main(int argc, } fprintf(stdout, - "#include \"bloomfilter.h\"\n"); + "#include \"bloomfilter-def.h\"\n"); /* use int[] instead of char[] since it cuts the memory use of gcc down to a quarter; don't use long long since various diff --git a/src/plugins/printable/peXX.c b/src/plugins/printable/peXX.c @@ -2,4 +2,4 @@ #define FILTER_NAME libextractor_printable_XX_filter #define FILTER_INIT_NAME libextractor_printable_XX_filter_init #define EXTRACT_NAME libextractor_printable_XX_extract -#include "printableextractor.c" +#include "printableextractor.h" diff --git a/src/plugins/printable/printableextractor.c b/src/plugins/printable/printableextractor.c @@ -1,523 +0,0 @@ -/* - This file is part of libextractor. - (C) 2002, 2003, 2004 Vidyut Samanta and Christian Grothoff - - libextractor is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your - option) any later version. - - libextractor is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with libextractor; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - */ - -#ifndef FILTER_NAME -#fail Oops. -#endif -#ifndef FILTER_INIT_NAME -#fail Oops. -#endif -#ifndef EXTRACT_NAME -#fail Oops. -#endif - -#include "platform.h" -#include "extractor.h" -#include "bloomfilter.c" - -/** - * Checks if a bit is active in the bitArray - * - * @param bitArray memory area to set the bit in - * @param bitIdx which bit to test - * @return 1 if the bit is set, 0 if not. - */ -static int testBit(unsigned char * bitArray, - unsigned int bitIdx) { - unsigned int slot; - unsigned int targetBit; - - slot = bitIdx / 8; - targetBit = (1L << (bitIdx % 8)); - return (bitArray[slot] & targetBit) != 0; -} - - -/** - * Callback: test if all bits are set - * - * @param bf the filter - * @param bit the bit to test - * @param arg pointer set to NO if bit is not set - */ -static void testBitCallback(Bloomfilter * bf, - unsigned int bit, - void * cls) { - int * arg = cls; - if (! testBit(bf->bitArray, - bit)) - *arg = 0; -} -/** - * Test if an element is in the filter. - * - * @param e the element - * @param bf the filter - * @return 1 if the element is in the filter, 0 if not - */ -static int testBloomfilter(Bloomfilter * bf, - const HashCode160 * e) { - int res; - - if (NULL == bf) - return 1; - res = 1; - iterateBits(bf, - &testBitCallback, - &res, - e); - return res; -} - - -extern Bloomfilter FILTER_NAME; - -static char * xstrndup(const char * s, size_t n){ - char * d; - - d= malloc(n+1); - memcpy(d,s,n); - d[n]='\0'; - return d; -} - -static struct EXTRACTOR_Keywords * addKeyword(struct EXTRACTOR_Keywords * list, - char * keyword) { - EXTRACTOR_KeywordList * next; - next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = list; - next->keyword = keyword; - next->keywordType = EXTRACTOR_UNKNOWN; - return next; -} - - -/** - * - * @param word (alphabetic characters without spaces) - * @return 0 if it is no word, 1 if it is - **/ -static int wordTest(char * word, - double * strlenthreshold) { - int i; - HashCode160 hc; - char * lower; - - if (strlen(word) <= (int) (*strlenthreshold)) { - return 0; - } - for (i=strlen(word)-1;i>=0;i--) - if (isdigit(word[i])) - return 0; - - hash(word, - strlen(word), - &hc); - i = testBloomfilter(&FILTER_NAME, - &hc); - if (! i) { - int count =0; - for (i=strlen(word)-1;i>=0;i--){ - if (isupper(word[i])) - count++; - } - if ( ((count==1) && (isupper(word[0]))) || - (count == strlen(word)) ){ - lower = strdup(word); - for (i=strlen(lower)-1;i>=0;i--) - lower[i] = tolower(lower[i]); - hash(lower, - strlen(lower), - &hc); - i = testBloomfilter(&FILTER_NAME, - &hc); - free(lower); - } else - i=0; - } - if (i) { - switch(strlen(word)) { - case 1: - *strlenthreshold = 6 * (*strlenthreshold); - break; - case 2: - *strlenthreshold = 3 * (*strlenthreshold); - break; - case 3: - *strlenthreshold = 1 + (*strlenthreshold); - break; - case 4: - break; - case 5: - *strlenthreshold = (*strlenthreshold) - 1; - break; - case 6: - *strlenthreshold = (*strlenthreshold) / 3; - break; - case 7: - *strlenthreshold = (*strlenthreshold) / 6; - break; - case 8: - *strlenthreshold = (*strlenthreshold) / 10; - break; - default: - *strlenthreshold = 0.25; - break; - } - if (*strlenthreshold < 0.25) - *strlenthreshold = 0.25; - } - - return i; -} - -static void addKeywordToList(char * keyword, - struct EXTRACTOR_Keywords ** head, - struct EXTRACTOR_Keywords ** tail) { - - if (*tail != NULL) { - (*tail)->next = addKeyword(NULL, keyword); - *tail = (*tail)->next; - } else { - *tail = addKeyword(NULL, keyword); - *head = *tail; - } -} - - -static int process(char * keyword, - double * thresh, - struct EXTRACTOR_Keywords ** head, - struct EXTRACTOR_Keywords ** tail) { - int i; - int max = 0; - int len; - int p; - int skip; - char * sxdup; - - max = 0; - p = 0; - sxdup = strdup(keyword); - len = strlen(keyword); - for (i=0;i<len;i++) { - if (isprint(keyword[i])) { - keyword[p++] = keyword[i]; - continue; - } - while ( (! isprint(keyword[i+1])) - && (i<len-1) ) - i++; - keyword[p] = 0; - if (wordTest(keyword, thresh)) - max = p; - } - if (wordTest(keyword, thresh)) - max = p; - if (max == 0) { - free(keyword); - if (isprint(sxdup[0])) { - i=0; - while ( (! isprint(sxdup[i+1])) - && (i<len-1) ) - i++; - free(sxdup); - return i+1; - } else { - free(sxdup); - return 1; - } - } - addKeywordToList(xstrndup(keyword, max), - head, - tail); - free(keyword); - p=0; - skip = 0; - for (i=0;i<len;i++) { - if (isprint(sxdup[i])) { - p++; - continue; - } - skip++; - if (p == max) - break; - } - free(sxdup); - return max + skip; -} - -#define MAXBLEN 20 - -static void testKeyword(size_t start, - size_t end, - char * data, - double * thresh, - struct EXTRACTOR_Keywords ** head, - struct EXTRACTOR_Keywords ** tail) { - char * keyword; - int i; - int len; - - len = end-start; - keyword = malloc(len + 1); - memcpy(keyword, &data[start], len); - for (i=len-1; i>=0; i--) - if (keyword[i]==0) keyword[i]=1; - keyword[len] = 0; - if (wordTest(keyword, thresh)) { - addKeywordToList(keyword, - head, - tail); - return; - } - i = 0; - while (len - i > MAXBLEN) { - i += process(xstrndup(&keyword[i], MAXBLEN), - thresh, - head, - tail); - } - process(strdup(&keyword[i]), - thresh, - head, - tail); - free(keyword); -} - -static int isEndOfSentence(char c) { - return ( (c == '.') || - (c == '!') || - (c == '?') ); -} - -static void processSentences(struct EXTRACTOR_Keywords ** head, - struct EXTRACTOR_Keywords ** tail) { - int numSentences = 0; - int numWords = 0; - struct EXTRACTOR_Keywords * pos; - struct EXTRACTOR_Keywords * start; - struct EXTRACTOR_Keywords * rpos; - struct EXTRACTOR_Keywords * last; - char * sentence; - int i; - - start = NULL; - last = NULL; - pos = *head; - while (pos != NULL) { - if ( (strlen(pos->keyword) > 1) || - (! isEndOfSentence(pos->keyword[0]) ) ) { - last = pos; - pos = pos->next; - numWords++; - continue; - } - /* found end of sentence! */ - if ( ( (numWords < 3) || (numWords > 30) ) && - ( (numSentences > 12) || (numWords < 2) ) ) { - /* found reasonable amount of text, - discard "non-sentences" */ - if (start == NULL) { - rpos = *head; - *head = pos->next; - pos->next = NULL; - EXTRACTOR_freeKeywords(rpos); - last = NULL; - pos = *head; - numWords = 0; - continue; - } else { - rpos = start->next; - start->next = pos->next; - pos->next = NULL; - EXTRACTOR_freeKeywords(rpos); - last = start; - pos = start->next; - numWords = 0; - continue; - } - } - - /* found sentence! build & advance start! */ - if (start == NULL) - rpos = *head; - else - rpos = start->next; - i = 1; - while (rpos != pos) { - i += strlen(rpos->keyword) + 1; - rpos = rpos->next; - } - sentence = malloc(i); - sentence[0] = 0; - if (start == NULL) - rpos = *head; - else - rpos = start->next; - while (rpos != pos) { - strcat(sentence, rpos->keyword); - strcat(sentence, " "); - rpos = rpos->next; - } - sentence[strlen(sentence)-1] = pos->keyword[0]; - sentence[i-1] = 0; - - if (start == NULL) - rpos = *head; - else - rpos = start->next; - if (start == NULL) - *head = addKeyword(pos->next, - sentence); - else - start->next = addKeyword(pos->next, - sentence); - pos->next = NULL; - EXTRACTOR_freeKeywords(rpos); - if (start == NULL) - last = start = *head; - else - last = start = start->next; - pos = last->next; - numSentences++; - numWords = 0; - continue; - } - *tail = last; -} - -/* which mime-types should not be subjected to - the printable extractor (e.g. because we have - a more specific extractor available)? */ -static char * blacklist[] = { - "image/jpeg", - "image/gif", - "image/png", - "image/x-png", - "audio/real", - "audio/mp3", - "audio/mpeg", - "application/x-gzip", - "application/x-dpkg", - "application/bz2", - "application/x-rpm", - "application/x-rar", - "application/x-zip", - "application/x-arj", - "application/x-compress", - "application/x-executable", - "application/x-sharedlib", - "application/x-archive", - "application/x-tar", - "application/x-lha", - "application/x-gtar", - "application/x-dpkg", - "application/ogg", - "video/real", - "video/asf", - "video/mpeg", - "video/quicktime", - NULL, -}; - -/* "man strings" gives for now an adequate description of - what we are doing here. EXTRACT_FUNC_NAME is set by - Makefile.am to reflect the library that this code module - is getting compiled into. */ -struct EXTRACTOR_Keywords * EXTRACT_NAME (char * filename, - char * data, - size_t size, - struct EXTRACTOR_Keywords * prev) { - int i; - size_t last; - size_t pos; - const char * mime; - struct EXTRACTOR_Keywords * head = NULL; - struct EXTRACTOR_Keywords * tail = NULL; - double thresh = 2.0; - - /* if the mime-type of the file is blacklisted, don't - run the printable extactor! */ - mime = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, - prev); - if (mime != NULL) { - int j; - j = 0; - while (blacklist[j] != NULL) { - if (0 == strcmp(blacklist[j], mime)) - return prev; - j++; - } - } - - last = 0; - pos = 0; - while (last < size) { - pos = last; - while ( (last < size) && - (!isspace(data[last])) ) - last++; - if ( (last < size) && (!isspace(data[last])) ) - last++; - if (last >= size) - break; - for (i=pos;i<last;i++) { - if ( isEndOfSentence(data[i])) { - testKeyword(pos, i, data, &thresh, &head, &tail); - if ( (i < size-1) && (isspace(data[i+1])) ) { - addKeywordToList(xstrndup(&data[i++],1), - &head, - &tail); - } - pos = i+1; - } else { - if ( (data[i] == ',') || - (data[i] == ';') || - (data[i] == ':') || - (data[i] == '"') ) { - testKeyword(pos, i, data, &thresh, &head, &tail); - pos = i+1; - } - } - } - if (pos > last) - continue; - testKeyword(pos, - last, - data, - &thresh, - &head, - &tail); - while ( (last < size) && - (isspace(data[last])) ) - last++; - } - processSentences(&head, &tail); - - if (tail != NULL) { - tail->next = prev; - prev = head; - } - return prev; -} - - -/* end of printableextractor.c */ diff --git a/src/plugins/printable/printableextractor.h b/src/plugins/printable/printableextractor.h @@ -0,0 +1,524 @@ +/* + This file is part of libextractor. + (C) 2002, 2003, 2004 Vidyut Samanta and Christian Grothoff + + libextractor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + libextractor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libextractor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + */ + +#ifndef FILTER_NAME +#fail Oops. +#endif +#ifndef FILTER_INIT_NAME +#fail Oops. +#endif +#ifndef EXTRACT_NAME +#fail Oops. +#endif + +#include "platform.h" +#include "extractor.h" +#include <string.h> +#include "bloomfilter.h" + +/** + * Checks if a bit is active in the bitArray + * + * @param bitArray memory area to set the bit in + * @param bitIdx which bit to test + * @return 1 if the bit is set, 0 if not. + */ +static int testBit(unsigned char * bitArray, + unsigned int bitIdx) { + unsigned int slot; + unsigned int targetBit; + + slot = bitIdx / 8; + targetBit = (1L << (bitIdx % 8)); + return (bitArray[slot] & targetBit) != 0; +} + + +/** + * Callback: test if all bits are set + * + * @param bf the filter + * @param bit the bit to test + * @param arg pointer set to NO if bit is not set + */ +static void testBitCallback(Bloomfilter * bf, + unsigned int bit, + void * cls) { + int * arg = cls; + if (! testBit(bf->bitArray, + bit)) + *arg = 0; +} +/** + * Test if an element is in the filter. + * + * @param e the element + * @param bf the filter + * @return 1 if the element is in the filter, 0 if not + */ +static int testBloomfilter(Bloomfilter * bf, + const HashCode160 * e) { + int res; + + if (NULL == bf) + return 1; + res = 1; + iterateBits(bf, + &testBitCallback, + &res, + e); + return res; +} + + +extern Bloomfilter FILTER_NAME; + +static char * xstrndup(const char * s, size_t n){ + char * d; + + d= malloc(n+1); + memcpy(d,s,n); + d[n]='\0'; + return d; +} + +static struct EXTRACTOR_Keywords * addKeyword(struct EXTRACTOR_Keywords * list, + char * keyword) { + EXTRACTOR_KeywordList * next; + next = malloc(sizeof(EXTRACTOR_KeywordList)); + next->next = list; + next->keyword = keyword; + next->keywordType = EXTRACTOR_UNKNOWN; + return next; +} + + +/** + * + * @param word (alphabetic characters without spaces) + * @return 0 if it is no word, 1 if it is + **/ +static int wordTest(char * word, + double * strlenthreshold) { + int i; + HashCode160 hc; + char * lower; + + if (strlen(word) <= (int) (*strlenthreshold)) { + return 0; + } + for (i=strlen(word)-1;i>=0;i--) + if (isdigit(word[i])) + return 0; + + hash(word, + strlen(word), + &hc); + i = testBloomfilter(&FILTER_NAME, + &hc); + if (! i) { + int count =0; + for (i=strlen(word)-1;i>=0;i--){ + if (isupper(word[i])) + count++; + } + if ( ((count==1) && (isupper(word[0]))) || + (count == strlen(word)) ){ + lower = strdup(word); + for (i=strlen(lower)-1;i>=0;i--) + lower[i] = tolower(lower[i]); + hash(lower, + strlen(lower), + &hc); + i = testBloomfilter(&FILTER_NAME, + &hc); + free(lower); + } else + i=0; + } + if (i) { + switch(strlen(word)) { + case 1: + *strlenthreshold = 6 * (*strlenthreshold); + break; + case 2: + *strlenthreshold = 3 * (*strlenthreshold); + break; + case 3: + *strlenthreshold = 1 + (*strlenthreshold); + break; + case 4: + break; + case 5: + *strlenthreshold = (*strlenthreshold) - 1; + break; + case 6: + *strlenthreshold = (*strlenthreshold) / 3; + break; + case 7: + *strlenthreshold = (*strlenthreshold) / 6; + break; + case 8: + *strlenthreshold = (*strlenthreshold) / 10; + break; + default: + *strlenthreshold = 0.25; + break; + } + if (*strlenthreshold < 0.25) + *strlenthreshold = 0.25; + } + + return i; +} + +static void addKeywordToList(char * keyword, + struct EXTRACTOR_Keywords ** head, + struct EXTRACTOR_Keywords ** tail) { + + if (*tail != NULL) { + (*tail)->next = addKeyword(NULL, keyword); + *tail = (*tail)->next; + } else { + *tail = addKeyword(NULL, keyword); + *head = *tail; + } +} + + +static int process(char * keyword, + double * thresh, + struct EXTRACTOR_Keywords ** head, + struct EXTRACTOR_Keywords ** tail) { + int i; + int max = 0; + int len; + int p; + int skip; + char * sxdup; + + max = 0; + p = 0; + sxdup = strdup(keyword); + len = strlen(keyword); + for (i=0;i<len;i++) { + if (isprint(keyword[i])) { + keyword[p++] = keyword[i]; + continue; + } + while ( (! isprint(keyword[i+1])) + && (i<len-1) ) + i++; + keyword[p] = 0; + if (wordTest(keyword, thresh)) + max = p; + } + if (wordTest(keyword, thresh)) + max = p; + if (max == 0) { + free(keyword); + if (isprint(sxdup[0])) { + i=0; + while ( (! isprint(sxdup[i+1])) + && (i<len-1) ) + i++; + free(sxdup); + return i+1; + } else { + free(sxdup); + return 1; + } + } + addKeywordToList(xstrndup(keyword, max), + head, + tail); + free(keyword); + p=0; + skip = 0; + for (i=0;i<len;i++) { + if (isprint(sxdup[i])) { + p++; + continue; + } + skip++; + if (p == max) + break; + } + free(sxdup); + return max + skip; +} + +#define MAXBLEN 20 + +static void testKeyword(size_t start, + size_t end, + char * data, + double * thresh, + struct EXTRACTOR_Keywords ** head, + struct EXTRACTOR_Keywords ** tail) { + char * keyword; + int i; + int len; + + len = end-start; + keyword = malloc(len + 1); + memcpy(keyword, &data[start], len); + for (i=len-1; i>=0; i--) + if (keyword[i]==0) keyword[i]=1; + keyword[len] = 0; + if (wordTest(keyword, thresh)) { + addKeywordToList(keyword, + head, + tail); + return; + } + i = 0; + while (len - i > MAXBLEN) { + i += process(xstrndup(&keyword[i], MAXBLEN), + thresh, + head, + tail); + } + process(strdup(&keyword[i]), + thresh, + head, + tail); + free(keyword); +} + +static int isEndOfSentence(char c) { + return ( (c == '.') || + (c == '!') || + (c == '?') ); +} + +static void processSentences(struct EXTRACTOR_Keywords ** head, + struct EXTRACTOR_Keywords ** tail) { + int numSentences = 0; + int numWords = 0; + struct EXTRACTOR_Keywords * pos; + struct EXTRACTOR_Keywords * start; + struct EXTRACTOR_Keywords * rpos; + struct EXTRACTOR_Keywords * last; + char * sentence; + int i; + + start = NULL; + last = NULL; + pos = *head; + while (pos != NULL) { + if ( (strlen(pos->keyword) > 1) || + (! isEndOfSentence(pos->keyword[0]) ) ) { + last = pos; + pos = pos->next; + numWords++; + continue; + } + /* found end of sentence! */ + if ( ( (numWords < 3) || (numWords > 30) ) && + ( (numSentences > 12) || (numWords < 2) ) ) { + /* found reasonable amount of text, + discard "non-sentences" */ + if (start == NULL) { + rpos = *head; + *head = pos->next; + pos->next = NULL; + EXTRACTOR_freeKeywords(rpos); + last = NULL; + pos = *head; + numWords = 0; + continue; + } else { + rpos = start->next; + start->next = pos->next; + pos->next = NULL; + EXTRACTOR_freeKeywords(rpos); + last = start; + pos = start->next; + numWords = 0; + continue; + } + } + + /* found sentence! build & advance start! */ + if (start == NULL) + rpos = *head; + else + rpos = start->next; + i = 1; + while (rpos != pos) { + i += strlen(rpos->keyword) + 1; + rpos = rpos->next; + } + sentence = malloc(i); + sentence[0] = 0; + if (start == NULL) + rpos = *head; + else + rpos = start->next; + while (rpos != pos) { + strcat(sentence, rpos->keyword); + strcat(sentence, " "); + rpos = rpos->next; + } + sentence[strlen(sentence)-1] = pos->keyword[0]; + sentence[i-1] = 0; + + if (start == NULL) + rpos = *head; + else + rpos = start->next; + if (start == NULL) + *head = addKeyword(pos->next, + sentence); + else + start->next = addKeyword(pos->next, + sentence); + pos->next = NULL; + EXTRACTOR_freeKeywords(rpos); + if (start == NULL) + last = start = *head; + else + last = start = start->next; + pos = last->next; + numSentences++; + numWords = 0; + continue; + } + *tail = last; +} + +/* which mime-types should not be subjected to + the printable extractor (e.g. because we have + a more specific extractor available)? */ +static char * blacklist[] = { + "image/jpeg", + "image/gif", + "image/png", + "image/x-png", + "audio/real", + "audio/mp3", + "audio/mpeg", + "application/x-gzip", + "application/x-dpkg", + "application/bz2", + "application/x-rpm", + "application/x-rar", + "application/x-zip", + "application/x-arj", + "application/x-compress", + "application/x-executable", + "application/x-sharedlib", + "application/x-archive", + "application/x-tar", + "application/x-lha", + "application/x-gtar", + "application/x-dpkg", + "application/ogg", + "video/real", + "video/asf", + "video/mpeg", + "video/quicktime", + NULL, +}; + +/* "man strings" gives for now an adequate description of + what we are doing here. EXTRACT_FUNC_NAME is set by + Makefile.am to reflect the library that this code module + is getting compiled into. */ +struct EXTRACTOR_Keywords * EXTRACT_NAME (char * filename, + char * data, + size_t size, + struct EXTRACTOR_Keywords * prev) { + int i; + size_t last; + size_t pos; + const char * mime; + struct EXTRACTOR_Keywords * head = NULL; + struct EXTRACTOR_Keywords * tail = NULL; + double thresh = 2.0; + + /* if the mime-type of the file is blacklisted, don't + run the printable extactor! */ + mime = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, + prev); + if (mime != NULL) { + int j; + j = 0; + while (blacklist[j] != NULL) { + if (0 == strcmp(blacklist[j], mime)) + return prev; + j++; + } + } + + last = 0; + pos = 0; + while (last < size) { + pos = last; + while ( (last < size) && + (!isspace(data[last])) ) + last++; + if ( (last < size) && (!isspace(data[last])) ) + last++; + if (last >= size) + break; + for (i=pos;i<last;i++) { + if ( isEndOfSentence(data[i])) { + testKeyword(pos, i, data, &thresh, &head, &tail); + if ( (i < size-1) && (isspace(data[i+1])) ) { + addKeywordToList(xstrndup(&data[i++],1), + &head, + &tail); + } + pos = i+1; + } else { + if ( (data[i] == ',') || + (data[i] == ';') || + (data[i] == ':') || + (data[i] == '"') ) { + testKeyword(pos, i, data, &thresh, &head, &tail); + pos = i+1; + } + } + } + if (pos > last) + continue; + testKeyword(pos, + last, + data, + &thresh, + &head, + &tail); + while ( (last < size) && + (isspace(data[last])) ) + last++; + } + processSentences(&head, &tail); + + if (tail != NULL) { + tail->next = prev; + prev = head; + } + return prev; +} + + +/* end of printableextractor.c */ diff --git a/src/plugins/rpm/Makefile.am b/src/plugins/rpm/Makefile.am @@ -1,12 +1,4 @@ -INCLUDES = -I$(top_srcdir)/src/include - -EXTRA_DIST = SYMBOLS - -# install plugins under: -plugindir = $(libdir)/libextractor - -LIBS = \ - @LTLIBINTL@ @LIBS@ +include ../Makefile-plugins.am SUBDIRS = . @@ -17,10 +9,8 @@ endif plugin_LTLIBRARIES = \ libextractor_rpm.la -PLUGINFLAGS = -Wl,-Bsymbolic -avoid-version -module -no-undefined - libextractor_rpm_la_SOURCES = \ rpmextractor.c libextractor_rpm_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,SYMBOLS \ + $(PLUGINFLAGS) $(retaincommand) \ $(WINFLAGS) diff --git a/src/plugins/thumbnail/Makefile.am b/src/plugins/thumbnail/Makefile.am @@ -1,16 +1,4 @@ -INCLUDES = \ - -I$(top_srcdir)/src/include \ - @GTK_CFLAGS@ - -EXTRA_DIST = SYMBOLS - -LIBS = \ - @LTLIBINTL@ @LIBS@ - -# install plugins under: -plugindir = $(libdir)/libextractor - -PLUGINFLAGS = -export-dynamic -avoid-version -module +include ../Makefile-plugins.am plugin_LTLIBRARIES = \ libextractor_thumbnail.la @@ -18,11 +6,11 @@ plugin_LTLIBRARIES = \ AM_CFLAGS = $(GLIB_CFLAGS) libextractor_thumbnail_la_CFLAGS = \ - $(GLIB_CFLAGS) + $(GLIB_CFLAGS) libextractor_thumbnail_la_LIBADD = \ $(LIBADD) -lgobject-2.0 @GTK_LIBS@ \ $(top_builddir)/src/main/libextractor.la libextractor_thumbnail_la_LDFLAGS = \ - $(PLUGINFLAGS) -Wl,--retain-symbols-file -Wl,SYMBOLS + $(PLUGINFLAGS) $(retaincommand) libextractor_thumbnail_la_SOURCES = \ thumbnailextractor.c