summaryrefslogtreecommitdiff
path: root/Build/source/texk/lcdf-typetools/include/lcdf
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/lcdf-typetools/include/lcdf')
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/bezier.hh136
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/clp.h167
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/error.hh192
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/filename.hh41
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/globmatch.hh8
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/hashmap.cc187
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh231
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/inttypes.h34
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/landmark.hh39
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/md5.h48
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh167
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/point.hh185
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/slurper.hh63
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/straccum.hh298
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/string.hh460
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/strtonum.h10
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/transform.hh162
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/vector.cc130
-rw-r--r--Build/source/texk/lcdf-typetools/include/lcdf/vector.hh255
19 files changed, 2813 insertions, 0 deletions
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/bezier.hh b/Build/source/texk/lcdf-typetools/include/lcdf/bezier.hh
new file mode 100644
index 00000000000..2635069521b
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/bezier.hh
@@ -0,0 +1,136 @@
+// -*- related-file-name: "../../liblcdf/bezier.cc" -*-
+#ifndef LCDF_BEZIER_HH
+#define LCDF_BEZIER_HH
+#include <lcdf/point.hh>
+#include <lcdf/vector.hh>
+#include <string.h>
+
+class Bezier { public:
+
+ Bezier() : _bb(-1) { }
+ inline Bezier(Point p[4]) throw ();
+ inline Bezier(const Point &, const Point &, const Point &, const Point &) throw ();
+
+ const Point *points() const { return _p; }
+ const Point &point(int i) const { assert(i>=0&&i<4); return _p[i]; }
+ Point &mpoint(int i) { assert(i>=0&&i<4); _bb = -1; return _p[i]; }
+ void set_point(int i, const Point &p) { mpoint(i) = p; }
+
+ Point eval(double) const throw ();
+ bool is_flat(double) const throw ();
+ bool in_bb(const Point &, double) const throw ();
+ bool hit(const Point &, double) const throw ();
+
+ inline double bb_left() const throw ();
+ inline double bb_right() const throw ();
+ inline double bb_top() const throw ();
+ inline double bb_bottom() const throw ();
+
+ inline double bb_left_x() const throw ();
+ inline double bb_right_x() const throw ();
+ inline double bb_top_x() const throw ();
+ inline double bb_bottom_x() const throw ();
+
+ void halve(Bezier &, Bezier &) const throw ();
+
+ inline void segmentize(Vector<Point> &) const;
+ void segmentize(Vector<Point> &, bool) const;
+
+ static void fit(const Vector<Point> &, double, Vector<Bezier> &);
+
+ private:
+
+ Point _p[4];
+ mutable int _bb;
+
+ void make_bb() const throw ();
+ inline void ensure_bb() const throw ();
+
+ double hit_recurse(const Point &, double, double, double, double, double) const throw ();
+
+};
+
+
+inline
+Bezier::Bezier(Point p[4]) throw ()
+ : _bb(-1)
+{
+ memcpy(_p, p, sizeof(Point) * 4);
+}
+
+inline
+Bezier::Bezier(const Point &p0, const Point &p1, const Point &p2, const Point &p3) throw ()
+{
+ _p[0] = p0;
+ _p[1] = p1;
+ _p[2] = p2;
+ _p[3] = p3;
+ _bb = -1;
+}
+
+inline void
+Bezier::ensure_bb() const throw ()
+{
+ if (_bb < 0)
+ make_bb();
+}
+
+inline double
+Bezier::bb_top_x() const throw ()
+{
+ return _p[(_bb >> 4) & 3].y;
+}
+
+inline double
+Bezier::bb_left_x() const throw ()
+{
+ return _p[(_bb >> 2) & 3].x;
+}
+
+inline double
+Bezier::bb_bottom_x() const throw ()
+{
+ return _p[(_bb >> 6) & 3].y;
+}
+
+inline double
+Bezier::bb_right_x() const throw ()
+{
+ return _p[(_bb >> 0) & 3].x;
+}
+
+inline double
+Bezier::bb_top() const throw ()
+{
+ ensure_bb();
+ return bb_top_x();
+}
+
+inline double
+Bezier::bb_left() const throw ()
+{
+ ensure_bb();
+ return bb_left_x();
+}
+
+inline double
+Bezier::bb_bottom() const throw ()
+{
+ ensure_bb();
+ return bb_bottom_x();
+}
+
+inline double
+Bezier::bb_right() const throw ()
+{
+ ensure_bb();
+ return bb_right_x();
+}
+
+inline void
+Bezier::segmentize(Vector<Point> &v) const
+{
+ segmentize(v, v.size() == 0 || v.back() != _p[0]);
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/clp.h b/Build/source/texk/lcdf-typetools/include/lcdf/clp.h
new file mode 100644
index 00000000000..2126aacbf9c
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/clp.h
@@ -0,0 +1,167 @@
+/* -*- related-file-name: "../../liblcdf/clp.c" -*- */
+#ifndef LCDF_CLP_H
+#define LCDF_CLP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* clp.h - Public interface to CLP.
+ * This file is part of CLP, the command line parser package.
+ *
+ * Copyright (c) 1997-2005 Eddie Kohler, kohler@icir.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, subject to the conditions
+ * listed in the Click LICENSE file, which is available in full at
+ * http://www.pdos.lcs.mit.edu/click/license.html. The conditions include: you
+ * must preserve this copyright notice, and you cannot mention the copyright
+ * holders in advertising related to the Software without their permission.
+ * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
+ * notice is a summary of the Click LICENSE file; the license in that file is
+ * legally binding. */
+
+
+/* Argument types */
+#define Clp_NoArg 0
+#define Clp_ArgString 1
+#define Clp_ArgStringNotOption 2
+#define Clp_ArgBool 3
+#define Clp_ArgInt 4
+#define Clp_ArgUnsigned 5
+#define Clp_ArgDouble 6
+
+#define Clp_FirstUserType 10
+
+/* Flags for individual Clp_Options */
+#define Clp_Mandatory (1<<0) /* Has mandatory argument */
+#define Clp_Optional (1<<1) /* Has optional argument */
+#define Clp_Negate (1<<2) /* Allow --no-OPT */
+#define Clp_OnlyNegated (1<<3) /* Allow --no-OPT, but not --OPT */
+#define Clp_PreferredMatch (1<<4) /* Prefer --OPT to --OPTwhatever */
+ /* when matching option prefixes */
+
+struct Clp_Option {
+ const char *long_name; /* e.g. "version" */
+ int short_name; /* e.g. 'v' */
+ int option_id; /* number returned by Clp_Next */
+ int arg_type; /* e.g. Clp_ArgBool */
+ int flags; /* e.g. Clp_Optional | Clp_Negate */
+};
+
+
+/* Sizes of clp->val */
+#define Clp_ValSize 40
+#define Clp_ValIntSize 10
+
+typedef struct Clp_Option Clp_Option;
+typedef struct Clp_Parser Clp_Parser;
+typedef struct Clp_Internal Clp_Internal;
+typedef struct Clp_ParserState Clp_ParserState;
+typedef struct Clp_Argv Clp_Argv;
+
+typedef int (*Clp_ArgParseFunc)(Clp_Parser *, const char *, int, void *);
+typedef void (*Clp_ErrorHandler)(const char *);
+
+struct Clp_Parser {
+
+ int negated;
+
+ int have_arg;
+ const char *arg;
+
+ union {
+ int i;
+ unsigned u;
+ double d;
+ const char *s;
+ void *pv;
+#ifdef HAVE_INT64_TYPES
+ int64_t i64;
+ uint64_t u64;
+#endif
+ char cs[Clp_ValSize];
+ unsigned char ucs[Clp_ValSize];
+ int is[Clp_ValIntSize];
+ unsigned us[Clp_ValIntSize];
+ } val;
+
+ Clp_Internal *internal;
+
+};
+
+
+Clp_Parser * Clp_NewParser(int argc, const char * const *argv,
+ int nopt, Clp_Option *opt);
+void Clp_DeleteParser(Clp_Parser *);
+
+Clp_ErrorHandler Clp_SetErrorHandler(Clp_Parser *, Clp_ErrorHandler);
+
+const char * Clp_ProgramName(Clp_Parser *);
+void Clp_SetProgramName(Clp_Parser *, const char *);
+
+
+struct Clp_Argv {
+ int argc;
+ char **argv;
+ char *argv_buf;
+};
+
+Clp_Argv * Clp_NewArgv(const char *args, int len);
+void Clp_DeleteArgv(Clp_Argv *);
+
+
+/* Option types for Clp_SetOptionChar */
+/* Clp_NotOption 0 */
+#define Clp_Short (1<<0)
+#define Clp_Long (1<<1)
+#define Clp_ShortNegated (1<<2)
+#define Clp_LongNegated (1<<3)
+#define Clp_LongImplicit (1<<4)
+
+int Clp_SetOptionChar(Clp_Parser *, int c, int option_type);
+
+
+/* Argument type flags for Clp_AddType */
+#define Clp_DisallowOptions (1<<0) /* No option-looking args */
+
+int Clp_AddType
+ (Clp_Parser *, int type_id, int flags,
+ Clp_ArgParseFunc func, void *user_data);
+
+
+/* Flags for Clp_AddStringListType */
+#define Clp_AllowNumbers (1<<0) /* Number args OK */
+
+int Clp_AddStringListType
+ (Clp_Parser *, int type_id, int flags, ...);
+int Clp_AddStringListTypeVec
+ (Clp_Parser *, int type_id, int flags,
+ int n, char **str, int *val);
+
+
+/* Return values from Clp_Next */
+#define Clp_NotOption 0
+#define Clp_Done -1
+#define Clp_BadOption -2
+#define Clp_Error -3
+
+int Clp_Next(Clp_Parser *);
+
+
+const char * Clp_Shift(Clp_Parser *, int allow_dashes);
+int Clp_SetOptionProcessing(Clp_Parser *, int option_processing);
+
+Clp_ParserState *Clp_NewParserState(void);
+void Clp_DeleteParserState(Clp_ParserState *);
+void Clp_SaveParser(Clp_Parser *, Clp_ParserState *);
+void Clp_RestoreParser(Clp_Parser *, Clp_ParserState *);
+
+int Clp_OptionError(Clp_Parser *, const char *, ...);
+int Clp_CurOptionNameBuf(Clp_Parser *, char *buf, int buflen);
+const char * Clp_CurOptionName(Clp_Parser *); /* uses static memory */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/error.hh b/Build/source/texk/lcdf-typetools/include/lcdf/error.hh
new file mode 100644
index 00000000000..8d38cbfb87a
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/error.hh
@@ -0,0 +1,192 @@
+// -*- related-file-name: "../../liblcdf/error.cc" -*-
+#ifndef LCDF_ERROR_HH
+#define LCDF_ERROR_HH
+#include <lcdf/string.hh>
+#ifndef __KERNEL__
+# include <stdio.h>
+#endif
+#include <stdarg.h>
+#if HAVE_ADDRESSABLE_VA_LIST
+# define VA_LIST_REF_T va_list *
+# define VA_LIST_DEREF(val) (*(val))
+# define VA_LIST_REF(val) (&(val))
+#else
+# define VA_LIST_REF_T va_list
+# define VA_LIST_DEREF(val) (val)
+# define VA_LIST_REF(val) (val)
+#endif
+
+class ErrorHandler { public:
+
+ enum Seriousness {
+ ERRVERBOSITY_CONTEXT= 0x8000,
+ ERRVERBOSITY_MAX = 0xFFFF,
+ ERRVERBOSITY_DEFAULT= ERRVERBOSITY_MAX,
+ ERRVERBOSITY_MASK = 0x0000FFFF,
+ ERRVERBOSITY_SHIFT = 16,
+
+ ERR_MIN_DEBUG = 0x00000000,
+ ERR_MIN_MESSAGE = 0x00010000,
+ ERR_MIN_WARNING = 0x00020000,
+ ERR_MIN_ERROR = 0x00030000,
+ ERR_MIN_FATAL = 0x00040000,
+
+ // fatal() with no explicit exit status exits with this status
+ FATAL_EXITSTATUS = 1,
+
+ ERR_DEBUG = ERR_MIN_DEBUG + ERRVERBOSITY_DEFAULT,
+ ERR_CONTEXT_MESSAGE = ERR_MIN_MESSAGE + ERRVERBOSITY_CONTEXT,
+ ERR_MESSAGE = ERR_MIN_MESSAGE + ERRVERBOSITY_DEFAULT,
+ ERR_WARNING = ERR_MIN_WARNING + ERRVERBOSITY_DEFAULT,
+ ERR_CONTEXT_ERROR = ERR_MIN_ERROR + ERRVERBOSITY_CONTEXT,
+ ERR_ERROR = ERR_MIN_ERROR + ERRVERBOSITY_DEFAULT,
+ ERR_FATAL = ERR_MIN_FATAL + ERRVERBOSITY_DEFAULT + (FATAL_EXITSTATUS << ERRVERBOSITY_SHIFT)
+ };
+
+ ErrorHandler() { }
+ virtual ~ErrorHandler() { }
+
+ static ErrorHandler *static_initialize(ErrorHandler *errh); // returns errh
+ static void static_cleanup();
+
+ static ErrorHandler *default_handler();
+ static ErrorHandler *ignore_handler();
+
+ static bool has_default_handler();
+ static void set_default_handler(ErrorHandler *);
+
+ virtual int nwarnings() const = 0;
+ virtual int nerrors() const = 0;
+ virtual void reset_counts() = 0;
+ virtual int min_verbosity() const;
+
+ // seriousness < ERR_MIN_WARNING returns OK_RESULT, which is 0
+ // seriousness >= ERR_MIN_WARNING returns ERROR_RESULT, which is -EINVAL
+ static const int OK_RESULT;
+ static const int ERROR_RESULT;
+
+ void debug(const char *format, ...);
+ void message(const char *format, ...);
+ int warning(const char *format, ...);
+ int error(const char *format, ...);
+ int fatal(const char *format, ...);
+ int fatal(int exit_status, const char *format, ...);
+
+ void ldebug(const String &landmark, const char *format, ...);
+ void lmessage(const String &landmark, const char *format, ...);
+ int lwarning(const String &landmark, const char *format, ...);
+ int lerror(const String &landmark, const char *format, ...);
+ int lfatal(const String &landmark, const char *format, ...);
+ int lfatal(int exit_status, const String &landmark, const char *format, ...);
+
+ int verror(Seriousness, const String &landmark, const char *format, va_list);
+ int verror_text(Seriousness, const String &landmark, const String &text);
+
+ String make_text(Seriousness, const char *, ...);
+ virtual String make_text(Seriousness, const char *, va_list);
+ virtual String decorate_text(Seriousness, const String &, const String &);
+ virtual void handle_text(Seriousness, const String &) = 0;
+ virtual int count_error(Seriousness, const String &) = 0;
+
+ virtual void set_error_code(int);
+
+ static String prepend_lines(const String &prefix, const String &text);
+
+ // error conversions
+ struct Conversion;
+ typedef String (*ConversionHook)(int flags, VA_LIST_REF_T);
+ enum ConversionFlags {
+ ZERO_PAD = 1, PLUS_POSITIVE = 2, SPACE_POSITIVE = 4, LEFT_JUST = 8,
+ ALTERNATE_FORM = 16, UPPERCASE = 32, SIGNED = 64, NEGATIVE = 128
+ };
+ static Conversion *add_conversion(const String &, ConversionHook);
+ static int remove_conversion(Conversion *);
+
+};
+
+class BaseErrorHandler : public ErrorHandler { public:
+ BaseErrorHandler() : _nwarnings(0), _nerrors(0) { }
+ int nwarnings() const { return _nwarnings; }
+ int nerrors() const { return _nerrors; }
+ void reset_counts() { _nwarnings = _nerrors = 0; }
+ int count_error(Seriousness, const String &);
+ private:
+ int _nwarnings, _nerrors;
+};
+
+#ifndef __KERNEL__
+class FileErrorHandler : public BaseErrorHandler { public:
+ FileErrorHandler(FILE *, const String & = String());
+ void handle_text(Seriousness, const String &);
+ private:
+ FILE *_f;
+ String _context;
+};
+#endif
+
+class SilentErrorHandler : public BaseErrorHandler { public:
+ SilentErrorHandler() { }
+ void handle_text(Seriousness, const String &);
+};
+
+class ErrorVeneer : public ErrorHandler { public:
+
+ ErrorVeneer(ErrorHandler *errh) : _errh(errh) { }
+
+ int nwarnings() const;
+ int nerrors() const;
+ void reset_counts();
+
+ String make_text(Seriousness, const char *, va_list);
+ String decorate_text(Seriousness, const String &, const String &);
+ void handle_text(Seriousness, const String &);
+ int count_error(Seriousness, const String &);
+
+ protected:
+
+ ErrorHandler *_errh;
+
+};
+
+class ContextErrorHandler : public ErrorVeneer { public:
+ ContextErrorHandler(ErrorHandler *, const String &context, const String &indent = " ", const String &context_landmark = "");
+ String decorate_text(Seriousness, const String &, const String &);
+ private:
+ String _context;
+ String _indent;
+ String _context_landmark;
+};
+
+class PrefixErrorHandler : public ErrorVeneer { public:
+ PrefixErrorHandler(ErrorHandler *, const String &prefix);
+ String decorate_text(Seriousness, const String &, const String &);
+ private:
+ String _prefix;
+};
+
+class LandmarkErrorHandler : public ErrorVeneer { public:
+ LandmarkErrorHandler(ErrorHandler *, const String &);
+ void set_landmark(const String &s) { _landmark = s; }
+ String decorate_text(Seriousness, const String &, const String &);
+ private:
+ String _landmark;
+};
+
+class VerboseFilterErrorHandler : public ErrorVeneer { public:
+ VerboseFilterErrorHandler(ErrorHandler *, int min_verbosity);
+ int min_verbosity() const;
+ void handle_text(Seriousness, const String &);
+ private:
+ int _min_verbosity;
+};
+
+#ifndef __KERNEL__
+class BailErrorHandler : public ErrorVeneer { public:
+ BailErrorHandler(ErrorHandler *, Seriousness = ERR_MIN_ERROR);
+ void handle_text(Seriousness, const String &);
+ private:
+ int _exit_seriousness;
+};
+#endif
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/filename.hh b/Build/source/texk/lcdf-typetools/include/lcdf/filename.hh
new file mode 100644
index 00000000000..9f1589d4779
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/filename.hh
@@ -0,0 +1,41 @@
+// -*- related-file-name: "../../liblcdf/filename.cc" -*-
+#ifndef LCDF_FILENAME_HH
+#define LCDF_FILENAME_HH
+#include <lcdf/string.hh>
+#include <stdio.h>
+
+class Filename { public:
+
+ Filename() : _dir("."), _actual(0) { }
+ Filename(const String &);
+ Filename(const String &dir, const String &name);
+ Filename(FILE *, const String &fake_name);
+
+ bool fake() const { return _actual != 0; }
+
+ const String &directory() const { return _dir; }
+ const String &name() const { return _name; }
+ const String &path() const { return _path; }
+ String base() const;
+ String extension() const;
+
+ operator bool() const { return _name; }
+ bool operator!() const { return !_name; }
+
+ FILE *open_read(bool binary = false) const;
+ bool readable() const;
+
+ FILE *open_write(bool binary = false) const;
+
+ Filename from_directory(const String &n) const { return Filename(_dir, n);}
+
+ private:
+
+ mutable String _dir; // mutable for c_str()
+ mutable String _name;
+ mutable String _path;
+ FILE *_actual;
+
+};
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/globmatch.hh b/Build/source/texk/lcdf-typetools/include/lcdf/globmatch.hh
new file mode 100644
index 00000000000..963035e0ead
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/globmatch.hh
@@ -0,0 +1,8 @@
+// -*- related-file-name: "../../liblcdf/globmatch.cc" -*-
+#ifndef LCDF_GLOBMATCH_HH
+#define LCDF_GLOBMATCH_HH
+class String;
+
+bool glob_match(const String& str, const String& pattern);
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.cc b/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.cc
new file mode 100644
index 00000000000..17cec16e0d5
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.cc
@@ -0,0 +1,187 @@
+#ifndef LCDF_HASHMAP_CC
+#define LCDF_HASHMAP_CC
+
+/*
+ * hashmap.{cc,hh} -- simple open-coded hash table class
+ * Eddie Kohler
+ *
+ * Copyright (c) 1999-2000 Massachusetts Institute of Technology
+ * Copyright (c) 2001-2003 International Computer Science Institute
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, subject to the conditions
+ * listed in the Click LICENSE file. These conditions include: you must
+ * preserve this copyright notice, and you cannot mention the copyright
+ * holders in advertising related to the Software without their permission.
+ * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
+ * notice is a summary of the Click LICENSE file; the license in that file is
+ * legally binding.
+ */
+
+/* #include <lcdf/hashmap.hh> */
+
+template <class K, class V>
+HashMap<K, V>::HashMap()
+ : _capacity(0), _grow_limit(0), _n(0), _e(0), _default_value()
+{
+ increase(-1);
+}
+
+template <class K, class V>
+HashMap<K, V>::HashMap(const V &def)
+ : _capacity(0), _grow_limit(0), _n(0), _e(0), _default_value(def)
+{
+ increase(-1);
+}
+
+
+template <class K, class V>
+HashMap<K, V>::HashMap(const HashMap<K, V> &m)
+ : _capacity(m._capacity), _grow_limit(m._grow_limit), _n(m._n),
+ _e(new Pair[m._capacity]), _default_value(m._default_value)
+{
+ for (int i = 0; i < _capacity; i++)
+ _e[i] = m._e[i];
+}
+
+
+template <class K, class V>
+HashMap<K, V> &
+HashMap<K, V>::operator=(const HashMap<K, V> &o)
+{
+ // This works with self-assignment.
+
+ _capacity = o._capacity;
+ _grow_limit = o._grow_limit;
+ _n = o._n;
+ _default_value = o._default_value;
+
+ Pair *new_e = new Pair[_capacity];
+ for (int i = 0; i < _capacity; i++)
+ new_e[i] = o._e[i];
+
+ delete[] _e;
+ _e = new_e;
+
+ return *this;
+}
+
+
+template <class K, class V>
+void
+HashMap<K, V>::increase(int min_size)
+{
+ int ncap = (_capacity < 8 ? 8 : _capacity * 2);
+ while (ncap < min_size && ncap > 0)
+ ncap *= 2;
+ if (ncap <= 0) // want too many elements
+ return;
+
+ Pair *ne = new Pair[ncap];
+ if (!ne) // out of memory
+ return;
+
+ Pair *oe = _e;
+ int ocap = _capacity;
+ _e = ne;
+ _capacity = ncap;
+ _grow_limit = ((3 * _capacity) >> 2) - 1;
+
+ Pair *otrav = oe;
+ for (int i = 0; i < ocap; i++, otrav++)
+ if (otrav->key) {
+ int j = bucket(otrav->key);
+ _e[j] = *otrav;
+ }
+
+ delete[] oe;
+}
+
+template <class K, class V>
+inline void
+HashMap<K, V>::check_capacity()
+{
+ if (_n >= _grow_limit)
+ increase(-1);
+}
+
+template <class K, class V>
+bool
+HashMap<K, V>::insert(const K &key, const V &val)
+{
+ check_capacity();
+ int i = bucket(key);
+ bool is_new = !(bool)_e[i].key;
+ _e[i].key = key;
+ _e[i].value = val;
+ _n += is_new;
+ return is_new;
+}
+
+template <class K, class V>
+V &
+HashMap<K, V>::find_force(const K &key, const V &value)
+{
+ check_capacity();
+ int i = bucket(key);
+ if (!(bool)_e[i].key) {
+ _e[i].key = key;
+ _e[i].value = value;
+ _n++;
+ }
+ return _e[i].value;
+}
+
+template <class K, class V>
+void
+HashMap<K, V>::clear()
+{
+ delete[] _e;
+ _e = 0;
+ _capacity = _grow_limit = _n = 0;
+ increase(-1);
+}
+
+template <class K, class V>
+void
+HashMap<K, V>::swap(HashMap<K, V> &o)
+{
+ int capacity = _capacity;
+ int grow_limit = _grow_limit;
+ int n = _n;
+ Pair *e = _e;
+ V default_value = _default_value;
+ _capacity = o._capacity;
+ _grow_limit = o._grow_limit;
+ _n = o._n;
+ _e = o._e;
+ _default_value = o._default_value;
+ o._capacity = capacity;
+ o._grow_limit = grow_limit;
+ o._n = n;
+ o._e = e;
+ o._default_value = default_value;
+}
+
+template <class K, class V>
+_HashMap_const_iterator<K, V>::_HashMap_const_iterator(const HashMap<K, V> *hm, int pos)
+ : _hm(hm), _pos(pos)
+{
+ typename HashMap<K, V>::Pair *e = _hm->_e;
+ int capacity = _hm->_capacity;
+ while (_pos < capacity && !(bool)e[_pos].key)
+ _pos++;
+}
+
+template <class K, class V>
+void
+_HashMap_const_iterator<K, V>::operator++(int)
+{
+ typename HashMap<K, V>::Pair *e = _hm->_e;
+ int capacity = _hm->_capacity;
+ for (_pos++; _pos < capacity && !(bool)e[_pos].key; _pos++)
+ ;
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh b/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh
new file mode 100644
index 00000000000..10b5c321177
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/hashmap.hh
@@ -0,0 +1,231 @@
+#ifndef LCDF_HASHMAP_HH
+#define LCDF_HASHMAP_HH
+#include <assert.h>
+
+// K AND V REQUIREMENTS:
+//
+// K::K()
+// K::operator bool() const
+// Must have (bool)(K()) == false
+// and no k with (bool)k == false is stored.
+// K & K::operator=(const K &)
+// k1 == k2
+// unsigned hashcode(const K &)
+// If hashcode(k1) != hashcode(k2), then k1 != k2.
+//
+// V::V()
+// V & V::operator=(const V &)
+
+template <class K, class V> class _HashMap_const_iterator;
+template <class K, class V> class _HashMap_iterator;
+
+inline unsigned
+hashcode(int i)
+{
+ return static_cast<unsigned>(i);
+}
+
+inline unsigned
+hashcode(unsigned u)
+{
+ return u;
+}
+
+inline unsigned
+hashcode(long l)
+{
+ return static_cast<unsigned>(l);
+}
+
+inline unsigned
+hashcode(unsigned long ul)
+{
+ return static_cast<unsigned long>(ul);
+}
+
+template <class K, class V>
+class HashMap { public:
+
+ HashMap();
+ explicit HashMap(const V &);
+ HashMap(const HashMap<K, V> &);
+ ~HashMap() { delete[] _e; }
+
+ int size() const { return _n; }
+ bool empty() const { return _n == 0; }
+ int capacity() const { return _capacity; }
+ void set_default_value(const V &v) { _default_value = v; }
+
+ typedef _HashMap_const_iterator<K, V> const_iterator;
+ typedef _HashMap_iterator<K, V> iterator;
+
+ inline const_iterator begin() const;
+ inline iterator begin();
+ inline const_iterator end() const;
+ inline iterator end();
+
+ inline const V &find(const K &) const;
+ inline V *findp(const K &) const;
+ inline const V &operator[](const K &k) const;
+ V &find_force(const K &, const V &);
+ inline V &find_force(const K &);
+
+ bool insert(const K &, const V &);
+ void clear();
+
+ HashMap<K, V> &operator=(const HashMap<K, V> &);
+ void swap(HashMap<K, V> &);
+
+ void resize(int size) { increase(size); }
+
+ struct Pair {
+ K key;
+ V value;
+ Pair() : key(), value() { }
+ };
+
+ private:
+
+ int _capacity;
+ int _grow_limit;
+ int _n;
+ Pair *_e;
+ V _default_value;
+
+ void increase(int);
+ inline void check_capacity();
+ inline int bucket(const K &) const;
+
+ friend class _HashMap_const_iterator<K, V>;
+ friend class _HashMap_iterator<K, V>;
+
+};
+
+template <class K, class V>
+class _HashMap_const_iterator { public:
+ typedef _HashMap_const_iterator const_iterator;
+ typedef typename HashMap<K, V>::Pair Pair;
+
+ operator bool() const { return _pos < _hm->_capacity; }
+ bool operator!() const { return _pos >= _hm->_capacity; }
+
+ void operator++(int);
+ void operator++() { (*this)++; }
+
+ const K &key() const { return _hm->_e[_pos].key; }
+ const V &value() const { return _hm->_e[_pos].value; }
+ const Pair &pair() const { return _hm->_e[_pos]; }
+
+ inline bool operator==(const const_iterator &) const;
+ inline bool operator!=(const const_iterator &) const;
+
+ private:
+ const HashMap<K, V> *_hm;
+ int _pos;
+ _HashMap_const_iterator(const HashMap<K, V> *, int);
+ friend class HashMap<K, V>;
+ friend class _HashMap_iterator<K, V>;
+};
+
+template <class K, class V>
+class _HashMap_iterator : public _HashMap_const_iterator<K, V> { public:
+ typedef _HashMap_iterator iterator;
+
+ V &value() const { return this->_hm->_e[this->_pos].value; }
+
+ private:
+ _HashMap_iterator(const HashMap<K, V> *hm, int pos) : _HashMap_const_iterator<K, V>(hm, pos) { }
+ friend class HashMap<K, V>;
+};
+
+
+template <class K, class V>
+inline int
+HashMap<K, V>::bucket(const K &key) const
+{
+ assert(key);
+ unsigned hc = hashcode(key);
+ int i = hc & (_capacity - 1);
+ int j = ((hc >> 6) & (_capacity - 1)) | 1;
+
+ while (_e[i].key && !(_e[i].key == key))
+ i = (i + j) & (_capacity - 1);
+
+ return i;
+}
+
+template <class K, class V>
+inline const V &
+HashMap<K, V>::find(const K &key) const
+{
+ int i = bucket(key);
+ const V *v = (_e[i].key ? &_e[i].value : &_default_value);
+ return *v;
+}
+
+template <class K, class V>
+inline const V &
+HashMap<K, V>::operator[](const K &key) const
+{
+ return find(key);
+}
+
+template <class K, class V>
+inline V *
+HashMap<K, V>::findp(const K &key) const
+{
+ int i = bucket(key);
+ return _e[i].key ? &_e[i].value : 0;
+}
+
+template <class K, class V>
+inline V &
+HashMap<K, V>::find_force(const K &key)
+{
+ return find_force(key, _default_value);
+}
+
+template <class K, class V>
+inline _HashMap_const_iterator<K, V>
+HashMap<K, V>::begin() const
+{
+ return const_iterator(this, 0);
+}
+
+template <class K, class V>
+inline _HashMap_const_iterator<K, V>
+HashMap<K, V>::end() const
+{
+ return const_iterator(this, _capacity);
+}
+
+template <class K, class V>
+inline _HashMap_iterator<K, V>
+HashMap<K, V>::begin()
+{
+ return iterator(this, 0);
+}
+
+template <class K, class V>
+inline _HashMap_iterator<K, V>
+HashMap<K, V>::end()
+{
+ return iterator(this, _capacity);
+}
+
+template <class K, class V>
+inline bool
+_HashMap_const_iterator<K, V>::operator==(const const_iterator &i) const
+{
+ return _hm == i._hm && _pos == i._pos;
+}
+
+template <class K, class V>
+inline bool
+_HashMap_const_iterator<K, V>::operator!=(const const_iterator &i) const
+{
+ return _hm != i._hm || _pos != i._pos;
+}
+
+#include <lcdf/hashmap.cc> // necessary to support GCC 3.3
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/inttypes.h b/Build/source/texk/lcdf-typetools/include/lcdf/inttypes.h
new file mode 100644
index 00000000000..b88e9e9faf0
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/inttypes.h
@@ -0,0 +1,34 @@
+#ifndef LCDF_INTTYPES_H
+#define LCDF_INTTYPES_H
+/* Define known-width integer types. */
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif defined(HAVE_SYS_TYPES_H)
+# include <sys/types.h>
+# ifdef HAVE_U_INT_TYPES
+typedef u_int8_t uint8_t;
+typedef u_int16_t uint16_t;
+typedef u_int32_t uint32_t;
+# endif
+#endif
+
+#ifdef HAVE_FAKE_INT_TYPES
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+#endif
+
+#ifndef HAVE_UINTPTR_T
+# if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT
+typedef unsigned int uintptr_t;
+# elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG
+typedef unsigned long uintptr_t;
+# endif
+#endif
+
+/* Note: Windows compilers call these types '[un]signed __int8', etc. */
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/landmark.hh b/Build/source/texk/lcdf-typetools/include/lcdf/landmark.hh
new file mode 100644
index 00000000000..836f14ec088
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/landmark.hh
@@ -0,0 +1,39 @@
+// -*- related-file-name: "../../liblcdf/landmark.cc" -*-
+#ifndef LCDF_LANDMARK_HH
+#define LCDF_LANDMARK_HH
+#include <lcdf/string.hh>
+
+class Landmark { public:
+
+ Landmark() : _file(), _line(~0U) { }
+ explicit Landmark(const String &f) : _file(f), _line(~0U) { }
+ Landmark(const String &f, unsigned l) : _file(f), _line(l) { }
+
+ operator bool() const { return _file; }
+ bool operator!() const { return !_file; }
+ bool has_line() const { return _line != ~0U; }
+
+ const String &file() const { return _file; }
+ unsigned line() const { return _line; }
+
+ Landmark next_line() const;
+ Landmark whole_file() const { return Landmark(_file); }
+
+ operator String() const;
+
+ private:
+
+ String _file;
+ unsigned _line;
+
+};
+
+Landmark operator+(const Landmark &, int);
+
+inline Landmark
+Landmark::next_line() const
+{
+ return *this + 1;
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/md5.h b/Build/source/texk/lcdf-typetools/include/lcdf/md5.h
new file mode 100644
index 00000000000..7d7f8641d23
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/md5.h
@@ -0,0 +1,48 @@
+/* -*- related-file-name: "../../liblcdf/md5.c" -*-
+ * md5.h - MD5 Message-Digest Algorithm
+ * Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+ *
+ * according to the definition of MD5 in RFC 1321 from April 1992.
+ * NOTE: This is *not* the same file as the one from glibc
+ *
+ * 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 2, 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, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LCDF_MD5_H
+#define LCDF_MD5_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MD5_DIGEST_SIZE 16
+#define MD5_TEXT_DIGEST_SIZE 26 /* + 1 for the terminating NUL */
+
+typedef struct { /* Hmm, should be private */
+ uint32_t A,B,C,D;
+ uint32_t nblocks;
+ unsigned char buf[64];
+ int count;
+ int finalized;
+} MD5_CONTEXT;
+
+void md5_init(MD5_CONTEXT *ctx);
+void md5_update(MD5_CONTEXT *hd, const unsigned char *inbuf, size_t inlen);
+void md5_final(unsigned char digest[MD5_DIGEST_SIZE], MD5_CONTEXT *ctx);
+void md5_final_text(char *text_digest, MD5_CONTEXT *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* LCDF_MD5_H */
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh b/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh
new file mode 100644
index 00000000000..2db15772ded
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/permstr.hh
@@ -0,0 +1,167 @@
+// -*- related-file-name: "../../liblcdf/permstr.cc" -*-
+#ifndef LCDF_PERMSTR_HH
+#define LCDF_PERMSTR_HH
+#include <assert.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <lcdf/inttypes.h>
+class PermString;
+inline bool operator==(PermString, PermString);
+inline bool operator!=(PermString, PermString);
+
+class PermString { struct Doodad; public:
+
+ typedef Doodad *Capsule;
+ // Declare a PermString::Initializer in any file in which you declare
+ // static global PermStrings.
+ struct Initializer { Initializer(); };
+
+ PermString() : _rep(zero_char_doodad.data) { }
+ explicit PermString(char c);
+ inline PermString(const char*);
+ inline PermString(const char*, int);
+ inline PermString(const char*, const char*);
+
+ inline operator bool() const;
+ inline bool operator!() const;
+
+ inline int length() const;
+ char operator[](int) const;
+ const char* begin() const { return _rep; }
+ inline const char* end() const;
+
+ friend inline bool operator==(PermString, PermString);
+ friend inline bool operator!=(PermString, PermString);
+
+ const char* c_str() const { return _rep; }
+
+ inline Capsule capsule() const;
+ inline static PermString decapsule(Capsule c);
+
+ friend PermString permprintf(const char*, ...);
+ friend PermString vpermprintf(const char*, va_list);
+ friend PermString permcat(PermString, PermString);
+ friend PermString permcat(PermString, PermString, PermString);
+
+ private:
+
+ struct Doodad {
+ Doodad* next;
+ int length;
+ char data[2];
+ };
+
+ const char* _rep;
+
+ PermString(Doodad* d) : _rep(d->data) { }
+ void initialize(const char*, int);
+ Doodad* doodad() const { return (Doodad*)(_rep - offsetof(Doodad, data)); }
+
+ friend struct PermString::Initializer;
+ static void static_initialize();
+
+ enum { NHASH = 1024 }; // must be power of 2
+ static Doodad zero_char_doodad, one_char_doodad[256], *buckets[NHASH];
+
+};
+
+
+inline
+PermString::PermString(const char* s)
+{
+ initialize(s, -1);
+}
+
+inline
+PermString::PermString(const char* s, int len)
+{
+ initialize(s, len);
+}
+
+inline
+PermString::PermString(const char* begin, const char* end)
+{
+ assert(end);
+ initialize(begin, end > begin ? end - begin : 0);
+}
+
+inline
+PermString::operator bool() const
+{
+ return _rep != zero_char_doodad.data;
+}
+
+inline bool
+PermString::operator!() const
+{
+ return _rep == zero_char_doodad.data;
+}
+
+inline int
+PermString::length() const
+{
+ return doodad()->length;
+}
+
+inline const char*
+PermString::end() const
+{
+ return _rep + doodad()->length;
+}
+
+inline bool
+operator==(PermString a, PermString b)
+{
+ return a._rep == b._rep;
+}
+
+bool operator==(PermString, const char*);
+
+inline bool
+operator==(const char* a, PermString b)
+{
+ return b == a;
+}
+
+inline bool
+operator!=(PermString a, PermString b)
+{
+ return a._rep != b._rep;
+}
+
+inline bool
+operator!=(PermString a, const char* b)
+{
+ return !(a == b);
+}
+
+inline bool
+operator!=(const char* a, PermString b)
+{
+ return !(b == a);
+}
+
+inline PermString::Capsule
+PermString::capsule() const
+{
+ return doodad();
+}
+
+inline PermString
+PermString::decapsule(Capsule c)
+{
+ return PermString(c);
+}
+
+inline unsigned
+hashcode(PermString s)
+{
+ return (uintptr_t)(s.c_str());
+}
+
+PermString permprintf(const char*, ...);
+PermString vpermprintf(const char*, va_list);
+PermString permcat(PermString, PermString);
+PermString permcat(PermString, PermString, PermString);
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/point.hh b/Build/source/texk/lcdf-typetools/include/lcdf/point.hh
new file mode 100644
index 00000000000..a4d2495cac2
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/point.hh
@@ -0,0 +1,185 @@
+// -*- related-file-name: "../../liblcdf/point.cc" -*-
+#ifndef LCDF_POINT_HH
+#define LCDF_POINT_HH
+#include <math.h>
+
+struct Point {
+
+ double x;
+ double y;
+
+ Point() { }
+ Point(double xx, double yy) : x(xx), y(yy) { }
+ // Point(const Point &) use compiler default
+ Point(const Point &p, double dx, double dy) : x(p.x + dx), y(p.y + dy) { }
+ // ~Point() use compiler default
+
+ inline double squared_length() const throw ();
+ inline double length() const throw ();
+ inline double magnitude() const throw ();
+ static inline double distance(const Point &, const Point &) throw ();
+ static inline double dot(const Point &, const Point &) throw ();
+ static Point midpoint(const Point &, const Point &) throw ();
+
+ inline double angle() const throw ();
+
+ void shift(double dx, double dy) { x += dx; y += dy; }
+
+ inline Point shifted(double dx, double dy) const throw ();
+ Point rotated(double) const throw ();
+ inline Point normal() const throw ();
+
+ bool on_line(const Point &, const Point &, double) const throw ();
+ bool on_segment(const Point &, const Point &, double) const throw ();
+
+ inline Point &operator+=(const Point &) throw ();
+ inline Point &operator-=(const Point &) throw ();
+ inline Point &operator*=(double) throw ();
+ inline Point &operator/=(double) throw ();
+
+ // Point operator+(Point, const Point &);
+ // Point operator-(Point, const Point &);
+ // Point operator*(Point, double);
+ // Point operator/(Point, double);
+ // Point operator-(const Point &);
+
+ // bool operator==(const Point &, const Point &);
+ // bool operator!=(const Point &, const Point &);
+
+};
+
+inline double
+Point::squared_length() const throw ()
+{
+ return x*x + y*y;
+}
+
+inline double
+Point::length() const throw ()
+{
+ return sqrt(x*x + y*y);
+}
+
+inline double
+Point::magnitude() const throw ()
+{
+ return length();
+}
+
+inline double
+Point::angle() const throw ()
+{
+ return atan2(y, x);
+}
+
+inline Point
+Point::shifted(double dx, double dy) const throw ()
+{
+ return Point(x + dx, y + dy);
+}
+
+inline Point
+Point::normal() const throw ()
+{
+ double l = length();
+ return (l ? Point(x/l, y/l) : *this);
+}
+
+inline Point &
+Point::operator+=(const Point &p) throw ()
+{
+ x += p.x;
+ y += p.y;
+ return *this;
+}
+
+inline Point &
+Point::operator-=(const Point &p) throw ()
+{
+ x -= p.x;
+ y -= p.y;
+ return *this;
+}
+
+inline Point &
+Point::operator*=(double d) throw ()
+{
+ x *= d;
+ y *= d;
+ return *this;
+}
+
+inline Point &
+Point::operator/=(double d) throw ()
+{
+ x /= d;
+ y /= d;
+ return *this;
+}
+
+inline bool
+operator==(const Point &a, const Point &b) throw ()
+{
+ return a.x == b.x && a.y == b.y;
+}
+
+inline bool
+operator!=(const Point &a, const Point &b) throw ()
+{
+ return a.x != b.x || a.y != b.y;
+}
+
+inline Point
+operator+(Point a, const Point &b) throw ()
+{
+ a += b;
+ return a;
+}
+
+inline Point
+operator-(Point a, const Point &b) throw ()
+{
+ a -= b;
+ return a;
+}
+
+inline Point
+operator-(const Point &a) throw ()
+{
+ return Point(-a.x, -a.y);
+}
+
+inline Point
+operator*(Point a, double scale) throw ()
+{
+ a *= scale;
+ return a;
+}
+
+inline Point
+operator*(double scale, Point a) throw ()
+{
+ a *= scale;
+ return a;
+}
+
+inline Point
+operator/(Point a, double scale) throw ()
+{
+ a /= scale;
+ return a;
+}
+
+inline double
+Point::distance(const Point &a, const Point &b) throw ()
+{
+ return (a - b).length();
+}
+
+inline double
+Point::dot(const Point &a, const Point &b) throw ()
+{
+ return a.x*b.x + a.y*b.y;
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/slurper.hh b/Build/source/texk/lcdf-typetools/include/lcdf/slurper.hh
new file mode 100644
index 00000000000..2e400d3c3f2
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/slurper.hh
@@ -0,0 +1,63 @@
+// -*- related-file-name: "../../liblcdf/slurper.cc" -*-
+#ifndef LCDF_SLURPER_HH
+#define LCDF_SLURPER_HH
+#include <lcdf/landmark.hh>
+#include <lcdf/filename.hh>
+#include <stdio.h>
+
+class Slurper { public:
+
+ Slurper(const Filename &, FILE * = 0);
+ ~Slurper();
+
+ bool ok() const { return _f != 0; }
+
+ Landmark landmark() const { return Landmark(_filename.name(), _lineno); }
+ operator Landmark() const { return landmark(); }
+ unsigned lineno() const { return _lineno; }
+
+ const Filename &filename() const { return _filename; }
+ char *peek_line();
+ char *next_line();
+ char *append_next_line();
+ void save_line() { _saved_line = true; }
+
+ char *cur_line() const { return (char *)_line; }
+ unsigned cur_line_length() const { return _line_len; }
+ void shorten_line(unsigned);
+
+ private:
+
+ FILE *_f;
+ Filename _filename;
+ unsigned _lineno;
+ bool _own_f;
+
+ unsigned char *_data;
+ unsigned _cap;
+ unsigned _pos;
+ unsigned _len;
+
+ unsigned char *_line;
+ unsigned _line_len;
+
+ bool _saved_line;
+ bool _at_eof;
+
+ void grow_buffer();
+ inline int more_data();
+ char *get_line_at(unsigned);
+
+};
+
+
+inline void
+Slurper::shorten_line(unsigned pos)
+{
+ if (pos < _line_len) {
+ _line_len = pos;
+ _line[_line_len] = 0;
+ }
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/straccum.hh b/Build/source/texk/lcdf-typetools/include/lcdf/straccum.hh
new file mode 100644
index 00000000000..e6c6422d2af
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/straccum.hh
@@ -0,0 +1,298 @@
+// -*- related-file-name: "../../liblcdf/straccum.cc" -*-
+#ifndef LCDF_STRACCUM_HH
+#define LCDF_STRACCUM_HH
+#include <string.h>
+#include <assert.h>
+#include <lcdf/string.hh>
+#ifdef HAVE_PERMSTRING
+# include <lcdf/permstr.hh>
+#endif
+template<class T> class Vector;
+
+class StringAccum { public:
+
+ StringAccum() : _s(0), _len(0), _cap(0) { }
+ explicit inline StringAccum(int);
+ explicit StringAccum(const char *);
+ explicit StringAccum(const String &);
+#ifdef HAVE_PERMSTRING
+ explicit StringAccum(PermString);
+#endif
+ ~StringAccum() { if (_cap >= 0) delete[] _s; }
+
+ char *data() const { return (char *)_s; }
+ int length() const { return _len; }
+
+ operator bool() const { return _len != 0; }
+ bool operator!() const { return _len == 0; }
+
+ bool out_of_memory() const { return _cap < 0; }
+
+ const char *c_str();
+
+ char operator[](int i) const{ assert(i>=0&&i<_len); return (char)_s[i]; }
+ char &operator[](int i) { assert(i>=0&&i<_len); return (char &)_s[i]; }
+ char back() const { assert(_len>0); return (char)_s[_len-1]; }
+ char &back() { assert(_len>0); return (char &)_s[_len-1]; }
+
+ inline void clear();
+
+ inline char *extend(int, int = 0);
+
+ inline void append(char);
+ inline void append(unsigned char);
+ inline void append_utf8(uint32_t);
+ inline void append(const char *, int);
+ inline void append(const char *begin, const char *end);
+ inline void append(const unsigned char *, int);
+
+ // word joining
+ void append_break_lines(const String& text, int linelen, const String& leftmargin = String());
+
+ inline char *reserve(int);
+ void set_length(int l) { assert(l>=0 && _len<=_cap); _len = l; }
+ void forward(int n) { assert(n>=0 && _len+n<=_cap); _len += n; }
+ void pop_back(int n = 1) { assert(n>=0 && _len>=n); _len -= n; }
+
+ StringAccum &snprintf(int, const char *, ...);
+
+ inline unsigned char *take_bytes(); // returns array allocated by new[]
+ String take_string();
+
+ // see also operator<< declarations below
+
+ private:
+
+ unsigned char *_s;
+ int _len;
+ int _cap;
+
+ void make_out_of_memory();
+ inline void safe_append(const char *, int);
+ bool grow(int);
+ inline void erase();
+ void append_utf8_hard(uint32_t);
+
+ StringAccum(const StringAccum &);
+ StringAccum &operator=(const StringAccum &);
+
+ friend StringAccum &operator<<(StringAccum &, const char *);
+#ifdef HAVE_PERMSTRING
+ friend StringAccum &operator<<(StringAccum &, PermString);
+#endif
+
+};
+
+inline StringAccum &operator<<(StringAccum &, char);
+inline StringAccum &operator<<(StringAccum &, unsigned char);
+inline StringAccum &operator<<(StringAccum &, const char *);
+inline StringAccum &operator<<(StringAccum &, const String &);
+inline StringAccum &operator<<(StringAccum &, const StringAccum &);
+#ifdef HAVE_PERMSTRING
+inline StringAccum &operator<<(StringAccum &, PermString);
+#endif
+
+inline StringAccum &operator<<(StringAccum &, bool);
+inline StringAccum &operator<<(StringAccum &, short);
+inline StringAccum &operator<<(StringAccum &, unsigned short);
+inline StringAccum &operator<<(StringAccum &, int);
+inline StringAccum &operator<<(StringAccum &, unsigned);
+StringAccum &operator<<(StringAccum &, long);
+StringAccum &operator<<(StringAccum &, unsigned long);
+StringAccum &operator<<(StringAccum &, double);
+
+
+inline
+StringAccum::StringAccum(int cap)
+ : _s(new unsigned char[cap]), _len(0), _cap(cap)
+{
+ assert(cap > 0);
+ if (!_s)
+ _cap = -1;
+}
+
+inline void
+StringAccum::append(unsigned char c)
+{
+ if (_len < _cap || grow(_len))
+ _s[_len++] = c;
+}
+
+inline void
+StringAccum::append(char c)
+{
+ append(static_cast<unsigned char>(c));
+}
+
+inline void
+StringAccum::append_utf8(uint32_t ch)
+{
+ if (ch < 0x80)
+ append((unsigned char) ch);
+ else
+ append_utf8_hard(ch);
+}
+
+inline char *
+StringAccum::reserve(int hm)
+{
+ assert(hm >= 0);
+ if (_len + hm <= _cap || grow(_len + hm))
+ return (char *)(_s + _len);
+ else
+ return 0;
+}
+
+inline char *
+StringAccum::extend(int amt, int extra)
+{
+ assert(extra >= 0);
+ char *c = reserve(amt + extra);
+ if (c)
+ _len += amt;
+ return c;
+}
+
+inline void
+StringAccum::safe_append(const char *s, int len)
+{
+ if (char *x = extend(len))
+ memcpy(x, s, len);
+}
+
+inline void
+StringAccum::append(const char *s, int len)
+{
+ if (len < 0)
+ len = strlen(s);
+ else if (len == 0 && s == String::out_of_memory_data())
+ make_out_of_memory();
+ safe_append(s, len);
+}
+
+inline void
+StringAccum::append(const unsigned char *s, int len)
+{
+ append(reinterpret_cast<const char *>(s), len);
+}
+
+inline void
+StringAccum::append(const char *begin, const char *end)
+{
+ if (begin < end)
+ safe_append(begin, end - begin);
+ else if (begin == String::out_of_memory_data())
+ make_out_of_memory();
+}
+
+inline void
+StringAccum::erase()
+{
+ _s = 0;
+ _len = 0;
+ _cap = 0;
+}
+
+inline unsigned char *
+StringAccum::take_bytes()
+{
+ unsigned char *str = _s;
+ erase();
+ return str;
+}
+
+inline void
+StringAccum::clear()
+{
+ if (_cap < 0)
+ _cap = 0, _s = 0;
+ _len = 0;
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, char c)
+{
+ sa.append(c);
+ return sa;
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, unsigned char c)
+{
+ sa.append(c);
+ return sa;
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, const char *s)
+{
+ sa.safe_append(s, strlen(s));
+ return sa;
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, bool b)
+{
+ return sa << (b ? "true" : "false");
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, short i)
+{
+ return sa << static_cast<long>(i);
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, unsigned short u)
+{
+ return sa << static_cast<unsigned long>(u);
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, int i)
+{
+ return sa << static_cast<long>(i);
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, unsigned u)
+{
+ return sa << static_cast<unsigned long>(u);
+}
+
+inline StringAccum &
+operator<<(StringAccum &sa, const String &s)
+{
+ sa.append(s.data(), s.length());
+ return sa;
+}
+
+#ifdef HAVE_PERMSTRING
+inline StringAccum &
+operator<<(StringAccum &sa, PermString s)
+{
+ sa.safe_append(s.c_str(), s.length());
+ return sa;
+}
+#endif
+
+inline StringAccum &
+operator<<(StringAccum &sa, const StringAccum &sb)
+{
+ sa.append(sb.data(), sb.length());
+ return sa;
+}
+
+inline bool
+operator==(StringAccum &sa, const char *s)
+{
+ return strcmp(sa.c_str(), s) == 0;
+}
+
+inline bool
+operator!=(StringAccum &sa, const char *s)
+{
+ return strcmp(sa.c_str(), s) != 0;
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/string.hh b/Build/source/texk/lcdf-typetools/include/lcdf/string.hh
new file mode 100644
index 00000000000..34eb1af3ed9
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/string.hh
@@ -0,0 +1,460 @@
+// -*- related-file-name: "../../liblcdf/string.cc" -*-
+#ifndef LCDF_STRING_HH
+#define LCDF_STRING_HH
+#ifdef HAVE_PERMSTRING
+# include <lcdf/permstr.hh>
+#endif
+#include <assert.h>
+class StringAccum;
+
+class String { public:
+
+ // Call static_initialize() before any function which might deal with
+ // Strings, and declare a String::Initializer in any file in which you
+ // declare static global Strings.
+ struct Initializer { Initializer(); };
+ friend struct String::Initializer;
+ static void static_initialize();
+ static void static_cleanup();
+
+ inline String();
+ inline String(const String &s);
+ String(const char *cc) { assign(cc, -1); }
+ String(const char *cc, int l) { assign(cc, l); }
+#ifdef HAVE_PERMSTRING
+ inline String(PermString p);
+#endif
+ explicit inline String(char);
+ explicit inline String(unsigned char);
+ explicit String(int);
+ explicit String(unsigned);
+ explicit String(long);
+ explicit String(unsigned long);
+ explicit String(double);
+ inline ~String();
+
+ static const String &null_string() { return *null_string_p; }
+ static const String &out_of_memory_string() { return *oom_string_p; }
+ static const char *out_of_memory_data() { return &oom_string_data; }
+ static String garbage_string(int n); // n garbage characters
+ static String fill_string(int c, int n); // n copies of c
+ static String stable_string(const char *, int = -1); // stable read-only memory
+
+ bool out_of_memory() const { return _data == &oom_string_data; }
+
+ int length() const { return _length; }
+ const char *data() const { return _data; }
+ const unsigned char *udata() const { return reinterpret_cast<const unsigned char *>(_data); }
+
+ typedef const char *const_iterator;
+ typedef const_iterator iterator;
+ const_iterator begin() const { return _data; }
+ const_iterator end() const { return _data + _length; }
+
+ char *mutable_data();
+ char *mutable_c_str();
+ unsigned char *mutable_udata() { return reinterpret_cast<unsigned char *>(mutable_data()); }
+
+ operator bool() const { return _length != 0; }
+ bool operator!() const { return _length == 0; }
+
+#ifdef HAVE_PERMSTRING
+ operator PermString() const { return PermString(_data, _length); }
+#endif
+
+ const char *c_str() const; // pointer returned is semi-transient
+
+ char operator[](int i) const { return _data[i]; }
+ char back() const { return _data[_length - 1]; }
+ int find_left(int c, int start = 0) const;
+ int find_left(const String &s, int start = 0) const;
+ int find_right(int c, int start = 0x7FFFFFFF) const;
+
+ bool equals(const char *, int) const;
+ // bool operator==(const String &, const String &);
+ // bool operator==(const String &, const char *);
+ // bool operator==(const char *, const String &);
+ // bool operator!=(const String &, const String &);
+ // bool operator!=(const String &, const char *);
+ // bool operator!=(const char *, const String &);
+
+ int compare(const char *, int) const;
+ int compare(const String &x) const { return compare(x._data, x._length); }
+ static inline int compare(const String &a, const String &b);
+ // bool operator<(const String &, const String &);
+ // bool operator<=(const String &, const String &);
+ // bool operator>(const String &, const String &);
+ // bool operator>=(const String &, const String &);
+
+ String substring(const char *begin, const char *end) const;
+ String substring(int pos, int len) const;
+ String substring(int pos) const { return substring(pos, _length); }
+
+ String lower() const;
+ String upper() const;
+ String printable() const;
+
+ inline String &operator=(const String &);
+ inline String &operator=(const char *);
+#ifdef HAVE_PERMSTRING
+ inline String &operator=(PermString);
+#endif
+
+ void append(const char *, int len);
+ void append_fill(int c, int len);
+ char *append_garbage(int len);
+ inline String &operator+=(const String &);
+ inline String &operator+=(const char *);
+ inline String &operator+=(char);
+#ifdef HAVE_PERMSTRING
+ inline String &operator+=(PermString p);
+#endif
+
+ // String operator+(String, const String &);
+ // String operator+(String, const char *);
+ // String operator+(const char *, const String &);
+ // String operator+(String, PermString);
+ // String operator+(PermString, String);
+ // String operator+(PermString, const char *);
+ // String operator+(const char *, PermString);
+ // String operator+(PermString, PermString);
+ // String operator+(String, char);
+
+ void align(int);
+
+ private:
+
+ struct Memo {
+ int _refcount;
+ int _capacity;
+ int _dirty;
+ char *_real_data;
+
+ inline Memo();
+ inline Memo(char *, int, int);
+ Memo(int, int);
+ ~Memo();
+ };
+
+ mutable const char *_data; // mutable for c_str()
+ mutable int _length;
+ mutable Memo *_memo;
+
+ inline String(const char *, int, Memo *);
+
+ inline void assign(const String &) const;
+ void assign(const char *, int);
+#ifdef HAVE_PERMSTRING
+ inline void assign(PermString) const;
+#endif
+ inline void deref() const;
+ void make_out_of_memory();
+
+ static Memo *null_memo;
+ static Memo *permanent_memo;
+ static Memo *oom_memo;
+ static String *null_string_p;
+ static String *oom_string_p;
+ static const char oom_string_data;
+
+ static String claim_string(char *, int, int); // claim memory
+
+ friend class StringAccum;
+
+};
+
+
+inline
+String::String(const char *data, int length, Memo *memo)
+ : _data(data), _length(length), _memo(memo)
+{
+ _memo->_refcount++;
+}
+
+inline void
+String::assign(const String &s) const
+{
+ _data = s._data;
+ _length = s._length;
+ _memo = s._memo;
+ _memo->_refcount++;
+}
+
+inline void
+String::deref() const
+{
+ if (--_memo->_refcount == 0)
+ delete _memo;
+}
+
+inline
+String::String()
+ : _data(null_memo->_real_data), _length(0), _memo(null_memo)
+{
+ _memo->_refcount++;
+}
+
+inline
+String::String(char c)
+{
+ assign(&c, 1);
+}
+
+inline
+String::String(unsigned char c)
+{
+ assign(reinterpret_cast<char *>(&c), 1);
+}
+
+inline
+String::String(const String &s)
+{
+ assign(s);
+}
+
+inline
+String::~String()
+{
+ deref();
+}
+
+inline String
+String::substring(const char *begin, const char *end) const
+{
+ if (begin < end && begin >= _data && end <= _data + _length)
+ return String(begin, end - begin, _memo);
+ else
+ return String();
+}
+
+inline int
+String::compare(const String &a, const String &b)
+{
+ return a.compare(b);
+}
+
+inline bool
+operator==(const String &s1, const String &s2)
+{
+ return s1.equals(s2.data(), s2.length());
+}
+
+inline bool
+operator==(const char *cc1, const String &s2)
+{
+ return s2.equals(cc1, -1);
+}
+
+inline bool
+operator==(const String &s1, const char *cc2)
+{
+ return s1.equals(cc2, -1);
+}
+
+inline bool
+operator!=(const String &s1, const String &s2)
+{
+ return !s1.equals(s2.data(), s2.length());
+}
+
+inline bool
+operator!=(const char *cc1, const String &s2)
+{
+ return !s2.equals(cc1, -1);
+}
+
+inline bool
+operator!=(const String &s1, const char *cc2)
+{
+ return !s1.equals(cc2, -1);
+}
+
+inline bool
+operator<(const String &s1, const String &s2)
+{
+ return s1.compare(s2.data(), s2.length()) < 0;
+}
+
+inline bool
+operator<=(const String &s1, const String &s2)
+{
+ return s1.compare(s2.data(), s2.length()) <= 0;
+}
+
+inline bool
+operator>(const String &s1, const String &s2)
+{
+ return s1.compare(s2.data(), s2.length()) > 0;
+}
+
+inline bool
+operator>=(const String &s1, const String &s2)
+{
+ return s1.compare(s2.data(), s2.length()) >= 0;
+}
+
+
+inline String &
+String::operator=(const String &s)
+{
+ if (&s != this) {
+ deref();
+ assign(s);
+ }
+ return *this;
+}
+
+inline String &
+String::operator=(const char *cc)
+{
+ deref();
+ assign(cc, -1);
+ return *this;
+}
+
+inline String &
+String::operator+=(const String &s)
+{
+ append(s._data, s._length);
+ return *this;
+}
+
+inline String &
+String::operator+=(const char *cc)
+{
+ append(cc, -1);
+ return *this;
+}
+
+inline String &
+String::operator+=(char c)
+{
+ append_fill(c, 1);
+ return *this;
+}
+
+inline String
+operator+(String s1, const String &s2)
+{
+ s1 += s2;
+ return s1;
+}
+
+inline String
+operator+(String s1, const char *cc2)
+{
+ s1.append(cc2, -1);
+ return s1;
+}
+
+inline String
+operator+(const char *cc1, const String &s2)
+{
+ String s1(cc1);
+ s1 += s2;
+ return s1;
+}
+
+inline String
+operator+(String s1, char c2)
+{
+ s1.append(&c2, 1);
+ return s1;
+}
+
+#ifdef HAVE_PERMSTRING
+
+inline void
+String::assign(PermString p) const
+{
+ _data = p.c_str();
+ _length = p.length();
+ _memo = permanent_memo;
+ _memo->_refcount++;
+}
+
+inline
+String::String(PermString p)
+{
+ assign(p);
+}
+
+inline bool
+operator==(PermString p1, const String &s2)
+{
+ return s2.equals(p1.c_str(), p1.length());
+}
+
+inline bool
+operator==(const String &s1, PermString p2)
+{
+ return s1.equals(p2.c_str(), p2.length());
+}
+
+inline bool
+operator!=(PermString p1, const String &s2)
+{
+ return !s2.equals(p1.c_str(), p1.length());
+}
+
+inline bool
+operator!=(const String &s1, PermString p2)
+{
+ return !s1.equals(p2.c_str(), p2.length());
+}
+
+inline String &
+String::operator=(PermString p)
+{
+ deref();
+ assign(p);
+ return *this;
+}
+
+inline String &
+String::operator+=(PermString p)
+{
+ append(p.c_str(), p.length());
+ return *this;
+}
+
+inline String
+operator+(String s1, PermString p2)
+{
+ s1.append(p2.c_str(), p2.length());
+ return s1;
+}
+
+inline String
+operator+(PermString p1, String s2)
+{
+ String s1(p1);
+ return s1 + s2;
+}
+
+inline String
+operator+(PermString p1, const char *cc2)
+{
+ String s1(p1);
+ return s1 + cc2;
+}
+
+inline String
+operator+(const char *cc1, PermString p2)
+{
+ String s1(cc1);
+ return s1 + p2;
+}
+
+inline String
+operator+(PermString p1, PermString p2)
+{
+ String s1(p1);
+ return s1 + p2;
+}
+
+#endif
+
+unsigned hashcode(const String &);
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/strtonum.h b/Build/source/texk/lcdf-typetools/include/lcdf/strtonum.h
new file mode 100644
index 00000000000..ee8745a4a42
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/strtonum.h
@@ -0,0 +1,10 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double strtonumber(const char *, char **);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/transform.hh b/Build/source/texk/lcdf-typetools/include/lcdf/transform.hh
new file mode 100644
index 00000000000..64c8dc384b7
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/transform.hh
@@ -0,0 +1,162 @@
+// -*- related-file-name: "../../liblcdf/transform.cc" -*-
+#ifndef LCDF_TRANSFORM_HH
+#define LCDF_TRANSFORM_HH
+#include <lcdf/bezier.hh>
+#include <lcdf/string.hh>
+#include <assert.h>
+
+class Transform { public:
+
+ Transform();
+ Transform(const double[6]);
+ Transform(double scalex, double sheary, double shearx, double scaley, double shiftx, double shifty);
+ // Transform(const Transform &) generated by compiler
+ // ~Transform() generated by compiler
+
+ double operator[](int i) const { assert(i>=0&&i<6); return _m[i]; }
+ bool null() const { return _null; }
+ void check_null(double tolerance);
+
+ void scale(double, double);
+ void scale(const Point &p) { scale(p.x, p.y); }
+ void scale(double d) { scale(d, d); }
+ void rotate(double);
+ void translate(double, double);
+ void translate(const Point &p) { translate(p.x, p.y); }
+ void shear(double);
+ inline void transform(const Transform &);
+
+ inline Transform scaled(double, double) const;
+ Transform scaled(const Point &p) const { return scaled(p.x, p.y); }
+ Transform scaled(double d) const { return scaled(d, d); }
+ inline Transform rotated(double) const;
+ inline Transform translated(double, double) const;
+ inline Transform translated(const Point &p) const;
+ inline Transform sheared(double) const;
+ Transform transformed(const Transform &) const;
+
+ // Transform operator+(Transform, const Point &);
+ // Transform &operator+=(Transform &, const Point &);
+ // Transform operator*(Transform, double);
+ // Transform &operator*=(Transform &, double);
+ // Transform operator*(Transform, const Transform &);
+ // Transform &operator*=(Transform &, const Transform &);
+ friend Point operator*(const Point &, const Transform &);
+ friend Point &operator*=(Point &, const Transform &);
+ friend Bezier operator*(const Bezier &, const Transform &);
+ friend Bezier &operator*=(Bezier &, const Transform &);
+
+ String unparse() const;
+
+ private:
+
+ // stored in PostScript order (along columns)
+ double _m[6];
+ bool _null;
+
+ void real_apply_to(Point &) const;
+ Point real_apply(const Point &) const;
+
+};
+
+
+inline Transform
+Transform::scaled(double x, double y) const
+{
+ Transform t(*this);
+ t.scale(x, y);
+ return t;
+}
+
+inline Transform
+Transform::rotated(double r) const
+{
+ Transform t(*this);
+ t.rotate(r);
+ return t;
+}
+
+inline Transform
+Transform::translated(double x, double y) const
+{
+ Transform t(*this);
+ t.translate(x, y);
+ return t;
+}
+
+inline Transform
+Transform::translated(const Point &p) const
+{
+ return translated(p.x, p.y);
+}
+
+inline Transform
+Transform::sheared(double s) const
+{
+ Transform t(*this);
+ t.shear(s);
+ return t;
+}
+
+
+inline Transform &
+operator+=(Transform &t, const Point &p)
+{
+ t.translate(p);
+ return t;
+}
+
+inline Transform
+operator+(Transform t, const Point &p)
+{
+ return t += p;
+}
+
+inline Transform &
+operator*=(Transform &t, double scale)
+{
+ t.scale(scale);
+ return t;
+}
+
+inline Transform
+operator*(Transform t, double scale)
+{
+ return t *= scale;
+}
+
+inline Transform
+operator*(const Transform &t, const Transform &tt)
+{
+ return t.transformed(tt);
+}
+
+inline Transform &
+operator*=(Transform &t, const Transform &tt)
+{
+ t = t.transformed(tt);
+ return t;
+}
+
+inline void
+Transform::transform(const Transform &t)
+{
+ *this *= t;
+}
+
+
+inline Point &
+operator*=(Point &p, const Transform &t)
+{
+ if (!t.null())
+ t.real_apply_to(p);
+ return p;
+}
+
+inline Point
+operator*(const Point &p, const Transform &t)
+{
+ return (t.null() ? p : t.real_apply(p));
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/vector.cc b/Build/source/texk/lcdf-typetools/include/lcdf/vector.cc
new file mode 100644
index 00000000000..0097edb2e47
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/vector.cc
@@ -0,0 +1,130 @@
+#ifndef LCDF_VECTOR_CC
+#define LCDF_VECTOR_CC
+
+/*
+ * vector.{cc,hh} -- simple array template class
+ * Eddie Kohler
+ *
+ * Copyright (c) 1999-2000 Massachusetts Institute of Technology
+ * Copyright (c) 2001-2003 International Computer Science Institute
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, subject to the conditions
+ * listed in the Click LICENSE file. These conditions include: you must
+ * preserve this copyright notice, and you cannot mention the copyright
+ * holders in advertising related to the Software without their permission.
+ * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
+ * notice is a summary of the Click LICENSE file; the license in that file is
+ * legally binding.
+ */
+
+/* #include <lcdf/vector.hh> */
+
+template <class T>
+Vector<T>::Vector(const Vector<T> &o)
+ : _l(0), _n(0), _capacity(0)
+{
+ *this = o;
+}
+
+template <class T>
+Vector<T>::~Vector()
+{
+ for (int i = 0; i < _n; i++)
+ _l[i].~T();
+ delete[] (unsigned char *)_l;
+}
+
+template <class T> Vector<T> &
+Vector<T>::operator=(const Vector<T> &o)
+{
+ if (&o != this) {
+ for (int i = 0; i < _n; i++)
+ _l[i].~T();
+ _n = 0;
+ if (reserve(o._n)) {
+ _n = o._n;
+ for (int i = 0; i < _n; i++)
+ new(velt(i)) T(o._l[i]);
+ }
+ }
+ return *this;
+}
+
+template <class T> Vector<T> &
+Vector<T>::assign(int n, const T &e)
+{
+ resize(0, e);
+ resize(n, e);
+ return *this;
+}
+
+template <class T> typename Vector<T>::iterator
+Vector<T>::erase(iterator a, iterator b)
+{
+ if (b > a) {
+ assert(a >= begin() && b <= end());
+ iterator i = a, j = b;
+ for (; j < end(); i++, j++) {
+ i->~T();
+ new((void*) i) T(*j);
+ }
+ for (; i < end(); i++)
+ i->~T();
+ _n -= b - a;
+ return a;
+ } else
+ return b;
+}
+
+template <class T> bool
+Vector<T>::reserve(int want)
+{
+ if (want < 0)
+ want = _capacity > 0 ? _capacity * 2 : 4;
+ if (want <= _capacity)
+ return true;
+
+ T *new_l = (T *)new unsigned char[sizeof(T) * want];
+ if (!new_l)
+ return false;
+
+ for (int i = 0; i < _n; i++) {
+ new(velt(new_l, i)) T(_l[i]);
+ _l[i].~T();
+ }
+ delete[] (unsigned char *)_l;
+
+ _l = new_l;
+ _capacity = want;
+ return true;
+}
+
+template <class T> void
+Vector<T>::resize(int nn, const T &e)
+{
+ if (nn <= _capacity || reserve(nn)) {
+ for (int i = nn; i < _n; i++)
+ _l[i].~T();
+ for (int i = _n; i < nn; i++)
+ new(velt(i)) T(e);
+ _n = nn;
+ }
+}
+
+template <class T> void
+Vector<T>::swap(Vector<T> &o)
+{
+ T *l = _l;
+ int n = _n;
+ int cap = _capacity;
+ _l = o._l;
+ _n = o._n;
+ _capacity = o._capacity;
+ o._l = l;
+ o._n = n;
+ o._capacity = cap;
+}
+
+#endif
diff --git a/Build/source/texk/lcdf-typetools/include/lcdf/vector.hh b/Build/source/texk/lcdf-typetools/include/lcdf/vector.hh
new file mode 100644
index 00000000000..672abb88036
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/include/lcdf/vector.hh
@@ -0,0 +1,255 @@
+#ifndef LCDF_VECTOR_HH
+#define LCDF_VECTOR_HH
+#include <assert.h>
+#include <stdlib.h>
+#ifdef HAVE_NEW_HDR
+# include <new>
+#elif defined(HAVE_NEW_H)
+# include <new.h>
+#else
+static inline void *operator new(size_t, void *v) { return v; }
+#endif
+
+template <class T>
+class Vector { public:
+
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+
+ typedef int size_type;
+
+ typedef T* iterator;
+ typedef const T* const_iterator;
+
+ explicit Vector() : _l(0), _n(0), _capacity(0) { }
+ explicit Vector(size_type n, const T &e) : _l(0), _n(0), _capacity(0) { resize(n, e); }
+ // template <class In> ...
+ Vector(const Vector<T> &);
+ ~Vector();
+
+ Vector<T>& operator=(const Vector<T>&);
+ Vector<T>& assign(size_type n, const T& e = T());
+ // template <class In> ...
+
+ // iterators
+ iterator begin() { return _l; }
+ const_iterator begin() const { return _l; }
+ iterator end() { return _l + _n; }
+ const_iterator end() const { return _l + _n; }
+
+ // capacity
+ size_type size() const { return _n; }
+ void resize(size_type nn, const T& e = T());
+ size_type capacity() const { return _capacity; }
+ bool empty() const { return _n == 0; }
+ bool reserve(size_type);
+
+ // element access
+ T& operator[](size_type i) { assert(i>=0 && i<_n); return _l[i]; }
+ const T& operator[](size_type i) const{ assert(i>=0 && i<_n); return _l[i]; }
+ T& at(size_type i) { return operator[](i); }
+ const T& at(size_type i) const { return operator[](i); }
+ T& front() { return operator[](0); }
+ const T& front() const { return operator[](0); }
+ T& back() { return operator[](_n - 1); }
+ const T& back() const { return operator[](_n - 1); }
+ T& at_u(size_type i) { return _l[i]; }
+ const T& at_u(size_type i) const { return _l[i]; }
+
+ // modifiers
+ inline void push_back(const T&);
+ inline void pop_back();
+ inline iterator erase(iterator);
+ iterator erase(iterator, iterator);
+ void swap(Vector<T> &);
+ void clear() { erase(begin(), end()); }
+
+ private:
+
+ T *_l;
+ size_type _n;
+ size_type _capacity;
+
+ void *velt(size_type i) const { return (void *)&_l[i]; }
+ static void *velt(T *l, size_type i) { return (void *)&l[i]; }
+
+};
+
+template <class T> inline void
+Vector<T>::push_back(const T &e)
+{
+ if (_n < _capacity || reserve(-1)) {
+ new(velt(_n)) T(e);
+ _n++;
+ }
+}
+
+template <class T> inline void
+Vector<T>::pop_back()
+{
+ assert(_n > 0);
+ --_n;
+ _l[_n].~T();
+}
+
+template <class T> inline typename Vector<T>::iterator
+Vector<T>::erase(iterator e)
+{
+ return (e < end() ? erase(e, e + 1) : e);
+}
+
+
+template <>
+class Vector<void*> { public:
+
+ typedef void* value_type;
+ typedef void*& reference;
+ typedef void* const& const_reference;
+ typedef void** pointer;
+ typedef void* const* const_pointer;
+
+ typedef int size_type;
+
+ typedef void** iterator;
+ typedef void* const* const_iterator;
+
+ explicit Vector() : _l(0), _n(0), _capacity(0) { }
+ explicit Vector(size_type n, void* e) : _l(0), _n(0), _capacity(0) { resize(n, e); }
+ Vector(const Vector<void*> &);
+ ~Vector();
+
+ Vector<void*> &operator=(const Vector<void*> &);
+ Vector<void*> &assign(size_type n, void* e = 0);
+
+ // iterators
+ iterator begin() { return _l; }
+ const_iterator begin() const { return _l; }
+ iterator end() { return _l + _n; }
+ const_iterator end() const { return _l + _n; }
+
+ // capacity
+ size_type size() const { return _n; }
+ void resize(size_type nn, void* e = 0);
+ size_type capacity() const { return _capacity; }
+ bool empty() const { return _n == 0; }
+ bool reserve(size_type);
+
+ // element access
+ void*& operator[](size_type i) { assert(i>=0 && i<_n); return _l[i]; }
+ void* operator[](size_type i) const { assert(i>=0 && i<_n); return _l[i]; }
+ void*& at(size_type i) { return operator[](i); }
+ void* at(size_type i) const { return operator[](i); }
+ void*& front() { return operator[](0); }
+ void* front() const { return operator[](0); }
+ void*& back() { return operator[](_n - 1); }
+ void* back() const { return operator[](_n - 1); }
+ void*& at_u(size_type i) { return _l[i]; }
+ void* at_u(size_type i) const { return _l[i]; }
+
+ // modifiers
+ inline void push_back(void*);
+ inline void pop_back();
+ inline iterator erase(iterator);
+ iterator erase(iterator, iterator);
+ void swap(Vector<void*> &);
+ void clear() { _n = 0; }
+
+ private:
+
+ void **_l;
+ size_type _n;
+ size_type _capacity;
+
+};
+
+inline void
+Vector<void*>::push_back(void *e)
+{
+ if (_n < _capacity || reserve(-1)) {
+ _l[_n] = e;
+ _n++;
+ }
+}
+
+inline void
+Vector<void*>::pop_back()
+{
+ assert(_n > 0);
+ --_n;
+}
+
+inline Vector<void*>::iterator
+Vector<void*>::erase(Vector<void*>::iterator e)
+{
+ return (e < end() ? erase(e, e + 1) : e);
+}
+
+
+template <class T>
+class Vector<T*>: private Vector<void*> {
+
+ typedef Vector<void*> Base;
+
+ public:
+
+ typedef T* value_type;
+ typedef T*& reference;
+ typedef T* const& const_reference;
+ typedef T** pointer;
+ typedef T* const* const_pointer;
+
+ typedef int size_type;
+
+ typedef T** iterator;
+ typedef T* const* const_iterator;
+
+ explicit Vector() : Base() { }
+ explicit Vector(size_type n, T* e) : Base(n, (void *)e) { }
+ Vector(const Vector<T *> &o) : Base(o) { }
+ ~Vector() { }
+
+ Vector<T *> &operator=(const Vector<T *> &o)
+ { Base::operator=(o); return *this; }
+ Vector<T *> &assign(size_type n, T *e = 0)
+ { Base::assign(n, (void *)e); return *this; }
+
+ // iterators
+ const_iterator begin() const { return (const_iterator)(Base::begin()); }
+ iterator begin() { return (iterator)(Base::begin()); }
+ const_iterator end() const { return (const_iterator)(Base::end()); }
+ iterator end() { return (iterator)(Base::end()); }
+
+ // capacity
+ size_type size() const { return Base::size(); }
+ void resize(size_type n, T *e = 0) { Base::resize(n, (void *)e); }
+ size_type capacity() const { return Base::capacity(); }
+ bool empty() const { return Base::empty(); }
+ bool reserve(size_type n) { return Base::reserve(n); }
+
+ // element access
+ T*& operator[](size_type i) { return (T*&)(Base::at(i)); }
+ T* operator[](size_type i) const { return (T*)(Base::operator[](i)); }
+ T*& at(size_type i) { return (T*&)(Base::operator[](i)); }
+ T* at(size_type i) const { return (T*)(Base::at(i)); }
+ T*& front() { return (T*&)(Base::front()); }
+ T* front() const { return (T*)(Base::front()); }
+ T*& back() { return (T*&)(Base::back()); }
+ T* back() const { return (T*)(Base::back()); }
+ T*& at_u(size_type i) { return (T*&)(Base::at_u(i)); }
+ T* at_u(size_type i) const { return (T*)(Base::at_u(i)); }
+
+ // modifiers
+ void push_back(T* e) { Base::push_back((void*)e); }
+ void pop_back() { Base::pop_back(); }
+ iterator erase(iterator i) { return Base::erase((void**)i); }
+ iterator erase(iterator i, iterator j) { return Base::erase((void**)i, (void**)j); }
+ void swap(Vector<T *> &o) { Base::swap(o); }
+ void clear() { Base::clear(); }
+
+};
+
+#include <lcdf/vector.cc> // necessary to support GCC 3.3
+#endif