chromium/third_party/fontconfig/src/src/fcxml.c

/*
 * fontconfig/src/fcxml.c
 *
 * Copyright © 2002 Keith Packard
 *
 * 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 the author(s) not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  The authors make no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL THE AUTHOR(S) 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 "fcint.h"
#include <string.h>
#include <fcntl.h>
#include <stdarg.h>

#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif

#ifdef ENABLE_LIBXML2

#include <libxml/parser.h>

#define XML_Char
#define XML_Parser
#define XML_ParserFree
#define XML_GetCurrentLineNumber
#define XML_GetErrorCode
#define XML_ErrorString(Error)

#else /* ENABLE_LIBXML2 */

#ifndef HAVE_XMLPARSE_H
#define HAVE_XMLPARSE_H
#endif

#if HAVE_XMLPARSE_H
#include <xmlparse.h>
#else
#include <expat.h>
#endif

#endif /* ENABLE_LIBXML2 */

#ifdef _WIN32
#include <mbstring.h>
extern FcChar8 fontconfig_instprefix[];
pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory = NULL;
pfnSHGetFolderPathA pSHGetFolderPathA = NULL;
static void
_ensureWin32GettersReady();
#endif

static FcChar8  *__fc_userdir =;
static FcChar8  *__fc_userconf =;

static void
FcExprDestroy (FcExpr *e);
static FcBool
_FcConfigParse (FcConfig	*config,
		const FcChar8	*name,
		FcBool		complain,
		FcBool		load);

void
FcTestDestroy (FcTest *test)
{}

void
FcRuleDestroy (FcRule *rule)
{}

static FcExpr *
FcExprCreateInteger (FcConfig *config, int i)
{}

static FcExpr *
FcExprCreateDouble (FcConfig *config, double d)
{}

static FcExpr *
FcExprCreateString (FcConfig *config, const FcChar8 *s)
{}

static FcExprMatrix *
FcExprMatrixCopyShallow (const FcExprMatrix *matrix)
{}

static void
FcExprMatrixFreeShallow (FcExprMatrix *m)
{}

static void
FcExprMatrixFree (FcExprMatrix *m)
{}

static FcExpr *
FcExprCreateMatrix (FcConfig *config, const FcExprMatrix *matrix)
{}

static FcExpr *
FcExprCreateRange (FcConfig *config, FcRange *range)
{}

static FcExpr *
FcExprCreateBool (FcConfig *config, FcBool b)
{}

static FcExpr *
FcExprCreateCharSet (FcConfig *config, FcCharSet *charset)
{}

static FcExpr *
FcExprCreateLangSet (FcConfig *config, FcLangSet *langset)
{}

static FcExpr *
FcExprCreateName (FcConfig *config, FcExprName name)
{}

static FcExpr *
FcExprCreateConst (FcConfig *config, const FcChar8 *constant)
{}

static FcExpr *
FcExprCreateOp (FcConfig *config, FcExpr *left, FcOp op, FcExpr *right)
{}

static void
FcExprDestroy (FcExpr *e)
{}

void
FcEditDestroy (FcEdit *e)
{}

FcElement;

static const struct {} fcElementMap[] =;
#define NUM_ELEMENT_MAPS

static const char *fcElementIgnoreName[16] =;

static FcElement
FcElementMap (const XML_Char *name)
{}

static const char *
FcElementReverseMap (FcElement e)
{}


FcPStack;

FcVStackTag;

FcVStack;

FcConfigParse;

FcConfigSeverity;

static void
FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, const char *fmt, ...)
{}


static FcExpr *
FcPopExpr (FcConfigParse *parse);


static const char *
FcTypeName (FcType type)
{}

static void
FcTypecheckValue (FcConfigParse *parse, FcType value, FcType type)
{}

static void
FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type)
{}

static FcTest *
FcTestCreate (FcConfigParse *parse,
	      FcMatchKind   kind,
	      FcQual	    qual,
	      const FcChar8 *field,
	      unsigned int  compare,
	      FcExpr	    *expr)
{}

static FcEdit *
FcEditCreate (FcConfigParse	*parse,
	      FcObject		object,
	      FcOp		op,
	      FcExpr		*expr,
	      FcValueBinding	binding)
{}

static FcRule *
FcRuleCreate (FcRuleType type,
	      void       *p)
{}

static FcVStack *
FcVStackCreateAndPush (FcConfigParse *parse)
{}

static FcBool
FcVStackPushString (FcConfigParse *parse, FcVStackTag tag, FcChar8 *string)
{}

