Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 09:13:56

0001 /**
0002  * @file
0003  *
0004  * @brief Unicode character range checking
0005  *
0006  * this module exports interfaces for the character
0007  *               range validation APIs
0008  */
0009 
0010 #ifndef __XML_CHVALID_H__
0011 #define __XML_CHVALID_H__
0012 
0013 #include <libxml/xmlversion.h>
0014 #include <libxml/xmlstring.h>
0015 
0016 #ifdef __cplusplus
0017 extern "C" {
0018 #endif
0019 
0020 /** @cond ignore */
0021 
0022 /*
0023  * Define our typedefs and structures
0024  *
0025  */
0026 typedef struct _xmlChSRange xmlChSRange;
0027 typedef xmlChSRange *xmlChSRangePtr;
0028 struct _xmlChSRange {
0029     unsigned short  low;
0030     unsigned short  high;
0031 };
0032 
0033 typedef struct _xmlChLRange xmlChLRange;
0034 typedef xmlChLRange *xmlChLRangePtr;
0035 struct _xmlChLRange {
0036     unsigned int    low;
0037     unsigned int    high;
0038 };
0039 
0040 typedef struct _xmlChRangeGroup xmlChRangeGroup;
0041 typedef xmlChRangeGroup *xmlChRangeGroupPtr;
0042 struct _xmlChRangeGroup {
0043     int         nbShortRange;
0044     int         nbLongRange;
0045     const xmlChSRange   *shortRange;    /* points to an array of ranges */
0046     const xmlChLRange   *longRange;
0047 };
0048 
0049 XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
0050 XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
0051 XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
0052 XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
0053 XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
0054 XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
0055 XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
0056 
0057 /**
0058  * Range checking routine
0059  */
0060 XMLPUBFUN int
0061         xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
0062 
0063 /** @endcond */
0064 
0065 /**
0066  * Automatically generated by genChRanges.py
0067  *
0068  * @param c  char to validate
0069  */
0070 #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
0071                  ((0x61 <= (c)) && ((c) <= 0x7a)) || \
0072                  ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
0073                  ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
0074                   (0xf8 <= (c)))
0075 
0076 /**
0077  * Automatically generated by genChRanges.py
0078  *
0079  * @param c  char to validate
0080  */
0081 #define xmlIsBaseCharQ(c)   (((c) < 0x100) ? \
0082                  xmlIsBaseChar_ch((c)) : \
0083                  xmlCharInRange((c), &xmlIsBaseCharGroup))
0084 
0085 /**
0086  * Automatically generated by genChRanges.py
0087  *
0088  * @param c  char to validate
0089  */
0090 #define xmlIsBlank_ch(c)    (((c) == 0x20) || \
0091                  ((0x9 <= (c)) && ((c) <= 0xa)) || \
0092                  ((c) == 0xd))
0093 
0094 /**
0095  * Automatically generated by genChRanges.py
0096  *
0097  * @param c  char to validate
0098  */
0099 #define xmlIsBlankQ(c)      (((c) < 0x100) ? \
0100                  xmlIsBlank_ch((c)) : 0)
0101 
0102 
0103 /**
0104  * Automatically generated by genChRanges.py
0105  *
0106  * @param c  char to validate
0107  */
0108 #define xmlIsChar_ch(c)     (((0x9 <= (c)) && ((c) <= 0xa)) || \
0109                  ((c) == 0xd) || \
0110                   (0x20 <= (c)))
0111 
0112 /**
0113  * Automatically generated by genChRanges.py
0114  *
0115  * @param c  char to validate
0116  */
0117 #define xmlIsCharQ(c)       (((c) < 0x100) ? \
0118                  xmlIsChar_ch((c)) :\
0119                 (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
0120                  ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
0121                  ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
0122 
0123 /**
0124  * Automatically generated by genChRanges.py
0125  *
0126  * @param c  char to validate
0127  */
0128 #define xmlIsCombiningQ(c)  (((c) < 0x100) ? \
0129                  0 : \
0130                  xmlCharInRange((c), &xmlIsCombiningGroup))
0131 
0132 /**
0133  * Automatically generated by genChRanges.py
0134  *
0135  * @param c  char to validate
0136  */
0137 #define xmlIsDigit_ch(c)    (((0x30 <= (c)) && ((c) <= 0x39)))
0138 
0139 /**
0140  * Automatically generated by genChRanges.py
0141  *
0142  * @param c  char to validate
0143  */
0144 #define xmlIsDigitQ(c)      (((c) < 0x100) ? \
0145                  xmlIsDigit_ch((c)) : \
0146                  xmlCharInRange((c), &xmlIsDigitGroup))
0147 
0148 /**
0149  * Automatically generated by genChRanges.py
0150  *
0151  * @param c  char to validate
0152  */
0153 #define xmlIsExtender_ch(c) (((c) == 0xb7))
0154 
0155 /**
0156  * Automatically generated by genChRanges.py
0157  *
0158  * @param c  char to validate
0159  */
0160 #define xmlIsExtenderQ(c)   (((c) < 0x100) ? \
0161                  xmlIsExtender_ch((c)) : \
0162                  xmlCharInRange((c), &xmlIsExtenderGroup))
0163 
0164 /**
0165  * Automatically generated by genChRanges.py
0166  *
0167  * @param c  char to validate
0168  */
0169 #define xmlIsIdeographicQ(c)    (((c) < 0x100) ? \
0170                  0 :\
0171                 (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
0172                  ((c) == 0x3007) || \
0173                  ((0x3021 <= (c)) && ((c) <= 0x3029))))
0174 
0175 /**
0176  * Automatically generated by genChRanges.py
0177  *
0178  * @param c  char to validate
0179  */
0180 #define xmlIsPubidChar_ch(c)    (xmlIsPubidChar_tab[(c)])
0181 
0182 /**
0183  * Automatically generated by genChRanges.py
0184  *
0185  * @param c  char to validate
0186  */
0187 #define xmlIsPubidCharQ(c)  (((c) < 0x100) ? \
0188                  xmlIsPubidChar_ch((c)) : 0)
0189 
0190 XML_DEPRECATED
0191 XMLPUBFUN int
0192         xmlIsBaseChar(unsigned int ch);
0193 XML_DEPRECATED
0194 XMLPUBFUN int
0195         xmlIsBlank(unsigned int ch);
0196 XML_DEPRECATED
0197 XMLPUBFUN int
0198         xmlIsChar(unsigned int ch);
0199 XML_DEPRECATED
0200 XMLPUBFUN int
0201         xmlIsCombining(unsigned int ch);
0202 XML_DEPRECATED
0203 XMLPUBFUN int
0204         xmlIsDigit(unsigned int ch);
0205 XML_DEPRECATED
0206 XMLPUBFUN int
0207         xmlIsExtender(unsigned int ch);
0208 XML_DEPRECATED
0209 XMLPUBFUN int
0210         xmlIsIdeographic(unsigned int ch);
0211 XML_DEPRECATED
0212 XMLPUBFUN int
0213         xmlIsPubidChar(unsigned int ch);
0214 
0215 #ifdef __cplusplus
0216 }
0217 #endif
0218 #endif /* __XML_CHVALID_H__ */