1 /* libxml2 - Library for parsing XML documents
2 * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3 *
4 * This file is not part of the GNU gettext program, but is used with
5 * GNU gettext.
6 *
7 * The original copyright notice is as follows:
8 */
9
10 /*
11 * Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this software and associated documentation files (the "Software"), to deal
15 * in the Software without restriction, including without limitation the rights
16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 * copies of the Software, and to permit persons to whom the Software is fur-
18 * nished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25 * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 * THE SOFTWARE.
30 *
31 * Author: breese@users.sourceforge.net
32 */
33
34 /*
35 * libxml.h: internal header only used during the compilation of libxml
36 */
37
38 #ifndef __XML_LIBXML_H__
39 #define __XML_LIBXML_H__
40
41 #ifndef NO_LARGEFILE_SOURCE
42 #ifndef _LARGEFILE_SOURCE
43 #define _LARGEFILE_SOURCE
44 #endif
45 #ifndef _FILE_OFFSET_BITS
46 #define _FILE_OFFSET_BITS 64
47 #endif
48 #endif
49
50 #if defined(macintosh)
51 #include "config-mac.h"
52 #elif defined(_WIN32_WCE)
53 /*
54 * Windows CE compatibility definitions and functions
55 * This is needed to compile libxml2 for Windows CE.
56 * At least I tested it with WinCE 5.0 for Emulator and WinCE 4.2/SH4 target
57 */
58 #include <win32config.h>
59 #include <libxml/xmlversion.h>
60 #else
61 /*
62 * Currently supported platforms use either autoconf or
63 * copy to config.h own "preset" configuration file.
64 * As result ifdef HAVE_CONFIG_H is omited here.
65 */
66 #include "config.h"
67 #include <libxml/xmlversion.h>
68 #endif
69
70 #if defined(__Lynx__)
71 #include <stdio.h> /* pull definition of size_t */
72 #include <varargs.h>
73 int snprintf(char *, size_t, const char *, ...);
74 int vfprintf(FILE *, const char *, va_list);
75 #endif
76
77 #ifndef WITH_TRIO
78 #include <stdio.h>
79 #else
80 /**
81 * TRIO_REPLACE_STDIO:
82 *
83 * This macro is defined if teh trio string formatting functions are to
84 * be used instead of the default stdio ones.
85 */
86 #define TRIO_REPLACE_STDIO
87 #include "trio.h"
88 #endif
89
90 #if defined(__clang__) || \
91 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406))
92 #define XML_IGNORE_PEDANTIC_WARNINGS \
93 _Pragma("GCC diagnostic push") \
94 _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
95 #define XML_POP_WARNINGS \
96 _Pragma("GCC diagnostic pop")
97 #else
98 #define XML_IGNORE_PEDANTIC_WARNINGS
99 #define XML_POP_WARNINGS
100 #endif
101
102 #include <libxml/xmlstring.h>
103
104 /*
105 * Internal variable indicating if a callback has been registered for
106 * node creation/destruction. It avoids spending a lot of time in locking
107 * function while checking if the callback exists.
108 */
109 extern int __xmlRegisterCallbacks;
110 /*
111 * internal error reporting routines, shared but not partof the API.
112 */
113 void __xmlIOErr(int domain, int code, const char *extra);
114 void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0);
115 #ifdef LIBXML_HTML_ENABLED
116 /*
117 * internal function of HTML parser needed for xmlParseInNodeContext
118 * but not part of the API
119 */
120 void __htmlParseContent(void *ctx);
121 #endif
122
123 /*
124 * internal global initialization critical section routines.
125 */
126 void __xmlGlobalInitMutexLock(void);
127 void __xmlGlobalInitMutexUnlock(void);
128 void __xmlGlobalInitMutexDestroy(void);
129
130 int __xmlInitializeDict(void);
131
132 #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
133 /*
134 * internal thread safe random function
135 */
136 int __xmlRandom(void);
137 #endif
138
139 XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg);
140 int xmlInputReadCallbackNop(void *context, char *buffer, int len);
141
142 #ifdef IN_LIBXML
143 #ifdef __GNUC__
144 #ifdef PIC
145 #ifdef __linux__
146 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
147 #include "elfgcchack.h"
148 #endif
149 #endif
150 #endif
151 #endif
152 #endif
153 #if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC)
154 # define LIBXML_STATIC 1
155 #endif
156 #endif /* ! __XML_LIBXML_H__ */