1 2 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
/* Fo
* fo-xml-char-util.h: Utility macros and functions for XML names, etc.
*
* Copyright (C) 1998-2002 Daniel Veillard.
* Copyright (C) 2001-2002 Sun Microsystems.
* All Rights Reserved.
* Copyright (C) 2007 Menteith Consulting Ltd
*
* Based on 'parserInternals.h' from libxml2 by Daniel Veillard.
*
* !See COPYING for the status of this software.
**/
/************************************************************************
* *
* UNICODE version of the macros. *
* *
************************************************************************/
/**
* IS_CHAR:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
* | [#x10000-#x10FFFF]
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
*/
#define IS_CHAR(c) \
((((c) >= 0x20) && ((c) <= 0xD7FF)) || \
((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \
(((c) >= 0xE000) && ((c) <= 0xFFFD)) || \
(((c) >= 0x10000) && ((c) <= 0x10FFFF)))
/**
* IS_BLANK:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
* [3] S ::= (#x20 | #x9 | #xD | #xA)+
*/
#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
((c) == 0x0D))
/**
* IS_BASECHAR:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
* [85] BaseChar ::= ... long list see REC ...
*/
#define IS_BASECHAR(c) fo_is_basechar(c)
/**
* IS_DIGIT:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
* [88] Digit ::= ... long list see REC ...
*/
#define IS_DIGIT(c) fo_is_digit(c)
/**
* IS_COMBINING:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
* [87] CombiningChar ::= ... long list see REC ...
*/
#define IS_COMBINING(c) fo_is_combining(c)
/**
* IS_EXTENDER:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
*
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
* [#x309D-#x309E] | [#x30FC-#x30FE]
*/
#define IS_EXTENDER(c) fo_is_extender(c)
/**
* IS_IDEOGRAPHIC:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
*
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
*/
#define IS_IDEOGRAPHIC(c) fo_is_ideographic(c)
/**
* IS_LETTER:
* @c: an UNICODE value (gunichar)
*
* Macro to check the following production in the XML spec:
*
*
* [84] Letter ::= BaseChar | Ideographic
*/
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
/*
* Function to finish the work of the macros where needed.
*/
gboolean fo_is_basechar (gunichar c);
gboolean fo_is_blank (gunichar c);
gboolean fo_is_letter (gunichar c);
gboolean fo_is_digit (gunichar c);
gboolean fo_is_ideographic (gunichar c);
gboolean fo_is_extender (gunichar c);
gboolean fo_is_combining (gunichar c);
gboolean fo_is_char (gunichar c);
|