diff options
26 files changed, 454 insertions, 220 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README index 5117901806a..63fcd890ccd 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -59,7 +59,7 @@ dvipos - ? dvipsk - maintained here, by us -dvisvgm 1.14.1 - checked 6jan16 +dvisvgm 1.14.2 - checked 20jan16 http://dvisvgm.bplaced.net/Downloads gregorio 4.0.1 - checked 29dec15 diff --git a/Build/source/texk/dvisvgm/ChangeLog b/Build/source/texk/dvisvgm/ChangeLog index 2462ea486f4..7e537680144 100644 --- a/Build/source/texk/dvisvgm/ChangeLog +++ b/Build/source/texk/dvisvgm/ChangeLog @@ -1,3 +1,8 @@ +2016-01-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Imported release 1.14.2 + * version.ac: Adapted. + 2016-01-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Imported release 1.14.1 diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure index 9f85ebe09be..85f1fdcce5f 100755 --- a/Build/source/texk/dvisvgm/configure +++ b/Build/source/texk/dvisvgm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dvisvgm (TeX Live) 1.14.1. +# Generated by GNU Autoconf 2.69 for dvisvgm (TeX Live) 1.14.2. # # Report bugs to <tex-k@tug.org>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvisvgm (TeX Live)' PACKAGE_TARNAME='dvisvgm--tex-live-' -PACKAGE_VERSION='1.14.1' -PACKAGE_STRING='dvisvgm (TeX Live) 1.14.1' +PACKAGE_VERSION='1.14.2' +PACKAGE_STRING='dvisvgm (TeX Live) 1.14.2' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1372,7 +1372,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dvisvgm (TeX Live) 1.14.1 to adapt to many kinds of systems. +\`configure' configures dvisvgm (TeX Live) 1.14.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1443,7 +1443,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dvisvgm (TeX Live) 1.14.1:";; + short | recursive ) echo "Configuration of dvisvgm (TeX Live) 1.14.2:";; esac cat <<\_ACEOF @@ -1583,7 +1583,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dvisvgm (TeX Live) configure 1.14.1 +dvisvgm (TeX Live) configure 1.14.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2451,7 +2451,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dvisvgm (TeX Live) $as_me 1.14.1, which was +It was created by dvisvgm (TeX Live) $as_me 1.14.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -8137,7 +8137,7 @@ fi # Define the identity of the package. PACKAGE='dvisvgm--tex-live-' - VERSION='1.14.1' + VERSION='1.14.2' cat >>confdefs.h <<_ACEOF @@ -18321,7 +18321,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -dvisvgm (TeX Live) config.lt 1.14.1 +dvisvgm (TeX Live) config.lt 1.14.2 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -20684,7 +20684,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dvisvgm (TeX Live) $as_me 1.14.1, which was +This file was extended by dvisvgm (TeX Live) $as_me 1.14.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20750,7 +20750,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dvisvgm (TeX Live) config.status 1.14.1 +dvisvgm (TeX Live) config.status 1.14.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog index 61c49bf6889..2560022a69e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog +++ b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/ChangeLog @@ -1,3 +1,7 @@ +2016-01-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Import release 1.14.2 + 2016-01-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Import release 1.14.1 diff --git a/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes index 3bda464c94c..fb6f32467a9 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes +++ b/Build/source/texk/dvisvgm/dvisvgm-src-PATCHES/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the dvisvgm-1.14.1 tree as obtained from: +Changes applied to the dvisvgm-1.14.2 tree as obtained from: http://dvisvgm.bplaced.net/Downloads Removed: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS index d3db68be3b7..e0ac3632d8b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/NEWS +++ b/Build/source/texk/dvisvgm/dvisvgm-src/NEWS @@ -1,3 +1,11 @@ +dvisvgm-1.14.2 (2016-01-20) +- fixed handling of background color specials (now they affect all succeeding pages until the next change) +- fixed a potential memory issue caused by accessing an invalid iterator +- updated xxHash to version 0.5.0 +- added xxHash to the output of --version=1 +- minor additions to the manpage +- added test case to validate the hash values used in Unicode.cpp + dvisvgm-1.14.1 (2016-01-05) - fixed an issue in the PostScript handler that could lead to invalid SVG files if multiple DVI pages were converted diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac index 500f3384cbf..2c1843e327e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac +++ b/Build/source/texk/dvisvgm/dvisvgm-src/configure.ac @@ -4,7 +4,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([dvisvgm],[1.14.1],[martin.gieseking@uos.de]) +AC_INIT([dvisvgm],[1.14.2],[martin.gieseking@uos.de]) DATE="January 2016" AC_CONFIG_SRCDIR(src) AC_CONFIG_HEADER(config.h) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 index 4ab8dd20936..7ff07f0015f 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.1 @@ -2,12 +2,12 @@ .\" Title: dvisvgm .\" Author: Martin Gieseking <martin.gieseking@uos.de> .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 01/05/2016 +.\" Date: 01/20/2016 .\" Manual: dvisvgm Manual -.\" Source: dvisvgm 1.14.1 +.\" Source: dvisvgm 1.14.2 .\" Language: English .\" -.TH "DVISVGM" "1" "01/05/2016" "dvisvgm 1\&.14\&.1" "dvisvgm Manual" +.TH "DVISVGM" "1" "01/20/2016" "dvisvgm 1\&.14\&.2" "dvisvgm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,10 +46,12 @@ However, TeX\(cqs main source for font descriptions is Metafont, which produces .sp When running dvisvgm without option \fB\-\-no\-fonts\fR, it creates \fIfont\fR elements (\fB<font>\fR\&...\fB</font>\fR) to embed the font data into the SVG files\&. Unfortunately, only few SVG renderes support these elements yet\&. Most web browsers and vector graphics applications don\(cqt evaluate them properly so that the text components of the resulting graphics might look strange\&. In order to create more compatible SVG files, command\-line option \fB\-\-no\-fonts\fR can be given to replace the font elements by plain graphics paths\&. .SH "OPTIONS" +.sp +dvisvgm provides a POSIX\-compliant command\-line interface with short and long option names\&. They may be given before and/or after the name of the file to be converted\&. Also, the order of specifying the options is not significant, i\&.e\&. you can add them in any order without changing dvisvgm\(cqs behavior\&. Certain options accept or require additional parameters which are directly appended to or separated by whitespace from a short option (e\&.g\&. \fB\-v0\fR or \fB\-v 0\fR)\&. Long options require an additional equals sign (\fB=\fR) between option name and argument but without any surrounding whitespace (e\&.g\&. \fB\-\-verbosity=0\fR)\&. .PP \fB\-a, \-\-trace\-all\fR=[\fIretrace\fR] .RS 4 -This option forces dvisvgm to vectorize not only the glyphs actually required to render the SVG file correctly \(en which is the default \(en, but processes all glyphs of all fonts referenced in the DVI file\&. Because dvisvgm stores the tracing results a font cache, all following conversions these fonts will speed up significantly\&. The boolean option +This option forces dvisvgm to vectorize not only the glyphs actually required to render the SVG file correctly \(en which is the default \(en, but processes all glyphs of all fonts referenced in the DVI file\&. Because dvisvgm stores the tracing results in a font cache, all following conversions of these fonts will speed up significantly\&. The boolean option \fIretrace\fR determines how to handle glyphs already stored in the cache\&. By default, these glyphs are skipped\&. Setting argument \fIretrace\fR diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in index 432e83c1463..c16d147a2bc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/doc/dvisvgm.txt.in @@ -71,11 +71,19 @@ by plain graphics paths. OPTIONS ------- +dvisvgm provides a POSIX-compliant command-line interface with short and long option names. +They may be given before and/or after the name of the file to be converted. Also, the order of +specifying the options is not significant, i.e. you can add them in any order without changing +dvisvgm's behavior. Certain options accept or require additional parameters which are directly +appended to or separated by whitespace from a short option (e.g. +-v0+ or +-v 0+). Long options +require an additional equals sign (+=+) between option name and argument but without any surrounding +whitespace (e.g. +--verbosity=0+). + *-a, --trace-all*=['retrace']:: This option forces dvisvgm to vectorize not only the glyphs actually required to render the SVG file correctly – which is the default –, but processes all glyphs of all fonts referenced in -the DVI file. Because dvisvgm stores the tracing results a font cache, all following conversions these -fonts will speed up significantly. +the DVI file. Because dvisvgm stores the tracing results in a font cache, all following conversions +of these fonts will speed up significantly. The boolean option 'retrace' determines how to handle glyphs already stored in the cache. By default, these glyphs are skipped. Setting argument 'retrace' to 'yes' or 'true' forces dvisvgm to retrace the corresponding bitmaps again. diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp index 89523695683..f1f19cc7691 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.cpp @@ -19,6 +19,7 @@ *************************************************************************/ #include <config.h> +#include <algorithm> #include "BgColorSpecialHandler.h" #include "ColorSpecialHandler.h" #include "SpecialActions.h" @@ -26,9 +27,46 @@ using namespace std; -bool BgColorSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - ColorSpecialHandler csh; - return csh.process(prefix, is, actions); +/** Collect all background color changes while preprocessing the DVI file. + * We need them in order to apply the correct background colors even if + * not all but only selected DVI pages are converted. */ +void BgColorSpecialHandler::preprocess (const char*, std::istream &is, SpecialActions *actions) { + Color color = ColorSpecialHandler::readColor(is); + unsigned pageno = actions->getCurrentPageNumber(); + if (_pageColors.empty() || _pageColors.back().second != color) { + if (!_pageColors.empty() && _pageColors.back().first == pageno) + _pageColors.back().second = color; + else + _pageColors.push_back(PageColor(pageno, color)); + } + _actions = actions; +} + + +bool BgColorSpecialHandler::process (const char*, istream&, SpecialActions*) { + return true; +} + + +static bool operator < (const pair<unsigned,Color> &pc1, const pair<unsigned,Color> &pc2) { + // order PageColor objects by page number + return pc1.first < pc2.first; +} + + +void BgColorSpecialHandler::dviBeginPage (unsigned pageno) { + // Ensure that the background color of the preceeding page is set as the + // default background color of the current page because this special affects + // the current and all subsequent pages until the next change. + // See the documentation of the color package, section 3.5. + if (_pageColors.empty()) + return; + // find number of page with bg color change not lower than the current one + vector<PageColor>::iterator it = lower_bound(_pageColors.begin(), _pageColors.end(), PageColor(pageno, Color::BLACK)); + if (it != _pageColors.end() && it->first == pageno) + _actions->setBgColor(it->second); + else if (it != _pageColors.begin()) + _actions->setBgColor((--it)->second); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h index 17bd2ab3e7b..772e41541f5 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BgColorSpecialHandler.h @@ -21,14 +21,26 @@ #ifndef DVISVGM_BGCOLORSPECIALHANDLER_H #define DVISVGM_BGCOLORSPECIALHANDLER_H +#include <vector> +#include "Color.h" #include "SpecialHandler.h" -struct BgColorSpecialHandler : SpecialHandler + +class BgColorSpecialHandler : public SpecialHandler, public DVIBeginPageListener { - const char* info () const {return "background color special";} - const char* name () const {return "bgcolor";} - const char** prefixes () const; - bool process (const char *prefix, std::istream &is, SpecialActions *actions); + public: + BgColorSpecialHandler () : _actions(0) {} + void preprocess (const char *prefix, std::istream &is, SpecialActions *actions); + bool process (const char *prefix, std::istream &is, SpecialActions *actions); + void dviBeginPage (unsigned pageno); + const char* info () const {return "background color special";} + const char* name () const {return "bgcolor";} + const char** prefixes () const; + + private: + typedef std::pair<unsigned,Color> PageColor; // page number and color + SpecialActions *_actions; + std::vector<PageColor> _pageColors; }; #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp index 3b8681de94c..f61de4768ca 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.cpp @@ -19,10 +19,7 @@ *************************************************************************/ #include <config.h> -#include <algorithm> -#include <cmath> #include <cstring> -#include <iomanip> #include <sstream> #include <vector> #include "ColorSpecialHandler.h" @@ -51,18 +48,16 @@ static void read_doubles (istream &is, vector<double> &v) { } -/** Reads a color statement from an input stream and converts it to RGB. +/** Reads a color statement from an input stream and converts it to a color object. * A color statement has the following syntax: * _color model_ _component values_ * Currently, the following color models are supported: rgb, cmyk, hsb and gray. * Examples: rgb 1 0.5 0, gray 0.5 - * @param[in] model if model != "" this value specifies the model, otherwise it's read from the stream + * @param[in] model the color model * @param[in] is stream to be read from - * @param[out] color italicresulting RGB triple - * @return true if statement has successfully been read */ -static void read_color (string model, istream &is, Color &color) { - if (model.empty()) - is >> model; + * @return resulting Color object */ +Color ColorSpecialHandler::readColor (const string &model, istream &is) { + Color color; if (model == "rgb") { vector<double> rgb(3); read_doubles(is, rgb); @@ -82,38 +77,40 @@ static void read_color (string model, istream &is, Color &color) { color.setGray(read_double(is)); else if (!color.setPSName(model, true)) throw SpecialException("unknown color statement"); + return color; } -bool ColorSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) { - Color color; - if (prefix && strcmp(prefix, "background") == 0) { - read_color("", is, color); - actions->setBgColor(color); +/** Reads the color model (rgb, cmyk, hsb, or gray) and the corresponding color compontents + * from a given input stream. + * @param[in] is stream to be read from + * @return resulting Color object */ +Color ColorSpecialHandler::readColor (istream &is) { + string model; + is >> model; + return readColor(model, is); +} + + +bool ColorSpecialHandler::process (const char*, istream &is, SpecialActions *actions) { + string cmd; + is >> cmd; + if (cmd == "push") // color push <model> <params> + _colorStack.push(readColor(is)); + else if (cmd == "pop") { + if (!_colorStack.empty()) // color pop + _colorStack.pop(); + } + else { // color <model> <params> + while (!_colorStack.empty()) + _colorStack.pop(); + _colorStack.push(readColor(cmd, is)); } - else { - string cmd; - is >> cmd; - if (cmd == "push") { // color push <model> <params> - read_color("", is, color); - _colorStack.push(color); - } - else if (cmd == "pop") { - if (!_colorStack.empty()) // color pop - _colorStack.pop(); - } - else { // color <model> <params> - read_color(cmd, is, color); - while (!_colorStack.empty()) - _colorStack.pop(); - _colorStack.push(color); - } - if (actions) { - if (_colorStack.empty()) - actions->setColor(Color::BLACK); - else - actions->setColor(_colorStack.top()); - } + if (actions) { + if (_colorStack.empty()) + actions->setColor(Color::BLACK); + else + actions->setColor(_colorStack.top()); } return true; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h index 7d401d96b86..d1bbd2e0c95 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/ColorSpecialHandler.h @@ -22,6 +22,7 @@ #define DVISVGM_COLORSPECIALHANDLER_H #include <stack> +#include <string> #include <vector> #include "Color.h" #include "SpecialHandler.h" @@ -31,6 +32,8 @@ class ColorSpecialHandler : public SpecialHandler { public: bool process (const char *prefix, std::istream &is, SpecialActions *actions); + static Color readColor (std::istream &is); + static Color readColor (const std::string &model, std::istream &is); const char* name () const {return "color";} const char* info () const {return "complete support of color specials";} const char** prefixes () const; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h index d161b1f6ac2..19a5042625a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIReader.h @@ -129,8 +129,9 @@ class DVIReader : public BasicDVIReader, protected VFActions double _dvi2bp; ///< factor to convert dvi units to PS points UInt32 _mag; ///< magnification factor * 1000 bool _inPostamble; ///< true if stream pointer is inside the postamble - double _pageHeight, _pageWidth; ///< page height and width in PS points - DVIState _dviState; ///< current cursor position + double _pageHeight; ///< page height in PS points + double _pageWidth; ///< page width in PS points + DVIState _dviState; ///< registers of the DVI processor std::stack<DVIState> _stateStack; std::vector<UInt32> _bopOffsets; double _prevYPos; ///< previous vertical cursor position diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp index b13af95158f..f93a1a49c81 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/DVIToSVG.cpp @@ -150,6 +150,7 @@ void DVIToSVG::beginPage (unsigned pageno, Int32 *c) { Message::mstream(false) << " [" << c[0] << ']'; Message::mstream().indent(1); _svg.appendToDoc(new XMLCommentNode(" This file was generated by dvisvgm " VERSION " ")); + SpecialManager::instance().notifyBeginPage(pageno); } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h index 932c09291cc..4594986a2dc 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FontStyle.h @@ -1,3 +1,23 @@ +/************************************************************************* +** FontStyle.h ** +** ** +** This file is part of dvisvgm -- a fast DVI to SVG converter ** +** Copyright (C) 2005-2016 Martin Gieseking <martin.gieseking@uos.de> ** +** ** +** This program 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 3 of ** +** the License, or (at your option) any later version. ** +** ** +** This program 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 this program; if not, see <http://www.gnu.org/licenses/>. ** +*************************************************************************/ + #ifndef FONTSTYLE #define FONTSTYLE diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h index d065e250c14..b55efdb35dd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/GraphicsPath.h @@ -202,10 +202,12 @@ class GraphicsPath return; Iterator prev = it++; while (it != _commands.end()) { - if (prev->type == Command::MOVETO && it->type == Command::MOVETO) - _commands.erase(prev); - else + if (prev->type != Command::MOVETO || it->type != Command::MOVETO) prev = it++; + else { + prev = _commands.erase(prev); // remove leading MOVETO and advance 'prev' to 'it' + ++it; + } } } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp index 867914b322f..0d8310748ee 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SVGTree.cpp @@ -116,7 +116,7 @@ void SVGTree::appendToPage (XMLNode *node) { _page->append(node); else _pageContainerStack.top()->append(node); - if (node != _text) // if the appended node differ from text element currently in use, + if (node != _text) // if the appended node differs from the text element currently in use, _text = 0; // then force creating a new text element for the following characters } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h index 3301af7dc57..94d39835e5a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialHandler.h @@ -43,6 +43,13 @@ struct DVIPreprocessingListener }; +struct DVIBeginPageListener +{ + virtual ~DVIBeginPageListener () {} + virtual void dviBeginPage (unsigned pageno) =0; +}; + + struct DVIEndPageListener { virtual ~DVIEndPageListener () {} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp index 5b96c6117aa..6abec223167 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.cpp @@ -65,6 +65,8 @@ void SpecialManager::registerHandler (SpecialHandler *handler) { _handlers[*p] = handler; if (DVIPreprocessingListener *listener = dynamic_cast<DVIPreprocessingListener*>(handler)) _preprocListeners.push_back(listener); + if (DVIBeginPageListener *listener = dynamic_cast<DVIBeginPageListener*>(handler)) + _beginPageListeners.push_back(listener); if (DVIEndPageListener *listener = dynamic_cast<DVIEndPageListener*>(handler)) _endPageListeners.push_back(listener); if (DVIPositionListener *listener = dynamic_cast<DVIPositionListener*>(handler)) @@ -153,6 +155,12 @@ void SpecialManager::notifyPreprocessingFinished () const { } +void SpecialManager::notifyBeginPage (unsigned pageno) const { + FORALL(_beginPageListeners, vector<DVIBeginPageListener*>::const_iterator, it) + (*it)->dviBeginPage(pageno); +} + + void SpecialManager::notifyEndPage (unsigned pageno) const { FORALL(_endPageListeners, vector<DVIEndPageListener*>::const_iterator, it) (*it)->dviEndPage(pageno); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h index 6985671b64e..c8f5d6ad446 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.h @@ -46,6 +46,7 @@ class SpecialManager void preprocess (const std::string &special, SpecialActions *actions) const; bool process (const std::string &special, double dvi2bp, SpecialActions *actions) const; void notifyPreprocessingFinished () const; + void notifyBeginPage (unsigned pageno) const; void notifyEndPage (unsigned pageno) const; void notifyPositionChange (double x, double y) const; void writeHandlerInfo (std::ostream &os) const; @@ -59,6 +60,7 @@ class SpecialManager HandlerPool _pool; ///< stores pointers to all handlers HandlerMap _handlers; ///< pointers to handlers for corresponding prefixes std::vector<DVIPreprocessingListener*> _preprocListeners; + std::vector<DVIBeginPageListener*> _beginPageListeners; std::vector<DVIEndPageListener*> _endPageListeners; std::vector<DVIPositionListener*> _positionListeners; }; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp index 43618004362..75bb69a27d6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TriangularPatch.cpp @@ -174,7 +174,7 @@ void TriangularPatch::approximate (int gridsize, bool overlap, double delta, Cal double v2 = snap(v1+inc); double ov2 = (overlap && snap(v2+inc) <= 1 ? snap(v2+inc) : v2); if (!overlap || (snap(u1+ov2) <= 1 && snap(ou2+v1) <= 1)) { - // create triangular segments pointing in the same orientation as the whole patch + // create triangular segments pointing in the same direction as the whole patch GraphicsPath<double> path; path.moveto(valueAt(u1, v1)); path.lineto(valueAt(ou2, v1)); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp index b445c6c4d3c..073b5bd2045 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/dvisvgm.cpp @@ -24,6 +24,7 @@ #include <iostream> #include <sstream> #include <string> +#include <xxhash.h> #include "gzstream.h" #include "CommandLine.h" #include "DVIToSVG.h" @@ -175,6 +176,7 @@ static void print_version (bool extended) { string gsver = gs.revision(true); if (!gsver.empty()) oss << "Ghostscript: " << gsver + "\n"; + const unsigned xxh_ver = XXH_versionNumber(); oss << #ifdef MIKTEX "MiKTeX: " << FileFinder::version() << "\n" @@ -182,6 +184,7 @@ static void print_version (bool extended) { "kpathsea: " << FileFinder::version() << "\n" #endif "potrace: " << (strchr(potrace_version(), ' ') ? strchr(potrace_version(), ' ')+1 : "unknown") << "\n" + "xxhash: " << xxh_ver/10000 << '.' << (xxh_ver/100)%100 << '.' << xxh_ver%100 << "\n" "zlib: " << zlibVersion(); } cout << oss.str() << endl; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c index 511d9941a25..35f53155a66 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c +++ b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.c @@ -1,6 +1,6 @@ /* xxHash - Fast Hash algorithm -Copyright (C) 2012-2015, Yann Collet +Copyright (C) 2012-2016, Yann Collet BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) @@ -32,18 +32,18 @@ You can contact the author at : */ -/************************************** +/* ************************************* * Tuning parameters -**************************************/ -/* XXH_FORCE_MEMORY_ACCESS +***************************************/ +/*!XXH_FORCE_MEMORY_ACCESS * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. * The below switch allow to select different access method for improved performance. * Method 0 (default) : use `memcpy()`. Safe and portable. * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets which generate assembly depending on alignment. + * Method 2 : direct access. This method doesn't depend on compiler but violate C standard. + * It can generate buggy code on targets which do not support unaligned memory accesses. * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) * See http://stackoverflow.com/a/32095106/646947 for details. * Prefer these methods in priority order (0 > 1 > 2) @@ -57,14 +57,14 @@ You can contact the author at : # endif #endif -/* XXH_ACCEPT_NULL_INPUT_POINTER : +/*!XXH_ACCEPT_NULL_INPUT_POINTER : * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. * By default, this option is disabled. To enable it, uncomment below define : */ /* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */ -/* XXH_FORCE_NATIVE_FORMAT : +/*!XXH_FORCE_NATIVE_FORMAT : * By default, xxHash library provides endian-independant Hash values, based on little-endian convention. * Results are therefore identical for little-endian and big-endian CPU. * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. @@ -74,9 +74,9 @@ You can contact the author at : */ #define XXH_FORCE_NATIVE_FORMAT 0 -/* XXH_USELESS_ALIGN_BRANCH : +/*!XXH_USELESS_ALIGN_BRANCH : * This is a minor performance trick, only useful with lots of very small keys. - * It means : don't make a test between aligned/unaligned, because performance will be the same. + * It means : don't check for aligned/unaligned input, because performance will be the same. * It saves one initial branch per hash. */ #if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) @@ -84,7 +84,7 @@ You can contact the author at : #endif -/************************************** +/* ************************************* * Compiler Specific Options ***************************************/ #ifdef _MSC_VER /* Visual Studio */ @@ -103,10 +103,9 @@ You can contact the author at : #endif -/************************************** +/* ************************************* * Includes & Memory related functions ***************************************/ -#include "xxhash.h" /* Modify the local functions below should you wish to use some other memory routines */ /* for malloc(), free() */ #include <stdlib.h> @@ -116,23 +115,28 @@ static void XXH_free (void* p) { free(p); } #include <string.h> static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } +#include "xxhash.h" + -/************************************** +/* ************************************* * Basic Types ***************************************/ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# include <stdint.h> - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef uint32_t U32; - typedef int32_t S32; - typedef uint64_t U64; -#else - typedef unsigned char BYTE; - typedef unsigned short U16; - typedef unsigned int U32; - typedef signed int S32; - typedef unsigned long long U64; +#ifndef MEM_MODULE +# define MEM_MODULE +# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# include <stdint.h> + typedef uint8_t BYTE; + typedef uint16_t U16; + typedef uint32_t U32; + typedef int32_t S32; + typedef uint64_t U64; +# else + typedef unsigned char BYTE; + typedef unsigned short U16; + typedef unsigned int U32; + typedef signed int S32; + typedef unsigned long long U64; +# endif #endif @@ -171,10 +175,10 @@ static U64 XXH_read64(const void* memPtr) return val; } -#endif // XXH_FORCE_DIRECT_MEMORY_ACCESS +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ -/****************************************** +/* **************************************** * Compiler-specific Functions and Macros ******************************************/ #define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) @@ -216,19 +220,19 @@ static U64 XXH_swap64 (U64 x) #endif -/*************************************** +/* ************************************* * Architecture Macros ***************************************/ typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; -/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example one the compiler command line */ +/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */ #ifndef XXH_CPU_LITTLE_ENDIAN - static const int one = 1; -# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&one)) + static const int g_one = 1; +# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&g_one)) #endif -/***************************** +/* *************************** * Memory reads *****************************/ typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; @@ -246,6 +250,11 @@ FORCE_INLINE U32 XXH_readLE32(const void* ptr, XXH_endianess endian) return XXH_readLE32_align(ptr, endian, XXH_unaligned); } +static U32 XXH_readBE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); +} + FORCE_INLINE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align) { if (align==XXH_unaligned) @@ -259,14 +268,19 @@ FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) return XXH_readLE64_align(ptr, endian, XXH_unaligned); } +static U64 XXH_readBE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); +} + -/*************************************** +/* ************************************* * Macros ***************************************/ -#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(!!(c)) }; } /* use only *after* variable declarations */ +#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ -/*************************************** +/* ************************************* * Constants ***************************************/ #define PRIME32_1 2654435761U @@ -281,8 +295,10 @@ FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) #define PRIME64_4 9650029242287828579ULL #define PRIME64_5 2870177450012600261ULL +XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } + -/***************************** +/* *************************** * Simple Hash Functions *****************************/ FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align) @@ -362,14 +378,14 @@ FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH } -unsigned int XXH32 (const void* input, size_t len, unsigned int seed) +XXH_PUBLIC_API unsigned int XXH32 (const void* input, size_t len, unsigned int seed) { #if 0 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH32_state_t state; - XXH32_reset(&state, seed); - XXH32_update(&state, input, len); - return XXH32_digest(&state); + XXH32_CREATESTATE_STATIC(state); + XXH32_reset(state, seed); + XXH32_update(state, input, len); + return XXH32_digest(state); #else XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; @@ -502,14 +518,14 @@ FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH } -unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) +XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) { #if 0 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH64_state_t state; - XXH64_reset(&state, seed); - XXH64_update(&state, input, len); - return XXH64_digest(&state); + XXH64_CREATESTATE_STATIC(state); + XXH64_reset(state, seed); + XXH64_update(state, input, len); + return XXH64_digest(state); #else XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; @@ -530,12 +546,12 @@ unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed #endif } -/**************************************************** +/* ************************************************** * Advanced Hash Functions ****************************************************/ /*** Allocation ***/ -typedef struct +struct XXH32_state_s { U64 total_len; U32 seed; @@ -545,9 +561,9 @@ typedef struct U32 v4; U32 mem32[4]; /* defined as U32 for alignment */ U32 memsize; -} XXH_istate32_t; +}; /* typedef'd to XXH32_state_t within xxhash.h */ -typedef struct +struct XXH64_state_s { U64 total_len; U64 seed; @@ -557,26 +573,26 @@ typedef struct U64 v4; U64 mem64[4]; /* defined as U64 for alignment */ U32 memsize; -} XXH_istate64_t; +}; /* typedef'd to XXH64_state_t within xxhash.h */ -XXH32_state_t* XXH32_createState(void) +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) { - XXH_STATIC_ASSERT(sizeof(XXH32_state_t) >= sizeof(XXH_istate32_t)); /* A compilation error here means XXH32_state_t is not large enough */ + XXH_STATIC_ASSERT(sizeof(XXH32_stateBody_t) >= sizeof(XXH32_state_t)); /* A compilation error here means XXH32_state_t is not large enough */ return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); } -XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } -XXH64_state_t* XXH64_createState(void) +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) { - XXH_STATIC_ASSERT(sizeof(XXH64_state_t) >= sizeof(XXH_istate64_t)); /* A compilation error here means XXH64_state_t is not large enough */ + XXH_STATIC_ASSERT(sizeof(XXH64_stateBody_t) >= sizeof(XXH64_state_t)); /* A compilation error here means XXH64_state_t is not large enough */ return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); } -XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; @@ -585,36 +601,36 @@ XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) /*** Hash feed ***/ -XXH_errorcode XXH32_reset(XXH32_state_t* state_in, unsigned int seed) +XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, unsigned int seed) { - XXH_istate32_t* state = (XXH_istate32_t*) state_in; - state->seed = seed; - state->v1 = seed + PRIME32_1 + PRIME32_2; - state->v2 = seed + PRIME32_2; - state->v3 = seed + 0; - state->v4 = seed - PRIME32_1; - state->total_len = 0; - state->memsize = 0; + XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ + memset(&state, 0, sizeof(state)); + state.seed = seed; + state.v1 = seed + PRIME32_1 + PRIME32_2; + state.v2 = seed + PRIME32_2; + state.v3 = seed + 0; + state.v4 = seed - PRIME32_1; + memcpy(statePtr, &state, sizeof(state)); return XXH_OK; } -XXH_errorcode XXH64_reset(XXH64_state_t* state_in, unsigned long long seed) + +XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, unsigned long long seed) { - XXH_istate64_t* state = (XXH_istate64_t*) state_in; - state->seed = seed; - state->v1 = seed + PRIME64_1 + PRIME64_2; - state->v2 = seed + PRIME64_2; - state->v3 = seed + 0; - state->v4 = seed - PRIME64_1; - state->total_len = 0; - state->memsize = 0; + XXH64_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ + memset(&state, 0, sizeof(state)); + state.seed = seed; + state.v1 = seed + PRIME64_1 + PRIME64_2; + state.v2 = seed + PRIME64_2; + state.v3 = seed + 0; + state.v4 = seed - PRIME64_1; + memcpy(statePtr, &state, sizeof(state)); return XXH_OK; } -FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state_in, const void* input, size_t len, XXH_endianess endian) +FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state, const void* input, size_t len, XXH_endianess endian) { - XXH_istate32_t* state = (XXH_istate32_t *) state_in; const BYTE* p = (const BYTE*)input; const BYTE* const bEnd = p + len; @@ -701,7 +717,7 @@ FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state_in, const v return XXH_OK; } -XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) +XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) { XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; @@ -713,9 +729,8 @@ XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t l -FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state_in, XXH_endianess endian) +FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state, XXH_endianess endian) { - const XXH_istate32_t* state = (const XXH_istate32_t*) state_in; const BYTE * p = (const BYTE*)state->mem32; const BYTE* bEnd = (const BYTE*)(state->mem32) + state->memsize; U32 h32; @@ -755,7 +770,7 @@ FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state_in, XXH_endiane } -unsigned int XXH32_digest (const XXH32_state_t* state_in) +XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t* state_in) { XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; @@ -766,9 +781,11 @@ unsigned int XXH32_digest (const XXH32_state_t* state_in) } -FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state_in, const void* input, size_t len, XXH_endianess endian) + +/* **** XXH64 **** */ + +FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state, const void* input, size_t len, XXH_endianess endian) { - XXH_istate64_t * state = (XXH_istate64_t *) state_in; const BYTE* p = (const BYTE*)input; const BYTE* const bEnd = p + len; @@ -855,7 +872,7 @@ FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state_in, const v return XXH_OK; } -XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) { XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; @@ -867,9 +884,8 @@ XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t l -FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state_in, XXH_endianess endian) +FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state, XXH_endianess endian) { - const XXH_istate64_t * state = (const XXH_istate64_t *) state_in; const BYTE * p = (const BYTE*)state->mem64; const BYTE* bEnd = (const BYTE*)state->mem64 + state->memsize; U64 h64; @@ -949,7 +965,7 @@ FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state_in, XXH_endiane } -unsigned long long XXH64_digest (const XXH64_state_t* state_in) +XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t* state_in) { XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; @@ -960,3 +976,37 @@ unsigned long long XXH64_digest (const XXH64_state_t* state_in) } +/* ************************** +* Canonical representation +****************************/ + +/*! Default XXH result types are basic unsigned 32 and 64 bits. +* The canonical representation follows human-readable write convention, aka big-endian (large digits first). +* These functions allow transformation of hash result into and from its canonical format. +* This way, hash values can be written into a file or buffer, and remain comparable across different systems and programs. +*/ + +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); + memcpy(dst, &hash, sizeof(*dst)); +} + +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); + memcpy(dst, &hash, sizeof(*dst)); +} + +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) +{ + return XXH_readBE32(src); +} + +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) +{ + return XXH_readBE64(src); +} + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h index c60aa61571c..8fa3da6424e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/xxHash/xxhash.h @@ -1,7 +1,7 @@ /* xxHash - Extremely Fast Hash algorithm Header File - Copyright (C) 2012-2015, Yann Collet. + Copyright (C) 2012-2016, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) @@ -64,41 +64,64 @@ XXH64 13.8 GB/s 1.9 GB/s XXH32 6.8 GB/s 6.0 GB/s */ -#pragma once +#ifndef XXHASH_H_5627135585666179 +#define XXHASH_H_5627135585666179 1 #if defined (__cplusplus) extern "C" { #endif -/***************************** +/* **************************** * Definitions -*****************************/ +******************************/ #include <stddef.h> /* size_t */ typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; -/***************************** -* Namespace Emulation -*****************************/ -/* Motivations : +/* **************************** +* API modifier +******************************/ +/*!XXH_PRIVATE_API +* Transforms all publics symbols within `xxhash.c` into private ones. +* Methodology : +* instead of : #include "xxhash.h" +* do : +* #define XXH_PRIVATE_API +* #include "xxhash.c" // note the .c , instead of .h +* also : don't compile and link xxhash.c separately +*/ +#ifdef XXH_PRIVATE_API +# if defined(__GNUC__) +# define XXH_PUBLIC_API static __attribute__((unused)) +# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# define XXH_PUBLIC_API static inline +# elif defined(_MSC_VER) +# define XXH_PUBLIC_API static __inline +# else +# define XXH_PUBLIC_API static /* this version may generate warnings for unused static functions; disable the relevant warning */ +# endif +#else +# define XXH_PUBLIC_API /* do nothing */ +#endif + +/*!XXH_NAMESPACE, aka Namespace Emulation : -If you need to include xxHash into your library, -but wish to avoid xxHash symbols to be present on your library interface -in an effort to avoid potential name collision if another library also includes xxHash, +If you want to include _and expose_ xxHash functions from within your own library, +but also want to avoid symbol collisions with another library which also includes xxHash, -you can use XXH_NAMESPACE, which will automatically prefix any symbol from xxHash -with the value of XXH_NAMESPACE (so avoid to keep it NULL, and avoid numeric values). +you can use XXH_NAMESPACE, to automatically prefix any public symbol from `xxhash.c` +with the value of XXH_NAMESPACE (so avoid to keep it NULL and avoid numeric values). -Note that no change is required within the calling program : -it can still call xxHash functions using their regular name. -They will be automatically translated by this header. +Note that no change is required within the calling program as long as it also includes `xxhash.h` : +regular symbol name will be automatically translated by this header. */ #ifdef XXH_NAMESPACE # define XXH_CAT(A,B) A##B # define XXH_NAME2(A,B) XXH_CAT(A,B) # define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) # define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) +# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) # define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) # define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) # define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) @@ -112,81 +135,121 @@ They will be automatically translated by this header. #endif -/***************************** +/* ************************************* +* Version +***************************************/ +#define XXH_VERSION_MAJOR 0 +#define XXH_VERSION_MINOR 5 +#define XXH_VERSION_RELEASE 0 +#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) +XXH_PUBLIC_API unsigned XXH_versionNumber (void); + + +/* **************************** * Simple Hash Functions -*****************************/ +******************************/ +typedef unsigned int XXH32_hash_t; +typedef unsigned long long XXH64_hash_t; -unsigned int XXH32 (const void* input, size_t length, unsigned seed); -unsigned long long XXH64 (const void* input, size_t length, unsigned long long seed); +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed); +XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed); -/* +/*! XXH32() : Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". The memory between input & input+length must be valid (allocated and read-accessible). "seed" can be used to alter the result predictably. - This function successfully passes all SMHasher tests. Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s XXH64() : Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". - Faster on 64-bits systems. Slower on 32-bits systems. + "seed" can be used to alter the result predictably. + This function runs faster on 64-bits systems, but slower on 32-bits systems (see benchmark). */ +/* **************************** +* Streaming Hash Functions +******************************/ +typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ +typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ -/***************************** -* Advanced Hash Functions -*****************************/ -typedef struct { long long ll[ 6]; } XXH32_state_t; -typedef struct { long long ll[11]; } XXH64_state_t; - -/* -These structures allow static allocation of XXH states. -States must then be initialized using XXHnn_reset() before first use. -If you prefer dynamic allocation, please refer to functions below. +/*! Static allocation + For static linking only, do not use in the context of DLL ! + XXHnn_CREATESTATE_STATIC(name); + is static-allocation equivalent of : + XXHnn_state_t* name = XXHnn_createState(); */ +typedef struct { long long ll[ 6]; } XXH32_stateBody_t; +typedef struct { long long ll[11]; } XXH64_stateBody_t; -XXH32_state_t* XXH32_createState(void); -XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); +#define XXH32_CREATESTATE_STATIC(name) XXH32_stateBody_t name##xxhbody; void* name##xxhvoid = &(name##xxhbody); XXH32_state_t* name = (XXH32_state_t*)(name##xxhvoid) /* no final ; */ +#define XXH64_CREATESTATE_STATIC(name) XXH64_stateBody_t name##xxhbody; void* name##xxhvoid = &(name##xxhbody); XXH64_state_t* name = (XXH64_state_t*)(name##xxhvoid) /* no final ; */ -XXH64_state_t* XXH64_createState(void); -XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); -/* -These functions create and release memory for XXH state. -States must then be initialized using XXHnn_reset() before first use. -*/ +/*!Dynamic allocation + To be preferred in the context of DLL */ +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); -XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned seed); -XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); -unsigned int XXH32_digest (const XXH32_state_t* statePtr); +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); -XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); -XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -unsigned long long XXH64_digest (const XXH64_state_t* statePtr); -/* -These functions calculate the xxHash of an input provided in multiple smaller packets, -as opposed to an input provided as a single block. +/* hash streaming */ -XXH state space must first be allocated, using either static or dynamic method provided above. +XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned int seed); +XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); + +XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); + +/*! +These functions generate the xxHash of an input provided in multiple segments, +as opposed to provided as a single block. + +XXH state must first be allocated, using either static or dynamic method provided above. Start a new hash by initializing state with a seed, using XXHnn_reset(). Then, feed the hash state by calling XXHnn_update() as many times as necessary. -Obviously, input must be valid, meaning allocated and read accessible. +Obviously, input must be valid, hence allocated and read accessible. The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. -Finally, you can produce a hash anytime, by using XXHnn_digest(). -This function returns the final nn-bits hash. -You can nonetheless continue feeding the hash state with more input, -and therefore get some new hashes, by calling again XXHnn_digest(). +Finally, a hash value can be produced anytime, by using XXHnn_digest(). +This function returns the nn-bits hash as an int or long long. -When you are done, don't forget to free XXH state space, using typically XXHnn_freeState(). +It's still possible to continue inserting input into the hash state after a digest, +and later on generate some new hashes, by calling again XXHnn_digest(). + +When done, free XXH state space if it was allocated dynamically. +*/ + + +/* ************************** +* Canonical representation +****************************/ +typedef struct { unsigned char digest[4]; } XXH32_canonical_t; +typedef struct { unsigned char digest[8]; } XXH64_canonical_t; + +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); + +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); + +/*! Default result type for XXH functions are primitive unsigned 32 and 64 bits. +* The canonical representation uses human-readable write convention, aka big-endian (large digits first). +* These functions allow transformation of hash result into and from its canonical format. +* This way, hash values can be written into a file / memory, and remain comparable on different systems and programs. */ #if defined (__cplusplus) } #endif + +#endif /* XXHASH_H_5627135585666179 */ diff --git a/Build/source/texk/dvisvgm/version.ac b/Build/source/texk/dvisvgm/version.ac index 4f0cd20a9da..96f2d344095 100644 --- a/Build/source/texk/dvisvgm/version.ac +++ b/Build/source/texk/dvisvgm/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current dvisvgm version -m4_define([dvisvgm_version], [1.14.1]) +m4_define([dvisvgm_version], [1.14.2]) |