summaryrefslogtreecommitdiff
path: root/pango/mini-xft
diff options
context:
space:
mode:
authorAlexander Larsson <alla@lysator.liu.se>2001-11-18 16:06:02 +0000
committerAlexander Larsson <alexl@src.gnome.org>2001-11-18 16:06:02 +0000
commit0766534429b5830716e782418179ea63f8f1f65d (patch)
tree1ab6b8c50e572af8320c8f3623b8135276c010f6 /pango/mini-xft
parentb12c0fb6263fd542bb03f8bb10076a0653694f12 (diff)
downloadpango-0766534429b5830716e782418179ea63f8f1f65d.tar.gz
Check for LEX and YACC. This will be made optional later, with the build
2001-11-17 Alexander Larsson <alla@lysator.liu.se> * configure.in: Check for LEX and YACC. This will be made optional later, with the build sources checked in to cvs. Generate pango/mini-xft/Makefile * modules/basic/basic-ft2.c: Use the new pangoft2 API. * pango/Makefile.am: Build mini-xft. Add new files. * pango/pango-context.[ch]: Support only one fontmap per context. Use pango_font_map_load_fontset() and PangoFontset instead of internal fontset. * pango/pango-fontmap.[ch]: New virtual function pango_font_map_load_fontset() and default implementation that uses pango_font_map_load_font(). * pango/pango-utils.[ch] (pango_lookup_aliases): Utility function for looking up aliases. This can be used by backend that has no backend specific aliases. * pango/pangoft2-fontcache.c: Removed file. * pango/pangoft2-fontmap.c: * pango/pangoft2-private.h: * pango/pangoft2.c: * pango/pangoft2.h: Major rewrite. Doesn't handle fontsets. Uses mini-xft so that it will always match the PangoXft backend. Simplified the public API. * pango/pangowin32.c: * pango/pangox.c: pango_context_add_font_map -> pango_context_set_font_map * pango/pangoxft-font.c: * pango/pangoxft-fontmap.c: * pango/pangoxft-private.h: New code to handle fontsets. * pango/mini-xft/*: Mini version of libXft from XFree86 in order to have the pangoFT2 and pangXft backends have same config files and generate the same fonts.
Diffstat (limited to 'pango/mini-xft')
-rw-r--r--pango/mini-xft/Makefile.am53
-rw-r--r--pango/mini-xft/MiniXft.h340
-rw-r--r--pango/mini-xft/MiniXftFreetype.h54
-rw-r--r--pango/mini-xft/README14
-rw-r--r--pango/mini-xft/Xemu.h15
-rw-r--r--pango/mini-xft/minixftcache.c608
-rw-r--r--pango/mini-xft/minixftcfg.c665
-rw-r--r--pango/mini-xft/minixftdbg.c230
-rw-r--r--pango/mini-xft/minixftdir.c136
-rw-r--r--pango/mini-xft/minixftdpy.c321
-rw-r--r--pango/mini-xft/minixftfont.c111
-rw-r--r--pango/mini-xft/minixftfreetype.c190
-rw-r--r--pango/mini-xft/minixftfs.c74
-rw-r--r--pango/mini-xft/minixftgram.c1498
-rw-r--r--pango/mini-xft/minixftgram.h49
-rw-r--r--pango/mini-xft/minixftgram.y452
-rw-r--r--pango/mini-xft/minixftinit.c48
-rw-r--r--pango/mini-xft/minixftint.h395
-rw-r--r--pango/mini-xft/minixftlex.c1985
-rw-r--r--pango/mini-xft/minixftlex.l275
-rw-r--r--pango/mini-xft/minixftlist.c303
-rw-r--r--pango/mini-xft/minixftmatch.c330
-rw-r--r--pango/mini-xft/minixftmatrix.c104
-rw-r--r--pango/mini-xft/minixftname.c391
-rw-r--r--pango/mini-xft/minixftpat.c411
-rw-r--r--pango/mini-xft/minixftstr.c156
26 files changed, 9208 insertions, 0 deletions
diff --git a/pango/mini-xft/Makefile.am b/pango/mini-xft/Makefile.am
new file mode 100644
index 00000000..b8dfe6fe
--- /dev/null
+++ b/pango/mini-xft/Makefile.am
@@ -0,0 +1,53 @@
+## Process this file with automake to produce Makefile.in
+
+INCLUDES = \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DLIBDIR=\"$(libdir)\" \
+ $(FREETYPE_CFLAGS) \
+ -I$(top_srcdir)
+
+LDADDS = @STRIP_BEGIN@ \
+ @GLIB_LIBS@ \
+ -lm \
+@STRIP_END@
+
+noinst_LTLIBRARIES = libmini-xft.la
+
+minixftgram.c: minixftgram.y
+ $(YACC) -d minixftgram.y
+ sed 's/yy/MiniXftConfig/g' y.tab.c | sed 's/__REALLY_YY__/yy/' > minixftgram.c && $(RM) y.tab.c
+ sed 's/yy/MiniXftConfig/g' y.tab.h | sed 's/__REALLY_YY__/yy/' > minixftgram.h && $(RM) y.tab.h
+
+minixftlex.c: minixftlex.l
+ $(LEX) minixftlex.l
+ sed 's/yy/MiniXftConfig/g' lex.yy.c | sed 's/__REALLY_YY__/yy/' > minixftlex.c && $(RM) lex.yy.c
+
+libmini_xft_la_SOURCES = \
+ Xemu.h \
+ MiniXft.h \
+ MiniXftFreetype.h \
+ minixftgram.h \
+ minixftint.h \
+ minixftgram.c \
+ minixftlex.c \
+ minixftdbg.c \
+ minixftfont.c \
+ minixftfs.c \
+ minixftlist.c \
+ minixftname.c \
+ minixftcache.c \
+ minixftdir.c \
+ minixftfreetype.c \
+ minixftmatch.c \
+ minixftpat.c \
+ minixftcfg.c \
+ minixftdpy.c \
+ minixftinit.c \
+ minixftmatrix.c \
+ minixftstr.c
+
+EXTRA_DIST = \
+ minixftgram.y \
+ minixftlex.l \
+ README
+
diff --git a/pango/mini-xft/MiniXft.h b/pango/mini-xft/MiniXft.h
new file mode 100644
index 00000000..31cfb1cf
--- /dev/null
+++ b/pango/mini-xft/MiniXft.h
@@ -0,0 +1,340 @@
+/*
+ * $XFree86: xc/lib/MiniXft/MiniXft.h,v 1.19 2001/04/29 03:21:17 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFT_H_
+#define _XFT_H_
+
+#include "Xemu.h"
+
+#include <stdarg.h>
+
+typedef unsigned char MiniXftChar8;
+typedef unsigned short MiniXftChar16;
+typedef unsigned int MiniXftChar32;
+
+#define XFT_FAMILY "family" /* String */
+#define XFT_STYLE "style" /* String */
+#define XFT_SLANT "slant" /* Int */
+#define XFT_WEIGHT "weight" /* Int */
+#define XFT_SIZE "size" /* Double */
+#define XFT_PIXEL_SIZE "pixelsize" /* Double */
+#define XFT_ENCODING "encoding" /* String */
+#define XFT_SPACING "spacing" /* Int */
+#define XFT_FOUNDRY "foundry" /* String */
+#define XFT_CORE "core" /* Bool */
+#define XFT_ANTIALIAS "antialias" /* Bool */
+#define XFT_XLFD "xlfd" /* String */
+#define XFT_FILE "file" /* String */
+#define XFT_INDEX "index" /* Int */
+#define XFT_RASTERIZER "rasterizer"/* String */
+#define XFT_OUTLINE "outline" /* Bool */
+#define XFT_SCALABLE "scalable" /* Bool */
+#define XFT_RGBA "rgba" /* Int */
+
+/* defaults from resources */
+#define XFT_SCALE "scale" /* double */
+#define XFT_RENDER "render" /* Bool */
+#define XFT_MINSPACE "minspace" /* Bool use minimum line spacing */
+#define XFT_DPI "dpi" /* double */
+
+/* specific to FreeType rasterizer */
+#define XFT_CHAR_WIDTH "charwidth" /* Int */
+#define XFT_CHAR_HEIGHT "charheight"/* Int */
+#define XFT_MATRIX "matrix" /* MiniXftMatrix */
+
+#define XFT_WEIGHT_LIGHT 0
+#define XFT_WEIGHT_MEDIUM 100
+#define XFT_WEIGHT_DEMIBOLD 180
+#define XFT_WEIGHT_BOLD 200
+#define XFT_WEIGHT_BLACK 210
+
+#define XFT_SLANT_ROMAN 0
+#define XFT_SLANT_ITALIC 100
+#define XFT_SLANT_OBLIQUE 110
+
+#define XFT_PROPORTIONAL 0
+#define XFT_MONO 100
+#define XFT_CHARCELL 110
+
+#define XFT_RGBA_NONE 0
+#define XFT_RGBA_RGB 1
+#define XFT_RGBA_BGR 2
+#define XFT_RGBA_VRGB 3
+#define XFT_RGBA_VBGR 4
+
+typedef enum _MiniXftType {
+ MiniXftTypeVoid,
+ MiniXftTypeInteger,
+ MiniXftTypeDouble,
+ MiniXftTypeString,
+ MiniXftTypeBool,
+ MiniXftTypeMatrix
+} MiniXftType;
+
+typedef struct _MiniXftMatrix {
+ double xx, xy, yx, yy;
+} MiniXftMatrix;
+
+#define MiniXftMatrixInit(m) ((m)->xx = (m)->yy = 1, \
+ (m)->xy = (m)->yx = 0)
+
+typedef enum _MiniXftResult {
+ MiniXftResultMatch, MiniXftResultNoMatch, MiniXftResultTypeMismatch, MiniXftResultNoId
+} MiniXftResult;
+
+typedef struct _MiniXftValue {
+ MiniXftType type;
+ union {
+ char *s;
+ int i;
+ Bool b;
+ double d;
+ MiniXftMatrix *m;
+ } u;
+} MiniXftValue;
+
+typedef struct _MiniXftValueList {
+ struct _MiniXftValueList *next;
+ MiniXftValue value;
+} MiniXftValueList;
+
+typedef struct _MiniXftPatternElt {
+ const char *object;
+ MiniXftValueList *values;
+} MiniXftPatternElt;
+
+typedef struct _MiniXftPattern {
+ int num;
+ int size;
+ MiniXftPatternElt *elts;
+} MiniXftPattern;
+
+typedef struct _MiniXftFontSet {
+ int nfont;
+ int sfont;
+ MiniXftPattern **fonts;
+} MiniXftFontSet;
+
+typedef struct _MiniXftObjectSet {
+ int nobject;
+ int sobject;
+ const char **objects;
+} MiniXftObjectSet;
+
+_XFUNCPROTOBEGIN
+
+/* xftcfg.c */
+Bool
+MiniXftConfigSubstitute (MiniXftPattern *p);
+
+/* xftdbg.c */
+void
+MiniXftValuePrint (MiniXftValue v);
+
+void
+MiniXftValueListPrint (MiniXftValueList *l);
+
+void
+MiniXftPatternPrint (MiniXftPattern *p);
+
+void
+MiniXftFontSetPrint (MiniXftFontSet *s);
+
+/* xftdir.c */
+/* xftdpy.c */
+void
+MiniXftSetDPI (double dpi);
+
+Bool
+MiniXftDefaultHasRender (Display *dpy);
+
+Bool
+MiniXftDefaultSet (Display *dpy, MiniXftPattern *defaults);
+
+void
+MiniXftDefaultSubstitute (Display *dpy, int screen, MiniXftPattern *pattern);
+
+/* xftfont.c */
+MiniXftPattern *
+MiniXftFontMatch (Display *dpy, int screen, MiniXftPattern *pattern, MiniXftResult *result);
+
+/* xftfreetype.c */
+/* xftfs.c */
+
+MiniXftFontSet *
+MiniXftFontSetCreate (void);
+
+void
+MiniXftFontSetDestroy (MiniXftFontSet *s);
+
+Bool
+MiniXftFontSetAdd (MiniXftFontSet *s, MiniXftPattern *font);
+
+/* xftglyphs.c */
+/* see MiniXftFreetype.h */
+
+/* xftgram.y */
+
+/* xftinit.c */
+extern MiniXftFontSet *_MiniXftFontSet;
+
+Bool
+MiniXftInit (char *config);
+
+/* xftlex.l */
+
+/* xftlist.c */
+MiniXftObjectSet *
+MiniXftObjectSetCreate (void);
+
+Bool
+MiniXftObjectSetAdd (MiniXftObjectSet *os, const char *object);
+
+void
+MiniXftObjectSetDestroy (MiniXftObjectSet *os);
+
+MiniXftObjectSet *
+MiniXftObjectSetVaBuild (const char *first, va_list va);
+
+MiniXftObjectSet *
+MiniXftObjectSetBuild (const char *first, ...);
+
+MiniXftFontSet *
+MiniXftListFontSets (MiniXftFontSet **sets,
+ int nsets,
+ MiniXftPattern *p,
+ MiniXftObjectSet *os);
+
+MiniXftFontSet *
+MiniXftListFontsPatternObjects (Display *dpy,
+ int screen,
+ MiniXftPattern *pattern,
+ MiniXftObjectSet *os);
+
+MiniXftFontSet *
+MiniXftListFonts (Display *dpy,
+ int screen,
+ ...);
+
+/* xftmatch.c */
+MiniXftPattern *
+MiniXftFontSetMatch (MiniXftFontSet **sets,
+ int nsets,
+ MiniXftPattern *p,
+ MiniXftResult *result);
+
+/* xftmatrix.c */
+int
+MiniXftMatrixEqual (const MiniXftMatrix *mat1, const MiniXftMatrix *mat2);
+
+void
+MiniXftMatrixMultiply (MiniXftMatrix *result, MiniXftMatrix *a, MiniXftMatrix *b);
+
+void
+MiniXftMatrixRotate (MiniXftMatrix *m, double c, double s);
+
+void
+MiniXftMatrixScale (MiniXftMatrix *m, double sx, double sy);
+
+void
+MiniXftMatrixShear (MiniXftMatrix *m, double sh, double sv);
+
+/* xftname.c */
+MiniXftPattern *
+MiniXftNameParse (const char *name);
+
+Bool
+MiniXftNameUnparse (MiniXftPattern *pat, char *dest, int len);
+
+/* xftpat.c */
+MiniXftPattern *
+MiniXftPatternCreate (void);
+
+MiniXftPattern *
+MiniXftPatternDuplicate (MiniXftPattern *p);
+
+void
+MiniXftValueDestroy (MiniXftValue v);
+
+void
+MiniXftValueListDestroy (MiniXftValueList *l);
+
+void
+MiniXftPatternDestroy (MiniXftPattern *p);
+
+MiniXftPatternElt *
+MiniXftPatternFind (MiniXftPattern *p, const char *object, Bool insert);
+
+Bool
+MiniXftPatternAdd (MiniXftPattern *p, const char *object, MiniXftValue value, Bool append);
+
+MiniXftResult
+MiniXftPatternGet (MiniXftPattern *p, const char *object, int id, MiniXftValue *v);
+
+Bool
+MiniXftPatternDel (MiniXftPattern *p, const char *object);
+
+Bool
+MiniXftPatternAddInteger (MiniXftPattern *p, const char *object, int i);
+
+Bool
+MiniXftPatternAddDouble (MiniXftPattern *p, const char *object, double d);
+
+Bool
+MiniXftPatternAddString (MiniXftPattern *p, const char *object, const char *s);
+
+Bool
+MiniXftPatternAddMatrix (MiniXftPattern *p, const char *object, const MiniXftMatrix *s);
+
+Bool
+MiniXftPatternAddBool (MiniXftPattern *p, const char *object, Bool b);
+
+MiniXftResult
+MiniXftPatternGetInteger (MiniXftPattern *p, const char *object, int n, int *i);
+
+MiniXftResult
+MiniXftPatternGetDouble (MiniXftPattern *p, const char *object, int n, double *d);
+
+MiniXftResult
+MiniXftPatternGetString (MiniXftPattern *p, const char *object, int n, char **s);
+
+MiniXftResult
+MiniXftPatternGetMatrix (MiniXftPattern *p, const char *object, int n, MiniXftMatrix **s);
+
+MiniXftResult
+MiniXftPatternGetBool (MiniXftPattern *p, const char *object, int n, Bool *b);
+
+MiniXftPattern *
+MiniXftPatternVaBuild (MiniXftPattern *orig, va_list va);
+
+MiniXftPattern *
+MiniXftPatternBuild (MiniXftPattern *orig, ...);
+
+/* xftrender.c */
+/* see MiniXftFreetype.h */
+
+/* xftstr.c */
+_XFUNCPROTOEND
+
+#endif /* _XFT_H_ */
diff --git a/pango/mini-xft/MiniXftFreetype.h b/pango/mini-xft/MiniXftFreetype.h
new file mode 100644
index 00000000..a69c6a47
--- /dev/null
+++ b/pango/mini-xft/MiniXftFreetype.h
@@ -0,0 +1,54 @@
+/*
+ * $XFree86: xc/lib/MiniXft/MiniXftFreetype.h,v 1.15 2001/03/31 23:07:29 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFTFREETYPE_H_
+#define _XFTFREETYPE_H_
+
+#include "MiniXft.h"
+#include <freetype/freetype.h>
+
+extern FT_Library _MiniXftFTlibrary;
+
+_XFUNCPROTOBEGIN
+
+/* xftdir.c */
+Bool
+MiniXftDirScan (MiniXftFontSet *set, const char *dir, Bool force);
+
+Bool
+MiniXftDirSave (MiniXftFontSet *set, const char *dir);
+
+/* xftfreetype.c */
+MiniXftPattern *
+MiniXftFreeTypeQuery (const char *file, int id, int *count);
+
+Bool
+MiniXftInitFtLibrary(void);
+
+_XFUNCPROTOEND
+
+#endif /* _XFTFREETYPE_H_ */
+
+
+
diff --git a/pango/mini-xft/README b/pango/mini-xft/README
new file mode 100644
index 00000000..11ea3392
--- /dev/null
+++ b/pango/mini-xft/README
@@ -0,0 +1,14 @@
+This is a copy of the libXft library from the XFree86 cvs server, with
+all the X specific parts removed. It is used by pangoft2 to locate
+fonts and to handle font aliases in exactly the same way as Xft does.
+
+In order to not have symbols collide, the following sed scripts were run
+on the code:
+
+for file in xftgram.y xftlex.l xftdir.c xftcache.c xftdpy.c xftfs.c xftname.c xftcfg.c xftfont.c xftinit.c xftlist.c xftpat.c xftdbg.c xftfreetype.c xftmatrix.c xftmatch.c xftstr.c xftgram.h xftint.h ; do
+ sed s#Xft#MiniXft#g $file | sed s#/X11/MiniXftConfig#/X11/XftConfig#g | sed s/xftint.h/minixftint.h/g | sed s/xftgram.h/minixftgram.h/g> mini-xft/mini$file;
+done
+
+for file in XftFreetype.h Xft.h; do
+ sed s/Xft/MiniXft/g $file > mini-xft/Mini$file;
+done
diff --git a/pango/mini-xft/Xemu.h b/pango/mini-xft/Xemu.h
new file mode 100644
index 00000000..17d0fd67
--- /dev/null
+++ b/pango/mini-xft/Xemu.h
@@ -0,0 +1,15 @@
+#ifndef XEMU_H
+#define XEMU_H
+
+#include <glib.h>
+
+#define _XFUNCPROTOBEGIN G_BEGIN_DECLS
+#define _XFUNCPROTOEND G_END_DECLS
+
+typedef gboolean Bool;
+typedef int Display;
+
+#define False FALSE
+#define True TRUE
+
+#endif /* XEMU_H */
diff --git a/pango/mini-xft/minixftcache.c b/pango/mini-xft/minixftcache.c
new file mode 100644
index 00000000..54ec1fd5
--- /dev/null
+++ b/pango/mini-xft/minixftcache.c
@@ -0,0 +1,608 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftcache.c,v 1.2 2001/06/11 22:53:30 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "minixftint.h"
+
+typedef struct _MiniXftFileCacheEnt {
+ struct _MiniXftFileCacheEnt *next;
+ unsigned int hash;
+ char *file;
+ int id;
+ time_t time;
+ char *name;
+ Bool referenced;
+} MiniXftFileCacheEnt;
+
+#define HASH_SIZE 509
+
+typedef struct _MiniXftFileCache {
+ MiniXftFileCacheEnt *ents[HASH_SIZE];
+ Bool updated;
+ int entries;
+ int referenced;
+} MiniXftFileCache;
+
+static MiniXftFileCache _MiniXftFileCache;
+
+static unsigned int
+_MiniXftFileCacheHash (char *string)
+{
+ unsigned int h = 0;
+ char c;
+
+ while ((c = *string++))
+ h = (h << 1) ^ c;
+ return h;
+}
+
+char *
+MiniXftFileCacheFind (char *file, int id, int *count)
+{
+ MiniXftFileCache *cache;
+ unsigned int hash;
+ char *match;
+ MiniXftFileCacheEnt *c, *name;
+ int maxid;
+ struct stat statb;
+
+ cache = &_MiniXftFileCache;
+ match = file;
+
+ hash = _MiniXftFileCacheHash (match);
+ name = 0;
+ maxid = -1;
+ for (c = cache->ents[hash % HASH_SIZE]; c; c = c->next)
+ {
+ if (c->hash == hash && !strcmp (match, c->file))
+ {
+ if (c->id > maxid)
+ maxid = c->id;
+ if (c->id == id)
+ {
+ if (stat (file, &statb) < 0)
+ {
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ printf (" file missing\n");
+ return 0;
+ }
+ if (statb.st_mtime != c->time)
+ {
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ printf (" timestamp mismatch (was %d is %d)\n",
+ (int) c->time, (int) statb.st_mtime);
+ return 0;
+ }
+ if (!c->referenced)
+ {
+ cache->referenced++;
+ c->referenced = True;
+ }
+ name = c;
+ }
+ }
+ }
+ if (!name)
+ return 0;
+ *count = maxid + 1;
+ return name->name;
+}
+
+/*
+ * Cache file syntax is quite simple:
+ *
+ * "file_name" id time "font_name" \n
+ */
+
+static Bool
+_MiniXftFileCacheReadString (FILE *f, char *dest, int len)
+{
+ int c;
+ Bool escape;
+
+ while ((c = getc (f)) != EOF)
+ if (c == '"')
+ break;
+ if (c == EOF)
+ return False;
+ if (len == 0)
+ return False;
+
+ escape = False;
+ while ((c = getc (f)) != EOF)
+ {
+ if (!escape)
+ {
+ switch (c) {
+ case '"':
+ *dest++ = '\0';
+ return True;
+ case '\\':
+ escape = True;
+ continue;
+ }
+ }
+ if (--len <= 1)
+ return False;
+ *dest++ = c;
+ escape = False;
+ }
+ return False;
+}
+
+static Bool
+_MiniXftFileCacheReadUlong (FILE *f, unsigned long *dest)
+{
+ unsigned long t;
+ int c;
+
+ while ((c = getc (f)) != EOF)
+ {
+ if (!isspace (c))
+ break;
+ }
+ if (c == EOF)
+ return False;
+ t = 0;
+ for (;;)
+ {
+ if (c == EOF || isspace (c))
+ break;
+ if (!isdigit (c))
+ return False;
+ t = t * 10 + (c - '0');
+ c = getc (f);
+ }
+ *dest = t;
+ return True;
+}
+
+static Bool
+_MiniXftFileCacheReadInt (FILE *f, int *dest)
+{
+ unsigned long t;
+ Bool ret;
+
+ ret = _MiniXftFileCacheReadUlong (f, &t);
+ if (ret)
+ *dest = (int) t;
+ return ret;
+}
+
+static Bool
+_MiniXftFileCacheReadTime (FILE *f, time_t *dest)
+{
+ unsigned long t;
+ Bool ret;
+
+ ret = _MiniXftFileCacheReadUlong (f, &t);
+ if (ret)
+ *dest = (time_t) t;
+ return ret;
+}
+
+static Bool
+_MiniXftFileCacheAdd (MiniXftFileCache *cache,
+ char *file,
+ int id,
+ time_t time,
+ char *name,
+ Bool replace)
+{
+ MiniXftFileCacheEnt *c;
+ MiniXftFileCacheEnt **prev, *old;
+ unsigned int hash;
+
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ {
+ printf ("%s face %s/%d as %s\n", replace ? "Replace" : "Add",
+ file, id, name);
+ }
+ hash = _MiniXftFileCacheHash (file);
+ for (prev = &cache->ents[hash % HASH_SIZE];
+ (old = *prev);
+ prev = &(*prev)->next)
+ {
+ if (old->hash == hash && old->id == id && !strcmp (old->file, file))
+ break;
+ }
+ if (*prev)
+ {
+ if (!replace)
+ return False;
+
+ old = *prev;
+ if (old->referenced)
+ cache->referenced--;
+ *prev = old->next;
+ free (old);
+ cache->entries--;
+ }
+
+ c = malloc (sizeof (MiniXftFileCacheEnt) +
+ strlen (file) + 1 +
+ strlen (name) + 1);
+ if (!c)
+ return False;
+ c->next = *prev;
+ *prev = c;
+ c->hash = hash;
+ c->file = (char *) (c + 1);
+ c->id = id;
+ c->name = c->file + strlen (file) + 1;
+ strcpy (c->file, file);
+ c->time = time;
+ c->referenced = replace;
+ strcpy (c->name, name);
+ cache->entries++;
+ return True;
+}
+
+void
+MiniXftFileCacheDispose (void)
+{
+ MiniXftFileCache *cache;
+ MiniXftFileCacheEnt *c, *next;
+ int h;
+
+ cache = &_MiniXftFileCache;
+
+ for (h = 0; h < HASH_SIZE; h++)
+ {
+ for (c = cache->ents[h]; c; c = next)
+ {
+ next = c->next;
+ free (c);
+ }
+ cache->ents[h] = 0;
+ }
+ cache->entries = 0;
+ cache->referenced = 0;
+ cache->updated = False;
+}
+
+void
+MiniXftFileCacheLoad (char *cache_file)
+{
+ MiniXftFileCache *cache;
+ FILE *f;
+ char file[8192];
+ int id;
+ time_t time;
+ char name[8192];
+
+ f = fopen (cache_file, "r");
+ if (!f)
+ return;
+
+ cache = &_MiniXftFileCache;
+
+ cache->updated = False;
+ while (_MiniXftFileCacheReadString (f, file, sizeof (file)) &&
+ _MiniXftFileCacheReadInt (f, &id) &&
+ _MiniXftFileCacheReadTime (f, &time) &&
+ _MiniXftFileCacheReadString (f, name, sizeof (name)))
+ {
+ (void) _MiniXftFileCacheAdd (cache, file, id, time, name, False);
+ }
+ fclose (f);
+}
+
+Bool
+MiniXftFileCacheUpdate (char *file, int id, char *name)
+{
+ MiniXftFileCache *cache;
+ char *match;
+ struct stat statb;
+ Bool ret;
+
+ cache = &_MiniXftFileCache;
+ match = file;
+
+ if (stat (file, &statb) < 0)
+ return False;
+ ret = _MiniXftFileCacheAdd (cache, match, id,
+ statb.st_mtime, name, True);
+ if (ret)
+ cache->updated = True;
+ return ret;
+}
+
+static Bool
+_MiniXftFileCacheWriteString (FILE *f, char *string)
+{
+ char c;
+
+ if (putc ('"', f) == EOF)
+ return False;
+ while ((c = *string++))
+ {
+ switch (c) {
+ case '"':
+ case '\\':
+ if (putc ('\\', f) == EOF)
+ return False;
+ /* fall through */
+ default:
+ if (putc (c, f) == EOF)
+ return False;
+ }
+ }
+ if (putc ('"', f) == EOF)
+ return False;
+ return True;
+}
+
+static Bool
+_MiniXftFileCacheWriteUlong (FILE *f, unsigned long t)
+{
+ int pow;
+ unsigned long temp, digit;
+
+ temp = t;
+ pow = 1;
+ while (temp >= 10)
+ {
+ temp /= 10;
+ pow *= 10;
+ }
+ temp = t;
+ while (pow)
+ {
+ digit = temp / pow;
+ if (putc ((char) digit + '0', f) == EOF)
+ return False;
+ temp = temp - pow * digit;
+ pow = pow / 10;
+ }
+ return True;
+}
+
+static Bool
+_MiniXftFileCacheWriteInt (FILE *f, int i)
+{
+ return _MiniXftFileCacheWriteUlong (f, (unsigned long) i);
+}
+
+static Bool
+_MiniXftFileCacheWriteTime (FILE *f, time_t t)
+{
+ return _MiniXftFileCacheWriteUlong (f, (unsigned long) t);
+}
+
+Bool
+MiniXftFileCacheSave (char *cache_file)
+{
+ MiniXftFileCache *cache;
+ char *lck;
+ char *tmp;
+ FILE *f;
+ int h;
+ MiniXftFileCacheEnt *c;
+
+ cache = &_MiniXftFileCache;
+
+ if (!cache->updated && cache->referenced == cache->entries)
+ return True;
+
+ lck = malloc (strlen (cache_file)*2 + 4);
+ if (!lck)
+ goto bail0;
+ tmp = lck + strlen (cache_file) + 2;
+ strcpy (lck, cache_file);
+ strcat (lck, "L");
+ strcpy (tmp, cache_file);
+ strcat (tmp, "T");
+ if (link (lck, cache_file) < 0 && errno != ENOENT)
+ goto bail1;
+ if (access (tmp, F_OK) == 0)
+ goto bail2;
+ f = fopen (tmp, "w");
+ if (!f)
+ goto bail2;
+
+ for (h = 0; h < HASH_SIZE; h++)
+ {
+ for (c = cache->ents[h]; c; c = c->next)
+ {
+ if (!c->referenced)
+ continue;
+ if (!_MiniXftFileCacheWriteString (f, c->file))
+ goto bail4;
+ if (putc (' ', f) == EOF)
+ goto bail4;
+ if (!_MiniXftFileCacheWriteInt (f, c->id))
+ goto bail4;
+ if (putc (' ', f) == EOF)
+ goto bail4;
+ if (!_MiniXftFileCacheWriteTime (f, c->time))
+ goto bail4;
+ if (putc (' ', f) == EOF)
+ goto bail4;
+ if (!_MiniXftFileCacheWriteString (f, c->name))
+ goto bail4;
+ if (putc ('\n', f) == EOF)
+ goto bail4;
+ }
+ }
+
+ if (fclose (f) == EOF)
+ goto bail3;
+
+ if (rename (tmp, cache_file) < 0)
+ goto bail3;
+
+ unlink (lck);
+ cache->updated = False;
+ return True;
+
+bail4:
+ fclose (f);
+bail3:
+ unlink (tmp);
+bail2:
+ unlink (lck);
+bail1:
+ free (lck);
+bail0:
+ return False;
+}
+
+Bool
+MiniXftFileCacheReadDir (MiniXftFontSet *set, const char *cache_file)
+{
+ MiniXftPattern *font;
+ FILE *f;
+ char *path;
+ char *base;
+ char file[8192];
+ int id;
+ char name[8192];
+ Bool ret = False;
+
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ {
+ printf ("MiniXftFileCacheReadDir cache_file \"%s\"\n", cache_file);
+ }
+
+ f = fopen (cache_file, "r");
+ if (!f)
+ {
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ {
+ printf (" no cache file\n");
+ }
+ goto bail0;
+ }
+
+ base = strrchr (cache_file, '/');
+ if (!base)
+ goto bail1;
+ base++;
+ path = malloc (base - cache_file + 8192 + 1);
+ if (!path)
+ goto bail1;
+ memcpy (path, cache_file, base - cache_file);
+ base = path + (base - cache_file);
+
+ while (_MiniXftFileCacheReadString (f, file, sizeof (file)) &&
+ _MiniXftFileCacheReadInt (f, &id) &&
+ _MiniXftFileCacheReadString (f, name, sizeof (name)))
+ {
+ font = MiniXftNameParse (name);
+ if (font)
+ {
+ strcpy (base, file);
+ if (_MiniXftFontDebug () & XFT_DBG_CACHEV)
+ {
+ printf (" dir cache file \"%s\"\n", file);
+ }
+ MiniXftPatternAddString (font, XFT_FILE, path);
+ if (!MiniXftFontSetAdd (set, font))
+ goto bail2;
+ }
+ }
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ {
+ printf (" cache loaded\n");
+ }
+
+ ret = True;
+bail2:
+ free (path);
+bail1:
+ fclose (f);
+bail0:
+ return ret;
+}
+
+Bool
+MiniXftFileCacheWriteDir (MiniXftFontSet *set, const char *cache_file)
+{
+ MiniXftPattern *font;
+ FILE *f;
+ char name[8192];
+ char *file, *base;
+ int n;
+ int id;
+
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ printf ("MiniXftFileCacheWriteDir cache_file \"%s\"\n", cache_file);
+
+ f = fopen (cache_file, "w");
+ if (!f)
+ {
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ printf (" can't create \"%s\"\n", cache_file);
+ goto bail0;
+ }
+ for (n = 0; n < set->nfont; n++)
+ {
+ font = set->fonts[n];
+ if (MiniXftPatternGetString (font, XFT_FILE, 0, &file) != MiniXftResultMatch)
+ goto bail1;
+ base = strrchr (file, '/');
+ if (base)
+ base = base + 1;
+ else
+ base = file;
+ if (MiniXftPatternGetInteger (font, XFT_INDEX, 0, &id) != MiniXftResultMatch)
+ goto bail1;
+ if (!MiniXftNameUnparse (font, name, sizeof (name)))
+ goto bail1;
+ if (_MiniXftFontDebug () & XFT_DBG_CACHEV)
+ printf (" write file \"%s\"\n", base);
+ if (!_MiniXftFileCacheWriteString (f, base))
+ goto bail1;
+ if (putc (' ', f) == EOF)
+ goto bail1;
+ if (!_MiniXftFileCacheWriteInt (f, id))
+ goto bail1;
+ if (putc (' ', f) == EOF)
+ goto bail1;
+ if (!_MiniXftFileCacheWriteString (f, name))
+ goto bail1;
+ if (putc ('\n', f) == EOF)
+ goto bail1;
+ }
+ if (fclose (f) == EOF)
+ goto bail0;
+
+ if (_MiniXftFontDebug () & XFT_DBG_CACHE)
+ printf (" cache written\n");
+ return True;
+
+bail1:
+ fclose (f);
+bail0:
+ unlink (cache_file);
+ return False;
+}
diff --git a/pango/mini-xft/minixftcfg.c b/pango/mini-xft/minixftcfg.c
new file mode 100644
index 00000000..ffc7e4e0
--- /dev/null
+++ b/pango/mini-xft/minixftcfg.c
@@ -0,0 +1,665 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftcfg.c,v 1.9 2001/03/31 01:57:20 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "minixftint.h"
+
+static char *MiniXftConfigDefaultDirs[] = {
+ "/usr/X11R6/lib/X11/fonts/Type1",
+ 0
+};
+
+char **MiniXftConfigDirs = MiniXftConfigDefaultDirs;
+static int MiniXftConfigNdirs;
+
+char MiniXftConfigDefaultCache[] = "~/.xftcache";
+char *MiniXftConfigCache = 0;
+
+static MiniXftSubst *MiniXftSubsts;
+/* #define XFT_DEBUG_EDIT */
+
+Bool
+MiniXftConfigAddDir (char *d)
+{
+ char **dirs;
+ char *dir;
+ char *h;
+
+ if (*d == '~')
+ {
+ h = getenv ("HOME");
+ if (!h)
+ return False;
+ dir = (char *) malloc (strlen (h) + strlen (d));
+ if (!dir)
+ return False;
+ strcpy (dir, h);
+ strcat (dir, d+1);
+ }
+ else
+ {
+ dir = (char *) malloc (strlen (d) + 1);
+ if (!dir)
+ return False;
+ strcpy (dir, d);
+ }
+ dirs = (char **) malloc ((MiniXftConfigNdirs + 2) * sizeof (char *));
+ if (!dirs)
+ {
+ free (dir);
+ return False;
+ }
+ if (MiniXftConfigNdirs)
+ {
+ memcpy (dirs, MiniXftConfigDirs, MiniXftConfigNdirs * sizeof (char *));
+ }
+ dirs[MiniXftConfigNdirs] = dir;
+ MiniXftConfigNdirs++;
+ dirs[MiniXftConfigNdirs] = 0;
+ if (MiniXftConfigDirs != MiniXftConfigDefaultDirs)
+ free (MiniXftConfigDirs);
+ MiniXftConfigDirs = dirs;
+ return True;
+}
+
+Bool
+MiniXftConfigSetCache (char *c)
+{
+ char *new;
+ char *h;
+
+ if (*c == '~')
+ {
+ h = getenv ("HOME");
+ if (!h)
+ return False;
+ new = (char *) malloc (strlen (h) + strlen (c));
+ if (!new)
+ return False;
+ strcpy (new, h);
+ strcat (new, c+1);
+ }
+ else
+ {
+ new = _MiniXftSaveString (c);
+ }
+ if (MiniXftConfigCache)
+ free (MiniXftConfigCache);
+ MiniXftConfigCache = new;
+ return True;
+}
+
+char *
+MiniXftConfigGetCache (void)
+{
+ if (!MiniXftConfigCache)
+ MiniXftConfigSetCache (MiniXftConfigDefaultCache);
+ return MiniXftConfigCache;
+}
+
+static int MiniXftSubstsMaxObjects;
+
+Bool
+MiniXftConfigAddEdit (MiniXftTest *test, MiniXftEdit *edit)
+{
+ MiniXftSubst *subst, **prev;
+ MiniXftTest *t;
+ int num;
+
+ subst = (MiniXftSubst *) malloc (sizeof (MiniXftSubst));
+ if (!subst)
+ return False;
+ for (prev = &MiniXftSubsts; *prev; prev = &(*prev)->next);
+ *prev = subst;
+ subst->next = 0;
+ subst->test = test;
+ subst->edit = edit;
+#ifdef XFT_DEBUG_EDIT
+ printf ("Add Subst ");
+ MiniXftSubstPrint (subst);
+#endif
+ num = 0;
+ for (t = test; t; t = t->next)
+ num++;
+ if (MiniXftSubstsMaxObjects < num)
+ MiniXftSubstsMaxObjects = num;
+ return True;
+}
+
+typedef struct _MiniXftSubState {
+ MiniXftPatternElt *elt;
+ MiniXftValueList *value;
+} MiniXftSubState;
+
+static MiniXftMatrix MiniXftIdentityMatrix = { 1, 0, 0, 1 };
+
+static MiniXftValue
+_MiniXftConfigPromote (MiniXftValue v, MiniXftValue u)
+{
+ if (v.type == MiniXftTypeInteger)
+ {
+ v.type = MiniXftTypeDouble;
+ v.u.d = (double) v.u.i;
+ }
+ if (v.type == MiniXftTypeVoid && u.type == MiniXftTypeMatrix)
+ {
+ v.u.m = &MiniXftIdentityMatrix;
+ v.type = MiniXftTypeMatrix;
+ }
+ return v;
+}
+
+Bool
+_MiniXftConfigCompareValue (MiniXftValue m,
+ MiniXftOp op,
+ MiniXftValue v)
+{
+ Bool ret;
+
+ if (m.type == MiniXftTypeVoid)
+ return True;
+ m = _MiniXftConfigPromote (m, v);
+ v = _MiniXftConfigPromote (v, m);
+ if (m.type == v.type)
+ {
+ ret = False;
+ switch (m.type) {
+ case MiniXftTypeDouble:
+ switch (op) {
+ case MiniXftOpEqual:
+ ret = m.u.d == v.u.d;
+ break;
+ case MiniXftOpNotEqual:
+ ret = m.u.d != v.u.d;
+ break;
+ case MiniXftOpLess:
+ ret = m.u.d < v.u.d;
+ break;
+ case MiniXftOpLessEqual:
+ ret = m.u.d <= v.u.d;
+ break;
+ case MiniXftOpMore:
+ ret = m.u.d > v.u.d;
+ break;
+ case MiniXftOpMoreEqual:
+ ret = m.u.d >= v.u.d;
+ break;
+ default:
+ break;
+ }
+ break;
+ case MiniXftTypeBool:
+ switch (op) {
+ case MiniXftOpEqual:
+ ret = m.u.b == v.u.b;
+ break;
+ case MiniXftOpNotEqual:
+ ret = m.u.b != v.u.b;
+ break;
+ default:
+ break;
+ }
+ break;
+ case MiniXftTypeString:
+ switch (op) {
+ case MiniXftOpEqual:
+ ret = _MiniXftStrCmpIgnoreCase (m.u.s, v.u.s) == 0;
+ break;
+ case MiniXftOpNotEqual:
+ ret = _MiniXftStrCmpIgnoreCase (m.u.s, v.u.s) != 0;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ if (op == MiniXftOpNotEqual)
+ ret = True;
+ else
+ ret = False;
+ }
+ return ret;
+}
+
+static MiniXftValueList *
+_MiniXftConfigMatchValueList (MiniXftTest *t,
+ MiniXftValueList *v)
+{
+ MiniXftValueList *ret = 0;
+
+ for (; v; v = v->next)
+ {
+ if (_MiniXftConfigCompareValue (v->value, t->op, t->value))
+ {
+ if (!ret)
+ ret = v;
+ }
+ else
+ {
+ if (t->qual == MiniXftQualAll)
+ {
+ ret = 0;
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+static MiniXftValue
+_MiniXftConfigEvaluate (MiniXftPattern *p, MiniXftExpr *e)
+{
+ MiniXftValue v, vl, vr;
+ MiniXftResult r;
+
+ switch (e->op) {
+ case MiniXftOpInteger:
+ v.type = MiniXftTypeInteger;
+ v.u.i = e->u.ival;
+ break;
+ case MiniXftOpDouble:
+ v.type = MiniXftTypeDouble;
+ v.u.d = e->u.dval;
+ break;
+ case MiniXftOpString:
+ v.type = MiniXftTypeString;
+ v.u.s = e->u.sval;
+ break;
+ case MiniXftOpMatrix:
+ v.type = MiniXftTypeMatrix;
+ v.u.m = e->u.mval;
+ break;
+ case MiniXftOpBool:
+ v.type = MiniXftTypeBool;
+ v.u.b = e->u.bval;
+ break;
+ case MiniXftOpField:
+ r = MiniXftPatternGet (p, e->u.field, 0, &v);
+ if (r != MiniXftResultMatch)
+ v.type = MiniXftTypeVoid;
+ break;
+ case MiniXftOpQuest:
+ vl = _MiniXftConfigEvaluate (p, e->u.tree.left);
+ if (vl.type == MiniXftTypeBool)
+ {
+ if (vl.u.b)
+ v = _MiniXftConfigEvaluate (p, e->u.tree.right->u.tree.left);
+ else
+ v = _MiniXftConfigEvaluate (p, e->u.tree.right->u.tree.right);
+ }
+ else
+ v.type = MiniXftTypeVoid;
+ break;
+ case MiniXftOpOr:
+ case MiniXftOpAnd:
+ case MiniXftOpEqual:
+ case MiniXftOpNotEqual:
+ case MiniXftOpLess:
+ case MiniXftOpLessEqual:
+ case MiniXftOpMore:
+ case MiniXftOpMoreEqual:
+ case MiniXftOpPlus:
+ case MiniXftOpMinus:
+ case MiniXftOpTimes:
+ case MiniXftOpDivide:
+ vl = _MiniXftConfigEvaluate (p, e->u.tree.left);
+ vr = _MiniXftConfigEvaluate (p, e->u.tree.right);
+ vl = _MiniXftConfigPromote (vl, vr);
+ vr = _MiniXftConfigPromote (vr, vl);
+ if (vl.type == vr.type)
+ {
+ switch (vl.type) {
+ case MiniXftTypeDouble:
+ switch (e->op) {
+ case MiniXftOpPlus:
+ v.type = MiniXftTypeDouble;
+ v.u.d = vl.u.d + vr.u.d;
+ break;
+ case MiniXftOpMinus:
+ v.type = MiniXftTypeDouble;
+ v.u.d = vl.u.d - vr.u.d;
+ break;
+ case MiniXftOpTimes:
+ v.type = MiniXftTypeDouble;
+ v.u.d = vl.u.d * vr.u.d;
+ break;
+ case MiniXftOpDivide:
+ v.type = MiniXftTypeDouble;
+ v.u.d = vl.u.d / vr.u.d;
+ break;
+ case MiniXftOpEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.d == vr.u.d;
+ break;
+ case MiniXftOpNotEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.d != vr.u.d;
+ break;
+ case MiniXftOpLess:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.d < vr.u.d;
+ break;
+ case MiniXftOpLessEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.d <= vr.u.d;
+ break;
+ case MiniXftOpMore:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.d > vr.u.d;
+ break;
+ case MiniXftOpMoreEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.d >= vr.u.d;
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ if (v.type == MiniXftTypeDouble &&
+ v.u.d == (double) (int) v.u.d)
+ {
+ v.type = MiniXftTypeInteger;
+ v.u.i = (int) v.u.d;
+ }
+ break;
+ case MiniXftTypeBool:
+ switch (e->op) {
+ case MiniXftOpOr:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.b || vr.u.b;
+ break;
+ case MiniXftOpAnd:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.b && vr.u.b;
+ break;
+ case MiniXftOpEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.b == vr.u.b;
+ break;
+ case MiniXftOpNotEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = vl.u.b != vr.u.b;
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ break;
+ case MiniXftTypeString:
+ switch (e->op) {
+ case MiniXftOpEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = _MiniXftStrCmpIgnoreCase (vl.u.s, vr.u.s) == 0;
+ break;
+ case MiniXftOpNotEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = _MiniXftStrCmpIgnoreCase (vl.u.s, vr.u.s) != 0;
+ break;
+ case MiniXftOpPlus:
+ v.type = MiniXftTypeString;
+ v.u.s = malloc (strlen (vl.u.s) + strlen (vr.u.s) + 1);
+ if (v.u.s)
+ {
+ strcpy (v.u.s, vl.u.s);
+ strcat (v.u.s, vr.u.s);
+ }
+ else
+ v.type = MiniXftTypeVoid;
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ case MiniXftTypeMatrix:
+ switch (e->op) {
+ case MiniXftOpEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = MiniXftMatrixEqual (vl.u.m, vr.u.m) == 0;
+ break;
+ case MiniXftOpNotEqual:
+ v.type = MiniXftTypeBool;
+ v.u.b = MiniXftMatrixEqual (vl.u.m, vr.u.m) != 0;
+ break;
+ case MiniXftOpTimes:
+ v.type = MiniXftTypeMatrix;
+ v.u.m = malloc (sizeof (MiniXftMatrix));
+ MiniXftMatrixMultiply (v.u.m, vl.u.m, vr.u.m);
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ }
+ else
+ v.type = MiniXftTypeVoid;
+ break;
+ case MiniXftOpNot:
+ vl = _MiniXftConfigEvaluate (p, e->u.tree.left);
+ switch (vl.type) {
+ case MiniXftTypeBool:
+ v.type = MiniXftTypeBool;
+ v.u.b = !vl.u.b;
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ break;
+ default:
+ v.type = MiniXftTypeVoid;
+ break;
+ }
+ return v;
+}
+
+static Bool
+_MiniXftConfigAdd (MiniXftValueList **head,
+ MiniXftValueList *position,
+ Bool append,
+ MiniXftValue value)
+{
+ MiniXftValueList *new, **prev;
+
+ new = (MiniXftValueList *) malloc (sizeof (MiniXftValueList));
+ if (!new)
+ goto bail0;
+
+ if (value.type == MiniXftTypeString)
+ {
+ value.u.s = _MiniXftSaveString (value.u.s);
+ if (!value.u.s)
+ goto bail1;
+
+ }
+ new->value = value;
+ new->next = 0;
+
+ if (append)
+ {
+ prev = &position->next;
+ }
+ else
+ {
+ for (prev = head; *prev; prev = &(*prev)->next)
+ {
+ if (*prev == position)
+ break;
+ }
+#ifdef XFT_DEBUG
+ if (!*prev)
+ printf ("position not on list\n");
+#endif
+ }
+
+#ifdef XFT_DEBUG_EDIT
+ printf ("%s list before ", append ? "Append" : "Prepend");
+ MiniXftValueListPrint (*head);
+ printf ("\n");
+#endif
+
+ new->next = *prev;
+ *prev = new;
+
+#ifdef XFT_DEBUG_EDIT
+ printf ("%s list after ", append ? "Append" : "Prepend");
+ MiniXftValueListPrint (*head);
+ printf ("\n");
+#endif
+
+ return True;
+
+bail1:
+ free (new);
+bail0:
+ return False;
+}
+
+static void
+_MiniXftConfigDel (MiniXftValueList **head,
+ MiniXftValueList *position)
+{
+ MiniXftValueList **prev;
+
+ for (prev = head; *prev; prev = &(*prev)->next)
+ {
+ if (*prev == position)
+ {
+ *prev = position->next;
+ position->next = 0;
+ MiniXftValueListDestroy (position);
+ break;
+ }
+ }
+}
+
+Bool
+MiniXftConfigSubstitute (MiniXftPattern *p)
+{
+ MiniXftSubst *s;
+ MiniXftSubState *st;
+ int i;
+ MiniXftTest *t;
+ MiniXftEdit *e;
+ MiniXftValue v;
+
+ st = (MiniXftSubState *) malloc (MiniXftSubstsMaxObjects * sizeof (MiniXftSubState));
+ if (!st && MiniXftSubstsMaxObjects)
+ return False;
+
+#ifdef XFT_DEBUG_EDIT
+ printf ("MiniXftConfigSubstitute ");
+ MiniXftPatternPrint (p);
+#endif
+ for (s = MiniXftSubsts; s; s = s->next)
+ {
+ for (t = s->test, i = 0; t; t = t->next, i++)
+ {
+#ifdef XFT_DEBUG_EDIT
+ printf ("MiniXftConfigSubstitute test ");
+ MiniXftTestPrint (t);
+#endif
+ st[i].elt = MiniXftPatternFind (p, t->field, False);
+ if (!st[i].elt)
+ {
+ if (t->qual == MiniXftQualAll)
+ continue;
+ else
+ break;
+ }
+ st[i].value = _MiniXftConfigMatchValueList (t, st[i].elt->values);
+ if (!st[i].value)
+ break;
+ }
+ if (t)
+ {
+#ifdef XFT_DEBUG_EDIT
+ printf ("No match\n");
+#endif
+ continue;
+ }
+#ifdef XFT_DEBUG_EDIT
+ printf ("Substitute ");
+ MiniXftSubstPrint (s);
+#endif
+ for (e = s->edit; e; e = e->next)
+ {
+ v = _MiniXftConfigEvaluate (p, e->expr);
+ if (v.type == MiniXftTypeVoid)
+ continue;
+ for (t = s->test, i = 0; t; t = t->next, i++)
+ if (!_MiniXftStrCmpIgnoreCase (t->field, e->field))
+ break;
+ switch (e->op) {
+ case MiniXftOpAssign:
+ if (t)
+ {
+ _MiniXftConfigAdd (&st[i].elt->values, st[i].value, True, v);
+ _MiniXftConfigDel (&st[i].elt->values, st[i].value);
+ }
+ else
+ {
+ MiniXftPatternDel (p, e->field);
+ MiniXftPatternAdd (p, e->field, v, True);
+ }
+ break;
+ case MiniXftOpPrepend:
+ if (t)
+ _MiniXftConfigAdd (&st[i].elt->values, st[i].value, False, v);
+ else
+ MiniXftPatternAdd (p, e->field, v, False);
+ break;
+ case MiniXftOpAppend:
+ if (t)
+ _MiniXftConfigAdd (&st[i].elt->values, st[i].value, True, v);
+ else
+ MiniXftPatternAdd (p, e->field, v, True);
+ break;
+ default:
+ break;
+ }
+ }
+#ifdef XFT_DEBUG_EDIT
+ printf ("MiniXftConfigSubstitute edit");
+ MiniXftPatternPrint (p);
+#endif
+ }
+ free (st);
+#ifdef XFT_DEBUG_EDIT
+ printf ("MiniXftConfigSubstitute done");
+ MiniXftPatternPrint (p);
+#endif
+ return True;
+}
diff --git a/pango/mini-xft/minixftdbg.c b/pango/mini-xft/minixftdbg.c
new file mode 100644
index 00000000..1912d8f5
--- /dev/null
+++ b/pango/mini-xft/minixftdbg.c
@@ -0,0 +1,230 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftdbg.c,v 1.3 2001/03/31 01:57:20 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "minixftint.h"
+#include <stdio.h>
+
+void
+MiniXftValuePrint (MiniXftValue v)
+{
+ switch (v.type) {
+ case MiniXftTypeVoid:
+ printf (" <void>");
+ break;
+ case MiniXftTypeInteger:
+ printf (" %d", v.u.i);
+ break;
+ case MiniXftTypeDouble:
+ printf (" %g", v.u.d);
+ break;
+ case MiniXftTypeString:
+ printf (" \"%s\"", v.u.s);
+ break;
+ case MiniXftTypeBool:
+ printf (" %s", v.u.b ? "True" : "False");
+ break;
+ case MiniXftTypeMatrix:
+ printf (" (%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
+ break;
+ }
+}
+
+void
+MiniXftValueListPrint (MiniXftValueList *l)
+{
+ for (; l; l = l->next)
+ MiniXftValuePrint (l->value);
+}
+
+void
+MiniXftPatternPrint (MiniXftPattern *p)
+{
+ int i;
+ MiniXftPatternElt *e;
+
+ printf ("Pattern %d of %d\n", p->num, p->size);
+ for (i = 0; i < p->num; i++)
+ {
+ e = &p->elts[i];
+ printf ("\t%s:", e->object);
+ MiniXftValueListPrint (e->values);
+ printf ("\n");
+ }
+ printf ("\n");
+}
+
+void
+MiniXftOpPrint (MiniXftOp op)
+{
+ switch (op) {
+ case MiniXftOpInteger: printf ("Integer"); break;
+ case MiniXftOpDouble: printf ("Double"); break;
+ case MiniXftOpString: printf ("String"); break;
+ case MiniXftOpMatrix: printf ("Matrix"); break;
+ case MiniXftOpBool: printf ("Bool"); break;
+ case MiniXftOpField: printf ("Field"); break;
+ case MiniXftOpAssign: printf ("Assign"); break;
+ case MiniXftOpPrepend: printf ("Prepend"); break;
+ case MiniXftOpAppend: printf ("Append"); break;
+ case MiniXftOpQuest: printf ("Quest"); break;
+ case MiniXftOpOr: printf ("Or"); break;
+ case MiniXftOpAnd: printf ("And"); break;
+ case MiniXftOpEqual: printf ("Equal"); break;
+ case MiniXftOpNotEqual: printf ("NotEqual"); break;
+ case MiniXftOpLess: printf ("Less"); break;
+ case MiniXftOpLessEqual: printf ("LessEqual"); break;
+ case MiniXftOpMore: printf ("More"); break;
+ case MiniXftOpMoreEqual: printf ("MoreEqual"); break;
+ case MiniXftOpPlus: printf ("Plus"); break;
+ case MiniXftOpMinus: printf ("Minus"); break;
+ case MiniXftOpTimes: printf ("Times"); break;
+ case MiniXftOpDivide: printf ("Divide"); break;
+ case MiniXftOpNot: printf ("Not"); break;
+ case MiniXftOpNil: printf ("Nil"); break;
+ }
+}
+
+void
+MiniXftTestPrint (MiniXftTest *test)
+{
+ switch (test->qual) {
+ case MiniXftQualAny:
+ printf ("any ");
+ break;
+ case MiniXftQualAll:
+ printf ("all ");
+ break;
+ }
+ printf ("%s ", test->field);
+ MiniXftOpPrint (test->op);
+ printf (" ");
+ MiniXftValuePrint (test->value);
+ printf ("\n");
+}
+
+void
+MiniXftExprPrint (MiniXftExpr *expr)
+{
+ switch (expr->op) {
+ case MiniXftOpInteger: printf ("%d", expr->u.ival); break;
+ case MiniXftOpDouble: printf ("%g", expr->u.dval); break;
+ case MiniXftOpString: printf ("\"%s\"", expr->u.sval); break;
+ case MiniXftOpMatrix: printf ("[%g %g %g %g]",
+ expr->u.mval->xx,
+ expr->u.mval->xy,
+ expr->u.mval->yx,
+ expr->u.mval->yy);
+ case MiniXftOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
+ case MiniXftOpField: printf ("%s", expr->u.field); break;
+ case MiniXftOpQuest:
+ MiniXftExprPrint (expr->u.tree.left);
+ printf (" quest ");
+ MiniXftExprPrint (expr->u.tree.right->u.tree.left);
+ printf (" colon ");
+ MiniXftExprPrint (expr->u.tree.right->u.tree.right);
+ break;
+ case MiniXftOpOr:
+ case MiniXftOpAnd:
+ case MiniXftOpEqual:
+ case MiniXftOpNotEqual:
+ case MiniXftOpLess:
+ case MiniXftOpLessEqual:
+ case MiniXftOpMore:
+ case MiniXftOpMoreEqual:
+ case MiniXftOpPlus:
+ case MiniXftOpMinus:
+ case MiniXftOpTimes:
+ case MiniXftOpDivide:
+ MiniXftExprPrint (expr->u.tree.left);
+ printf (" ");
+ switch (expr->op) {
+ case MiniXftOpOr: printf ("Or"); break;
+ case MiniXftOpAnd: printf ("And"); break;
+ case MiniXftOpEqual: printf ("Equal"); break;
+ case MiniXftOpNotEqual: printf ("NotEqual"); break;
+ case MiniXftOpLess: printf ("Less"); break;
+ case MiniXftOpLessEqual: printf ("LessEqual"); break;
+ case MiniXftOpMore: printf ("More"); break;
+ case MiniXftOpMoreEqual: printf ("MoreEqual"); break;
+ case MiniXftOpPlus: printf ("Plus"); break;
+ case MiniXftOpMinus: printf ("Minus"); break;
+ case MiniXftOpTimes: printf ("Times"); break;
+ case MiniXftOpDivide: printf ("Divide"); break;
+ default: break;
+ }
+ printf (" ");
+ MiniXftExprPrint (expr->u.tree.right);
+ break;
+ case MiniXftOpNot:
+ printf ("Not ");
+ MiniXftExprPrint (expr->u.tree.left);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+MiniXftEditPrint (MiniXftEdit *edit)
+{
+ printf ("Edit %s ", edit->field);
+ MiniXftOpPrint (edit->op);
+ printf (" ");
+ MiniXftExprPrint (edit->expr);
+}
+
+void
+MiniXftSubstPrint (MiniXftSubst *subst)
+{
+ MiniXftEdit *e;
+ MiniXftTest *t;
+
+ printf ("match\n");
+ for (t = subst->test; t; t = t->next)
+ {
+ printf ("\t");
+ MiniXftTestPrint (t);
+ }
+ printf ("edit\n");
+ for (e = subst->edit; e; e = e->next)
+ {
+ printf ("\t");
+ MiniXftEditPrint (e);
+ printf (";\n");
+ }
+ printf ("\n");
+}
+
+void
+MiniXftFontSetPrint (MiniXftFontSet *s)
+{
+ int i;
+
+ printf ("FontSet %d of %d\n", s->nfont, s->sfont);
+ for (i = 0; i < s->nfont; i++)
+ {
+ printf ("Font %d ", i);
+ MiniXftPatternPrint (s->fonts[i]);
+ }
+}
diff --git a/pango/mini-xft/minixftdir.c b/pango/mini-xft/minixftdir.c
new file mode 100644
index 00000000..c6eacb10
--- /dev/null
+++ b/pango/mini-xft/minixftdir.c
@@ -0,0 +1,136 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftdir.c,v 1.3 2001/05/16 10:32:54 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <string.h>
+#include "minixftint.h"
+
+Bool
+MiniXftDirScan (MiniXftFontSet *set, const char *dir, Bool force)
+{
+ DIR *d;
+ struct dirent *e;
+ char *file;
+ char *base;
+ MiniXftPattern *font;
+ char *name;
+ int count;
+ Bool ret = True;
+ int id;
+
+ file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
+ if (!file)
+ return False;
+
+ strcpy (file, dir);
+ strcat (file, "/");
+ base = file + strlen (file);
+ if (!force)
+ {
+ strcpy (base, "MiniXftCache");
+
+ if (MiniXftFileCacheReadDir (set, file))
+ {
+ free (file);
+ return True;
+ }
+ }
+
+ d = opendir (dir);
+ if (!d)
+ {
+ free (file);
+ return False;
+ }
+ while (ret && (e = readdir (d)))
+ {
+ if (e->d_name[0] != '.')
+ {
+ id = 0;
+ strcpy (base, e->d_name);
+ do
+ {
+ if (!force)
+ name = MiniXftFileCacheFind (file, id, &count);
+ else
+ name = 0;
+ if (name)
+ {
+ font = MiniXftNameParse (name);
+ if (font)
+ MiniXftPatternAddString (font, XFT_FILE, file);
+ }
+ else
+ {
+ font = MiniXftFreeTypeQuery (file, id, &count);
+ if (font && !force)
+ {
+ char unparse[8192];
+
+ if (MiniXftNameUnparse (font, unparse, sizeof (unparse)))
+ {
+ (void) MiniXftFileCacheUpdate (file, id, unparse);
+ }
+ }
+ }
+ if (font)
+ {
+ if (!MiniXftFontSetAdd (set, font))
+ {
+ MiniXftPatternDestroy (font);
+ font = 0;
+ ret = False;
+ }
+ }
+ id++;
+ } while (font && ret && id < count);
+ }
+ }
+ free (file);
+ closedir (d);
+ return ret;
+}
+
+Bool
+MiniXftDirSave (MiniXftFontSet *set, const char *dir)
+{
+ char *file;
+ char *base;
+ Bool ret;
+
+ file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
+ if (!file)
+ return False;
+
+ strcpy (file, dir);
+ strcat (file, "/");
+ base = file + strlen (file);
+ strcpy (base, "MiniXftCache");
+ ret = MiniXftFileCacheWriteDir (set, file);
+ free (file);
+ return ret;
+}
+
diff --git a/pango/mini-xft/minixftdpy.c b/pango/mini-xft/minixftdpy.c
new file mode 100644
index 00000000..6dbf061f
--- /dev/null
+++ b/pango/mini-xft/minixftdpy.c
@@ -0,0 +1,321 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftdpy.c,v 1.7 2001/04/29 03:21:17 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "minixftint.h"
+
+MiniXftDisplayInfo *_MiniXftDisplayInfo;
+
+static MiniXftDisplayInfo *
+_MiniXftDisplayInfoGet (Display *dpy)
+{
+ MiniXftDisplayInfo *info, **prev;
+
+ for (prev = &_MiniXftDisplayInfo; (info = *prev); prev = &(*prev)->next)
+ {
+ if (info->display == dpy)
+ {
+ /*
+ * MRU the list
+ */
+ if (prev != &_MiniXftDisplayInfo)
+ {
+ *prev = info->next;
+ info->next = _MiniXftDisplayInfo;
+ _MiniXftDisplayInfo = info;
+ }
+ return info;
+ }
+ }
+ info = (MiniXftDisplayInfo *) malloc (sizeof (MiniXftDisplayInfo));
+ if (!info)
+ goto bail0;
+
+ info->display = dpy;
+ info->defaults = 0;
+
+ info->next = _MiniXftDisplayInfo;
+ _MiniXftDisplayInfo = info;
+ return info;
+
+bail0:
+ if (_MiniXftFontDebug () & XFT_DBG_RENDER)
+ {
+ printf ("MiniXftDisplayInfoGet failed to initialize, MiniXft unhappy\n");
+ }
+ return 0;
+}
+
+Bool
+MiniXftDefaultHasRender (Display *dpy)
+{
+ return True;
+}
+
+Bool
+MiniXftDefaultSet (Display *dpy, MiniXftPattern *defaults)
+{
+ MiniXftDisplayInfo *info = _MiniXftDisplayInfoGet (dpy);
+
+ if (!info)
+ return False;
+ if (info->defaults)
+ MiniXftPatternDestroy (info->defaults);
+ info->defaults = defaults;
+ return True;
+}
+
+int
+MiniXftDefaultParseBool (char *v)
+{
+ char c0, c1;
+
+ c0 = *v;
+ if (isupper (c0))
+ c0 = tolower (c0);
+ if (c0 == 't' || c0 == 'y' || c0 == '1')
+ return 1;
+ if (c0 == 'f' || c0 == 'n' || c0 == '0')
+ return 0;
+ if (c0 == 'o')
+ {
+ c1 = v[1];
+ if (isupper (c1))
+ c1 = tolower (c1);
+ if (c1 == 'n')
+ return 1;
+ if (c1 == 'f')
+ return 0;
+ }
+ return -1;
+}
+
+static Bool
+_MiniXftDefaultInitBool (Display *dpy, MiniXftPattern *pat, char *option)
+{
+ return True;
+}
+
+static Bool
+_MiniXftDefaultInitDouble (Display *dpy, MiniXftPattern *pat, char *option)
+{
+ return True;
+}
+
+static Bool
+_MiniXftDefaultInitInteger (Display *dpy, MiniXftPattern *pat, char *option)
+{
+ return True;
+}
+
+static MiniXftPattern *
+_MiniXftDefaultInit (Display *dpy)
+{
+ MiniXftPattern *pat;
+
+ pat = MiniXftPatternCreate ();
+ if (!pat)
+ goto bail0;
+
+ if (!_MiniXftDefaultInitBool (dpy, pat, XFT_CORE))
+ goto bail1;
+ if (!_MiniXftDefaultInitDouble (dpy, pat, XFT_SCALE))
+ goto bail1;
+ if (!_MiniXftDefaultInitDouble (dpy, pat, XFT_DPI))
+ goto bail1;
+ if (!_MiniXftDefaultInitBool (dpy, pat, XFT_RENDER))
+ goto bail1;
+ if (!_MiniXftDefaultInitInteger (dpy, pat, XFT_RGBA))
+ goto bail1;
+ if (!_MiniXftDefaultInitBool (dpy, pat, XFT_ANTIALIAS))
+ goto bail1;
+ if (!_MiniXftDefaultInitBool (dpy, pat, XFT_MINSPACE))
+ goto bail1;
+
+ return pat;
+
+bail1:
+ MiniXftPatternDestroy (pat);
+bail0:
+ return 0;
+}
+
+static MiniXftResult
+_MiniXftDefaultGet (Display *dpy, const char *object, int screen, MiniXftValue *v)
+{
+ MiniXftDisplayInfo *info = _MiniXftDisplayInfoGet (dpy);
+ MiniXftResult r;
+
+ if (!info)
+ return MiniXftResultNoMatch;
+
+ if (!info->defaults)
+ {
+ info->defaults = _MiniXftDefaultInit (dpy);
+ if (!info->defaults)
+ return MiniXftResultNoMatch;
+ }
+ r = MiniXftPatternGet (info->defaults, object, screen, v);
+ if (r == MiniXftResultNoId && screen > 0)
+ r = MiniXftPatternGet (info->defaults, object, 0, v);
+ return r;
+}
+
+Bool
+MiniXftDefaultGetBool (Display *dpy, const char *object, int screen, Bool def)
+{
+ MiniXftResult r;
+ MiniXftValue v;
+
+ r = _MiniXftDefaultGet (dpy, object, screen, &v);
+ if (r != MiniXftResultMatch || v.type != MiniXftTypeBool)
+ return def;
+ return v.u.b;
+}
+
+int
+MiniXftDefaultGetInteger (Display *dpy, const char *object, int screen, int def)
+{
+ MiniXftResult r;
+ MiniXftValue v;
+
+ r = _MiniXftDefaultGet (dpy, object, screen, &v);
+ if (r != MiniXftResultMatch || v.type != MiniXftTypeInteger)
+ return def;
+ return v.u.i;
+}
+
+double
+MiniXftDefaultGetDouble (Display *dpy, const char *object, int screen, double def)
+{
+ MiniXftResult r;
+ MiniXftValue v;
+
+ r = _MiniXftDefaultGet (dpy, object, screen, &v);
+ if (r != MiniXftResultMatch || v.type != MiniXftTypeDouble)
+ return def;
+ return v.u.d;
+}
+
+MiniXftFontSet *
+MiniXftDisplayGetFontSet (Display *dpy)
+{
+ return 0;
+}
+
+static double default_dpi = 0.0;
+
+void
+MiniXftSetDPI (double dpi)
+{
+ default_dpi = dpi;
+}
+
+void
+MiniXftDefaultSubstitute (Display *dpy, int screen, MiniXftPattern *pattern)
+{
+ MiniXftValue v;
+ double size;
+ double scale;
+
+ if (MiniXftPatternGet (pattern, XFT_STYLE, 0, &v) == MiniXftResultNoMatch)
+ {
+ if (MiniXftPatternGet (pattern, XFT_WEIGHT, 0, &v) == MiniXftResultNoMatch )
+ {
+ MiniXftPatternAddInteger (pattern, XFT_WEIGHT, XFT_WEIGHT_MEDIUM);
+ }
+ if (MiniXftPatternGet (pattern, XFT_SLANT, 0, &v) == MiniXftResultNoMatch)
+ {
+ MiniXftPatternAddInteger (pattern, XFT_SLANT, XFT_SLANT_ROMAN);
+ }
+ }
+ if (MiniXftPatternGet (pattern, XFT_ENCODING, 0, &v) == MiniXftResultNoMatch)
+ MiniXftPatternAddString (pattern, XFT_ENCODING, "iso8859-1");
+ if (MiniXftPatternGet (pattern, XFT_RENDER, 0, &v) == MiniXftResultNoMatch)
+ {
+ MiniXftPatternAddBool (pattern, XFT_RENDER,
+ MiniXftDefaultGetBool (dpy, XFT_RENDER, screen,
+ MiniXftDefaultHasRender (dpy)));
+ }
+ if (MiniXftPatternGet (pattern, XFT_CORE, 0, &v) == MiniXftResultNoMatch)
+ {
+ MiniXftPatternAddBool (pattern, XFT_CORE,
+ MiniXftDefaultGetBool (dpy, XFT_CORE, screen,
+ !MiniXftDefaultHasRender (dpy)));
+ }
+ if (MiniXftPatternGet (pattern, XFT_ANTIALIAS, 0, &v) == MiniXftResultNoMatch)
+ {
+ MiniXftPatternAddBool (pattern, XFT_ANTIALIAS,
+ MiniXftDefaultGetBool (dpy, XFT_ANTIALIAS, screen,
+ True));
+ }
+ if (MiniXftPatternGet (pattern, XFT_RGBA, 0, &v) == MiniXftResultNoMatch)
+ {
+ MiniXftPatternAddInteger (pattern, XFT_RGBA,
+ MiniXftDefaultGetInteger (dpy, XFT_RGBA, screen,
+ XFT_RGBA_NONE));
+ }
+ if (MiniXftPatternGet (pattern, XFT_MINSPACE, 0, &v) == MiniXftResultNoMatch)
+ {
+ MiniXftPatternAddBool (pattern, XFT_MINSPACE,
+ MiniXftDefaultGetBool (dpy, XFT_MINSPACE, screen,
+ False));
+ }
+ if (MiniXftPatternGet (pattern, XFT_PIXEL_SIZE, 0, &v) == MiniXftResultNoMatch)
+ {
+ double dpi;
+
+ if (MiniXftPatternGet (pattern, XFT_SIZE, 0, &v) != MiniXftResultMatch)
+ {
+ size = 12.0;
+ MiniXftPatternAddDouble (pattern, XFT_SIZE, size);
+ }
+ else
+ {
+ switch (v.type) {
+ case MiniXftTypeInteger:
+ size = (double) v.u.i;
+ break;
+ case MiniXftTypeDouble:
+ size = v.u.d;
+ break;
+ default:
+ size = 12.0;
+ break;
+ }
+ }
+ scale = MiniXftDefaultGetDouble (dpy, XFT_SCALE, screen, 1.0);
+ size *= scale;
+ if (default_dpi > 0.0)
+ dpi = default_dpi;
+ else
+ dpi = 72.0;
+ dpi = MiniXftDefaultGetDouble (dpy, XFT_DPI, screen, dpi);
+ size = size * dpi / 72.0;
+ MiniXftPatternAddDouble (pattern, XFT_PIXEL_SIZE, size);
+ }
+}
+
diff --git a/pango/mini-xft/minixftfont.c b/pango/mini-xft/minixftfont.c
new file mode 100644
index 00000000..46665c43
--- /dev/null
+++ b/pango/mini-xft/minixftfont.c
@@ -0,0 +1,111 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftfont.c,v 1.8 2000/12/20 00:20:48 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "minixftint.h"
+
+MiniXftPattern *
+MiniXftFontMatch (Display *dpy, int screen, MiniXftPattern *pattern, MiniXftResult *result)
+{
+ MiniXftPattern *new;
+ MiniXftPattern *match;
+ MiniXftFontSet *sets[2];
+ int nsets;
+ Bool render, core;
+
+ if (!MiniXftInit (0))
+ return 0;
+
+ new = MiniXftPatternDuplicate (pattern);
+ if (!new)
+ return 0;
+
+ if (_MiniXftFontDebug () & XFT_DBG_OPENV)
+ {
+ printf ("MiniXftFontMatch pattern ");
+ MiniXftPatternPrint (new);
+ }
+ MiniXftConfigSubstitute (new);
+ if (_MiniXftFontDebug () & XFT_DBG_OPENV)
+ {
+ printf ("MiniXftFontMatch after MiniXftConfig substitutions ");
+ MiniXftPatternPrint (new);
+ }
+ MiniXftDefaultSubstitute (dpy, screen, new);
+ if (_MiniXftFontDebug () & XFT_DBG_OPENV)
+ {
+ printf ("MiniXftFontMatch after X resource substitutions ");
+ MiniXftPatternPrint (new);
+ }
+ nsets = 0;
+
+ render = True;
+ core = False;
+ (void) MiniXftPatternGetBool (new, XFT_RENDER, 0, &render);
+ (void) MiniXftPatternGetBool (new, XFT_CORE, 0, &core);
+ if (_MiniXftFontDebug () & XFT_DBG_OPENV)
+ {
+ printf ("MiniXftFontMatch: use core fonts \"%s\", use render fonts \"%s\"\n",
+ core ? "True" : "False", render ? "True" : "False");
+ }
+
+ if (render)
+ {
+ if (MiniXftInitFtLibrary ())
+ {
+ sets[nsets] = _MiniXftFontSet;
+ if (sets[nsets])
+ nsets++;
+ }
+ }
+
+ match = MiniXftFontSetMatch (sets, nsets, new, result);
+ MiniXftPatternDestroy (new);
+ return match;
+}
+
+int
+_MiniXftFontDebug (void)
+{
+ static int initialized;
+ static int debug;
+
+ if (!initialized)
+ {
+ char *e;
+
+ initialized = 1;
+ e = getenv ("XFT_DEBUG");
+ if (e)
+ {
+ printf ("XFT_DEBUG=%s\n", e);
+ debug = atoi (e);
+ if (debug <= 0)
+ debug = 1;
+ }
+ }
+ return debug;
+}
+
diff --git a/pango/mini-xft/minixftfreetype.c b/pango/mini-xft/minixftfreetype.c
new file mode 100644
index 00000000..7b92abd4
--- /dev/null
+++ b/pango/mini-xft/minixftfreetype.c
@@ -0,0 +1,190 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftfreetype.c,v 1.14 2001/09/21 19:54:53 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "minixftint.h"
+
+FT_Library _MiniXftFTlibrary;
+
+typedef struct _MiniXftFtEncoding {
+ const char *name;
+ FT_Encoding encoding;
+} MiniXftFtEncoding;
+
+static MiniXftFtEncoding xftFtEncoding[] = {
+ { "iso10646-1", ft_encoding_unicode, },
+ { "iso8859-1", ft_encoding_unicode, },
+ { "apple-roman", ft_encoding_apple_roman },
+ { "adobe-fontspecific", ft_encoding_symbol, },
+ { "glyphs-fontspecific",ft_encoding_none, },
+};
+
+#define NUM_FT_ENCODINGS (sizeof xftFtEncoding / sizeof xftFtEncoding[0])
+
+#define FT_Matrix_Equal(a,b) ((a)->xx == (b)->xx && \
+ (a)->yy == (b)->yy && \
+ (a)->xy == (b)->xy && \
+ (a)->yx == (b)->yx)
+
+MiniXftPattern *
+MiniXftFreeTypeQuery (const char *file, int id, int *count)
+{
+ FT_Face face;
+ MiniXftPattern *pat;
+ int slant;
+ int weight;
+ int i, j;
+
+ if (FT_New_Face (_MiniXftFTlibrary, file, id, &face))
+ return 0;
+
+ *count = face->num_faces;
+
+ pat = MiniXftPatternCreate ();
+ if (!pat)
+ goto bail0;
+
+
+ if (!MiniXftPatternAddBool (pat, XFT_CORE, False))
+ goto bail1;
+
+ if (!MiniXftPatternAddBool (pat, XFT_OUTLINE,
+ (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0))
+ goto bail1;
+
+ if (!MiniXftPatternAddBool (pat, XFT_SCALABLE,
+ (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0))
+ goto bail1;
+
+
+ slant = XFT_SLANT_ROMAN;
+ if (face->style_flags & FT_STYLE_FLAG_ITALIC)
+ slant = XFT_SLANT_ITALIC;
+
+ if (!MiniXftPatternAddInteger (pat, XFT_SLANT, slant))
+ goto bail1;
+
+ weight = XFT_WEIGHT_MEDIUM;
+ if (face->style_flags & FT_STYLE_FLAG_BOLD)
+ weight = XFT_WEIGHT_BOLD;
+
+ if (!MiniXftPatternAddInteger (pat, XFT_WEIGHT, weight))
+ goto bail1;
+
+ if (!MiniXftPatternAddString (pat, XFT_FAMILY, face->family_name))
+ goto bail1;
+
+ if (!MiniXftPatternAddString (pat, XFT_STYLE, face->style_name))
+ goto bail1;
+
+ if (!MiniXftPatternAddString (pat, XFT_FILE, file))
+ goto bail1;
+
+ if (!MiniXftPatternAddInteger (pat, XFT_INDEX, id))
+ goto bail1;
+
+#if 0
+ if ((face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0)
+ if (!MiniXftPatternAddInteger (pat, XFT_SPACING, XFT_MONO))
+ goto bail1;
+#endif
+
+ if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
+ {
+ for (i = 0; i < face->num_fixed_sizes; i++)
+ if (!MiniXftPatternAddDouble (pat, XFT_PIXEL_SIZE,
+ (double) face->available_sizes[i].height))
+ goto bail1;
+ }
+
+ for (i = 0; i < face->num_charmaps; i++)
+ {
+#if 0
+ printf ("face %s encoding %d %c%c%c%c\n",
+ face->family_name, i,
+ face->charmaps[i]->encoding >> 24,
+ face->charmaps[i]->encoding >> 16,
+ face->charmaps[i]->encoding >> 8,
+ face->charmaps[i]->encoding >> 0);
+#endif
+ for (j = 0; j < NUM_FT_ENCODINGS; j++)
+ {
+ if (face->charmaps[i]->encoding == xftFtEncoding[j].encoding)
+ {
+ if (!MiniXftPatternAddString (pat, XFT_ENCODING,
+ xftFtEncoding[j].name))
+ goto bail1;
+ }
+ }
+ }
+
+ if (!MiniXftPatternAddString (pat, XFT_ENCODING,
+ "glyphs-fontspecific"))
+ goto bail1;
+
+
+ FT_Done_Face (face);
+ return pat;
+
+bail1:
+ MiniXftPatternDestroy (pat);
+bail0:
+ FT_Done_Face (face);
+ return 0;
+}
+
+/* #define XFT_DEBUG_FONTSET */
+Bool
+MiniXftInitFtLibrary (void)
+{
+ char **d;
+ char *cache;
+
+ if (_MiniXftFTlibrary)
+ return True;
+ if (FT_Init_FreeType (&_MiniXftFTlibrary))
+ return False;
+ _MiniXftFontSet = MiniXftFontSetCreate ();
+ if (!_MiniXftFontSet)
+ return False;
+ cache = MiniXftConfigGetCache ();
+ if (cache)
+ MiniXftFileCacheLoad (cache);
+ for (d = MiniXftConfigDirs; d && *d; d++)
+ {
+#ifdef XFT_DEBUG_FONTSET
+ printf ("scan dir %s\n", *d);
+#endif
+ MiniXftDirScan (_MiniXftFontSet, *d, False);
+ }
+#ifdef XFT_DEBUG_FONTSET
+ MiniXftFontSetPrint (_MiniXftFontSet);
+#endif
+ if (cache)
+ MiniXftFileCacheSave (cache);
+ MiniXftFileCacheDispose ();
+ return True;
+}
diff --git a/pango/mini-xft/minixftfs.c b/pango/mini-xft/minixftfs.c
new file mode 100644
index 00000000..74c1f444
--- /dev/null
+++ b/pango/mini-xft/minixftfs.c
@@ -0,0 +1,74 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftfs.c,v 1.1 2000/11/29 08:39:22 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include "minixftint.h"
+
+MiniXftFontSet *
+MiniXftFontSetCreate (void)
+{
+ MiniXftFontSet *s;
+
+ s = (MiniXftFontSet *) malloc (sizeof (MiniXftFontSet));
+ if (!s)
+ return 0;
+ s->nfont = 0;
+ s->sfont = 0;
+ s->fonts = 0;
+ return s;
+}
+
+void
+MiniXftFontSetDestroy (MiniXftFontSet *s)
+{
+ int i;
+
+ for (i = 0; i < s->nfont; i++)
+ MiniXftPatternDestroy (s->fonts[i]);
+ if (s->fonts)
+ free (s->fonts);
+ free (s);
+}
+
+Bool
+MiniXftFontSetAdd (MiniXftFontSet *s, MiniXftPattern *font)
+{
+ MiniXftPattern **f;
+ int sfont;
+
+ if (s->nfont == s->sfont)
+ {
+ sfont = s->sfont + 32;
+ if (s->fonts)
+ f = (MiniXftPattern **) realloc (s->fonts, sfont * sizeof (MiniXftPattern *));
+ else
+ f = (MiniXftPattern **) malloc (sfont * sizeof (MiniXftPattern *));
+ if (!f)
+ return False;
+ s->sfont = sfont;
+ s->fonts = f;
+ }
+ s->fonts[s->nfont++] = font;
+ return True;
+}
diff --git a/pango/mini-xft/minixftgram.c b/pango/mini-xft/minixftgram.c
new file mode 100644
index 00000000..d4798f54
--- /dev/null
+++ b/pango/mini-xft/minixftgram.c
@@ -0,0 +1,1498 @@
+
+/* A Bison parser, made from minixftgram.y
+ by GNU Bison version 1.28 */
+
+#define YYBISON 1 /* Identify Bison output. */
+
+#define INTEGER 257
+#define DOUBLE 258
+#define STRING 259
+#define NAME 260
+#define ANY 261
+#define ALL 262
+#define DIR 263
+#define CACHE 264
+#define INCLUDE 265
+#define INCLUDEIF 266
+#define MATCH 267
+#define EDIT 268
+#define TOK_TRUE 269
+#define TOK_FALSE 270
+#define TOK_NIL 271
+#define EQUAL 272
+#define SEMI 273
+#define OS 274
+#define CS 275
+#define QUEST 276
+#define COLON 277
+#define OROR 278
+#define ANDAND 279
+#define EQEQ 280
+#define NOTEQ 281
+#define LESS 282
+#define LESSEQ 283
+#define MORE 284
+#define MOREEQ 285
+#define PLUS 286
+#define MINUS 287
+#define TIMES 288
+#define DIVIDE 289
+#define NOT 290
+
+#line 25 "minixftgram.y"
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "minixftint.h"
+
+static MiniXftMatrix matrix;
+
+
+#line 35 "minixftgram.y"
+typedef union {
+ int ival;
+ double dval;
+ char *sval;
+ MiniXftExpr *eval;
+ MiniXftPattern *pval;
+ MiniXftValue vval;
+ MiniXftEdit *Eval;
+ MiniXftOp oval;
+ MiniXftQual qval;
+ MiniXftTest *tval;
+} YYSTYPE;
+#include <stdio.h>
+
+#ifndef __cplusplus
+#ifndef __STDC__
+#define const
+#endif
+#endif
+
+
+
+#define YYFINAL 95
+#define YYFLAG -32768
+#define YYNTBASE 37
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? MiniXftConfigtranslate[x] : 51)
+
+static const char MiniXftConfigtranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
+};
+
+#if YYDEBUG != 0
+static const short MiniXftConfigprhs[] = { 0,
+ 0, 3, 4, 7, 10, 13, 16, 21, 24, 25,
+ 30, 32, 34, 35, 37, 39, 41, 43, 45, 47,
+ 49, 51, 53, 55, 57, 59, 61, 63, 65, 72,
+ 74, 76, 79, 80, 85, 87, 90, 93, 95, 97,
+ 99, 101, 103, 105, 107, 109, 113, 117, 121, 125,
+ 129, 133, 137, 141, 145, 149, 153, 157, 160
+};
+
+static const short MiniXftConfigrhs[] = { 37,
+ 38, 0, 0, 9, 5, 0, 10, 5, 0, 11,
+ 5, 0, 12, 5, 0, 13, 39, 14, 47, 0,
+ 40, 39, 0, 0, 41, 42, 43, 44, 0, 7,
+ 0, 8, 0, 0, 6, 0, 18, 0, 26, 0,
+ 27, 0, 28, 0, 29, 0, 30, 0, 31, 0,
+ 3, 0, 4, 0, 5, 0, 15, 0, 16, 0,
+ 17, 0, 45, 0, 20, 46, 46, 46, 46, 21,
+ 0, 3, 0, 4, 0, 48, 47, 0, 0, 42,
+ 49, 50, 19, 0, 18, 0, 32, 18, 0, 18,
+ 32, 0, 3, 0, 4, 0, 5, 0, 15, 0,
+ 16, 0, 17, 0, 45, 0, 6, 0, 50, 24,
+ 50, 0, 50, 25, 50, 0, 50, 26, 50, 0,
+ 50, 27, 50, 0, 50, 28, 50, 0, 50, 29,
+ 50, 0, 50, 30, 50, 0, 50, 31, 50, 0,
+ 50, 32, 50, 0, 50, 33, 50, 0, 50, 34,
+ 50, 0, 50, 35, 50, 0, 36, 50, 0, 50,
+ 22, 50, 23, 50, 0
+};
+
+#endif
+
+#if YYDEBUG != 0
+static const short MiniXftConfigrline[] = { 0,
+ 77, 78, 80, 82, 84, 86, 88, 91, 93, 96,
+ 99, 101, 103, 106, 111, 113, 115, 117, 119, 121,
+ 123, 126, 131, 136, 141, 146, 151, 155, 161, 168,
+ 170, 172, 174, 177, 180, 182, 184, 187, 189, 191,
+ 193, 195, 197, 199, 201, 203, 205, 207, 209, 211,
+ 213, 215, 217, 219, 221, 223, 225, 227, 229
+};
+#endif
+
+
+#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
+
+static const char * const MiniXftConfigtname[] = { "$","error","$undefined.","INTEGER",
+"DOUBLE","STRING","NAME","ANY","ALL","DIR","CACHE","INCLUDE","INCLUDEIF","MATCH",
+"EDIT","TOK_TRUE","TOK_FALSE","TOK_NIL","EQUAL","SEMI","OS","CS","QUEST","COLON",
+"OROR","ANDAND","EQEQ","NOTEQ","LESS","LESSEQ","MORE","MOREEQ","PLUS","MINUS",
+"TIMES","DIVIDE","NOT","configs","config","tests","test","qual","field","compare",
+"value","matrix","number","edits","edit","eqop","expr", NULL
+};
+#endif
+
+static const short MiniXftConfigr1[] = { 0,
+ 37, 37, 38, 38, 38, 38, 38, 39, 39, 40,
+ 41, 41, 41, 42, 43, 43, 43, 43, 43, 43,
+ 43, 44, 44, 44, 44, 44, 44, 44, 45, 46,
+ 46, 47, 47, 48, 49, 49, 49, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50
+};
+
+static const short MiniXftConfigr2[] = { 0,
+ 2, 0, 2, 2, 2, 2, 4, 2, 0, 4,
+ 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 6, 1,
+ 1, 2, 0, 4, 1, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 2, 5
+};
+
+static const short MiniXftConfigdefact[] = { 2,
+ 0, 0, 0, 0, 0, 9, 1, 3, 4, 5,
+ 6, 11, 12, 0, 9, 0, 33, 8, 14, 0,
+ 0, 7, 33, 15, 16, 17, 18, 19, 20, 21,
+ 0, 35, 0, 0, 32, 22, 23, 24, 25, 26,
+ 27, 0, 10, 28, 37, 36, 38, 39, 40, 45,
+ 41, 42, 43, 0, 44, 0, 30, 31, 0, 58,
+ 34, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 0, 0,
+ 0, 59, 29, 0, 0
+};
+
+static const short MiniXftConfigdefgoto[] = { 1,
+ 7, 14, 15, 16, 21, 31, 43, 55, 59, 22,
+ 23, 34, 56
+};
+
+static const short MiniXftConfigpact[] = {-32768,
+ 39, 32, 52, 94, 95, -1,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768, 15, -1, 79, 79,-32768,-32768, 80,
+ 8,-32768, 79,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+ 27, 69, 84, 18,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768, 24,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768, 18,-32768, 34,-32768,-32768, 24,-32768,
+-32768, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 24, 48, 87, 97, 105, 105,
+ -31, -31, -31, -31, 11, 11,-32768,-32768, 24, 18,
+ 82, 62,-32768, 104,-32768
+};
+
+static const short MiniXftConfigpgoto[] = {-32768,
+-32768, 90,-32768,-32768, 125,-32768,-32768, 111, -34, 120,
+-32768,-32768, -54
+};
+
+
+#define YYLAST 143
+
+
+static const short MiniXftConfigtable[] = { 60,
+ 71, 72, 73, 74, -13, 12, 13, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
+ 47, 48, 49, 50, 75, 32, 57, 58, 17, 36,
+ 37, 38, 51, 52, 53, 92, 8, 42, 94, 33,
+ 89, 39, 40, 41, 73, 74, 42, 2, 3, 4,
+ 5, 6, 61, 54, 91, 62, 9, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 62,
+ 90, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 62, 19, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, 24, 10, 11,
+ 45, 46, 93, 95, 18, 25, 26, 27, 28, 29,
+ 30, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 67, 68, 69, 70, 71, 72, 73, 74,
+ 20, 44, 35
+};
+
+static const short MiniXftConfigcheck[] = { 54,
+ 32, 33, 34, 35, 6, 7, 8, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 3, 4, 5, 6, 59, 18, 3, 4, 14, 3,
+ 4, 5, 15, 16, 17, 90, 5, 20, 0, 32,
+ 75, 15, 16, 17, 34, 35, 20, 9, 10, 11,
+ 12, 13, 19, 36, 89, 22, 5, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 22, 6, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 18, 5, 5,
+ 32, 18, 21, 0, 15, 26, 27, 28, 29, 30,
+ 31, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 28, 29, 30, 31, 32, 33, 34, 35,
+ 16, 31, 23
+};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "/usr/lib/bison.simple"
+/* This file comes from bison-1.28. */
+
+/* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+
+ 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. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+#ifndef YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
+#ifdef __GNUC__
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#else /* not GNU C. */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define YYSTACK_USE_ALLOCA
+#include <alloca.h>
+#else /* not sparc */
+/* We think this test detects Watcom and Microsoft C. */
+/* This used to test MSDOS, but that is a bad idea
+ since that symbol is in the user namespace. */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+ instead, just don't use alloca. */
+#include <malloc.h>
+#endif
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+/* I don't know what this was needed for, but it pollutes the namespace.
+ So I turned it off. rms, 2 May 1997. */
+/* #include <malloc.h> */
+ #pragma alloca
+#define YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+ and on HPUX 10. Eventually we can turn this on. */
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#endif /* __hpux */
+#endif
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* YYSTACK_USE_ALLOCA not defined */
+
+#ifdef YYSTACK_USE_ALLOCA
+#define YYSTACK_ALLOC alloca
+#else
+#define YYSTACK_ALLOC malloc
+#endif
+
+/* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+ as one case of the switch. */
+
+#define MiniXftConfigerrok (MiniXftConfigerrstatus = 0)
+#define MiniXftConfigclearin (MiniXftConfigchar = YYEMPTY)
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYACCEPT goto MiniXftConfigacceptlab
+#define YYABORT goto MiniXftConfigabortlab
+#define YYERROR goto MiniXftConfigerrlab1
+/* Like YYERROR except do call MiniXftConfigerror.
+ This remains here temporarily to ease the
+ transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define YYFAIL goto MiniXftConfigerrlab
+#define YYRECOVERING() (!!MiniXftConfigerrstatus)
+#define YYBACKUP(token, value) \
+do \
+ if (MiniXftConfigchar == YYEMPTY && MiniXftConfiglen == 1) \
+ { MiniXftConfigchar = (token), MiniXftConfiglval = (value); \
+ MiniXftConfigchar1 = YYTRANSLATE (MiniXftConfigchar); \
+ YYPOPSTACK; \
+ goto MiniXftConfigbackup; \
+ } \
+ else \
+ { MiniXftConfigerror ("syntax error: cannot back up"); YYERROR; } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+#ifndef YYPURE
+#define YYLEX MiniXftConfiglex()
+#endif
+
+#ifdef YYPURE
+#ifdef YYLSP_NEEDED
+#ifdef YYLEX_PARAM
+#define YYLEX MiniXftConfiglex(&MiniXftConfiglval, &MiniXftConfiglloc, YYLEX_PARAM)
+#else
+#define YYLEX MiniXftConfiglex(&MiniXftConfiglval, &MiniXftConfiglloc)
+#endif
+#else /* not YYLSP_NEEDED */
+#ifdef YYLEX_PARAM
+#define YYLEX MiniXftConfiglex(&MiniXftConfiglval, YYLEX_PARAM)
+#else
+#define YYLEX MiniXftConfiglex(&MiniXftConfiglval)
+#endif
+#endif /* not YYLSP_NEEDED */
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYPURE
+
+int MiniXftConfigchar; /* the lookahead symbol */
+YYSTYPE MiniXftConfiglval; /* the semantic value of the */
+ /* lookahead symbol */
+
+#ifdef YYLSP_NEEDED
+YYLTYPE MiniXftConfiglloc; /* location data for the lookahead */
+ /* symbol */
+#endif
+
+int MiniXftConfignerrs; /* number of parse errors so far */
+#endif /* not YYPURE */
+
+#if YYDEBUG != 0
+int MiniXftConfigdebug; /* nonzero means print parse trace */
+/* Since this is uninitialized, it does not stop multiple parsers
+ from coexisting. */
+#endif
+
+/* YYINITDEPTH indicates the initial size of the parser's stacks */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH is the maximum size the stacks can grow to
+ (effective only if the built-in stack extension method is used). */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+/* Define __MiniXftConfig_memcpy. Note that the size argument
+ should be passed with type unsigned int, because that is what the non-GCC
+ definitions require. With GCC, __builtin_memcpy takes an arg
+ of type size_t, but it can handle unsigned int. */
+
+#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+#define __MiniXftConfig_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
+#else /* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__MiniXftConfig_memcpy (to, from, count)
+ char *to;
+ char *from;
+ unsigned int count;
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__MiniXftConfig_memcpy (char *to, char *from, unsigned int count)
+{
+ register char *t = to;
+ register char *f = from;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#endif
+#endif
+
+#line 217 "/usr/lib/bison.simple"
+
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into MiniXftConfigparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
+
+#ifdef YYPARSE_PARAM
+#ifdef __cplusplus
+#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL
+#else /* not __cplusplus */
+#define YYPARSE_PARAM_ARG YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+#endif /* not __cplusplus */
+#else /* not YYPARSE_PARAM */
+#define YYPARSE_PARAM_ARG
+#define YYPARSE_PARAM_DECL
+#endif /* not YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int MiniXftConfigparse (void *);
+#else
+int MiniXftConfigparse (void);
+#endif
+#endif
+
+int
+MiniXftConfigparse(YYPARSE_PARAM_ARG)
+ YYPARSE_PARAM_DECL
+{
+ register int MiniXftConfigstate;
+ register int MiniXftConfign;
+ register short *MiniXftConfigssp;
+ register YYSTYPE *MiniXftConfigvsp;
+ int MiniXftConfigerrstatus; /* number of tokens to shift before error messages enabled */
+ int MiniXftConfigchar1 = 0; /* lookahead token as an internal (translated) token number */
+
+ short MiniXftConfigssa[YYINITDEPTH]; /* the state stack */
+ YYSTYPE MiniXftConfigvsa[YYINITDEPTH]; /* the semantic value stack */
+
+ short *MiniXftConfigss = MiniXftConfigssa; /* refer to the stacks thru separate pointers */
+ YYSTYPE *MiniXftConfigvs = MiniXftConfigvsa; /* to allow MiniXftConfigoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+ YYLTYPE MiniXftConfiglsa[YYINITDEPTH]; /* the location stack */
+ YYLTYPE *MiniXftConfigls = MiniXftConfiglsa;
+ YYLTYPE *MiniXftConfiglsp;
+
+#define YYPOPSTACK (MiniXftConfigvsp--, MiniXftConfigssp--, MiniXftConfiglsp--)
+#else
+#define YYPOPSTACK (MiniXftConfigvsp--, MiniXftConfigssp--)
+#endif
+
+ int MiniXftConfigstacksize = YYINITDEPTH;
+ int MiniXftConfigfree_stacks = 0;
+
+#ifdef YYPURE
+ int MiniXftConfigchar;
+ YYSTYPE MiniXftConfiglval;
+ int MiniXftConfignerrs;
+#ifdef YYLSP_NEEDED
+ YYLTYPE MiniXftConfiglloc;
+#endif
+#endif
+
+ YYSTYPE MiniXftConfigval; /* the variable used to return */
+ /* semantic values from the action */
+ /* routines */
+
+ int MiniXftConfiglen;
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Starting parse\n");
+#endif
+
+ MiniXftConfigstate = 0;
+ MiniXftConfigerrstatus = 0;
+ MiniXftConfignerrs = 0;
+ MiniXftConfigchar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ MiniXftConfigssp = MiniXftConfigss - 1;
+ MiniXftConfigvsp = MiniXftConfigvs;
+#ifdef YYLSP_NEEDED
+ MiniXftConfiglsp = MiniXftConfigls;
+#endif
+
+/* Push a new state, which is found in MiniXftConfigstate . */
+/* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks. */
+MiniXftConfignewstate:
+
+ *++MiniXftConfigssp = MiniXftConfigstate;
+
+ if (MiniXftConfigssp >= MiniXftConfigss + MiniXftConfigstacksize - 1)
+ {
+ /* Give user a chance to reallocate the stack */
+ /* Use copies of these so that the &'s don't force the real ones into memory. */
+ YYSTYPE *MiniXftConfigvs1 = MiniXftConfigvs;
+ short *MiniXftConfigss1 = MiniXftConfigss;
+#ifdef YYLSP_NEEDED
+ YYLTYPE *MiniXftConfigls1 = MiniXftConfigls;
+#endif
+
+ /* Get the current used size of the three stacks, in elements. */
+ int size = MiniXftConfigssp - MiniXftConfigss + 1;
+
+#ifdef MiniXftConfigoverflow
+ /* Each stack pointer address is followed by the size of
+ the data in use in that stack, in bytes. */
+#ifdef YYLSP_NEEDED
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if MiniXftConfigoverflow is a macro. */
+ MiniXftConfigoverflow("parser stack overflow",
+ &MiniXftConfigss1, size * sizeof (*MiniXftConfigssp),
+ &MiniXftConfigvs1, size * sizeof (*MiniXftConfigvsp),
+ &MiniXftConfigls1, size * sizeof (*MiniXftConfiglsp),
+ &MiniXftConfigstacksize);
+#else
+ MiniXftConfigoverflow("parser stack overflow",
+ &MiniXftConfigss1, size * sizeof (*MiniXftConfigssp),
+ &MiniXftConfigvs1, size * sizeof (*MiniXftConfigvsp),
+ &MiniXftConfigstacksize);
+#endif
+
+ MiniXftConfigss = MiniXftConfigss1; MiniXftConfigvs = MiniXftConfigvs1;
+#ifdef YYLSP_NEEDED
+ MiniXftConfigls = MiniXftConfigls1;
+#endif
+#else /* no MiniXftConfigoverflow */
+ /* Extend the stack our own way. */
+ if (MiniXftConfigstacksize >= YYMAXDEPTH)
+ {
+ MiniXftConfigerror("parser stack overflow");
+ if (MiniXftConfigfree_stacks)
+ {
+ free (MiniXftConfigss);
+ free (MiniXftConfigvs);
+#ifdef YYLSP_NEEDED
+ free (MiniXftConfigls);
+#endif
+ }
+ return 2;
+ }
+ MiniXftConfigstacksize *= 2;
+ if (MiniXftConfigstacksize > YYMAXDEPTH)
+ MiniXftConfigstacksize = YYMAXDEPTH;
+#ifndef YYSTACK_USE_ALLOCA
+ MiniXftConfigfree_stacks = 1;
+#endif
+ MiniXftConfigss = (short *) YYSTACK_ALLOC (MiniXftConfigstacksize * sizeof (*MiniXftConfigssp));
+ __MiniXftConfig_memcpy ((char *)MiniXftConfigss, (char *)MiniXftConfigss1,
+ size * (unsigned int) sizeof (*MiniXftConfigssp));
+ MiniXftConfigvs = (YYSTYPE *) YYSTACK_ALLOC (MiniXftConfigstacksize * sizeof (*MiniXftConfigvsp));
+ __MiniXftConfig_memcpy ((char *)MiniXftConfigvs, (char *)MiniXftConfigvs1,
+ size * (unsigned int) sizeof (*MiniXftConfigvsp));
+#ifdef YYLSP_NEEDED
+ MiniXftConfigls = (YYLTYPE *) YYSTACK_ALLOC (MiniXftConfigstacksize * sizeof (*MiniXftConfiglsp));
+ __MiniXftConfig_memcpy ((char *)MiniXftConfigls, (char *)MiniXftConfigls1,
+ size * (unsigned int) sizeof (*MiniXftConfiglsp));
+#endif
+#endif /* no MiniXftConfigoverflow */
+
+ MiniXftConfigssp = MiniXftConfigss + size - 1;
+ MiniXftConfigvsp = MiniXftConfigvs + size - 1;
+#ifdef YYLSP_NEEDED
+ MiniXftConfiglsp = MiniXftConfigls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Stack size increased to %d\n", MiniXftConfigstacksize);
+#endif
+
+ if (MiniXftConfigssp >= MiniXftConfigss + MiniXftConfigstacksize - 1)
+ YYABORT;
+ }
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Entering state %d\n", MiniXftConfigstate);
+#endif
+
+ goto MiniXftConfigbackup;
+ MiniXftConfigbackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* MiniXftConfigresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ MiniXftConfign = MiniXftConfigpact[MiniXftConfigstate];
+ if (MiniXftConfign == YYFLAG)
+ goto MiniXftConfigdefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* MiniXftConfigchar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
+ if (MiniXftConfigchar == YYEMPTY)
+ {
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Reading a token: ");
+#endif
+ MiniXftConfigchar = YYLEX;
+ }
+
+ /* Convert token to internal form (in MiniXftConfigchar1) for indexing tables with */
+
+ if (MiniXftConfigchar <= 0) /* This means end of input. */
+ {
+ MiniXftConfigchar1 = 0;
+ MiniXftConfigchar = YYEOF; /* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Now at end of input.\n");
+#endif
+ }
+ else
+ {
+ MiniXftConfigchar1 = YYTRANSLATE(MiniXftConfigchar);
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ {
+ fprintf (stderr, "Next token is %d (%s", MiniXftConfigchar, MiniXftConfigtname[MiniXftConfigchar1]);
+ /* Give the individual parser a way to print the precise meaning
+ of a token, for further debugging info. */
+#ifdef YYPRINT
+ YYPRINT (stderr, MiniXftConfigchar, MiniXftConfiglval);
+#endif
+ fprintf (stderr, ")\n");
+ }
+#endif
+ }
+
+ MiniXftConfign += MiniXftConfigchar1;
+ if (MiniXftConfign < 0 || MiniXftConfign > YYLAST || MiniXftConfigcheck[MiniXftConfign] != MiniXftConfigchar1)
+ goto MiniXftConfigdefault;
+
+ MiniXftConfign = MiniXftConfigtable[MiniXftConfign];
+
+ /* MiniXftConfign is what to do for this token type in this state.
+ Negative => reduce, -MiniXftConfign is rule number.
+ Positive => shift, MiniXftConfign is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (MiniXftConfign < 0)
+ {
+ if (MiniXftConfign == YYFLAG)
+ goto MiniXftConfigerrlab;
+ MiniXftConfign = -MiniXftConfign;
+ goto MiniXftConfigreduce;
+ }
+ else if (MiniXftConfign == 0)
+ goto MiniXftConfigerrlab;
+
+ if (MiniXftConfign == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Shifting token %d (%s), ", MiniXftConfigchar, MiniXftConfigtname[MiniXftConfigchar1]);
+#endif
+
+ /* Discard the token being shifted unless it is eof. */
+ if (MiniXftConfigchar != YYEOF)
+ MiniXftConfigchar = YYEMPTY;
+
+ *++MiniXftConfigvsp = MiniXftConfiglval;
+#ifdef YYLSP_NEEDED
+ *++MiniXftConfiglsp = MiniXftConfiglloc;
+#endif
+
+ /* count tokens shifted since error; after three, turn off error status. */
+ if (MiniXftConfigerrstatus) MiniXftConfigerrstatus--;
+
+ MiniXftConfigstate = MiniXftConfign;
+ goto MiniXftConfignewstate;
+
+/* Do the default action for the current state. */
+MiniXftConfigdefault:
+
+ MiniXftConfign = MiniXftConfigdefact[MiniXftConfigstate];
+ if (MiniXftConfign == 0)
+ goto MiniXftConfigerrlab;
+
+/* Do a reduction. MiniXftConfign is the number of a rule to reduce with. */
+MiniXftConfigreduce:
+ MiniXftConfiglen = MiniXftConfigr2[MiniXftConfign];
+ if (MiniXftConfiglen > 0)
+ MiniXftConfigval = MiniXftConfigvsp[1-MiniXftConfiglen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ {
+ int i;
+
+ fprintf (stderr, "Reducing via rule %d (line %d), ",
+ MiniXftConfign, MiniXftConfigrline[MiniXftConfign]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (i = MiniXftConfigprhs[MiniXftConfign]; MiniXftConfigrhs[i] > 0; i++)
+ fprintf (stderr, "%s ", MiniXftConfigtname[MiniXftConfigrhs[i]]);
+ fprintf (stderr, " -> %s\n", MiniXftConfigtname[MiniXftConfigr1[MiniXftConfign]]);
+ }
+#endif
+
+
+ switch (MiniXftConfign) {
+
+case 3:
+#line 81 "minixftgram.y"
+{ MiniXftConfigAddDir (MiniXftConfigvsp[0].sval); ;
+ break;}
+case 4:
+#line 83 "minixftgram.y"
+{ MiniXftConfigSetCache (MiniXftConfigvsp[0].sval); ;
+ break;}
+case 5:
+#line 85 "minixftgram.y"
+{ MiniXftConfigPushInput (MiniXftConfigvsp[0].sval, True); ;
+ break;}
+case 6:
+#line 87 "minixftgram.y"
+{ MiniXftConfigPushInput (MiniXftConfigvsp[0].sval, False); ;
+ break;}
+case 7:
+#line 89 "minixftgram.y"
+{ MiniXftConfigAddEdit (MiniXftConfigvsp[-2].tval, MiniXftConfigvsp[0].Eval); ;
+ break;}
+case 8:
+#line 92 "minixftgram.y"
+{ MiniXftConfigvsp[-1].tval->next = MiniXftConfigvsp[0].tval; MiniXftConfigval.tval = MiniXftConfigvsp[-1].tval; ;
+ break;}
+case 9:
+#line 94 "minixftgram.y"
+{ MiniXftConfigval.tval = 0; ;
+ break;}
+case 10:
+#line 97 "minixftgram.y"
+{ MiniXftConfigval.tval = MiniXftTestCreate (MiniXftConfigvsp[-3].qval, MiniXftConfigvsp[-2].sval, MiniXftConfigvsp[-1].oval, MiniXftConfigvsp[0].vval); ;
+ break;}
+case 11:
+#line 100 "minixftgram.y"
+{ MiniXftConfigval.qval = MiniXftQualAny; ;
+ break;}
+case 12:
+#line 102 "minixftgram.y"
+{ MiniXftConfigval.qval = MiniXftQualAll; ;
+ break;}
+case 13:
+#line 104 "minixftgram.y"
+{ MiniXftConfigval.qval = MiniXftQualAny; ;
+ break;}
+case 14:
+#line 107 "minixftgram.y"
+{
+ MiniXftConfigval.sval = MiniXftConfigSaveField (MiniXftConfigvsp[0].sval);
+ ;
+ break;}
+case 15:
+#line 112 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpEqual; ;
+ break;}
+case 16:
+#line 114 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpEqual; ;
+ break;}
+case 17:
+#line 116 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpNotEqual; ;
+ break;}
+case 18:
+#line 118 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpLess; ;
+ break;}
+case 19:
+#line 120 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpLessEqual; ;
+ break;}
+case 20:
+#line 122 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpMore; ;
+ break;}
+case 21:
+#line 124 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpMoreEqual; ;
+ break;}
+case 22:
+#line 127 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeInteger;
+ MiniXftConfigval.vval.u.i = MiniXftConfigvsp[0].ival;
+ ;
+ break;}
+case 23:
+#line 132 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeDouble;
+ MiniXftConfigval.vval.u.d = MiniXftConfigvsp[0].dval;
+ ;
+ break;}
+case 24:
+#line 137 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeString;
+ MiniXftConfigval.vval.u.s = MiniXftConfigvsp[0].sval;
+ ;
+ break;}
+case 25:
+#line 142 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeBool;
+ MiniXftConfigval.vval.u.b = True;
+ ;
+ break;}
+case 26:
+#line 147 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeBool;
+ MiniXftConfigval.vval.u.b = False;
+ ;
+ break;}
+case 27:
+#line 152 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeVoid;
+ ;
+ break;}
+case 28:
+#line 156 "minixftgram.y"
+{
+ MiniXftConfigval.vval.type = MiniXftTypeMatrix;
+ MiniXftConfigval.vval.u.m = &matrix;
+ ;
+ break;}
+case 29:
+#line 162 "minixftgram.y"
+{
+ matrix.xx = MiniXftConfigvsp[-4].dval;
+ matrix.xy = MiniXftConfigvsp[-3].dval;
+ matrix.yx = MiniXftConfigvsp[-2].dval;
+ matrix.yy = MiniXftConfigvsp[-1].dval;
+ ;
+ break;}
+case 30:
+#line 169 "minixftgram.y"
+{ MiniXftConfigval.dval = (double) MiniXftConfigvsp[0].ival; ;
+ break;}
+case 32:
+#line 173 "minixftgram.y"
+{ MiniXftConfigvsp[-1].Eval->next = MiniXftConfigvsp[0].Eval; MiniXftConfigval.Eval = MiniXftConfigvsp[-1].Eval; ;
+ break;}
+case 33:
+#line 175 "minixftgram.y"
+{ MiniXftConfigval.Eval = 0; ;
+ break;}
+case 34:
+#line 178 "minixftgram.y"
+{ MiniXftConfigval.Eval = MiniXftEditCreate (MiniXftConfigvsp[-3].sval, MiniXftConfigvsp[-2].oval, MiniXftConfigvsp[-1].eval); ;
+ break;}
+case 35:
+#line 181 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpAssign; ;
+ break;}
+case 36:
+#line 183 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpPrepend; ;
+ break;}
+case 37:
+#line 185 "minixftgram.y"
+{ MiniXftConfigval.oval = MiniXftOpAppend; ;
+ break;}
+case 38:
+#line 188 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateInteger (MiniXftConfigvsp[0].ival); ;
+ break;}
+case 39:
+#line 190 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateDouble (MiniXftConfigvsp[0].dval); ;
+ break;}
+case 40:
+#line 192 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateString (MiniXftConfigvsp[0].sval); ;
+ break;}
+case 41:
+#line 194 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateBool (True); ;
+ break;}
+case 42:
+#line 196 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateBool (False); ;
+ break;}
+case 43:
+#line 198 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateNil (); ;
+ break;}
+case 44:
+#line 200 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateMatrix (&matrix); ;
+ break;}
+case 45:
+#line 202 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateField (MiniXftConfigvsp[0].sval); ;
+ break;}
+case 46:
+#line 204 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpOr, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 47:
+#line 206 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpAnd, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 48:
+#line 208 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpEqual, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 49:
+#line 210 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpNotEqual, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 50:
+#line 212 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpLess, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 51:
+#line 214 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpLessEqual, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 52:
+#line 216 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpMore, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 53:
+#line 218 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpMoreEqual, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 54:
+#line 220 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpPlus, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 55:
+#line 222 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpMinus, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 56:
+#line 224 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpTimes, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 57:
+#line 226 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpDivide, MiniXftConfigvsp[0].eval); ;
+ break;}
+case 58:
+#line 228 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[0].eval, MiniXftOpNot, (MiniXftExpr *) 0); ;
+ break;}
+case 59:
+#line 230 "minixftgram.y"
+{ MiniXftConfigval.eval = MiniXftExprCreateOp (MiniXftConfigvsp[-4].eval, MiniXftOpQuest, MiniXftExprCreateOp (MiniXftConfigvsp[-2].eval, MiniXftOpQuest, MiniXftConfigvsp[0].eval)); ;
+ break;}
+}
+ /* the action file gets copied in in place of this dollarsign */
+#line 543 "/usr/lib/bison.simple"
+
+ MiniXftConfigvsp -= MiniXftConfiglen;
+ MiniXftConfigssp -= MiniXftConfiglen;
+#ifdef YYLSP_NEEDED
+ MiniXftConfiglsp -= MiniXftConfiglen;
+#endif
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ {
+ short *ssp1 = MiniXftConfigss - 1;
+ fprintf (stderr, "state stack now");
+ while (ssp1 != MiniXftConfigssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ *++MiniXftConfigvsp = MiniXftConfigval;
+
+#ifdef YYLSP_NEEDED
+ MiniXftConfiglsp++;
+ if (MiniXftConfiglen == 0)
+ {
+ MiniXftConfiglsp->first_line = MiniXftConfiglloc.first_line;
+ MiniXftConfiglsp->first_column = MiniXftConfiglloc.first_column;
+ MiniXftConfiglsp->last_line = (MiniXftConfiglsp-1)->last_line;
+ MiniXftConfiglsp->last_column = (MiniXftConfiglsp-1)->last_column;
+ MiniXftConfiglsp->text = 0;
+ }
+ else
+ {
+ MiniXftConfiglsp->last_line = (MiniXftConfiglsp+MiniXftConfiglen-1)->last_line;
+ MiniXftConfiglsp->last_column = (MiniXftConfiglsp+MiniXftConfiglen-1)->last_column;
+ }
+#endif
+
+ /* Now "shift" the result of the reduction.
+ Determine what state that goes to,
+ based on the state we popped back to
+ and the rule number reduced by. */
+
+ MiniXftConfign = MiniXftConfigr1[MiniXftConfign];
+
+ MiniXftConfigstate = MiniXftConfigpgoto[MiniXftConfign - YYNTBASE] + *MiniXftConfigssp;
+ if (MiniXftConfigstate >= 0 && MiniXftConfigstate <= YYLAST && MiniXftConfigcheck[MiniXftConfigstate] == *MiniXftConfigssp)
+ MiniXftConfigstate = MiniXftConfigtable[MiniXftConfigstate];
+ else
+ MiniXftConfigstate = MiniXftConfigdefgoto[MiniXftConfign - YYNTBASE];
+
+ goto MiniXftConfignewstate;
+
+MiniXftConfigerrlab: /* here on detecting error */
+
+ if (! MiniXftConfigerrstatus)
+ /* If not already recovering from an error, report this error. */
+ {
+ ++MiniXftConfignerrs;
+
+#ifdef YYERROR_VERBOSE
+ MiniXftConfign = MiniXftConfigpact[MiniXftConfigstate];
+
+ if (MiniXftConfign > YYFLAG && MiniXftConfign < YYLAST)
+ {
+ int size = 0;
+ char *msg;
+ int x, count;
+
+ count = 0;
+ /* Start X at -MiniXftConfign if nec to avoid negative indexes in MiniXftConfigcheck. */
+ for (x = (MiniXftConfign < 0 ? -MiniXftConfign : 0);
+ x < (sizeof(MiniXftConfigtname) / sizeof(char *)); x++)
+ if (MiniXftConfigcheck[x + MiniXftConfign] == x)
+ size += strlen(MiniXftConfigtname[x]) + 15, count++;
+ msg = (char *) malloc(size + 15);
+ if (msg != 0)
+ {
+ strcpy(msg, "parse error");
+
+ if (count < 5)
+ {
+ count = 0;
+ for (x = (MiniXftConfign < 0 ? -MiniXftConfign : 0);
+ x < (sizeof(MiniXftConfigtname) / sizeof(char *)); x++)
+ if (MiniXftConfigcheck[x + MiniXftConfign] == x)
+ {
+ strcat(msg, count == 0 ? ", expecting `" : " or `");
+ strcat(msg, MiniXftConfigtname[x]);
+ strcat(msg, "'");
+ count++;
+ }
+ }
+ MiniXftConfigerror(msg);
+ free(msg);
+ }
+ else
+ MiniXftConfigerror ("parse error; also virtual memory exceeded");
+ }
+ else
+#endif /* YYERROR_VERBOSE */
+ MiniXftConfigerror("parse error");
+ }
+
+ goto MiniXftConfigerrlab1;
+MiniXftConfigerrlab1: /* here on error raised explicitly by an action */
+
+ if (MiniXftConfigerrstatus == 3)
+ {
+ /* if just tried and failed to reuse lookahead token after an error, discard it. */
+
+ /* return failure if at end of input */
+ if (MiniXftConfigchar == YYEOF)
+ YYABORT;
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Discarding token %d (%s).\n", MiniXftConfigchar, MiniXftConfigtname[MiniXftConfigchar1]);
+#endif
+
+ MiniXftConfigchar = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token
+ after shifting the error token. */
+
+ MiniXftConfigerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto MiniXftConfigerrhandle;
+
+MiniXftConfigerrdefault: /* current state does not do anything special for the error token. */
+
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+ MiniXftConfign = MiniXftConfigdefact[MiniXftConfigstate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
+ if (MiniXftConfign) goto MiniXftConfigdefault;
+#endif
+
+MiniXftConfigerrpop: /* pop the current state because it cannot handle the error token */
+
+ if (MiniXftConfigssp == MiniXftConfigss) YYABORT;
+ MiniXftConfigvsp--;
+ MiniXftConfigstate = *--MiniXftConfigssp;
+#ifdef YYLSP_NEEDED
+ MiniXftConfiglsp--;
+#endif
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ {
+ short *ssp1 = MiniXftConfigss - 1;
+ fprintf (stderr, "Error: state stack now");
+ while (ssp1 != MiniXftConfigssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+MiniXftConfigerrhandle:
+
+ MiniXftConfign = MiniXftConfigpact[MiniXftConfigstate];
+ if (MiniXftConfign == YYFLAG)
+ goto MiniXftConfigerrdefault;
+
+ MiniXftConfign += YYTERROR;
+ if (MiniXftConfign < 0 || MiniXftConfign > YYLAST || MiniXftConfigcheck[MiniXftConfign] != YYTERROR)
+ goto MiniXftConfigerrdefault;
+
+ MiniXftConfign = MiniXftConfigtable[MiniXftConfign];
+ if (MiniXftConfign < 0)
+ {
+ if (MiniXftConfign == YYFLAG)
+ goto MiniXftConfigerrpop;
+ MiniXftConfign = -MiniXftConfign;
+ goto MiniXftConfigreduce;
+ }
+ else if (MiniXftConfign == 0)
+ goto MiniXftConfigerrpop;
+
+ if (MiniXftConfign == YYFINAL)
+ YYACCEPT;
+
+#if YYDEBUG != 0
+ if (MiniXftConfigdebug)
+ fprintf(stderr, "Shifting error token, ");
+#endif
+
+ *++MiniXftConfigvsp = MiniXftConfiglval;
+#ifdef YYLSP_NEEDED
+ *++MiniXftConfiglsp = MiniXftConfiglloc;
+#endif
+
+ MiniXftConfigstate = MiniXftConfign;
+ goto MiniXftConfignewstate;
+
+ MiniXftConfigacceptlab:
+ /* YYACCEPT comes here. */
+ if (MiniXftConfigfree_stacks)
+ {
+ free (MiniXftConfigss);
+ free (MiniXftConfigvs);
+#ifdef YYLSP_NEEDED
+ free (MiniXftConfigls);
+#endif
+ }
+ return 0;
+
+ MiniXftConfigabortlab:
+ /* YYABORT comes here. */
+ if (MiniXftConfigfree_stacks)
+ {
+ free (MiniXftConfigss);
+ free (MiniXftConfigvs);
+#ifdef YYLSP_NEEDED
+ free (MiniXftConfigls);
+#endif
+ }
+ return 1;
+}
+#line 232 "minixftgram.y"
+
+
+int
+MiniXftConfigwrap (void)
+{
+ return 1;
+}
+
+void
+MiniXftConfigerror (char *fmt, ...)
+{
+ va_list args;
+
+ fprintf (stderr, "\"%s\": line %d, ", MiniXftConfigFile, MiniXftConfigLineno);
+ va_start (args, fmt);
+ vfprintf (stderr, fmt, args);
+ va_end (args);
+ fprintf (stderr, "\n");
+}
+
+MiniXftTest *
+MiniXftTestCreate (MiniXftQual qual, const char *field, MiniXftOp compare, MiniXftValue value)
+{
+ MiniXftTest *test = (MiniXftTest *) malloc (sizeof (MiniXftTest));;
+
+ if (test)
+ {
+ test->next = 0;
+ test->qual = qual;
+ test->field = field; /* already saved in grammar */
+ test->op = compare;
+ if (value.type == MiniXftTypeString)
+ value.u.s = _MiniXftSaveString (value.u.s);
+ else if (value.type == MiniXftTypeMatrix)
+ value.u.m = _MiniXftSaveMatrix (value.u.m);
+ test->value = value;
+ }
+ return test;
+}
+
+MiniXftExpr *
+MiniXftExprCreateInteger (int i)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpInteger;
+ e->u.ival = i;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateDouble (double d)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpDouble;
+ e->u.dval = d;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateString (const char *s)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpString;
+ e->u.sval = _MiniXftSaveString (s);
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateMatrix (const MiniXftMatrix *m)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpMatrix;
+ e->u.mval = _MiniXftSaveMatrix (m);
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateBool (Bool b)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpBool;
+ e->u.bval = b;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateNil (void)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpNil;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateField (const char *field)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpField;
+ e->u.field = _MiniXftSaveString (field);
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateOp (MiniXftExpr *left, MiniXftOp op, MiniXftExpr *right)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = op;
+ e->u.tree.left = left;
+ e->u.tree.right = right;
+ }
+ return e;
+}
+
+void
+MiniXftExprDestroy (MiniXftExpr *e)
+{
+ switch (e->op) {
+ case MiniXftOpInteger:
+ break;
+ case MiniXftOpDouble:
+ break;
+ case MiniXftOpString:
+ free (e->u.sval);
+ break;
+ case MiniXftOpMatrix:
+ free (e->u.mval);
+ break;
+ case MiniXftOpBool:
+ break;
+ case MiniXftOpField:
+ free (e->u.field);
+ break;
+ case MiniXftOpAssign:
+ case MiniXftOpPrepend:
+ case MiniXftOpAppend:
+ break;
+ case MiniXftOpOr:
+ case MiniXftOpAnd:
+ case MiniXftOpEqual:
+ case MiniXftOpNotEqual:
+ case MiniXftOpLess:
+ case MiniXftOpLessEqual:
+ case MiniXftOpMore:
+ case MiniXftOpMoreEqual:
+ case MiniXftOpPlus:
+ case MiniXftOpMinus:
+ case MiniXftOpTimes:
+ case MiniXftOpDivide:
+ case MiniXftOpQuest:
+ MiniXftExprDestroy (e->u.tree.right);
+ /* fall through */
+ case MiniXftOpNot:
+ MiniXftExprDestroy (e->u.tree.left);
+ break;
+ case MiniXftOpNil:
+ break;
+ }
+ free (e);
+}
+
+MiniXftEdit *
+MiniXftEditCreate (const char *field, MiniXftOp op, MiniXftExpr *expr)
+{
+ MiniXftEdit *e = (MiniXftEdit *) malloc (sizeof (MiniXftEdit));
+
+ if (e)
+ {
+ e->next = 0;
+ e->field = field; /* already saved in grammar */
+ e->op = op;
+ e->expr = expr;
+ }
+ return e;
+}
+
+void
+MiniXftEditDestroy (MiniXftEdit *e)
+{
+ if (e->next)
+ MiniXftEditDestroy (e->next);
+ free ((void *) e->field);
+ if (e->expr)
+ MiniXftExprDestroy (e->expr);
+}
+
+char *
+MiniXftConfigSaveField (const char *field)
+{
+ return _MiniXftSaveString (field);
+}
diff --git a/pango/mini-xft/minixftgram.h b/pango/mini-xft/minixftgram.h
new file mode 100644
index 00000000..8207b436
--- /dev/null
+++ b/pango/mini-xft/minixftgram.h
@@ -0,0 +1,49 @@
+typedef union {
+ int ival;
+ double dval;
+ char *sval;
+ MiniXftExpr *eval;
+ MiniXftPattern *pval;
+ MiniXftValue vval;
+ MiniXftEdit *Eval;
+ MiniXftOp oval;
+ MiniXftQual qval;
+ MiniXftTest *tval;
+} YYSTYPE;
+#define INTEGER 257
+#define DOUBLE 258
+#define STRING 259
+#define NAME 260
+#define ANY 261
+#define ALL 262
+#define DIR 263
+#define CACHE 264
+#define INCLUDE 265
+#define INCLUDEIF 266
+#define MATCH 267
+#define EDIT 268
+#define TOK_TRUE 269
+#define TOK_FALSE 270
+#define TOK_NIL 271
+#define EQUAL 272
+#define SEMI 273
+#define OS 274
+#define CS 275
+#define QUEST 276
+#define COLON 277
+#define OROR 278
+#define ANDAND 279
+#define EQEQ 280
+#define NOTEQ 281
+#define LESS 282
+#define LESSEQ 283
+#define MORE 284
+#define MOREEQ 285
+#define PLUS 286
+#define MINUS 287
+#define TIMES 288
+#define DIVIDE 289
+#define NOT 290
+
+
+extern YYSTYPE MiniXftConfiglval;
diff --git a/pango/mini-xft/minixftgram.y b/pango/mini-xft/minixftgram.y
new file mode 100644
index 00000000..e2daaa33
--- /dev/null
+++ b/pango/mini-xft/minixftgram.y
@@ -0,0 +1,452 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftgram.y,v 1.5 2001/05/16 10:32:54 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+%{
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "minixftint.h"
+
+static MiniXftMatrix matrix;
+
+%}
+
+%union {
+ int ival;
+ double dval;
+ char *sval;
+ MiniXftExpr *eval;
+ MiniXftPattern *pval;
+ MiniXftValue vval;
+ MiniXftEdit *Eval;
+ MiniXftOp oval;
+ MiniXftQual qval;
+ MiniXftTest *tval;
+}
+
+%token <ival> INTEGER
+%token <dval> DOUBLE
+%token <sval> STRING NAME
+%token <ival> ANY ALL
+%token <ival> DIR CACHE INCLUDE INCLUDEIF MATCH EDIT
+%token <ival> TOK_TRUE TOK_FALSE TOK_NIL
+%token <ival> EQUAL SEMI OS CS
+
+%type <eval> expr
+%type <vval> value
+%type <sval> field
+%type <Eval> edit
+%type <Eval> edits
+%type <oval> eqop
+%type <qval> qual
+%type <oval> compare
+%type <tval> tests test
+%type <dval> number
+
+%right <ival> QUEST COLON
+%left <ival> OROR
+%left <ival> ANDAND
+%left <ival> EQEQ NOTEQ
+%left <ival> LESS LESSEQ MORE MOREEQ
+%left <ival> PLUS MINUS
+%left <ival> TIMES DIVIDE
+%right <ival> NOT
+
+%%
+configs : configs config
+ |
+ ;
+config : DIR STRING
+ { MiniXftConfigAddDir ($2); }
+ | CACHE STRING
+ { MiniXftConfigSetCache ($2); }
+ | INCLUDE STRING
+ { MiniXftConfigPushInput ($2, True); }
+ | INCLUDEIF STRING
+ { MiniXftConfigPushInput ($2, False); }
+ | MATCH tests EDIT edits
+ { MiniXftConfigAddEdit ($2, $4); }
+ ;
+tests : test tests
+ { $1->next = $2; $$ = $1; }
+ |
+ { $$ = 0; }
+ ;
+test : qual field compare value
+ { $$ = MiniXftTestCreate ($1, $2, $3, $4); }
+ ;
+qual : ANY
+ { $$ = MiniXftQualAny; }
+ | ALL
+ { $$ = MiniXftQualAll; }
+ |
+ { $$ = MiniXftQualAny; }
+ ;
+field : NAME
+ {
+ $$ = MiniXftConfigSaveField ($1);
+ }
+ ;
+compare : EQUAL
+ { $$ = MiniXftOpEqual; }
+ | EQEQ
+ { $$ = MiniXftOpEqual; }
+ | NOTEQ
+ { $$ = MiniXftOpNotEqual; }
+ | LESS
+ { $$ = MiniXftOpLess; }
+ | LESSEQ
+ { $$ = MiniXftOpLessEqual; }
+ | MORE
+ { $$ = MiniXftOpMore; }
+ | MOREEQ
+ { $$ = MiniXftOpMoreEqual; }
+ ;
+value : INTEGER
+ {
+ $$.type = MiniXftTypeInteger;
+ $$.u.i = $1;
+ }
+ | DOUBLE
+ {
+ $$.type = MiniXftTypeDouble;
+ $$.u.d = $1;
+ }
+ | STRING
+ {
+ $$.type = MiniXftTypeString;
+ $$.u.s = $1;
+ }
+ | TOK_TRUE
+ {
+ $$.type = MiniXftTypeBool;
+ $$.u.b = True;
+ }
+ | TOK_FALSE
+ {
+ $$.type = MiniXftTypeBool;
+ $$.u.b = False;
+ }
+ | TOK_NIL
+ {
+ $$.type = MiniXftTypeVoid;
+ }
+ | matrix
+ {
+ $$.type = MiniXftTypeMatrix;
+ $$.u.m = &matrix;
+ }
+ ;
+matrix : OS number number number number CS
+ {
+ matrix.xx = $2;
+ matrix.xy = $3;
+ matrix.yx = $4;
+ matrix.__REALLY_YY__ = $5;
+ }
+number : INTEGER
+ { $$ = (double) $1; }
+ | DOUBLE
+ ;
+edits : edit edits
+ { $1->next = $2; $$ = $1; }
+ |
+ { $$ = 0; }
+ ;
+edit : field eqop expr SEMI
+ { $$ = MiniXftEditCreate ($1, $2, $3); }
+ ;
+eqop : EQUAL
+ { $$ = MiniXftOpAssign; }
+ | PLUS EQUAL
+ { $$ = MiniXftOpPrepend; }
+ | EQUAL PLUS
+ { $$ = MiniXftOpAppend; }
+ ;
+expr : INTEGER
+ { $$ = MiniXftExprCreateInteger ($1); }
+ | DOUBLE
+ { $$ = MiniXftExprCreateDouble ($1); }
+ | STRING
+ { $$ = MiniXftExprCreateString ($1); }
+ | TOK_TRUE
+ { $$ = MiniXftExprCreateBool (True); }
+ | TOK_FALSE
+ { $$ = MiniXftExprCreateBool (False); }
+ | TOK_NIL
+ { $$ = MiniXftExprCreateNil (); }
+ | matrix
+ { $$ = MiniXftExprCreateMatrix (&matrix); }
+ | NAME
+ { $$ = MiniXftExprCreateField ($1); }
+ | expr OROR expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpOr, $3); }
+ | expr ANDAND expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpAnd, $3); }
+ | expr EQEQ expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpEqual, $3); }
+ | expr NOTEQ expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpNotEqual, $3); }
+ | expr LESS expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpLess, $3); }
+ | expr LESSEQ expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpLessEqual, $3); }
+ | expr MORE expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpMore, $3); }
+ | expr MOREEQ expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpMoreEqual, $3); }
+ | expr PLUS expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpPlus, $3); }
+ | expr MINUS expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpMinus, $3); }
+ | expr TIMES expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpTimes, $3); }
+ | expr DIVIDE expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpDivide, $3); }
+ | NOT expr
+ { $$ = MiniXftExprCreateOp ($2, MiniXftOpNot, (MiniXftExpr *) 0); }
+ | expr QUEST expr COLON expr
+ { $$ = MiniXftExprCreateOp ($1, MiniXftOpQuest, MiniXftExprCreateOp ($3, MiniXftOpQuest, $5)); }
+ ;
+%%
+
+int
+MiniXftConfigwrap (void)
+{
+ return 1;
+}
+
+void
+MiniXftConfigerror (char *fmt, ...)
+{
+ va_list args;
+
+ fprintf (stderr, "\"%s\": line %d, ", MiniXftConfigFile, MiniXftConfigLineno);
+ va_start (args, fmt);
+ vfprintf (stderr, fmt, args);
+ va_end (args);
+ fprintf (stderr, "\n");
+}
+
+MiniXftTest *
+MiniXftTestCreate (MiniXftQual qual, const char *field, MiniXftOp compare, MiniXftValue value)
+{
+ MiniXftTest *test = (MiniXftTest *) malloc (sizeof (MiniXftTest));;
+
+ if (test)
+ {
+ test->next = 0;
+ test->qual = qual;
+ test->field = field; /* already saved in grammar */
+ test->op = compare;
+ if (value.type == MiniXftTypeString)
+ value.u.s = _MiniXftSaveString (value.u.s);
+ else if (value.type == MiniXftTypeMatrix)
+ value.u.m = _MiniXftSaveMatrix (value.u.m);
+ test->value = value;
+ }
+ return test;
+}
+
+MiniXftExpr *
+MiniXftExprCreateInteger (int i)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpInteger;
+ e->u.ival = i;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateDouble (double d)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpDouble;
+ e->u.dval = d;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateString (const char *s)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpString;
+ e->u.sval = _MiniXftSaveString (s);
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateMatrix (const MiniXftMatrix *m)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpMatrix;
+ e->u.mval = _MiniXftSaveMatrix (m);
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateBool (Bool b)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpBool;
+ e->u.bval = b;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateNil (void)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpNil;
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateField (const char *field)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = MiniXftOpField;
+ e->u.field = _MiniXftSaveString (field);
+ }
+ return e;
+}
+
+MiniXftExpr *
+MiniXftExprCreateOp (MiniXftExpr *left, MiniXftOp op, MiniXftExpr *right)
+{
+ MiniXftExpr *e = (MiniXftExpr *) malloc (sizeof (MiniXftExpr));
+
+ if (e)
+ {
+ e->op = op;
+ e->u.tree.left = left;
+ e->u.tree.right = right;
+ }
+ return e;
+}
+
+void
+MiniXftExprDestroy (MiniXftExpr *e)
+{
+ switch (e->op) {
+ case MiniXftOpInteger:
+ break;
+ case MiniXftOpDouble:
+ break;
+ case MiniXftOpString:
+ free (e->u.sval);
+ break;
+ case MiniXftOpMatrix:
+ free (e->u.mval);
+ break;
+ case MiniXftOpBool:
+ break;
+ case MiniXftOpField:
+ free (e->u.field);
+ break;
+ case MiniXftOpAssign:
+ case MiniXftOpPrepend:
+ case MiniXftOpAppend:
+ break;
+ case MiniXftOpOr:
+ case MiniXftOpAnd:
+ case MiniXftOpEqual:
+ case MiniXftOpNotEqual:
+ case MiniXftOpLess:
+ case MiniXftOpLessEqual:
+ case MiniXftOpMore:
+ case MiniXftOpMoreEqual:
+ case MiniXftOpPlus:
+ case MiniXftOpMinus:
+ case MiniXftOpTimes:
+ case MiniXftOpDivide:
+ case MiniXftOpQuest:
+ MiniXftExprDestroy (e->u.tree.right);
+ /* fall through */
+ case MiniXftOpNot:
+ MiniXftExprDestroy (e->u.tree.left);
+ break;
+ case MiniXftOpNil:
+ break;
+ }
+ free (e);
+}
+
+MiniXftEdit *
+MiniXftEditCreate (const char *field, MiniXftOp op, MiniXftExpr *expr)
+{
+ MiniXftEdit *e = (MiniXftEdit *) malloc (sizeof (MiniXftEdit));
+
+ if (e)
+ {
+ e->next = 0;
+ e->field = field; /* already saved in grammar */
+ e->op = op;
+ e->expr = expr;
+ }
+ return e;
+}
+
+void
+MiniXftEditDestroy (MiniXftEdit *e)
+{
+ if (e->next)
+ MiniXftEditDestroy (e->next);
+ free ((void *) e->field);
+ if (e->expr)
+ MiniXftExprDestroy (e->expr);
+}
+
+char *
+MiniXftConfigSaveField (const char *field)
+{
+ return _MiniXftSaveString (field);
+}
diff --git a/pango/mini-xft/minixftinit.c b/pango/mini-xft/minixftinit.c
new file mode 100644
index 00000000..9a995044
--- /dev/null
+++ b/pango/mini-xft/minixftinit.c
@@ -0,0 +1,48 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftinit.c,v 1.2 2000/12/15 17:12:53 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include "minixftint.h"
+
+MiniXftFontSet *_MiniXftFontSet;
+Bool _MiniXftConfigInitialized;
+
+Bool
+MiniXftInit (char *config)
+{
+ if (_MiniXftConfigInitialized)
+ return True;
+ _MiniXftConfigInitialized = True;
+ if (!config)
+ {
+ config = getenv ("XFT_CONFIG");
+ if (!config)
+ config = XFT_DEFAULT_PATH;
+ }
+ if (MiniXftConfigLexFile (config))
+ {
+ MiniXftConfigparse ();
+ }
+ return True;
+}
diff --git a/pango/mini-xft/minixftint.h b/pango/mini-xft/minixftint.h
new file mode 100644
index 00000000..22f937a9
--- /dev/null
+++ b/pango/mini-xft/minixftint.h
@@ -0,0 +1,395 @@
+/*
+ * $XFree86: xc/lib/MiniXft/minixftint.h,v 1.26 2001/07/13 18:16:10 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFTINT_H_
+#define _XFTINT_H_
+
+#include "MiniXftFreetype.h"
+
+typedef struct _MiniXftMatcher {
+ char *object;
+ double (*compare) (char *object, MiniXftValue value1, MiniXftValue value2);
+} MiniXftMatcher;
+
+typedef struct _MiniXftSymbolic {
+ const char *name;
+ int value;
+} MiniXftSymbolic;
+
+#define XFT_DRAW_N_SRC 2
+
+#define XFT_DRAW_SRC_TEXT 0
+#define XFT_DRAW_SRC_RECT 1
+
+typedef struct _MiniXftDisplayInfo {
+ struct _MiniXftDisplayInfo *next;
+ Display *display;
+ // XExtCodes *codes;
+ MiniXftPattern *defaults;
+ // MiniXftFontSet *coreFonts;
+ Bool hasRender;
+} MiniXftDisplayInfo;
+
+extern MiniXftDisplayInfo *_MiniXftDisplayInfo;
+extern MiniXftFontSet *_MiniXftGlobalFontSet;
+extern char **MiniXftConfigDirs;
+extern MiniXftFontSet *_MiniXftFontSet;
+
+#define XFT_NMISSING 256
+
+#ifndef XFT_DEFAULT_PATH
+#define XFT_DEFAULT_PATH "/usr/X11R6/lib/X11/XftConfig"
+#endif
+
+#define XFT_DBG_OPEN 1
+#define XFT_DBG_OPENV 2
+#define XFT_DBG_RENDER 4
+#define XFT_DBG_DRAW 8
+#define XFT_DBG_REF 16
+#define XFT_DBG_GLYPH 32
+#define XFT_DBG_GLYPHV 64
+#define XFT_DBG_CACHE 128
+#define XFT_DBG_CACHEV 256
+#define XFT_DBG_MATCH 512
+#define XFT_DBG_MATCHV 1024
+
+typedef enum _MiniXftOp {
+ MiniXftOpInteger, MiniXftOpDouble, MiniXftOpString, MiniXftOpMatrix, MiniXftOpBool, MiniXftOpNil,
+ MiniXftOpField,
+ MiniXftOpAssign, MiniXftOpPrepend, MiniXftOpAppend,
+ MiniXftOpQuest,
+ MiniXftOpOr, MiniXftOpAnd, MiniXftOpEqual, MiniXftOpNotEqual,
+ MiniXftOpLess, MiniXftOpLessEqual, MiniXftOpMore, MiniXftOpMoreEqual,
+ MiniXftOpPlus, MiniXftOpMinus, MiniXftOpTimes, MiniXftOpDivide,
+ MiniXftOpNot
+} MiniXftOp;
+
+typedef struct _MiniXftExpr {
+ MiniXftOp op;
+ union {
+ int ival;
+ double dval;
+ char *sval;
+ MiniXftMatrix *mval;
+ Bool bval;
+ char *field;
+ struct {
+ struct _MiniXftExpr *left, *right;
+ } tree;
+ } u;
+} MiniXftExpr;
+
+typedef enum _MiniXftQual {
+ MiniXftQualAny, MiniXftQualAll
+} MiniXftQual;
+
+typedef struct _MiniXftTest {
+ struct _MiniXftTest *next;
+ MiniXftQual qual;
+ const char *field;
+ MiniXftOp op;
+ MiniXftValue value;
+} MiniXftTest;
+
+typedef struct _MiniXftEdit {
+ struct _MiniXftEdit *next;
+ const char *field;
+ MiniXftOp op;
+ MiniXftExpr *expr;
+} MiniXftEdit;
+
+typedef struct _MiniXftSubst {
+ struct _MiniXftSubst *next;
+ MiniXftTest *test;
+ MiniXftEdit *edit;
+} MiniXftSubst;
+
+/*
+ * I tried this with functions that took va_list* arguments
+ * but portability concerns made me change these functions
+ * into macros (sigh).
+ */
+
+#define _MiniXftPatternVapBuild(result, orig, va) \
+{ \
+ MiniXftPattern *__p__ = (orig); \
+ const char *__o__; \
+ MiniXftValue __v__; \
+ \
+ if (!__p__) \
+ { \
+ __p__ = MiniXftPatternCreate (); \
+ if (!__p__) \
+ goto _MiniXftPatternVapBuild_bail0; \
+ } \
+ for (;;) \
+ { \
+ __o__ = va_arg (va, const char *); \
+ if (!__o__) \
+ break; \
+ __v__.type = va_arg (va, MiniXftType); \
+ switch (__v__.type) { \
+ case MiniXftTypeVoid: \
+ goto _MiniXftPatternVapBuild_bail1; \
+ case MiniXftTypeInteger: \
+ __v__.u.i = va_arg (va, int); \
+ break; \
+ case MiniXftTypeDouble: \
+ __v__.u.d = va_arg (va, double); \
+ break; \
+ case MiniXftTypeString: \
+ __v__.u.s = va_arg (va, char *); \
+ break; \
+ case MiniXftTypeBool: \
+ __v__.u.b = va_arg (va, Bool); \
+ break; \
+ case MiniXftTypeMatrix: \
+ __v__.u.m = va_arg (va, MiniXftMatrix *); \
+ break; \
+ } \
+ if (!MiniXftPatternAdd (__p__, __o__, __v__, True)) \
+ goto _MiniXftPatternVapBuild_bail1; \
+ } \
+ result = __p__; \
+ goto _MiniXftPatternVapBuild_return; \
+ \
+_MiniXftPatternVapBuild_bail1: \
+ if (!orig) \
+ MiniXftPatternDestroy (__p__); \
+_MiniXftPatternVapBuild_bail0: \
+ result = 0; \
+ \
+_MiniXftPatternVapBuild_return: \
+ ; \
+}
+
+
+/* xftcache.c */
+
+char *
+MiniXftFileCacheFind (char *file, int id, int *count);
+
+void
+MiniXftFileCacheDispose (void);
+
+void
+MiniXftFileCacheLoad (char *cache);
+
+Bool
+MiniXftFileCacheUpdate (char *file, int id, char *name);
+
+Bool
+MiniXftFileCacheSave (char *cache);
+
+Bool
+MiniXftFileCacheReadDir (MiniXftFontSet *set, const char *cache_file);
+
+Bool
+MiniXftFileCacheWriteDir (MiniXftFontSet *set, const char *cache_file);
+
+/* xftcfg.c */
+Bool
+MiniXftConfigAddDir (char *d);
+
+Bool
+MiniXftConfigSetCache (char *c);
+
+char *
+MiniXftConfigGetCache (void);
+
+Bool
+MiniXftConfigAddEdit (MiniXftTest *test, MiniXftEdit *edit);
+
+Bool
+_MiniXftConfigCompareValue (MiniXftValue m,
+ MiniXftOp op,
+ MiniXftValue v);
+
+/* xftdbg.c */
+void
+MiniXftOpPrint (MiniXftOp op);
+
+void
+MiniXftTestPrint (MiniXftTest *test);
+
+void
+MiniXftExprPrint (MiniXftExpr *expr);
+
+void
+MiniXftEditPrint (MiniXftEdit *edit);
+
+void
+MiniXftSubstPrint (MiniXftSubst *subst);
+
+/* xftdpy.c */
+int
+MiniXftDefaultParseBool (char *v);
+
+Bool
+MiniXftDefaultGetBool (Display *dpy, const char *object, int screen, Bool def);
+
+int
+MiniXftDefaultGetInteger (Display *dpy, const char *object, int screen, int def);
+
+double
+MiniXftDefaultGetDouble (Display *dpy, const char *object, int screen, double def);
+
+MiniXftFontSet *
+MiniXftDisplayGetFontSet (Display *dpy);
+
+/* xftextent.c */
+/* xftfont.c */
+int
+_MiniXftFontDebug (void);
+
+/* xftfs.c */
+/* xftgram.y */
+int
+MiniXftConfigparse (void);
+
+int
+MiniXftConfigwrap (void);
+
+void
+MiniXftConfigerror (char *fmt, ...);
+
+char *
+MiniXftConfigSaveField (const char *field);
+
+MiniXftTest *
+MiniXftTestCreate (MiniXftQual qual, const char *field, MiniXftOp compare, MiniXftValue value);
+
+MiniXftExpr *
+MiniXftExprCreateInteger (int i);
+
+MiniXftExpr *
+MiniXftExprCreateDouble (double d);
+
+MiniXftExpr *
+MiniXftExprCreateString (const char *s);
+
+MiniXftExpr *
+MiniXftExprCreateMatrix (const MiniXftMatrix *m);
+
+MiniXftExpr *
+MiniXftExprCreateBool (Bool b);
+
+MiniXftExpr *
+MiniXftExprCreateNil (void);
+
+MiniXftExpr *
+MiniXftExprCreateField (const char *field);
+
+MiniXftExpr *
+MiniXftExprCreateOp (MiniXftExpr *left, MiniXftOp op, MiniXftExpr *right);
+
+void
+MiniXftExprDestroy (MiniXftExpr *e);
+
+MiniXftEdit *
+MiniXftEditCreate (const char *field, MiniXftOp op, MiniXftExpr *expr);
+
+void
+MiniXftEditDestroy (MiniXftEdit *e);
+
+/* xftinit.c */
+
+/* xftlex.l */
+extern int MiniXftConfigLineno;
+extern char *MiniXftConfigFile;
+
+int
+MiniXftConfiglex (void);
+
+Bool
+MiniXftConfigLexFile(char *s);
+
+Bool
+MiniXftConfigPushInput (char *s, Bool complain);
+
+/* xftlist.c */
+Bool
+MiniXftListValueCompare (MiniXftValue v1,
+ MiniXftValue v2);
+
+Bool
+MiniXftListValueListCompare (MiniXftValueList *v1orig,
+ MiniXftValueList *v2orig,
+ MiniXftQual qual);
+
+Bool
+MiniXftListMatch (MiniXftPattern *p,
+ MiniXftPattern *font,
+ MiniXftQual qual);
+
+Bool
+MiniXftListAppend (MiniXftFontSet *s,
+ MiniXftPattern *font,
+ MiniXftObjectSet *os);
+
+
+/* xftmatch.c */
+
+/* xftname.c */
+Bool
+MiniXftNameConstant (char *string, int *result);
+
+/* xftpat.c */
+
+/* xftrender.c */
+
+/* xftmatrix.c */
+MiniXftMatrix *
+_MiniXftSaveMatrix (const MiniXftMatrix *mat);
+
+/* xftstr.c */
+char *
+_MiniXftSaveString (const char *s);
+
+const char *
+_MiniXftGetInt(const char *ptr, int *val);
+
+char *
+_MiniXftSplitStr (const char *field, char *save);
+
+char *
+_MiniXftDownStr (const char *field, char *save);
+
+const char *
+_MiniXftSplitField (const char *field, char *save);
+
+const char *
+_MiniXftSplitValue (const char *field, char *save);
+
+int
+_MiniXftMatchSymbolic (MiniXftSymbolic *s, int n, const char *name, int def);
+
+int
+_MiniXftStrCmpIgnoreCase (const char *s1, const char *s2);
+
+/* xftxlfd.c */
+Bool
+MiniXftCoreAddFonts (MiniXftFontSet *set, Display *dpy, Bool ignore_scalable);
+
+#endif /* _XFT_INT_H_ */
diff --git a/pango/mini-xft/minixftlex.c b/pango/mini-xft/minixftlex.c
new file mode 100644
index 00000000..4e901a6d
--- /dev/null
+++ b/pango/mini-xft/minixftlex.c
@@ -0,0 +1,1985 @@
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header$
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define MiniXftConfigconst const
+#else
+#define MiniXftConfigconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN MiniXftConfig_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((MiniXftConfig_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE MiniXftConfigrestart( MiniXftConfigin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct MiniXftConfig_buffer_state *YY_BUFFER_STATE;
+
+extern int MiniXftConfigleng;
+extern FILE *MiniXftConfigin, *MiniXftConfigout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * MiniXftConfigless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the MiniXftConfigless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define MiniXftConfigless(n) \
+ do \
+ { \
+ /* Undo effects of setting up MiniXftConfigtext. */ \
+ *MiniXftConfig_cp = MiniXftConfig_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ MiniXftConfig_c_buf_p = MiniXftConfig_cp = MiniXftConfig_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up MiniXftConfigtext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) MiniXftConfigunput( c, MiniXftConfigtext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int MiniXftConfig_size_t;
+
+
+struct MiniXftConfig_buffer_state
+ {
+ FILE *MiniXftConfig_input_file;
+
+ char *MiniXftConfig_ch_buf; /* input buffer */
+ char *MiniXftConfig_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ MiniXftConfig_size_t MiniXftConfig_buf_size;
+
+ /* Number of characters read into MiniXftConfig_ch_buf, not including EOB
+ * characters.
+ */
+ int MiniXftConfig_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int MiniXftConfig_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int MiniXftConfig_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int MiniXftConfig_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int MiniXftConfig_fill_buffer;
+
+ int MiniXftConfig_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via MiniXftConfigrestart()), so that the user can continue scanning by
+ * just pointing MiniXftConfigin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE MiniXftConfig_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER MiniXftConfig_current_buffer
+
+
+/* MiniXftConfig_hold_char holds the character lost when MiniXftConfigtext is formed. */
+static char MiniXftConfig_hold_char;
+
+static int MiniXftConfig_n_chars; /* number of characters read into MiniXftConfig_ch_buf */
+
+
+int MiniXftConfigleng;
+
+/* Points to current character in buffer. */
+static char *MiniXftConfig_c_buf_p = (char *) 0;
+static int MiniXftConfig_init = 1; /* whether we need to initialize */
+static int MiniXftConfig_start = 0; /* start state number */
+
+/* Flag which is used to allow MiniXftConfigwrap()'s to do buffer switches
+ * instead of setting up a fresh MiniXftConfigin. A bit of a hack ...
+ */
+static int MiniXftConfig_did_buffer_switch_on_eof;
+
+void MiniXftConfigrestart YY_PROTO(( FILE *input_file ));
+
+void MiniXftConfig_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void MiniXftConfig_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE MiniXftConfig_create_buffer YY_PROTO(( FILE *file, int size ));
+void MiniXftConfig_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void MiniXftConfig_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void MiniXftConfig_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER MiniXftConfig_flush_buffer( MiniXftConfig_current_buffer )
+
+YY_BUFFER_STATE MiniXftConfig_scan_buffer YY_PROTO(( char *base, MiniXftConfig_size_t size ));
+YY_BUFFER_STATE MiniXftConfig_scan_string YY_PROTO(( MiniXftConfigconst char *MiniXftConfig_str ));
+YY_BUFFER_STATE MiniXftConfig_scan_bytes YY_PROTO(( MiniXftConfigconst char *bytes, int len ));
+
+static void *MiniXftConfig_flex_alloc YY_PROTO(( MiniXftConfig_size_t ));
+static void *MiniXftConfig_flex_realloc YY_PROTO(( void *, MiniXftConfig_size_t ));
+static void MiniXftConfig_flex_free YY_PROTO(( void * ));
+
+#define MiniXftConfig_new_buffer MiniXftConfig_create_buffer
+
+#define MiniXftConfig_set_interactive(is_interactive) \
+ { \
+ if ( ! MiniXftConfig_current_buffer ) \
+ MiniXftConfig_current_buffer = MiniXftConfig_create_buffer( MiniXftConfigin, YY_BUF_SIZE ); \
+ MiniXftConfig_current_buffer->MiniXftConfig_is_interactive = is_interactive; \
+ }
+
+#define MiniXftConfig_set_bol(at_bol) \
+ { \
+ if ( ! MiniXftConfig_current_buffer ) \
+ MiniXftConfig_current_buffer = MiniXftConfig_create_buffer( MiniXftConfigin, YY_BUF_SIZE ); \
+ MiniXftConfig_current_buffer->MiniXftConfig_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (MiniXftConfig_current_buffer->MiniXftConfig_at_bol)
+
+typedef unsigned char YY_CHAR;
+FILE *MiniXftConfigin = (FILE *) 0, *MiniXftConfigout = (FILE *) 0;
+typedef int MiniXftConfig_state_type;
+extern char *MiniXftConfigtext;
+#define MiniXftConfigtext_ptr MiniXftConfigtext
+
+static MiniXftConfig_state_type MiniXftConfig_get_previous_state YY_PROTO(( void ));
+static MiniXftConfig_state_type MiniXftConfig_try_NUL_trans YY_PROTO(( MiniXftConfig_state_type current_state ));
+static int MiniXftConfig_get_next_buffer YY_PROTO(( void ));
+static void MiniXftConfig_fatal_error YY_PROTO(( MiniXftConfigconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up MiniXftConfigtext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ MiniXftConfigtext_ptr = MiniXftConfig_bp; \
+ MiniXftConfigleng = (int) (MiniXftConfig_cp - MiniXftConfig_bp); \
+ MiniXftConfig_hold_char = *MiniXftConfig_cp; \
+ *MiniXftConfig_cp = '\0'; \
+ MiniXftConfig_c_buf_p = MiniXftConfig_cp;
+
+#define YY_NUM_RULES 39
+#define YY_END_OF_BUFFER 40
+static MiniXftConfigconst short int MiniXftConfig_accept[94] =
+ { 0,
+ 0, 0, 40, 37, 38, 21, 37, 37, 19, 17,
+ 18, 37, 20, 34, 15, 16, 24, 14, 28, 30,
+ 36, 31, 32, 36, 36, 36, 36, 36, 36, 36,
+ 36, 36, 37, 2, 29, 0, 33, 0, 22, 35,
+ 0, 1, 35, 34, 0, 25, 26, 27, 36, 36,
+ 36, 36, 36, 36, 36, 36, 36, 36, 36, 23,
+ 33, 0, 35, 0, 0, 35, 13, 12, 36, 3,
+ 36, 36, 36, 36, 11, 36, 35, 0, 36, 8,
+ 36, 36, 36, 9, 4, 10, 36, 7, 36, 5,
+ 36, 6, 0
+
+ } ;
+
+static MiniXftConfigconst int MiniXftConfig_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 4, 5, 1, 1, 6, 1, 1,
+ 1, 7, 8, 1, 9, 10, 11, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 13, 14, 15,
+ 16, 17, 18, 1, 19, 19, 19, 19, 20, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 21, 22, 23, 1, 24, 1, 25, 19, 26, 27,
+
+ 28, 29, 19, 30, 31, 19, 19, 32, 33, 34,
+ 19, 19, 19, 35, 36, 37, 38, 19, 19, 19,
+ 39, 19, 40, 41, 42, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static MiniXftConfigconst int MiniXftConfig_meta[43] =
+ { 0,
+ 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 3, 1, 1, 1, 1, 1, 1, 3, 3,
+ 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 1,
+ 1, 1
+ } ;
+
+static MiniXftConfigconst short int MiniXftConfig_base[96] =
+ { 0,
+ 0, 126, 130, 132, 132, 113, 39, 122, 132, 132,
+ 132, 32, 120, 35, 132, 132, 110, 109, 108, 132,
+ 0, 132, 132, 14, 98, 91, 94, 95, 85, 93,
+ 86, 81, 74, 132, 132, 45, 132, 46, 132, 42,
+ 102, 132, 45, 46, 67, 132, 132, 132, 0, 81,
+ 73, 85, 75, 77, 73, 78, 66, 70, 63, 132,
+ 47, 41, 66, 88, 87, 86, 0, 0, 67, 0,
+ 59, 59, 61, 66, 0, 63, 32, 47, 62, 0,
+ 60, 49, 54, 0, 0, 0, 54, 0, 52, 46,
+ 42, 0, 132, 106, 61
+
+ } ;
+
+static MiniXftConfigconst short int MiniXftConfig_def[96] =
+ { 0,
+ 93, 1, 93, 93, 93, 93, 94, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 95, 93, 93, 95, 95, 95, 95, 95, 95, 95,
+ 95, 95, 93, 93, 93, 94, 93, 94, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 95, 95,
+ 95, 95, 95, 95, 95, 95, 95, 95, 95, 93,
+ 94, 93, 93, 93, 93, 93, 95, 95, 95, 95,
+ 95, 95, 95, 95, 95, 95, 93, 93, 95, 95,
+ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
+ 95, 95, 0, 93, 93
+
+ } ;
+
+static MiniXftConfigconst short int MiniXftConfig_nxt[175] =
+ { 0,
+ 4, 5, 6, 7, 4, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
+ 22, 4, 23, 4, 24, 25, 26, 27, 28, 21,
+ 29, 21, 30, 31, 21, 21, 32, 21, 21, 4,
+ 33, 4, 37, 40, 43, 50, 44, 51, 37, 61,
+ 37, 45, 62, 40, 45, 43, 63, 44, 78, 45,
+ 38, 45, 45, 49, 45, 45, 38, 38, 38, 45,
+ 92, 41, 45, 45, 65, 65, 91, 63, 66, 90,
+ 89, 41, 77, 88, 64, 45, 87, 86, 77, 85,
+ 84, 83, 82, 45, 81, 80, 79, 66, 66, 78,
+
+ 76, 75, 74, 73, 72, 64, 36, 71, 36, 70,
+ 69, 68, 67, 62, 60, 59, 58, 57, 56, 55,
+ 54, 53, 52, 48, 47, 46, 42, 39, 35, 93,
+ 34, 3, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93
+ } ;
+
+static MiniXftConfigconst short int MiniXftConfig_chk[175] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 7, 12, 14, 24, 14, 24, 36, 38,
+ 61, 77, 62, 40, 14, 44, 43, 44, 78, 77,
+ 7, 40, 14, 95, 43, 44, 36, 38, 61, 40,
+ 91, 12, 43, 44, 45, 45, 90, 63, 45, 89,
+ 87, 40, 62, 83, 43, 63, 82, 81, 78, 79,
+ 76, 74, 73, 63, 72, 71, 69, 66, 65, 64,
+
+ 59, 58, 57, 56, 55, 63, 94, 54, 94, 53,
+ 52, 51, 50, 41, 33, 32, 31, 30, 29, 28,
+ 27, 26, 25, 19, 18, 17, 13, 8, 6, 3,
+ 2, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93
+ } ;
+
+static MiniXftConfig_state_type MiniXftConfig_last_accepting_state;
+static char *MiniXftConfig_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define MiniXftConfigmore() MiniXftConfigmore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *MiniXftConfigtext;
+#line 1 "minixftlex.l"
+#define INITIAL 0
+#line 2 "minixftlex.l"
+/*
+ * $XFree86: xc/lib/MiniXft/xftlex.l,v 1.7 2001/05/18 16:03:06 tsi Exp $
+ *
+ * Copyright (c) 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <string.h>
+#include "minixftint.h"
+
+#include "minixftgram.h"
+
+int MiniXftConfigLineno;
+
+static void _MiniXftConfigSkipComment (void);
+
+static void _MiniXftConfigSkipLine (void);
+
+static int _MiniXftConfigPopInput (void);
+
+
+#define XFT_CONFIG_IN_DEEP 20
+FILE *MiniXftConfigInStack[XFT_CONFIG_IN_DEEP];
+FILE **MiniXftConfigInpt = MiniXftConfigInStack + XFT_CONFIG_IN_DEEP;
+FILE *MiniXftConfigInput;
+int MiniXftConfigLinenos[XFT_CONFIG_IN_DEEP];
+int *MiniXftConfigLinenopt = MiniXftConfigLinenos + XFT_CONFIG_IN_DEEP;
+char *MiniXftConfigFile = "";
+char *MiniXftConfigFileNames[XFT_CONFIG_IN_DEEP];
+char **MiniXftConfigFileNamePt = MiniXftConfigFileNames + XFT_CONFIG_IN_DEEP;
+int MiniXftConfigFiledeep = 0;
+
+#undef YY_INPUT
+
+#define YY_INPUT(buf,result,max_size) \
+{ \
+ int c; \
+ result = 0; \
+ while (result < max_size) { \
+ c = getc (MiniXftConfigInput); \
+ if (c < 0) { \
+ c = _MiniXftConfigPopInput (); \
+ if (c < 0) \
+ break; \
+ } \
+ buf[result++] = c; \
+ if (c == '\n') \
+ { \
+ MiniXftConfigLineno++; \
+ break; \
+ } \
+ } \
+}
+
+#ifndef FLEX_SCANNER
+#undef input
+#undef unput
+static int input (void)
+{
+ char buf[1];
+ static int r = EOF;
+
+ if (r == 0)
+ return 0;
+ YY_INPUT(buf, r, 1);
+ if (r == 0)
+ return EOF;
+ return buf[0];
+}
+
+static void unput (char c)
+{
+ if (!c || c == EOF)
+ return;
+ if (c == '\n')
+ MiniXftConfigLineno--;
+ ungetc (c, MiniXftConfigInput);
+}
+#endif
+
+#line 531 "lex.MiniXftConfig.c"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int MiniXftConfigwrap YY_PROTO(( void ));
+#else
+extern int MiniXftConfigwrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void MiniXftConfigunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef MiniXftConfigtext_ptr
+static void MiniXftConfig_flex_strncpy YY_PROTO(( char *, MiniXftConfigconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int MiniXftConfig_flex_strlen YY_PROTO(( MiniXftConfigconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int MiniXftConfiginput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int MiniXftConfig_start_stack_ptr = 0;
+static int MiniXftConfig_start_stack_depth = 0;
+static int *MiniXftConfig_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void MiniXftConfig_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void MiniXftConfig_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int MiniXftConfig_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( MiniXftConfigtext, MiniXftConfigleng, 1, MiniXftConfigout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( MiniXftConfig_current_buffer->MiniXftConfig_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( MiniXftConfigin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( MiniXftConfigin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, MiniXftConfigin )) == 0) \
+ && ferror( MiniXftConfigin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "MiniXftConfigterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef MiniXftConfigterminate
+#define MiniXftConfigterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) MiniXftConfig_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int MiniXftConfiglex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after MiniXftConfigtext and MiniXftConfigleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ if ( MiniXftConfigleng > 0 ) \
+ MiniXftConfig_current_buffer->MiniXftConfig_at_bol = \
+ (MiniXftConfigtext[MiniXftConfigleng - 1] == '\n'); \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register MiniXftConfig_state_type MiniXftConfig_current_state;
+ register char *MiniXftConfig_cp = NULL, *MiniXftConfig_bp = NULL;
+ register int MiniXftConfig_act;
+
+#line 100 "minixftlex.l"
+
+#line 687 "lex.MiniXftConfig.c"
+
+ if ( MiniXftConfig_init )
+ {
+ MiniXftConfig_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! MiniXftConfig_start )
+ MiniXftConfig_start = 1; /* first start state */
+
+ if ( ! MiniXftConfigin )
+ MiniXftConfigin = stdin;
+
+ if ( ! MiniXftConfigout )
+ MiniXftConfigout = stdout;
+
+ if ( ! MiniXftConfig_current_buffer )
+ MiniXftConfig_current_buffer =
+ MiniXftConfig_create_buffer( MiniXftConfigin, YY_BUF_SIZE );
+
+ MiniXftConfig_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ MiniXftConfig_cp = MiniXftConfig_c_buf_p;
+
+ /* Support of MiniXftConfigtext. */
+ *MiniXftConfig_cp = MiniXftConfig_hold_char;
+
+ /* MiniXftConfig_bp points to the position in MiniXftConfig_ch_buf of the start of
+ * the current run.
+ */
+ MiniXftConfig_bp = MiniXftConfig_cp;
+
+ MiniXftConfig_current_state = MiniXftConfig_start;
+ MiniXftConfig_current_state += YY_AT_BOL();
+MiniXftConfig_match:
+ do
+ {
+ register YY_CHAR MiniXftConfig_c = MiniXftConfig_ec[YY_SC_TO_UI(*MiniXftConfig_cp)];
+ if ( MiniXftConfig_accept[MiniXftConfig_current_state] )
+ {
+ MiniXftConfig_last_accepting_state = MiniXftConfig_current_state;
+ MiniXftConfig_last_accepting_cpos = MiniXftConfig_cp;
+ }
+ while ( MiniXftConfig_chk[MiniXftConfig_base[MiniXftConfig_current_state] + MiniXftConfig_c] != MiniXftConfig_current_state )
+ {
+ MiniXftConfig_current_state = (int) MiniXftConfig_def[MiniXftConfig_current_state];
+ if ( MiniXftConfig_current_state >= 94 )
+ MiniXftConfig_c = MiniXftConfig_meta[(unsigned int) MiniXftConfig_c];
+ }
+ MiniXftConfig_current_state = MiniXftConfig_nxt[MiniXftConfig_base[MiniXftConfig_current_state] + (unsigned int) MiniXftConfig_c];
+ ++MiniXftConfig_cp;
+ }
+ while ( MiniXftConfig_base[MiniXftConfig_current_state] != 132 );
+
+MiniXftConfig_find_action:
+ MiniXftConfig_act = MiniXftConfig_accept[MiniXftConfig_current_state];
+ if ( MiniXftConfig_act == 0 )
+ { /* have to back up */
+ MiniXftConfig_cp = MiniXftConfig_last_accepting_cpos;
+ MiniXftConfig_current_state = MiniXftConfig_last_accepting_state;
+ MiniXftConfig_act = MiniXftConfig_accept[MiniXftConfig_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( MiniXftConfig_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *MiniXftConfig_cp = MiniXftConfig_hold_char;
+ MiniXftConfig_cp = MiniXftConfig_last_accepting_cpos;
+ MiniXftConfig_current_state = MiniXftConfig_last_accepting_state;
+ goto MiniXftConfig_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 101 "minixftlex.l"
+_MiniXftConfigSkipComment();
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 102 "minixftlex.l"
+_MiniXftConfigSkipLine();
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 103 "minixftlex.l"
+return DIR;
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 104 "minixftlex.l"
+return CACHE;
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 105 "minixftlex.l"
+return INCLUDE;
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 106 "minixftlex.l"
+return INCLUDEIF;
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 107 "minixftlex.l"
+return MATCH;
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 108 "minixftlex.l"
+return EDIT;
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 109 "minixftlex.l"
+return TOK_TRUE;
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 110 "minixftlex.l"
+return TOK_FALSE;
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 111 "minixftlex.l"
+return TOK_NIL;
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 112 "minixftlex.l"
+return ANY;
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 113 "minixftlex.l"
+return ALL;
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 114 "minixftlex.l"
+return EQUAL;
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 115 "minixftlex.l"
+return COLON;
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 116 "minixftlex.l"
+return SEMI;
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 117 "minixftlex.l"
+return PLUS;
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 118 "minixftlex.l"
+return MINUS;
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 119 "minixftlex.l"
+return TIMES;
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 120 "minixftlex.l"
+return DIVIDE;
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 121 "minixftlex.l"
+return NOT;
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 122 "minixftlex.l"
+return ANDAND;
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 123 "minixftlex.l"
+return OROR;
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 124 "minixftlex.l"
+return LESS;
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 125 "minixftlex.l"
+return LESSEQ;
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 126 "minixftlex.l"
+return EQEQ;
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 127 "minixftlex.l"
+return MOREEQ;
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 128 "minixftlex.l"
+return MORE;
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 129 "minixftlex.l"
+return NOTEQ;
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 130 "minixftlex.l"
+return QUEST;
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 131 "minixftlex.l"
+return OS;
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 132 "minixftlex.l"
+return CS;
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 133 "minixftlex.l"
+{
+ MiniXftConfigtext[MiniXftConfigleng - 1] = '\0';
+ MiniXftConfiglval.sval = MiniXftConfigtext+1;
+ return STRING;
+ }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 138 "minixftlex.l"
+{
+ MiniXftConfiglval.ival = strtol (MiniXftConfigtext, 0, 10);
+ return INTEGER;
+ }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 142 "minixftlex.l"
+{
+ MiniXftConfiglval.dval = strtod (MiniXftConfigtext, 0);
+ return DOUBLE;
+ }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 146 "minixftlex.l"
+{
+ if (MiniXftNameConstant (MiniXftConfigtext, &MiniXftConfiglval.ival))
+ return INTEGER;
+ MiniXftConfiglval.sval = MiniXftConfigtext;
+ return NAME;
+ }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 152 "minixftlex.l"
+;
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 153 "minixftlex.l"
+;
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 154 "minixftlex.l"
+ECHO;
+ YY_BREAK
+#line 981 "lex.MiniXftConfig.c"
+case YY_STATE_EOF(INITIAL):
+ MiniXftConfigterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int MiniXftConfig_amount_of_matched_text = (int) (MiniXftConfig_cp - MiniXftConfigtext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *MiniXftConfig_cp = MiniXftConfig_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( MiniXftConfig_current_buffer->MiniXftConfig_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed MiniXftConfigin at a new source and called
+ * MiniXftConfiglex(). If so, then we have to assure
+ * consistency between MiniXftConfig_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ MiniXftConfig_n_chars = MiniXftConfig_current_buffer->MiniXftConfig_n_chars;
+ MiniXftConfig_current_buffer->MiniXftConfig_input_file = MiniXftConfigin;
+ MiniXftConfig_current_buffer->MiniXftConfig_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for MiniXftConfig_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since MiniXftConfig_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( MiniXftConfig_c_buf_p <= &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[MiniXftConfig_n_chars] )
+ { /* This was really a NUL. */
+ MiniXftConfig_state_type MiniXftConfig_next_state;
+
+ MiniXftConfig_c_buf_p = MiniXftConfigtext_ptr + MiniXftConfig_amount_of_matched_text;
+
+ MiniXftConfig_current_state = MiniXftConfig_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * MiniXftConfig_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ MiniXftConfig_next_state = MiniXftConfig_try_NUL_trans( MiniXftConfig_current_state );
+
+ MiniXftConfig_bp = MiniXftConfigtext_ptr + YY_MORE_ADJ;
+
+ if ( MiniXftConfig_next_state )
+ {
+ /* Consume the NUL. */
+ MiniXftConfig_cp = ++MiniXftConfig_c_buf_p;
+ MiniXftConfig_current_state = MiniXftConfig_next_state;
+ goto MiniXftConfig_match;
+ }
+
+ else
+ {
+ MiniXftConfig_cp = MiniXftConfig_c_buf_p;
+ goto MiniXftConfig_find_action;
+ }
+ }
+
+ else switch ( MiniXftConfig_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ MiniXftConfig_did_buffer_switch_on_eof = 0;
+
+ if ( MiniXftConfigwrap() )
+ {
+ /* Note: because we've taken care in
+ * MiniXftConfig_get_next_buffer() to have set up
+ * MiniXftConfigtext, we can now set up
+ * MiniXftConfig_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ MiniXftConfig_c_buf_p = MiniXftConfigtext_ptr + YY_MORE_ADJ;
+
+ MiniXftConfig_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! MiniXftConfig_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ MiniXftConfig_c_buf_p =
+ MiniXftConfigtext_ptr + MiniXftConfig_amount_of_matched_text;
+
+ MiniXftConfig_current_state = MiniXftConfig_get_previous_state();
+
+ MiniXftConfig_cp = MiniXftConfig_c_buf_p;
+ MiniXftConfig_bp = MiniXftConfigtext_ptr + YY_MORE_ADJ;
+ goto MiniXftConfig_match;
+
+ case EOB_ACT_LAST_MATCH:
+ MiniXftConfig_c_buf_p =
+ &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[MiniXftConfig_n_chars];
+
+ MiniXftConfig_current_state = MiniXftConfig_get_previous_state();
+
+ MiniXftConfig_cp = MiniXftConfig_c_buf_p;
+ MiniXftConfig_bp = MiniXftConfigtext_ptr + YY_MORE_ADJ;
+ goto MiniXftConfig_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of MiniXftConfiglex */
+
+
+/* MiniXftConfig_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int MiniXftConfig_get_next_buffer()
+ {
+ register char *dest = MiniXftConfig_current_buffer->MiniXftConfig_ch_buf;
+ register char *source = MiniXftConfigtext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( MiniXftConfig_c_buf_p > &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[MiniXftConfig_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( MiniXftConfig_current_buffer->MiniXftConfig_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( MiniXftConfig_c_buf_p - MiniXftConfigtext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (MiniXftConfig_c_buf_p - MiniXftConfigtext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( MiniXftConfig_current_buffer->MiniXftConfig_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ MiniXftConfig_current_buffer->MiniXftConfig_n_chars = MiniXftConfig_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ MiniXftConfig_current_buffer->MiniXftConfig_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = MiniXftConfig_current_buffer;
+
+ int MiniXftConfig_c_buf_p_offset =
+ (int) (MiniXftConfig_c_buf_p - b->MiniXftConfig_ch_buf);
+
+ if ( b->MiniXftConfig_is_our_buffer )
+ {
+ int new_size = b->MiniXftConfig_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->MiniXftConfig_buf_size += b->MiniXftConfig_buf_size / 8;
+ else
+ b->MiniXftConfig_buf_size *= 2;
+
+ b->MiniXftConfig_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ MiniXftConfig_flex_realloc( (void *) b->MiniXftConfig_ch_buf,
+ b->MiniXftConfig_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->MiniXftConfig_ch_buf = 0;
+
+ if ( ! b->MiniXftConfig_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ MiniXftConfig_c_buf_p = &b->MiniXftConfig_ch_buf[MiniXftConfig_c_buf_p_offset];
+
+ num_to_read = MiniXftConfig_current_buffer->MiniXftConfig_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[number_to_move]),
+ MiniXftConfig_n_chars, num_to_read );
+
+ MiniXftConfig_current_buffer->MiniXftConfig_n_chars = MiniXftConfig_n_chars;
+ }
+
+ if ( MiniXftConfig_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ MiniXftConfigrestart( MiniXftConfigin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ MiniXftConfig_current_buffer->MiniXftConfig_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ MiniXftConfig_n_chars += number_to_move;
+ MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[MiniXftConfig_n_chars] = YY_END_OF_BUFFER_CHAR;
+ MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[MiniXftConfig_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ MiniXftConfigtext_ptr = &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* MiniXftConfig_get_previous_state - get the state just before the EOB char was reached */
+
+static MiniXftConfig_state_type MiniXftConfig_get_previous_state()
+ {
+ register MiniXftConfig_state_type MiniXftConfig_current_state;
+ register char *MiniXftConfig_cp;
+
+ MiniXftConfig_current_state = MiniXftConfig_start;
+ MiniXftConfig_current_state += YY_AT_BOL();
+
+ for ( MiniXftConfig_cp = MiniXftConfigtext_ptr + YY_MORE_ADJ; MiniXftConfig_cp < MiniXftConfig_c_buf_p; ++MiniXftConfig_cp )
+ {
+ register YY_CHAR MiniXftConfig_c = (*MiniXftConfig_cp ? MiniXftConfig_ec[YY_SC_TO_UI(*MiniXftConfig_cp)] : 1);
+ if ( MiniXftConfig_accept[MiniXftConfig_current_state] )
+ {
+ MiniXftConfig_last_accepting_state = MiniXftConfig_current_state;
+ MiniXftConfig_last_accepting_cpos = MiniXftConfig_cp;
+ }
+ while ( MiniXftConfig_chk[MiniXftConfig_base[MiniXftConfig_current_state] + MiniXftConfig_c] != MiniXftConfig_current_state )
+ {
+ MiniXftConfig_current_state = (int) MiniXftConfig_def[MiniXftConfig_current_state];
+ if ( MiniXftConfig_current_state >= 94 )
+ MiniXftConfig_c = MiniXftConfig_meta[(unsigned int) MiniXftConfig_c];
+ }
+ MiniXftConfig_current_state = MiniXftConfig_nxt[MiniXftConfig_base[MiniXftConfig_current_state] + (unsigned int) MiniXftConfig_c];
+ }
+
+ return MiniXftConfig_current_state;
+ }
+
+
+/* MiniXftConfig_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = MiniXftConfig_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static MiniXftConfig_state_type MiniXftConfig_try_NUL_trans( MiniXftConfig_state_type MiniXftConfig_current_state )
+#else
+static MiniXftConfig_state_type MiniXftConfig_try_NUL_trans( MiniXftConfig_current_state )
+MiniXftConfig_state_type MiniXftConfig_current_state;
+#endif
+ {
+ register int MiniXftConfig_is_jam;
+ register char *MiniXftConfig_cp = MiniXftConfig_c_buf_p;
+
+ register YY_CHAR MiniXftConfig_c = 1;
+ if ( MiniXftConfig_accept[MiniXftConfig_current_state] )
+ {
+ MiniXftConfig_last_accepting_state = MiniXftConfig_current_state;
+ MiniXftConfig_last_accepting_cpos = MiniXftConfig_cp;
+ }
+ while ( MiniXftConfig_chk[MiniXftConfig_base[MiniXftConfig_current_state] + MiniXftConfig_c] != MiniXftConfig_current_state )
+ {
+ MiniXftConfig_current_state = (int) MiniXftConfig_def[MiniXftConfig_current_state];
+ if ( MiniXftConfig_current_state >= 94 )
+ MiniXftConfig_c = MiniXftConfig_meta[(unsigned int) MiniXftConfig_c];
+ }
+ MiniXftConfig_current_state = MiniXftConfig_nxt[MiniXftConfig_base[MiniXftConfig_current_state] + (unsigned int) MiniXftConfig_c];
+ MiniXftConfig_is_jam = (MiniXftConfig_current_state == 93);
+
+ return MiniXftConfig_is_jam ? 0 : MiniXftConfig_current_state;
+ }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void MiniXftConfigunput( int c, register char *MiniXftConfig_bp )
+#else
+static void MiniXftConfigunput( c, MiniXftConfig_bp )
+int c;
+register char *MiniXftConfig_bp;
+#endif
+ {
+ register char *MiniXftConfig_cp = MiniXftConfig_c_buf_p;
+
+ /* undo effects of setting up MiniXftConfigtext */
+ *MiniXftConfig_cp = MiniXftConfig_hold_char;
+
+ if ( MiniXftConfig_cp < MiniXftConfig_current_buffer->MiniXftConfig_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = MiniXftConfig_n_chars + 2;
+ register char *dest = &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[
+ MiniXftConfig_current_buffer->MiniXftConfig_buf_size + 2];
+ register char *source =
+ &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[number_to_move];
+
+ while ( source > MiniXftConfig_current_buffer->MiniXftConfig_ch_buf )
+ *--dest = *--source;
+
+ MiniXftConfig_cp += (int) (dest - source);
+ MiniXftConfig_bp += (int) (dest - source);
+ MiniXftConfig_current_buffer->MiniXftConfig_n_chars =
+ MiniXftConfig_n_chars = MiniXftConfig_current_buffer->MiniXftConfig_buf_size;
+
+ if ( MiniXftConfig_cp < MiniXftConfig_current_buffer->MiniXftConfig_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--MiniXftConfig_cp = (char) c;
+
+
+ MiniXftConfigtext_ptr = MiniXftConfig_bp;
+ MiniXftConfig_hold_char = *MiniXftConfig_cp;
+ MiniXftConfig_c_buf_p = MiniXftConfig_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int MiniXftConfiginput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *MiniXftConfig_c_buf_p = MiniXftConfig_hold_char;
+
+ if ( *MiniXftConfig_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* MiniXftConfig_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( MiniXftConfig_c_buf_p < &MiniXftConfig_current_buffer->MiniXftConfig_ch_buf[MiniXftConfig_n_chars] )
+ /* This was really a NUL. */
+ *MiniXftConfig_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = MiniXftConfig_c_buf_p - MiniXftConfigtext_ptr;
+ ++MiniXftConfig_c_buf_p;
+
+ switch ( MiniXftConfig_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because MiniXftConfig_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ MiniXftConfigrestart( MiniXftConfigin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( MiniXftConfigwrap() )
+ return EOF;
+
+ if ( ! MiniXftConfig_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return MiniXftConfiginput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ MiniXftConfig_c_buf_p = MiniXftConfigtext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) MiniXftConfig_c_buf_p; /* cast for 8-bit char's */
+ *MiniXftConfig_c_buf_p = '\0'; /* preserve MiniXftConfigtext */
+ MiniXftConfig_hold_char = *++MiniXftConfig_c_buf_p;
+
+ MiniXftConfig_current_buffer->MiniXftConfig_at_bol = (c == '\n');
+
+ return c;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void MiniXftConfigrestart( FILE *input_file )
+#else
+void MiniXftConfigrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! MiniXftConfig_current_buffer )
+ MiniXftConfig_current_buffer = MiniXftConfig_create_buffer( MiniXftConfigin, YY_BUF_SIZE );
+
+ MiniXftConfig_init_buffer( MiniXftConfig_current_buffer, input_file );
+ MiniXftConfig_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void MiniXftConfig_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void MiniXftConfig_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( MiniXftConfig_current_buffer == new_buffer )
+ return;
+
+ if ( MiniXftConfig_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *MiniXftConfig_c_buf_p = MiniXftConfig_hold_char;
+ MiniXftConfig_current_buffer->MiniXftConfig_buf_pos = MiniXftConfig_c_buf_p;
+ MiniXftConfig_current_buffer->MiniXftConfig_n_chars = MiniXftConfig_n_chars;
+ }
+
+ MiniXftConfig_current_buffer = new_buffer;
+ MiniXftConfig_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (MiniXftConfigwrap()) processing, but the only time this flag
+ * is looked at is after MiniXftConfigwrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ MiniXftConfig_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void MiniXftConfig_load_buffer_state( void )
+#else
+void MiniXftConfig_load_buffer_state()
+#endif
+ {
+ MiniXftConfig_n_chars = MiniXftConfig_current_buffer->MiniXftConfig_n_chars;
+ MiniXftConfigtext_ptr = MiniXftConfig_c_buf_p = MiniXftConfig_current_buffer->MiniXftConfig_buf_pos;
+ MiniXftConfigin = MiniXftConfig_current_buffer->MiniXftConfig_input_file;
+ MiniXftConfig_hold_char = *MiniXftConfig_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE MiniXftConfig_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE MiniXftConfig_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) MiniXftConfig_flex_alloc( sizeof( struct MiniXftConfig_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in MiniXftConfig_create_buffer()" );
+
+ b->MiniXftConfig_buf_size = size;
+
+ /* MiniXftConfig_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->MiniXftConfig_ch_buf = (char *) MiniXftConfig_flex_alloc( b->MiniXftConfig_buf_size + 2 );
+ if ( ! b->MiniXftConfig_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in MiniXftConfig_create_buffer()" );
+
+ b->MiniXftConfig_is_our_buffer = 1;
+
+ MiniXftConfig_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void MiniXftConfig_delete_buffer( YY_BUFFER_STATE b )
+#else
+void MiniXftConfig_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == MiniXftConfig_current_buffer )
+ MiniXftConfig_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->MiniXftConfig_is_our_buffer )
+ MiniXftConfig_flex_free( (void *) b->MiniXftConfig_ch_buf );
+
+ MiniXftConfig_flex_free( (void *) b );
+ }
+
+
+
+#ifdef YY_USE_PROTOS
+void MiniXftConfig_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void MiniXftConfig_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ MiniXftConfig_flush_buffer( b );
+
+ b->MiniXftConfig_input_file = file;
+ b->MiniXftConfig_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->MiniXftConfig_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->MiniXftConfig_is_interactive = 0;
+#else
+ b->MiniXftConfig_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void MiniXftConfig_flush_buffer( YY_BUFFER_STATE b )
+#else
+void MiniXftConfig_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->MiniXftConfig_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->MiniXftConfig_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->MiniXftConfig_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->MiniXftConfig_buf_pos = &b->MiniXftConfig_ch_buf[0];
+
+ b->MiniXftConfig_at_bol = 1;
+ b->MiniXftConfig_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == MiniXftConfig_current_buffer )
+ MiniXftConfig_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE MiniXftConfig_scan_buffer( char *base, MiniXftConfig_size_t size )
+#else
+YY_BUFFER_STATE MiniXftConfig_scan_buffer( base, size )
+char *base;
+MiniXftConfig_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) MiniXftConfig_flex_alloc( sizeof( struct MiniXftConfig_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in MiniXftConfig_scan_buffer()" );
+
+ b->MiniXftConfig_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->MiniXftConfig_buf_pos = b->MiniXftConfig_ch_buf = base;
+ b->MiniXftConfig_is_our_buffer = 0;
+ b->MiniXftConfig_input_file = 0;
+ b->MiniXftConfig_n_chars = b->MiniXftConfig_buf_size;
+ b->MiniXftConfig_is_interactive = 0;
+ b->MiniXftConfig_at_bol = 1;
+ b->MiniXftConfig_fill_buffer = 0;
+ b->MiniXftConfig_buffer_status = YY_BUFFER_NEW;
+
+ MiniXftConfig_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE MiniXftConfig_scan_string( MiniXftConfigconst char *MiniXftConfig_str )
+#else
+YY_BUFFER_STATE MiniXftConfig_scan_string( MiniXftConfig_str )
+MiniXftConfigconst char *MiniXftConfig_str;
+#endif
+ {
+ int len;
+ for ( len = 0; MiniXftConfig_str[len]; ++len )
+ ;
+
+ return MiniXftConfig_scan_bytes( MiniXftConfig_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE MiniXftConfig_scan_bytes( MiniXftConfigconst char *bytes, int len )
+#else
+YY_BUFFER_STATE MiniXftConfig_scan_bytes( bytes, len )
+MiniXftConfigconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ MiniXftConfig_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) MiniXftConfig_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in MiniXftConfig_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = MiniXftConfig_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in MiniXftConfig_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->MiniXftConfig_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void MiniXftConfig_push_state( int new_state )
+#else
+static void MiniXftConfig_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( MiniXftConfig_start_stack_ptr >= MiniXftConfig_start_stack_depth )
+ {
+ MiniXftConfig_size_t new_size;
+
+ MiniXftConfig_start_stack_depth += YY_START_STACK_INCR;
+ new_size = MiniXftConfig_start_stack_depth * sizeof( int );
+
+ if ( ! MiniXftConfig_start_stack )
+ MiniXftConfig_start_stack = (int *) MiniXftConfig_flex_alloc( new_size );
+
+ else
+ MiniXftConfig_start_stack = (int *) MiniXftConfig_flex_realloc(
+ (void *) MiniXftConfig_start_stack, new_size );
+
+ if ( ! MiniXftConfig_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ MiniXftConfig_start_stack[MiniXftConfig_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void MiniXftConfig_pop_state()
+ {
+ if ( --MiniXftConfig_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(MiniXftConfig_start_stack[MiniXftConfig_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int MiniXftConfig_top_state()
+ {
+ return MiniXftConfig_start_stack[MiniXftConfig_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void MiniXftConfig_fatal_error( MiniXftConfigconst char msg[] )
+#else
+static void MiniXftConfig_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine MiniXftConfigless() so it works in section 3 code. */
+
+#undef MiniXftConfigless
+#define MiniXftConfigless(n) \
+ do \
+ { \
+ /* Undo effects of setting up MiniXftConfigtext. */ \
+ MiniXftConfigtext[MiniXftConfigleng] = MiniXftConfig_hold_char; \
+ MiniXftConfig_c_buf_p = MiniXftConfigtext + n; \
+ MiniXftConfig_hold_char = *MiniXftConfig_c_buf_p; \
+ *MiniXftConfig_c_buf_p = '\0'; \
+ MiniXftConfigleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef MiniXftConfigtext_ptr
+#ifdef YY_USE_PROTOS
+static void MiniXftConfig_flex_strncpy( char *s1, MiniXftConfigconst char *s2, int n )
+#else
+static void MiniXftConfig_flex_strncpy( s1, s2, n )
+char *s1;
+MiniXftConfigconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int MiniXftConfig_flex_strlen( MiniXftConfigconst char *s )
+#else
+static int MiniXftConfig_flex_strlen( s )
+MiniXftConfigconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *MiniXftConfig_flex_alloc( MiniXftConfig_size_t size )
+#else
+static void *MiniXftConfig_flex_alloc( size )
+MiniXftConfig_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *MiniXftConfig_flex_realloc( void *ptr, MiniXftConfig_size_t size )
+#else
+static void *MiniXftConfig_flex_realloc( ptr, size )
+void *ptr;
+MiniXftConfig_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void MiniXftConfig_flex_free( void *ptr )
+#else
+static void MiniXftConfig_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ MiniXftConfiglex();
+ return 0;
+ }
+#endif
+#line 154 "minixftlex.l"
+
+static void
+_MiniXftConfigSkipComment (void)
+{
+ int c;
+
+ c = input();
+ for (;;) {
+ while (c != EOF && c != '*')
+ c = input();
+ if (c == EOF)
+ return;
+ c = input();
+ if (c == EOF || c == '/')
+ return;
+ }
+}
+
+static void
+_MiniXftConfigSkipLine (void)
+{
+ int c;
+
+ do {
+ c = input();
+ } while (c != EOF && c != '\n');
+ if (c == '\n') unput('\n');
+}
+
+Bool
+MiniXftConfigLexFile(char *s)
+{
+ FILE *f;
+
+ f = fopen (s, "r");
+ if (f == 0)
+ {
+ fprintf (stderr, "cannot open file \"%s\"\n", s);
+ return False;
+ }
+ ++MiniXftConfigFiledeep;
+ MiniXftConfigInput = f;
+ MiniXftConfigFile = s;
+ return True;
+}
+
+Bool
+MiniXftConfigPushInput (char *s, Bool complain)
+{
+ FILE *f;
+ char *t;
+ char *h;
+
+ if (MiniXftConfigInpt == MiniXftConfigInStack)
+ {
+ (void) fprintf (stderr, "files nested too deeply\n");
+ return False;
+ }
+ t = s;
+ if (*s == '~')
+ {
+ h = getenv ("HOME");
+ if (h)
+ {
+ t = (char *) malloc (strlen (h) + strlen (s));
+ if (t)
+ {
+ strcpy (t, h);
+ strcat (t, s+1);
+ }
+ else
+ t = s;
+ }
+ }
+ f = fopen (t, "r");
+ if (t != s)
+ free (t);
+ if (f == 0)
+ {
+ if (complain)
+ (void) fprintf (stderr, "cannot open file %s\n", s);
+ return False;
+ }
+ ++MiniXftConfigFiledeep;
+ *--MiniXftConfigInpt = MiniXftConfigInput;
+ *--MiniXftConfigLinenopt = MiniXftConfigLineno;
+ *--MiniXftConfigFileNamePt = MiniXftConfigFile;
+ MiniXftConfigInput = f;
+ MiniXftConfigLineno = 1;
+ MiniXftConfigFile = _MiniXftSaveString (s);
+ return True;
+}
+
+static int
+_MiniXftConfigPopInput (void)
+{
+ int c;
+
+ for (;;)
+ {
+ c = getc (MiniXftConfigInput);
+ if (c >= 0)
+ return c;
+ fclose (MiniXftConfigInput);
+ MiniXftConfigInput = 0;
+ if (MiniXftConfigInpt == MiniXftConfigInStack + XFT_CONFIG_IN_DEEP)
+ return EOF;
+ MiniXftConfigInput = *MiniXftConfigInpt++;
+ MiniXftConfigLineno = *MiniXftConfigLinenopt++;
+ free (MiniXftConfigFile);
+ MiniXftConfigFile = *MiniXftConfigFileNamePt++;
+ --MiniXftConfigFiledeep;
+ }
+}
+
+void
+MiniXftConfigLexDone (void)
+{
+#ifdef FLEX_SCANNER
+ MiniXftConfig_delete_buffer (MiniXftConfig_current_buffer);
+#endif
+}
diff --git a/pango/mini-xft/minixftlex.l b/pango/mini-xft/minixftlex.l
new file mode 100644
index 00000000..9ddb7920
--- /dev/null
+++ b/pango/mini-xft/minixftlex.l
@@ -0,0 +1,275 @@
+%{
+/*
+ * $XFree86: xc/lib/MiniXft/xftlex.l,v 1.7 2001/05/18 16:03:06 tsi Exp $
+ *
+ * Copyright (c) 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <string.h>
+#include "minixftint.h"
+
+#include "minixftgram.h"
+
+int MiniXftConfigLineno;
+
+static void _MiniXftConfigSkipComment (void);
+
+static void _MiniXftConfigSkipLine (void);
+
+static int _MiniXftConfigPopInput (void);
+
+
+#define XFT_CONFIG_IN_DEEP 20
+FILE *MiniXftConfigInStack[XFT_CONFIG_IN_DEEP];
+FILE **MiniXftConfigInpt = MiniXftConfigInStack + XFT_CONFIG_IN_DEEP;
+FILE *MiniXftConfigInput;
+int MiniXftConfigLinenos[XFT_CONFIG_IN_DEEP];
+int *MiniXftConfigLinenopt = MiniXftConfigLinenos + XFT_CONFIG_IN_DEEP;
+char *MiniXftConfigFile = "";
+char *MiniXftConfigFileNames[XFT_CONFIG_IN_DEEP];
+char **MiniXftConfigFileNamePt = MiniXftConfigFileNames + XFT_CONFIG_IN_DEEP;
+int MiniXftConfigFiledeep = 0;
+
+#undef YY_INPUT
+
+#define YY_INPUT(buf,result,max_size) \
+{ \
+ int c; \
+ result = 0; \
+ while (result < max_size) { \
+ c = getc (MiniXftConfigInput); \
+ if (c < 0) { \
+ c = _MiniXftConfigPopInput (); \
+ if (c < 0) \
+ break; \
+ } \
+ buf[result++] = c; \
+ if (c == '\n') \
+ { \
+ MiniXftConfigLineno++; \
+ break; \
+ } \
+ } \
+}
+
+#ifndef FLEX_SCANNER
+#undef input
+#undef unput
+static int input (void)
+{
+ char buf[1];
+ static int r = EOF;
+
+ if (r == 0)
+ return 0;
+ YY_INPUT(buf, r, 1);
+ if (r == 0)
+ return EOF;
+ return buf[0];
+}
+
+static void unput (char c)
+{
+ if (!c || c == EOF)
+ return;
+ if (c == '\n')
+ MiniXftConfigLineno--;
+ ungetc (c, MiniXftConfigInput);
+}
+#endif
+
+%}
+%%
+"/\052" _MiniXftConfigSkipComment();
+^# _MiniXftConfigSkipLine();
+dir return DIR;
+cache return CACHE;
+include return INCLUDE;
+includeif return INCLUDEIF;
+match return MATCH;
+edit return EDIT;
+true return TOK_TRUE;
+false return TOK_FALSE;
+nil return TOK_NIL;
+any return ANY;
+all return ALL;
+"=" return EQUAL;
+":" return COLON;
+";" return SEMI;
+"+" return PLUS;
+"-" return MINUS;
+"*" return TIMES;
+"/" return DIVIDE;
+"!" return NOT;
+"&&" return ANDAND;
+"||" return OROR;
+"<" return LESS;
+"<=" return LESSEQ;
+"==" return EQEQ;
+">=" return MOREEQ;
+">" return MORE;
+"!=" return NOTEQ;
+"?" return QUEST;
+"[" return OS;
+"]" return CS;
+\"([^\n\"]|\\\")*\" {
+ yytext[yyleng - 1] = '\0';
+ yylval.sval = yytext+1;
+ return STRING;
+ }
+[0-9]+ {
+ yylval.ival = strtol (yytext, 0, 10);
+ return INTEGER;
+ }
+(([0-9]+((\.[0-9]*(\{[0-9]+\})?)?))|(\.[0-9]+)|(\.[0-9]*\{[0-9]+\}))(([Ee][-+]?[0-9]+)?) {
+ yylval.dval = strtod (yytext, 0);
+ return DOUBLE;
+ }
+[a-zA-Z][0-9a-zA-Z_]* {
+ if (MiniXftNameConstant (yytext, &yylval.ival))
+ return INTEGER;
+ yylval.sval = yytext;
+ return NAME;
+ }
+. ;
+"\n" ;
+%%
+static void
+_MiniXftConfigSkipComment (void)
+{
+ int c;
+
+ c = input();
+ for (;;) {
+ while (c != EOF && c != '*')
+ c = input();
+ if (c == EOF)
+ return;
+ c = input();
+ if (c == EOF || c == '/')
+ return;
+ }
+}
+
+static void
+_MiniXftConfigSkipLine (void)
+{
+ int c;
+
+ do {
+ c = input();
+ } while (c != EOF && c != '\n');
+ if (c == '\n') unput('\n');
+}
+
+Bool
+MiniXftConfigLexFile(char *s)
+{
+ FILE *f;
+
+ f = fopen (s, "r");
+ if (f == 0)
+ {
+ fprintf (stderr, "cannot open file \"%s\"\n", s);
+ return False;
+ }
+ ++MiniXftConfigFiledeep;
+ MiniXftConfigInput = f;
+ MiniXftConfigFile = s;
+ return True;
+}
+
+Bool
+MiniXftConfigPushInput (char *s, Bool complain)
+{
+ FILE *f;
+ char *t;
+ char *h;
+
+ if (MiniXftConfigInpt == MiniXftConfigInStack)
+ {
+ (void) fprintf (stderr, "files nested too deeply\n");
+ return False;
+ }
+ t = s;
+ if (*s == '~')
+ {
+ h = getenv ("HOME");
+ if (h)
+ {
+ t = (char *) malloc (strlen (h) + strlen (s));
+ if (t)
+ {
+ strcpy (t, h);
+ strcat (t, s+1);
+ }
+ else
+ t = s;
+ }
+ }
+ f = fopen (t, "r");
+ if (t != s)
+ free (t);
+ if (f == 0)
+ {
+ if (complain)
+ (void) fprintf (stderr, "cannot open file %s\n", s);
+ return False;
+ }
+ ++MiniXftConfigFiledeep;
+ *--MiniXftConfigInpt = MiniXftConfigInput;
+ *--MiniXftConfigLinenopt = MiniXftConfigLineno;
+ *--MiniXftConfigFileNamePt = MiniXftConfigFile;
+ MiniXftConfigInput = f;
+ MiniXftConfigLineno = 1;
+ MiniXftConfigFile = _MiniXftSaveString (s);
+ return True;
+}
+
+static int
+_MiniXftConfigPopInput (void)
+{
+ int c;
+
+ for (;;)
+ {
+ c = getc (MiniXftConfigInput);
+ if (c >= 0)
+ return c;
+ fclose (MiniXftConfigInput);
+ MiniXftConfigInput = 0;
+ if (MiniXftConfigInpt == MiniXftConfigInStack + XFT_CONFIG_IN_DEEP)
+ return EOF;
+ MiniXftConfigInput = *MiniXftConfigInpt++;
+ MiniXftConfigLineno = *MiniXftConfigLinenopt++;
+ free (MiniXftConfigFile);
+ MiniXftConfigFile = *MiniXftConfigFileNamePt++;
+ --MiniXftConfigFiledeep;
+ }
+}
+
+void
+MiniXftConfigLexDone (void)
+{
+#ifdef FLEX_SCANNER
+ MiniXftConfig_delete_buffer (MiniXftConfig_current_buffer);
+#endif
+}
diff --git a/pango/mini-xft/minixftlist.c b/pango/mini-xft/minixftlist.c
new file mode 100644
index 00000000..230ab858
--- /dev/null
+++ b/pango/mini-xft/minixftlist.c
@@ -0,0 +1,303 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftlist.c,v 1.2 2000/12/07 23:57:28 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include "minixftint.h"
+
+MiniXftObjectSet *
+MiniXftObjectSetCreate (void)
+{
+ MiniXftObjectSet *os;
+
+ os = (MiniXftObjectSet *) malloc (sizeof (MiniXftObjectSet));
+ if (!os)
+ return 0;
+ os->nobject = 0;
+ os->sobject = 0;
+ os->objects = 0;
+ return os;
+}
+
+Bool
+MiniXftObjectSetAdd (MiniXftObjectSet *os, const char *object)
+{
+ int s;
+ const char **objects;
+
+ if (os->nobject == os->sobject)
+ {
+ s = os->sobject + 4;
+ if (os->objects)
+ objects = (const char **) realloc ((void *) os->objects,
+ s * sizeof (const char **));
+ else
+ objects = (const char **) malloc (s * sizeof (const char **));
+ if (!objects)
+ return False;
+ os->objects = objects;
+ os->sobject = s;
+ }
+ os->objects[os->nobject++] = object;
+ return True;
+}
+
+void
+MiniXftObjectSetDestroy (MiniXftObjectSet *os)
+{
+ if (os->objects)
+ free ((void *) os->objects);
+ free (os);
+}
+
+#define _MiniXftObjectSetVapBuild(__ret__, __first__, __va__) \
+{ \
+ MiniXftObjectSet *__os__; \
+ const char *__ob__; \
+ \
+ __ret__ = 0; \
+ __os__ = MiniXftObjectSetCreate (); \
+ if (!__os__) \
+ goto _MiniXftObjectSetVapBuild_bail0; \
+ __ob__ = __first__; \
+ while (__ob__) \
+ { \
+ if (!MiniXftObjectSetAdd (__os__, __ob__)) \
+ goto _MiniXftObjectSetVapBuild_bail1; \
+ __ob__ = va_arg (__va__, const char *); \
+ } \
+ __ret__ = __os__; \
+ \
+_MiniXftObjectSetVapBuild_bail1: \
+ if (!__ret__ && __os__) \
+ MiniXftObjectSetDestroy (__os__); \
+_MiniXftObjectSetVapBuild_bail0: \
+ ; \
+}
+
+MiniXftObjectSet *
+MiniXftObjectSetVaBuild (const char *first, va_list va)
+{
+ MiniXftObjectSet *ret;
+
+ _MiniXftObjectSetVapBuild (ret, first, va);
+ return ret;
+}
+
+MiniXftObjectSet *
+MiniXftObjectSetBuild (const char *first, ...)
+{
+ va_list va;
+ MiniXftObjectSet *os;
+
+ va_start (va, first);
+ _MiniXftObjectSetVapBuild (os, first, va);
+ va_end (va);
+ return os;
+}
+
+Bool
+MiniXftListValueCompare (MiniXftValue v1,
+ MiniXftValue v2)
+{
+ return _MiniXftConfigCompareValue (v1, MiniXftOpEqual, v2);
+}
+
+Bool
+MiniXftListValueListCompare (MiniXftValueList *v1orig,
+ MiniXftValueList *v2orig,
+ MiniXftQual qual)
+{
+ MiniXftValueList *v1, *v2;
+
+ for (v1 = v1orig; v1; v1 = v1->next)
+ {
+ for (v2 = v2orig; v2; v2 = v2->next)
+ {
+ if (_MiniXftConfigCompareValue (v1->value, MiniXftOpEqual, v2->value))
+ {
+ if (qual == MiniXftQualAny)
+ return True;
+ else
+ break;
+ }
+ }
+ if (qual == MiniXftQualAll)
+ {
+ if (!v2)
+ return False;
+ }
+ }
+ if (qual == MiniXftQualAll)
+ return True;
+ else
+ return False;
+}
+
+/*
+ * True iff all objects in "p" match "font"
+ */
+Bool
+MiniXftListMatch (MiniXftPattern *p,
+ MiniXftPattern *font,
+ MiniXftQual qual)
+{
+ int i;
+ MiniXftPatternElt *e;
+
+ for (i = 0; i < p->num; i++)
+ {
+ e = MiniXftPatternFind (font, p->elts[i].object, False);
+ if (!e)
+ {
+ if (qual == MiniXftQualAll)
+ continue;
+ else
+ return False;
+ }
+ if (!MiniXftListValueListCompare (p->elts[i].values, e->values, qual))
+ return False;
+ }
+ return True;
+}
+
+Bool
+MiniXftListAppend (MiniXftFontSet *s,
+ MiniXftPattern *font,
+ MiniXftObjectSet *os)
+{
+ int f;
+ int o;
+ MiniXftPattern *l;
+ MiniXftPatternElt *e;
+ MiniXftValueList *v;
+
+ for (f = 0; f < s->nfont; f++)
+ {
+ l = s->fonts[f];
+ if (MiniXftListMatch (l, font, MiniXftQualAll))
+ return True;
+ }
+ l = MiniXftPatternCreate ();
+ if (!l)
+ goto bail0;
+ for (o = 0; o < os->nobject; o++)
+ {
+ e = MiniXftPatternFind (font, os->objects[o], False);
+ if (e)
+ {
+ for (v = e->values; v; v = v->next)
+ {
+ if (!MiniXftPatternAdd (l, os->objects[o], v->value, True))
+ goto bail1;
+ }
+ }
+ }
+ if (!MiniXftFontSetAdd (s, l))
+ goto bail1;
+ return True;
+bail1:
+ MiniXftPatternDestroy (l);
+bail0:
+ return False;
+}
+
+MiniXftFontSet *
+MiniXftListFontSets (MiniXftFontSet **sets,
+ int nsets,
+ MiniXftPattern *p,
+ MiniXftObjectSet *os)
+{
+ MiniXftFontSet *ret;
+ MiniXftFontSet *s;
+ int f;
+ int set;
+
+ ret = MiniXftFontSetCreate ();
+ if (!ret)
+ goto bail0;
+ for (set = 0; set < nsets; set++)
+ {
+ s = sets[set];
+ for (f = 0; f < s->nfont; f++)
+ {
+ if (MiniXftListMatch (p, s->fonts[f], MiniXftQualAny))
+ {
+ if (!MiniXftListAppend (ret, s->fonts[f], os))
+ goto bail1;
+ }
+ }
+ }
+ return ret;
+bail1:
+ MiniXftFontSetDestroy (ret);
+bail0:
+ return 0;
+}
+
+MiniXftFontSet *
+MiniXftListFontsPatternObjects (Display *dpy,
+ int screen,
+ MiniXftPattern *pattern,
+ MiniXftObjectSet *os)
+{
+ MiniXftFontSet *sets[2];
+ int nsets = 0;
+
+ if (!MiniXftInit (0))
+ return 0;
+
+ if (MiniXftInitFtLibrary ())
+ {
+ sets[nsets] = _MiniXftFontSet;
+ if (sets[nsets])
+ nsets++;
+ }
+ return MiniXftListFontSets (sets, nsets, pattern, os);
+}
+
+MiniXftFontSet *
+MiniXftListFonts (Display *dpy,
+ int screen,
+ ...)
+{
+ va_list va;
+ MiniXftFontSet *fs;
+ MiniXftObjectSet *os;
+ MiniXftPattern *pattern;
+ const char *first;
+
+ va_start (va, screen);
+
+ _MiniXftPatternVapBuild (pattern, 0, va);
+
+ first = va_arg (va, const char *);
+ _MiniXftObjectSetVapBuild (os, first, va);
+
+ va_end (va);
+
+ fs = MiniXftListFontsPatternObjects (dpy, screen, pattern, os);
+ MiniXftPatternDestroy (pattern);
+ MiniXftObjectSetDestroy (os);
+ return fs;
+}
diff --git a/pango/mini-xft/minixftmatch.c b/pango/mini-xft/minixftmatch.c
new file mode 100644
index 00000000..3b68f70b
--- /dev/null
+++ b/pango/mini-xft/minixftmatch.c
@@ -0,0 +1,330 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftmatch.c,v 1.6 2001/09/21 19:54:53 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <string.h>
+#include <ctype.h>
+#include "minixftint.h"
+#include <stdio.h>
+
+static double
+_MiniXftCompareInteger (char *object, MiniXftValue value1, MiniXftValue value2)
+{
+ int v;
+
+ if (value2.type != MiniXftTypeInteger || value1.type != MiniXftTypeInteger)
+ return -1.0;
+ v = value2.u.i - value1.u.i;
+ if (v < 0)
+ v = -v;
+ return (double) v;
+}
+
+static double
+_MiniXftCompareString (char *object, MiniXftValue value1, MiniXftValue value2)
+{
+ if (value2.type != MiniXftTypeString || value1.type != MiniXftTypeString)
+ return -1.0;
+ return (double) _MiniXftStrCmpIgnoreCase (value1.u.s, value2.u.s) != 0;
+}
+
+static double
+_MiniXftCompareBool (char *object, MiniXftValue value1, MiniXftValue value2)
+{
+ if (value2.type != MiniXftTypeBool || value1.type != MiniXftTypeBool)
+ return -1.0;
+ return (double) value2.u.b != value1.u.b;
+}
+
+static double
+_MiniXftCompareSize (char *object, MiniXftValue value1, MiniXftValue value2)
+{
+ double v1, v2, v;
+
+ switch (value1.type) {
+ case MiniXftTypeInteger:
+ v1 = value1.u.i;
+ break;
+ case MiniXftTypeDouble:
+ v1 = value1.u.d;
+ break;
+ default:
+ return -1;
+ }
+ switch (value2.type) {
+ case MiniXftTypeInteger:
+ v2 = value2.u.i;
+ break;
+ case MiniXftTypeDouble:
+ v2 = value2.u.d;
+ break;
+ default:
+ return -1;
+ }
+ if (v2 == 0)
+ return 0;
+ v = v2 - v1;
+ if (v < 0)
+ v = -v;
+ return v;
+}
+
+/*
+ * Order is significant, it defines the precedence of
+ * each value, earlier values are more significant than
+ * later values
+ */
+static MiniXftMatcher _MiniXftMatchers [] = {
+ { XFT_FOUNDRY, _MiniXftCompareString, },
+ { XFT_ENCODING, _MiniXftCompareString, },
+ { XFT_FAMILY, _MiniXftCompareString, },
+ { XFT_SPACING, _MiniXftCompareInteger, },
+ { XFT_PIXEL_SIZE, _MiniXftCompareSize, },
+ { XFT_STYLE, _MiniXftCompareString, },
+ { XFT_SLANT, _MiniXftCompareInteger, },
+ { XFT_WEIGHT, _MiniXftCompareInteger, },
+ { XFT_RASTERIZER, _MiniXftCompareString, },
+ { XFT_ANTIALIAS, _MiniXftCompareBool, },
+ { XFT_OUTLINE, _MiniXftCompareBool, },
+};
+
+#define NUM_MATCHER (sizeof _MiniXftMatchers / sizeof _MiniXftMatchers[0])
+
+static Bool
+_MiniXftCompareValueList (const char *object,
+ MiniXftValueList *v1orig, /* pattern */
+ MiniXftValueList *v2orig, /* target */
+ MiniXftValue *bestValue,
+ double *value,
+ MiniXftResult *result)
+{
+ MiniXftValueList *v1, *v2;
+ double v, best;
+ int j;
+ int i;
+
+ for (i = 0; i < NUM_MATCHER; i++)
+ {
+ if (!_MiniXftStrCmpIgnoreCase (_MiniXftMatchers[i].object, object))
+ break;
+ }
+ if (i == NUM_MATCHER)
+ {
+ if (bestValue)
+ *bestValue = v2orig->value;
+ return True;
+ }
+
+ best = 1e99;
+ j = 0;
+ for (v1 = v1orig; v1; v1 = v1->next)
+ {
+ for (v2 = v2orig; v2; v2 = v2->next)
+ {
+ v = (*_MiniXftMatchers[i].compare) (_MiniXftMatchers[i].object,
+ v1->value,
+ v2->value);
+ if (v < 0)
+ {
+ *result = MiniXftResultTypeMismatch;
+ return False;
+ }
+ if (_MiniXftFontDebug () & XFT_DBG_MATCHV)
+ printf (" v %g j %d ", v, j);
+ v = v * 100 + j;
+ if (v < best)
+ {
+ if (bestValue)
+ *bestValue = v2->value;
+ best = v;
+ }
+ }
+ j++;
+ }
+ if (_MiniXftFontDebug () & XFT_DBG_MATCHV)
+ {
+ printf (" %s: %g ", object, best);
+ MiniXftValueListPrint (v1orig);
+ printf (", ");
+ MiniXftValueListPrint (v2orig);
+ printf ("\n");
+ }
+ value[i] += best;
+ return True;
+}
+
+/*
+ * Return a value indicating the distance between the two lists of
+ * values
+ */
+
+static Bool
+_MiniXftCompare (MiniXftPattern *pat,
+ MiniXftPattern *fnt,
+ double *value,
+ MiniXftResult *result)
+{
+ int i, i1, i2;
+
+ for (i = 0; i < NUM_MATCHER; i++)
+ value[i] = 0.0;
+
+ for (i1 = 0; i1 < pat->num; i1++)
+ {
+ for (i2 = 0; i2 < fnt->num; i2++)
+ {
+ if (!_MiniXftStrCmpIgnoreCase (pat->elts[i1].object,
+ fnt->elts[i2].object))
+ {
+ if (!_MiniXftCompareValueList (pat->elts[i1].object,
+ pat->elts[i1].values,
+ fnt->elts[i2].values,
+ 0,
+ value,
+ result))
+ return False;
+ break;
+ }
+ }
+#if 0
+ /*
+ * Overspecified patterns are slightly penalized in
+ * case some other font includes the requested field
+ */
+ if (i2 == fnt->num)
+ {
+ for (i2 = 0; i2 < NUM_MATCHER; i2++)
+ {
+ if (!_MiniXftStrCmpIgnoreCase (_MiniXftMatchers[i2].object,
+ pat->elts[i1].object))
+ {
+ value[i2] = 1.0;
+ break;
+ }
+ }
+ }
+#endif
+ }
+ return True;
+}
+
+MiniXftPattern *
+MiniXftFontSetMatch (MiniXftFontSet **sets,
+ int nsets,
+ MiniXftPattern *p,
+ MiniXftResult *result)
+{
+ double score[NUM_MATCHER], bestscore[NUM_MATCHER];
+ int f;
+ MiniXftFontSet *s;
+ MiniXftPattern *best;
+ MiniXftPattern *new;
+ MiniXftPatternElt *fe, *pe;
+ MiniXftValue v;
+ int i;
+ int set;
+
+ for (i = 0; i < NUM_MATCHER; i++)
+ bestscore[i] = 0;
+ best = 0;
+ if (_MiniXftFontDebug () & XFT_DBG_MATCH)
+ {
+ printf ("Match ");
+ MiniXftPatternPrint (p);
+ }
+ for (set = 0; set < nsets; set++)
+ {
+ s = sets[set];
+ for (f = 0; f < s->nfont; f++)
+ {
+ if (_MiniXftFontDebug () & XFT_DBG_MATCH)
+ {
+ printf ("Font %d ", f);
+ MiniXftPatternPrint (s->fonts[f]);
+ }
+ if (!_MiniXftCompare (p, s->fonts[f], score, result))
+ return 0;
+ if (_MiniXftFontDebug () & XFT_DBG_MATCH)
+ {
+ printf ("Score");
+ for (i = 0; i < NUM_MATCHER; i++)
+ {
+ printf (" %g", score[i]);
+ }
+ printf ("\n");
+ }
+ for (i = 0; i < NUM_MATCHER; i++)
+ {
+ if (best && bestscore[i] < score[i])
+ break;
+ if (!best || score[i] < bestscore[i])
+ {
+ for (i = 0; i < NUM_MATCHER; i++)
+ bestscore[i] = score[i];
+ best = s->fonts[f];
+ break;
+ }
+ }
+ }
+ }
+ if (_MiniXftFontDebug () & XFT_DBG_MATCH)
+ {
+ printf ("Best score");
+ for (i = 0; i < NUM_MATCHER; i++)
+ printf (" %g", bestscore[i]);
+ MiniXftPatternPrint (best);
+ }
+ if (!best)
+ {
+ *result = MiniXftResultNoMatch;
+ return 0;
+ }
+ new = MiniXftPatternCreate ();
+ if (!new)
+ return 0;
+ for (i = 0; i < best->num; i++)
+ {
+ fe = &best->elts[i];
+ pe = MiniXftPatternFind (p, fe->object, False);
+ if (pe)
+ {
+ if (!_MiniXftCompareValueList (pe->object, pe->values,
+ fe->values, &v, score, result))
+ {
+ MiniXftPatternDestroy (new);
+ return 0;
+ }
+ }
+ else
+ v = fe->values->value;
+ MiniXftPatternAdd (new, fe->object, v, True);
+ }
+ for (i = 0; i < p->num; i++)
+ {
+ pe = &p->elts[i];
+ fe = MiniXftPatternFind (best, pe->object, False);
+ if (!fe)
+ MiniXftPatternAdd (new, pe->object, pe->values->value, True);
+ }
+ return new;
+}
diff --git a/pango/mini-xft/minixftmatrix.c b/pango/mini-xft/minixftmatrix.c
new file mode 100644
index 00000000..b7decb69
--- /dev/null
+++ b/pango/mini-xft/minixftmatrix.c
@@ -0,0 +1,104 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftmatrix.c,v 1.1 2001/03/30 18:50:18 keithp Exp $
+ *
+ * Copyright © 2000 Tuomas J. Lukka
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Tuomas Lukka not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Tuomas Lukka makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * TUOMAS LUKKA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL TUOMAS LUKKA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <math.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "minixftint.h"
+
+MiniXftMatrix *
+_MiniXftSaveMatrix (const MiniXftMatrix *mat)
+{
+ MiniXftMatrix *r;
+ if(!mat)
+ return 0;
+ r = (MiniXftMatrix *) malloc (sizeof (*r) );
+ if (!r)
+ return 0;
+ *r = *mat;
+ return r;
+}
+
+int
+MiniXftMatrixEqual (const MiniXftMatrix *mat1, const MiniXftMatrix *mat2)
+{
+ if(mat1 == mat2) return True;
+ if(mat1 == 0 || mat2 == 0) return False;
+ return mat1->xx == mat2->xx &&
+ mat1->xy == mat2->xy &&
+ mat1->yx == mat2->yx &&
+ mat1->yy == mat2->yy;
+}
+
+void
+MiniXftMatrixMultiply (MiniXftMatrix *result, MiniXftMatrix *a, MiniXftMatrix *b)
+{
+ MiniXftMatrix r;
+
+ r.xx = a->xx * b->xx + a->xy * b->yx;
+ r.xy = a->xx * b->xy + a->xy * b->yy;
+ r.yx = a->yx * b->xx + a->yy * b->yx;
+ r.yy = a->yx * b->xy + a->yy * b->yy;
+ *result = r;
+}
+
+void
+MiniXftMatrixRotate (MiniXftMatrix *m, double c, double s)
+{
+ MiniXftMatrix r;
+
+ /*
+ * X Coordinate system is upside down, swap to make
+ * rotations counterclockwise
+ */
+ r.xx = c;
+ r.xy = -s;
+ r.yx = s;
+ r.yy = c;
+ MiniXftMatrixMultiply (m, &r, m);
+}
+
+void
+MiniXftMatrixScale (MiniXftMatrix *m, double sx, double sy)
+{
+ MiniXftMatrix r;
+
+ r.xx = sx;
+ r.xy = 0;
+ r.yx = 0;
+ r.yy = sy;
+ MiniXftMatrixMultiply (m, &r, m);
+}
+
+void
+MiniXftMatrixShear (MiniXftMatrix *m, double sh, double sv)
+{
+ MiniXftMatrix r;
+
+ r.xx = 1;
+ r.xy = sh;
+ r.yx = sv;
+ r.yy = 1;
+ MiniXftMatrixMultiply (m, &r, m);
+}
diff --git a/pango/mini-xft/minixftname.c b/pango/mini-xft/minixftname.c
new file mode 100644
index 00000000..3452f39a
--- /dev/null
+++ b/pango/mini-xft/minixftname.c
@@ -0,0 +1,391 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftname.c,v 1.10 2001/03/30 18:50:18 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "minixftint.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+typedef struct _MiniXftObjectType {
+ const char *object;
+ MiniXftType type;
+} MiniXftObjectType;
+
+static const MiniXftObjectType _MiniXftObjectTypes[] = {
+ { XFT_FAMILY, MiniXftTypeString, },
+ { XFT_STYLE, MiniXftTypeString, },
+ { XFT_SLANT, MiniXftTypeInteger, },
+ { XFT_WEIGHT, MiniXftTypeInteger, },
+ { XFT_SIZE, MiniXftTypeDouble, },
+ { XFT_PIXEL_SIZE, MiniXftTypeDouble, },
+ { XFT_ENCODING, MiniXftTypeString, },
+ { XFT_SPACING, MiniXftTypeInteger, },
+ { XFT_FOUNDRY, MiniXftTypeString, },
+ { XFT_CORE, MiniXftTypeBool, },
+ { XFT_ANTIALIAS, MiniXftTypeBool, },
+ { XFT_XLFD, MiniXftTypeString, },
+ { XFT_FILE, MiniXftTypeString, },
+ { XFT_INDEX, MiniXftTypeInteger, },
+ { XFT_RASTERIZER, MiniXftTypeString, },
+ { XFT_OUTLINE, MiniXftTypeBool, },
+ { XFT_SCALABLE, MiniXftTypeBool, },
+ { XFT_RGBA, MiniXftTypeInteger, },
+ { XFT_SCALE, MiniXftTypeDouble, },
+ { XFT_RENDER, MiniXftTypeBool, },
+ { XFT_MINSPACE, MiniXftTypeBool, },
+ { XFT_CHAR_WIDTH, MiniXftTypeInteger },
+ { XFT_CHAR_HEIGHT, MiniXftTypeInteger },
+ { XFT_MATRIX, MiniXftTypeMatrix },
+};
+
+#define NUM_OBJECT_TYPES (sizeof _MiniXftObjectTypes / sizeof _MiniXftObjectTypes[0])
+
+static const MiniXftObjectType *
+MiniXftNameGetType (const char *object)
+{
+ int i;
+
+ for (i = 0; i < NUM_OBJECT_TYPES; i++)
+ {
+ if (!_MiniXftStrCmpIgnoreCase (object, _MiniXftObjectTypes[i].object))
+ return &_MiniXftObjectTypes[i];
+ }
+ return 0;
+}
+
+typedef struct _MiniXftConstant {
+ const char *name;
+ const char *object;
+ int value;
+} MiniXftConstant;
+
+static MiniXftConstant MiniXftConstants[] = {
+ { "light", "weight", XFT_WEIGHT_LIGHT, },
+ { "medium", "weight", XFT_WEIGHT_MEDIUM, },
+ { "demibold", "weight", XFT_WEIGHT_DEMIBOLD, },
+ { "bold", "weight", XFT_WEIGHT_BOLD, },
+ { "black", "weight", XFT_WEIGHT_BLACK, },
+
+ { "roman", "slant", XFT_SLANT_ROMAN, },
+ { "italic", "slant", XFT_SLANT_ITALIC, },
+ { "oblique", "slant", XFT_SLANT_OBLIQUE, },
+
+ { "proportional", "spacing", XFT_PROPORTIONAL, },
+ { "mono", "spacing", XFT_MONO, },
+ { "charcell", "spacing", XFT_CHARCELL, },
+
+ { "rgb", "rgba", XFT_RGBA_RGB, },
+ { "bgr", "rgba", XFT_RGBA_BGR, },
+ { "vrgb", "rgba", XFT_RGBA_VRGB },
+ { "vbgr", "rgba", XFT_RGBA_VBGR },
+};
+
+#define NUM_XFT_CONSTANTS (sizeof MiniXftConstants/sizeof MiniXftConstants[0])
+
+static MiniXftConstant *
+_MiniXftNameConstantLookup (char *string)
+{
+ int i;
+
+ for (i = 0; i < NUM_XFT_CONSTANTS; i++)
+ if (!_MiniXftStrCmpIgnoreCase (string, MiniXftConstants[i].name))
+ return &MiniXftConstants[i];
+ return 0;
+}
+
+Bool
+MiniXftNameConstant (char *string, int *result)
+{
+ MiniXftConstant *c;
+
+ if ((c = _MiniXftNameConstantLookup(string)))
+ {
+ *result = c->value;
+ return True;
+ }
+ return False;
+}
+
+static MiniXftValue
+_MiniXftNameConvert (MiniXftType type, char *string, MiniXftMatrix *m)
+{
+ MiniXftValue v;
+
+ v.type = type;
+ switch (v.type) {
+ case MiniXftTypeInteger:
+ if (!MiniXftNameConstant (string, &v.u.i))
+ v.u.i = atoi (string);
+ break;
+ case MiniXftTypeString:
+ v.u.s = string;
+ break;
+ case MiniXftTypeBool:
+ v.u.b = MiniXftDefaultParseBool (string);
+ break;
+ case MiniXftTypeDouble:
+ v.u.d = strtod (string, 0);
+ break;
+ case MiniXftTypeMatrix:
+ v.u.m = m;
+ sscanf (string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy);
+ break;
+ default:
+ break;
+ }
+ return v;
+}
+
+static const char *
+_MiniXftNameFindNext (const char *cur, const char *delim, char *save, char *last)
+{
+ char c;
+
+ while ((c = *cur))
+ {
+ if (c == '\\')
+ {
+ ++cur;
+ if (!(c = *cur))
+ break;
+ }
+ else if (strchr (delim, c))
+ break;
+ ++cur;
+ *save++ = c;
+ }
+ *save = 0;
+ *last = *cur;
+ if (*cur)
+ cur++;
+ return cur;
+}
+
+MiniXftPattern *
+MiniXftNameParse (const char *name)
+{
+ char *save;
+ MiniXftPattern *pat;
+ double d;
+ char *e;
+ char delim;
+ MiniXftValue v;
+ MiniXftMatrix m;
+ const MiniXftObjectType *t;
+ MiniXftConstant *c;
+
+ save = malloc (strlen (name) + 1);
+ if (!save)
+ goto bail0;
+ pat = MiniXftPatternCreate ();
+ if (!pat)
+ goto bail1;
+
+ for (;;)
+ {
+ name = _MiniXftNameFindNext (name, "-,:", save, &delim);
+ if (save[0])
+ {
+ if (!MiniXftPatternAddString (pat, XFT_FAMILY, save))
+ goto bail2;
+ }
+ if (delim != ',')
+ break;
+ }
+ if (delim == '-')
+ {
+ for (;;)
+ {
+ name = _MiniXftNameFindNext (name, "-,:", save, &delim);
+ d = strtod (save, &e);
+ if (e != save)
+ {
+ if (!MiniXftPatternAddDouble (pat, XFT_SIZE, d))
+ goto bail2;
+ }
+ if (delim != ',')
+ break;
+ }
+ }
+ while (delim == ':')
+ {
+ name = _MiniXftNameFindNext (name, "=_:", save, &delim);
+ if (save[0])
+ {
+ if (delim == '=' || delim == '_')
+ {
+ t = MiniXftNameGetType (save);
+ for (;;)
+ {
+ name = _MiniXftNameFindNext (name, ":,", save, &delim);
+ if (save[0] && t)
+ {
+ v = _MiniXftNameConvert (t->type, save, &m);
+ if (!MiniXftPatternAdd (pat, t->object, v, True))
+ goto bail2;
+ }
+ if (delim != ',')
+ break;
+ }
+ }
+ else
+ {
+ if ((c = _MiniXftNameConstantLookup (save)))
+ {
+ if (!MiniXftPatternAddInteger (pat, c->object, c->value))
+ goto bail2;
+ }
+ }
+ }
+ }
+
+ free (save);
+ return pat;
+
+bail2:
+ MiniXftPatternDestroy (pat);
+bail1:
+ free (save);
+bail0:
+ return 0;
+}
+
+static Bool
+_MiniXftNameUnparseString (const char *string, char *escape, char **destp, int *lenp)
+{
+ int len = *lenp;
+ char *dest = *destp;
+ char c;
+
+ while ((c = *string++))
+ {
+ if (escape && strchr (escape, c))
+ {
+ if (len-- == 0)
+ return False;
+ *dest++ = escape[0];
+ }
+ if (len-- == 0)
+ return False;
+ *dest++ = c;
+ }
+ *destp = dest;
+ *lenp = len;
+ return True;
+}
+
+static Bool
+_MiniXftNameUnparseValue (MiniXftValue v, char *escape, char **destp, int *lenp)
+{
+ char temp[1024];
+
+ switch (v.type) {
+ case MiniXftTypeVoid:
+ return True;
+ case MiniXftTypeInteger:
+ sprintf (temp, "%d", v.u.i);
+ return _MiniXftNameUnparseString (temp, 0, destp, lenp);
+ case MiniXftTypeDouble:
+ sprintf (temp, "%g", v.u.d);
+ return _MiniXftNameUnparseString (temp, 0, destp, lenp);
+ case MiniXftTypeString:
+ return _MiniXftNameUnparseString (v.u.s, escape, destp, lenp);
+ case MiniXftTypeBool:
+ return _MiniXftNameUnparseString (v.u.b ? "True" : "False", 0, destp, lenp);
+ case MiniXftTypeMatrix:
+ sprintf (temp, "%g %g %g %g",
+ v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
+ return _MiniXftNameUnparseString (temp, 0, destp, lenp);
+ }
+ return False;
+}
+
+static Bool
+_MiniXftNameUnparseValueList (MiniXftValueList *v, char *escape, char **destp, int *lenp)
+{
+ while (v)
+ {
+ if (!_MiniXftNameUnparseValue (v->value, escape, destp, lenp))
+ return False;
+ if ((v = v->next))
+ if (!_MiniXftNameUnparseString (",", 0, destp, lenp))
+ return False;
+ }
+ return True;
+}
+
+#define XFT_ESCAPE_FIXED "\\-:,"
+#define XFT_ESCAPE_VARIABLE "\\=_:,"
+
+Bool
+MiniXftNameUnparse (MiniXftPattern *pat, char *dest, int len)
+{
+ int i;
+ MiniXftPatternElt *e;
+ const MiniXftObjectType *o;
+
+ e = MiniXftPatternFind (pat, XFT_FAMILY, False);
+ if (e)
+ {
+ if (!_MiniXftNameUnparseValueList (e->values, XFT_ESCAPE_FIXED,
+ &dest, &len))
+ return False;
+ }
+ e = MiniXftPatternFind (pat, XFT_SIZE, False);
+ if (e)
+ {
+ if (!_MiniXftNameUnparseString ("-", 0, &dest, &len))
+ return False;
+ if (!_MiniXftNameUnparseValueList (e->values, XFT_ESCAPE_FIXED, &dest, &len))
+ return False;
+ }
+ for (i = 0; i < NUM_OBJECT_TYPES; i++)
+ {
+ o = &_MiniXftObjectTypes[i];
+ if (!strcmp (o->object, XFT_FAMILY) ||
+ !strcmp (o->object, XFT_SIZE) ||
+ !strcmp (o->object, XFT_FILE))
+ continue;
+
+ e = MiniXftPatternFind (pat, o->object, False);
+ if (e)
+ {
+ if (!_MiniXftNameUnparseString (":", 0, &dest, &len))
+ return False;
+ if (!_MiniXftNameUnparseString (o->object, XFT_ESCAPE_VARIABLE,
+ &dest, &len))
+ return False;
+ if (!_MiniXftNameUnparseString ("=", 0, &dest, &len))
+ return False;
+ if (!_MiniXftNameUnparseValueList (e->values, XFT_ESCAPE_VARIABLE,
+ &dest, &len))
+ return False;
+ }
+ }
+ if (len == 0)
+ return False;
+ *dest = '\0';
+ return True;
+}
diff --git a/pango/mini-xft/minixftpat.c b/pango/mini-xft/minixftpat.c
new file mode 100644
index 00000000..223966b3
--- /dev/null
+++ b/pango/mini-xft/minixftpat.c
@@ -0,0 +1,411 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftpat.c,v 1.6 2001/03/30 18:50:18 keithp Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "minixftint.h"
+
+MiniXftPattern *
+MiniXftPatternCreate (void)
+{
+ MiniXftPattern *p;
+
+ p = (MiniXftPattern *) malloc (sizeof (MiniXftPattern));
+ if (!p)
+ return 0;
+ p->num = 0;
+ p->size = 0;
+ p->elts = 0;
+ return p;
+}
+
+void
+MiniXftValueDestroy (MiniXftValue v)
+{
+ if (v.type == MiniXftTypeString)
+ free (v.u.s);
+ if( v.type == MiniXftTypeMatrix)
+ free (v.u.m);
+}
+
+void
+MiniXftValueListDestroy (MiniXftValueList *l)
+{
+ MiniXftValueList *next;
+ for (; l; l = next)
+ {
+ if (l->value.type == MiniXftTypeString)
+ free (l->value.u.s);
+ if (l->value.type == MiniXftTypeMatrix)
+ free (l->value.u.m);
+ next = l->next;
+ free (l);
+ }
+}
+
+void
+MiniXftPatternDestroy (MiniXftPattern *p)
+{
+ int i;
+
+ for (i = 0; i < p->num; i++)
+ MiniXftValueListDestroy (p->elts[i].values);
+
+ if (p->elts)
+ {
+ free (p->elts);
+ p->elts = 0;
+ }
+ p->num = p->size = 0;
+ free (p);
+}
+
+MiniXftPatternElt *
+MiniXftPatternFind (MiniXftPattern *p, const char *object, Bool insert)
+{
+ int i;
+ int s;
+ MiniXftPatternElt *e;
+
+ /* match existing */
+ for (i = 0; i < p->num; i++)
+ {
+ if (!_MiniXftStrCmpIgnoreCase (object, p->elts[i].object))
+ return &p->elts[i];
+ }
+
+ if (!insert)
+ return 0;
+
+ /* grow array */
+ if (i == p->size)
+ {
+ s = p->size + 16;
+ if (p->elts)
+ e = (MiniXftPatternElt *) realloc (p->elts, s * sizeof (MiniXftPatternElt));
+ else
+ e = (MiniXftPatternElt *) malloc (s * sizeof (MiniXftPatternElt));
+ if (!e)
+ return False;
+ p->elts = e;
+ while (p->size < s)
+ {
+ p->elts[p->size].object = 0;
+ p->elts[p->size].values = 0;
+ p->size++;
+ }
+ }
+
+ /* bump count */
+ p->num++;
+
+ return &p->elts[i];
+}
+
+Bool
+MiniXftPatternAdd (MiniXftPattern *p, const char *object, MiniXftValue value, Bool append)
+{
+ MiniXftPatternElt *e;
+ MiniXftValueList *new, **prev;
+
+ new = (MiniXftValueList *) malloc (sizeof (MiniXftValueList));
+ if (!new)
+ goto bail0;
+
+ /* dup string */
+ if (value.type == MiniXftTypeString)
+ {
+ value.u.s = _MiniXftSaveString (value.u.s);
+ if (!value.u.s)
+ goto bail1;
+ }
+ else if (value.type == MiniXftTypeMatrix)
+ {
+ value.u.m = _MiniXftSaveMatrix (value.u.m);
+ if (!value.u.m)
+ goto bail1;
+ }
+ new->value = value;
+ new->next = 0;
+
+ e = MiniXftPatternFind (p, object, True);
+ if (!e)
+ goto bail2;
+
+ e->object = object;
+ if (append)
+ {
+ for (prev = &e->values; *prev; prev = &(*prev)->next);
+ *prev = new;
+ }
+ else
+ {
+ new->next = e->values;
+ e->values = new;
+ }
+
+ return True;
+
+bail2:
+ if (value.type == MiniXftTypeString)
+ free (value.u.s);
+ else if (value.type == MiniXftTypeMatrix)
+ free (value.u.m);
+bail1:
+ free (new);
+bail0:
+ return False;
+}
+
+Bool
+MiniXftPatternDel (MiniXftPattern *p, const char *object)
+{
+ MiniXftPatternElt *e;
+ int i;
+
+ e = MiniXftPatternFind (p, object, False);
+ if (!e)
+ return False;
+
+ i = e - p->elts;
+
+ /* destroy value */
+ MiniXftValueListDestroy (e->values);
+
+ /* shuffle existing ones down */
+ memmove (e, e+1, (p->elts + p->num - (e + 1)) * sizeof (MiniXftPatternElt));
+ p->num--;
+ p->elts[p->num].object = 0;
+ p->elts[p->num].values = 0;
+ return True;
+}
+
+Bool
+MiniXftPatternAddInteger (MiniXftPattern *p, const char *object, int i)
+{
+ MiniXftValue v;
+
+ v.type = MiniXftTypeInteger;
+ v.u.i = i;
+ return MiniXftPatternAdd (p, object, v, True);
+}
+
+Bool
+MiniXftPatternAddDouble (MiniXftPattern *p, const char *object, double d)
+{
+ MiniXftValue v;
+
+ v.type = MiniXftTypeDouble;
+ v.u.d = d;
+ return MiniXftPatternAdd (p, object, v, True);
+}
+
+
+Bool
+MiniXftPatternAddString (MiniXftPattern *p, const char *object, const char *s)
+{
+ MiniXftValue v;
+
+ v.type = MiniXftTypeString;
+ v.u.s = (char *) s;
+ return MiniXftPatternAdd (p, object, v, True);
+}
+
+Bool
+MiniXftPatternAddMatrix (MiniXftPattern *p, const char *object, const MiniXftMatrix *s)
+{
+ MiniXftValue v;
+
+ v.type = MiniXftTypeMatrix;
+ v.u.m = (MiniXftMatrix *) s;
+ return MiniXftPatternAdd (p, object, v, True);
+}
+
+
+Bool
+MiniXftPatternAddBool (MiniXftPattern *p, const char *object, Bool b)
+{
+ MiniXftValue v;
+
+ v.type = MiniXftTypeBool;
+ v.u.b = b;
+ return MiniXftPatternAdd (p, object, v, True);
+}
+
+MiniXftResult
+MiniXftPatternGet (MiniXftPattern *p, const char *object, int id, MiniXftValue *v)
+{
+ MiniXftPatternElt *e;
+ MiniXftValueList *l;
+
+ e = MiniXftPatternFind (p, object, False);
+ if (!e)
+ return MiniXftResultNoMatch;
+ for (l = e->values; l; l = l->next)
+ {
+ if (!id)
+ {
+ *v = l->value;
+ return MiniXftResultMatch;
+ }
+ id--;
+ }
+ return MiniXftResultNoId;
+}
+
+MiniXftResult
+MiniXftPatternGetInteger (MiniXftPattern *p, const char *object, int id, int *i)
+{
+ MiniXftValue v;
+ MiniXftResult r;
+
+ r = MiniXftPatternGet (p, object, id, &v);
+ if (r != MiniXftResultMatch)
+ return r;
+ switch (v.type) {
+ case MiniXftTypeDouble:
+ *i = (int) v.u.d;
+ break;
+ case MiniXftTypeInteger:
+ *i = v.u.i;
+ break;
+ default:
+ return MiniXftResultTypeMismatch;
+ }
+ return MiniXftResultMatch;
+}
+
+MiniXftResult
+MiniXftPatternGetDouble (MiniXftPattern *p, const char *object, int id, double *d)
+{
+ MiniXftValue v;
+ MiniXftResult r;
+
+ r = MiniXftPatternGet (p, object, id, &v);
+ if (r != MiniXftResultMatch)
+ return r;
+ switch (v.type) {
+ case MiniXftTypeDouble:
+ *d = v.u.d;
+ break;
+ case MiniXftTypeInteger:
+ *d = (double) v.u.i;
+ break;
+ default:
+ return MiniXftResultTypeMismatch;
+ }
+ return MiniXftResultMatch;
+}
+
+MiniXftResult
+MiniXftPatternGetString (MiniXftPattern *p, const char *object, int id, char **s)
+{
+ MiniXftValue v;
+ MiniXftResult r;
+
+ r = MiniXftPatternGet (p, object, id, &v);
+ if (r != MiniXftResultMatch)
+ return r;
+ if (v.type != MiniXftTypeString)
+ return MiniXftResultTypeMismatch;
+ *s = v.u.s;
+ return MiniXftResultMatch;
+}
+
+MiniXftResult
+MiniXftPatternGetMatrix (MiniXftPattern *p, const char *object, int id, MiniXftMatrix **m)
+{
+ MiniXftValue v;
+ MiniXftResult r;
+
+ r = MiniXftPatternGet (p, object, id, &v);
+ if (r != MiniXftResultMatch)
+ return r;
+ if (v.type != MiniXftTypeMatrix)
+ return MiniXftResultTypeMismatch;
+ *m = v.u.m;
+ return MiniXftResultMatch;
+}
+
+
+MiniXftResult
+MiniXftPatternGetBool (MiniXftPattern *p, const char *object, int id, Bool *b)
+{
+ MiniXftValue v;
+ MiniXftResult r;
+
+ r = MiniXftPatternGet (p, object, id, &v);
+ if (r != MiniXftResultMatch)
+ return r;
+ if (v.type != MiniXftTypeBool)
+ return MiniXftResultTypeMismatch;
+ *b = v.u.b;
+ return MiniXftResultMatch;
+}
+
+MiniXftPattern *
+MiniXftPatternDuplicate (MiniXftPattern *orig)
+{
+ MiniXftPattern *new;
+ int i;
+ MiniXftValueList *l;
+
+ new = MiniXftPatternCreate ();
+ if (!new)
+ goto bail0;
+
+ for (i = 0; i < orig->num; i++)
+ {
+ for (l = orig->elts[i].values; l; l = l->next)
+ if (!MiniXftPatternAdd (new, orig->elts[i].object, l->value, True))
+ goto bail1;
+ }
+
+ return new;
+
+bail1:
+ MiniXftPatternDestroy (new);
+bail0:
+ return 0;
+}
+
+MiniXftPattern *
+MiniXftPatternVaBuild (MiniXftPattern *orig, va_list va)
+{
+ MiniXftPattern *ret;
+
+ _MiniXftPatternVapBuild (ret, orig, va);
+ return ret;
+}
+
+MiniXftPattern *
+MiniXftPatternBuild (MiniXftPattern *orig, ...)
+{
+ va_list va;
+
+ va_start (va, orig);
+ _MiniXftPatternVapBuild (orig, orig, va);
+ va_end (va);
+ return orig;
+}
diff --git a/pango/mini-xft/minixftstr.c b/pango/mini-xft/minixftstr.c
new file mode 100644
index 00000000..afa22338
--- /dev/null
+++ b/pango/mini-xft/minixftstr.c
@@ -0,0 +1,156 @@
+/*
+ * $XFree86: xc/lib/MiniXft/xftstr.c,v 1.6 2001/04/01 14:00:01 tsi Exp $
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include "minixftint.h"
+
+char *
+_MiniXftSaveString (const char *s)
+{
+ char *r;
+
+ if (!s)
+ return 0;
+ r = (char *) malloc (strlen (s) + 1);
+ if (!r)
+ return 0;
+ strcpy (r, s);
+ return r;
+}
+
+const char *
+_MiniXftGetInt(const char *ptr, int *val)
+{
+ if (*ptr == '*') {
+ *val = -1;
+ ptr++;
+ } else
+ for (*val = 0; *ptr >= '0' && *ptr <= '9';)
+ *val = *val * 10 + *ptr++ - '0';
+ if (*ptr == '-')
+ return ptr;
+ return (char *) 0;
+}
+
+char *
+_MiniXftSplitStr (const char *field, char *save)
+{
+ char *s = save;
+ char c;
+
+ while (*field)
+ {
+ if (*field == '-')
+ break;
+ c = *field++;
+ *save++ = c;
+ }
+ *save = 0;
+ return s;
+}
+
+char *
+_MiniXftDownStr (const char *field, char *save)
+{
+ char *s = save;
+ char c;
+
+ while (*field)
+ {
+ c = *field++;
+ *save++ = c;
+ }
+ *save = 0;
+ return s;
+}
+
+const char *
+_MiniXftSplitField (const char *field, char *save)
+{
+ char c;
+
+ while (*field)
+ {
+ if (*field == '-' || *field == '=')
+ break;
+ c = *field++;
+ *save++ = c;
+ }
+ *save = 0;
+ return field;
+}
+
+const char *
+_MiniXftSplitValue (const char *field, char *save)
+{
+ char c;
+
+ while (*field)
+ {
+ if (*field == '-' || *field == ',')
+ break;
+ c = *field++;
+ *save++ = c;
+ }
+ *save = 0;
+ if (*field)
+ field++;
+ return field;
+}
+
+int
+_MiniXftMatchSymbolic (MiniXftSymbolic *s, int n, const char *name, int def)
+{
+ while (n--)
+ {
+ if (!_MiniXftStrCmpIgnoreCase (s->name, name))
+ return s->value;
+ s++;
+ }
+ return def;
+}
+
+int
+_MiniXftStrCmpIgnoreCase (const char *s1, const char *s2)
+{
+ char c1, c2;
+
+ for (;;)
+ {
+ c1 = *s1++;
+ c2 = *s2++;
+ if (!c1 || !c2)
+ break;
+ if (isupper (c1))
+ c1 = tolower (c1);
+ if (isupper (c2))
+ c2 = tolower (c2);
+ if (c1 != c2)
+ break;
+ }
+ return (int) c2 - (int) c1;
+}
+