static FcBool
FcVStackPushInteger (FcConfigParse *parse, int integer)
{}

static FcBool
FcVStackPushDouble (FcConfigParse *parse, double _double)
{}

static FcBool
FcVStackPushMatrix (FcConfigParse *parse, FcExprMatrix *matrix)
{}

static FcBool
FcVStackPushRange (FcConfigParse *parse, FcRange *range)
{}

static FcBool
FcVStackPushBool (FcConfigParse *parse, FcBool bool_)
{}

static FcBool
FcVStackPushCharSet (FcConfigParse *parse, FcCharSet *charset)
{}

static FcBool
FcVStackPushLangSet (FcConfigParse *parse, FcLangSet *langset)
{}

static FcBool
FcVStackPushName (FcConfigParse *parse, FcMatchKind kind, FcObject object)
{}

static FcBool
FcVStackPushTest (FcConfigParse *parse, FcTest *test)
{}

static FcBool
FcVStackPushExpr (FcConfigParse *parse, FcVStackTag tag, FcExpr *expr)
{}

static FcBool
FcVStackPushEdit (FcConfigParse *parse, FcEdit *edit)
{}

static FcBool
FcVStackPushPattern (FcConfigParse *parse, FcPattern *pattern)
{}

static FcVStack *
FcVStackFetch (FcConfigParse *parse, int off)
{}

static FcVStack *
FcVStackPeek (FcConfigParse *parse)
{}

static void
FcVStackPopAndDestroy (FcConfigParse *parse)
{}

static void
FcVStackClear (FcConfigParse *parse)
{}

static int
FcVStackElements (FcConfigParse *parse)
{}

static FcChar8 **
FcConfigSaveAttr (const XML_Char **attr, FcChar8 **buf, int size_bytes)
{}

static FcBool
FcPStackPush (FcConfigParse *parse, FcElement element, const XML_Char **attr)
{}

static FcBool
FcPStackPop (FcConfigParse *parse)
{}

static FcBool
FcConfigParseInit (FcConfigParse	*parse,
		   const FcChar8	*name,
		   FcConfig		*config,
		   XML_Parser		parser,
		   FcBool		enabled)
{}

static void
FcConfigCleanup (FcConfigParse	*parse)
{}

static const FcChar8 *
FcConfigGetAttribute (FcConfigParse *parse, const char *attr)
{}

static FcStrSet *
_get_real_paths_from_prefix(FcConfigParse *parse, const FcChar8 *path, const FcChar8 *prefix)
{}

static void
FcStartElement(void *userData, const XML_Char *name, const XML_Char **attr)
{}

static void
FcParseRescan (FcConfigParse *parse)
{}

static void
FcParseInt (FcConfigParse *parse)
{}

/*
 * idea copied from glib g_ascii_strtod with
 * permission of the author (Alexander Larsson)
 */

#include <locale.h>

static double
FcStrtod (char *s, char **end)
{}

static void
FcParseDouble (FcConfigParse *parse)
{}

static void
FcParseString (FcConfigParse *parse, FcVStackTag tag)
{}

static void
FcParseName (FcConfigParse *parse)
{}

static void
FcParseMatrix (FcConfigParse *parse)
{}

static void
FcParseRange (FcConfigParse *parse)
{}

static FcBool
FcConfigLexBool (FcConfigParse *parse, const FcChar8 *bool_)
{}

static void
FcParseBool (FcConfigParse *parse)
{}

static void
FcParseCharSet (FcConfigParse *parse)
{}

static void
FcParseLangSet (FcConfigParse *parse)
{}

static FcBool
FcConfigLexBinding (FcConfigParse   *parse,
		    const FcChar8   *binding_string,
		    FcValueBinding  *binding_ret)
{}

static void
FcParseFamilies (FcConfigParse *parse, FcVStackTag tag)
{}

static void
FcParseFamily (FcConfigParse *parse)
{}

static void
FcParseAlias (FcConfigParse *parse)
{}

static void
FcParseDescription (FcConfigParse *parse)
{}

static void
FcParseRemapDir (FcConfigParse *parse)
{}

static void
FcParseResetDirs (FcConfigParse *parse)
{}

static FcExpr *
FcPopExpr (FcConfigParse *parse)
{}

/*
 * This builds a tree of binary operations.  Note
 * that every operator is defined so that if only
 * a single operand is contained, the value of the
 * whole expression is the value of the operand.
 *
 * This code reduces in that case to returning that
 * operand.
 */
static FcExpr *
FcPopBinary (FcConfigParse *parse, FcOp op)
{}

