ReactOS 0.4.17-dev-966-gf06eace
xmllite_private.h
Go to the documentation of this file.
1/*
2 * XMLLite private things
3 *
4 * Copyright 2012 Nikolay Sivov for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#ifndef __XMLLITE_PRIVATE__
22#define __XMLLITE_PRIVATE__
23
24static inline void *m_alloc(IMalloc *imalloc, size_t len)
25{
26 if (imalloc)
27 return IMalloc_Alloc(imalloc, len);
28 else
29 return malloc(len);
30}
31
32static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len)
33{
34 if (imalloc)
35 return IMalloc_Realloc(imalloc, mem, len);
36 else
37 return realloc(mem, len);
38}
39
40static inline void m_free(IMalloc *imalloc, void *mem)
41{
42 if (imalloc)
43 IMalloc_Free(imalloc, mem);
44 else
45 free(mem);
46}
47
48typedef enum
49{
55
60
65
66/* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] */
67static inline BOOL is_char(WCHAR ch)
68{
69 return (ch == '\t') || (ch == '\r') || (ch == '\n') ||
70 (ch >= 0x20 && ch <= 0xd7ff) ||
71 (ch >= 0xd800 && ch <= 0xdbff) || /* high surrogate */
72 (ch >= 0xdc00 && ch <= 0xdfff) || /* low surrogate */
73 (ch >= 0xe000 && ch <= 0xfffd);
74}
75
76/* [3] S ::= (#x20 | #x9 | #xD | #xA)+ */
78{
79 return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
80}
81
82#endif /* __XMLLITE_PRIVATE__ */
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
unsigned char ch[4][2]
Definition: console.c:118
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: sysinfo.c:13
xml_encoding
Definition: mxwriter.c:49
short WCHAR
Definition: pedump.c:58
Definition: mem.c:349
static void * m_alloc(IMalloc *imalloc, size_t len)
static BOOL is_wchar_space(WCHAR ch)
BOOL is_namechar(WCHAR ch)
Definition: reader.c:1530
xml_encoding parse_encoding_name(const WCHAR *, int)
Definition: reader.c:737
const WCHAR * get_encoding_name(xml_encoding)
Definition: reader.c:155
BOOL is_namestartchar(WCHAR ch)
Definition: reader.c:1486
static void m_free(IMalloc *imalloc, void *mem)
static BOOL is_char(WCHAR ch)
BOOL is_pubchar(WCHAR ch)
Definition: reader.c:1473
BOOL is_ncnamechar(WCHAR ch)
Definition: reader.c:1506
HRESULT get_code_page(xml_encoding, UINT *)
Definition: reader.c:724
xml_encoding get_encoding_from_codepage(UINT)
Definition: reader.c:160
static void * m_realloc(IMalloc *imalloc, void *mem, size_t len)
xml_encoding
@ XmlEncoding_UTF8
@ XmlEncoding_Unknown
@ XmlEncoding_UTF16
@ XmlEncoding_USASCII