static void
FcParseBinary (FcConfigParse *parse, FcOp op)
{}

/*
 * This builds a a unary operator, it consumes only
 * a single operand
 */

static FcExpr *
FcPopUnary (FcConfigParse *parse, FcOp op)
{}

static void
FcParseUnary (FcConfigParse *parse, FcOp op)
{}

static void
FcParseDir (FcConfigParse *parse)
{}

static void
FcParseCacheDir (FcConfigParse *parse)
{}

void
FcConfigPathFini (void)
{}

static void
FcParseInclude (FcConfigParse *parse)
{}

FcOpMap;

static FcOp
FcConfigLexOp (const FcChar8 *op, const FcOpMap	*map, int nmap)
{}

static const FcOpMap fcCompareOps[] =;

#define NUM_COMPARE_OPS

static FcOp
FcConfigLexCompare (const FcChar8 *compare)
{}

static void
FcParseTest (FcConfigParse *parse)
{}

static const FcOpMap fcModeOps[] =;

#define NUM_MODE_OPS

static FcOp
FcConfigLexMode (const FcChar8 *mode)
{}

static void
FcParseEdit (FcConfigParse *parse)
{}

static void
FcParseMatch (FcConfigParse *parse)
{}

static void
FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
{}


static FcValue
FcPopValue (FcConfigParse *parse)
{}

static void
FcParsePatelt (FcConfigParse *parse)
{}

static void
FcParsePattern (FcConfigParse *parse)
{}

static void
FcEndElement(void *userData, const XML_Char *name FC_UNUSED)
{}

static void
FcCharacterData (void *userData, const XML_Char *s, int len)
{}

static void
FcStartDoctypeDecl (void	    *userData,
		    const XML_Char  *doctypeName,
		    const XML_Char  *sysid FC_UNUSED,
		    const XML_Char  *pubid FC_UNUSED,
		    int		    has_internal_subset FC_UNUSED)
{}

#ifdef ENABLE_LIBXML2

static void
FcInternalSubsetDecl (void            *userData,
		      const XML_Char  *doctypeName,
		      const XML_Char  *sysid,
		      const XML_Char  *pubid)
{}

static void
FcExternalSubsetDecl (void            *userData,
		      const XML_Char  *doctypeName,
		      const XML_Char  *sysid,
		      const XML_Char  *pubid)
{}

#else /* ENABLE_LIBXML2 */

static void
FcEndDoctypeDecl (void *userData FC_UNUSED)
{
}

#endif /* ENABLE_LIBXML2 */

static int
FcSortCmpStr (const void *a, const void *b)
{}

static FcBool
FcConfigParseAndLoadDir (FcConfig	*config,
			 const FcChar8	*name,
			 const FcChar8	*dir,
			 FcBool		complain,
			 FcBool		load)
{}

static FcBool
FcConfigParseAndLoadFromMemoryInternal (FcConfig       *config,
					const FcChar8  *filename,
					const FcChar8  *buffer,
					FcBool         complain,
					FcBool         load)
{}

static FcBool
_FcConfigParse (FcConfig	*config,
		const FcChar8	*name,
		FcBool		complain,
		FcBool		load)
{}

FcBool
FcConfigParseOnly (FcConfig		*config,
		   const FcChar8	*name,
		   FcBool		complain)
{}

FcBool
FcConfigParseAndLoad (FcConfig	    *config,
		      const FcChar8 *name,
		      FcBool	    complain)
{}

FcBool
FcConfigParseAndLoadFromMemory (FcConfig       *config,
				const FcChar8  *buffer,
				FcBool         complain)
{}

#ifdef _WIN32
static void
_ensureWin32GettersReady()
{
    if (!pGetSystemWindowsDirectory)
    {
        HMODULE hk32 = GetModuleHandleA("kernel32.dll");
        if (!(pGetSystemWindowsDirectory = (pfnGetSystemWindowsDirectory)GetProcAddress(hk32, "GetSystemWindowsDirectoryA")))
            pGetSystemWindowsDirectory = (pfnGetSystemWindowsDirectory)GetWindowsDirectory;
    }
    if (!pSHGetFolderPathA)
    {
        HMODULE hSh = LoadLibraryA("shfolder.dll");
        /* the check is done later, because there is no provided fallback */
        if (hSh)
            pSHGetFolderPathA = (pfnSHGetFolderPathA)GetProcAddress(hSh, "SHGetFolderPathA");
    }
}
#endif // _WIN32

#define __fcxml__
#include "fcaliastail.h"
#undef __fcxml__