chvalid.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * Summary: Unicode character range checking
  3. * Description: this module exports interfaces for the character
  4. * range validation APIs
  5. *
  6. * This file is automatically generated from the cvs source
  7. * definition files using the genChRanges.py Python script
  8. *
  9. * Generation date: Mon Mar 27 11:09:48 2006
  10. * Sources: chvalid.def
  11. * Author: William Brack <wbrack@mmm.com.hk>
  12. */
  13. #ifndef __XML_CHVALID_H__
  14. #define __XML_CHVALID_H__
  15. #include <libxml/xmlversion.h>
  16. #include <libxml/xmlstring.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*
  21. * Define our typedefs and structures
  22. *
  23. */
  24. typedef struct _xmlChSRange xmlChSRange;
  25. typedef xmlChSRange *xmlChSRangePtr;
  26. struct _xmlChSRange {
  27. unsigned short low;
  28. unsigned short high;
  29. };
  30. typedef struct _xmlChLRange xmlChLRange;
  31. typedef xmlChLRange *xmlChLRangePtr;
  32. struct _xmlChLRange {
  33. unsigned int low;
  34. unsigned int high;
  35. };
  36. typedef struct _xmlChRangeGroup xmlChRangeGroup;
  37. typedef xmlChRangeGroup *xmlChRangeGroupPtr;
  38. struct _xmlChRangeGroup {
  39. int nbShortRange;
  40. int nbLongRange;
  41. const xmlChSRange *shortRange; /* points to an array of ranges */
  42. const xmlChLRange *longRange;
  43. };
  44. /**
  45. * Range checking routine
  46. */
  47. XMLPUBFUN int XMLCALL
  48. xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
  49. /**
  50. * xmlIsBaseChar_ch:
  51. * @c: char to validate
  52. *
  53. * Automatically generated by genChRanges.py
  54. */
  55. #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
  56. ((0x61 <= (c)) && ((c) <= 0x7a)) || \
  57. ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
  58. ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
  59. (0xf8 <= (c)))
  60. /**
  61. * xmlIsBaseCharQ:
  62. * @c: char to validate
  63. *
  64. * Automatically generated by genChRanges.py
  65. */
  66. #define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
  67. xmlIsBaseChar_ch((c)) : \
  68. xmlCharInRange((c), &xmlIsBaseCharGroup))
  69. XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
  70. /**
  71. * xmlIsBlank_ch:
  72. * @c: char to validate
  73. *
  74. * Automatically generated by genChRanges.py
  75. */
  76. #define xmlIsBlank_ch(c) (((c) == 0x20) || \
  77. ((0x9 <= (c)) && ((c) <= 0xa)) || \
  78. ((c) == 0xd))
  79. /**
  80. * xmlIsBlankQ:
  81. * @c: char to validate
  82. *
  83. * Automatically generated by genChRanges.py
  84. */
  85. #define xmlIsBlankQ(c) (((c) < 0x100) ? \
  86. xmlIsBlank_ch((c)) : 0)
  87. /**
  88. * xmlIsChar_ch:
  89. * @c: char to validate
  90. *
  91. * Automatically generated by genChRanges.py
  92. */
  93. #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
  94. ((c) == 0xd) || \
  95. (0x20 <= (c)))
  96. /**
  97. * xmlIsCharQ:
  98. * @c: char to validate
  99. *
  100. * Automatically generated by genChRanges.py
  101. */
  102. #define xmlIsCharQ(c) (((c) < 0x100) ? \
  103. xmlIsChar_ch((c)) :\
  104. (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
  105. ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
  106. ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
  107. XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
  108. /**
  109. * xmlIsCombiningQ:
  110. * @c: char to validate
  111. *
  112. * Automatically generated by genChRanges.py
  113. */
  114. #define xmlIsCombiningQ(c) (((c) < 0x100) ? \
  115. 0 : \
  116. xmlCharInRange((c), &xmlIsCombiningGroup))
  117. XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
  118. /**
  119. * xmlIsDigit_ch:
  120. * @c: char to validate
  121. *
  122. * Automatically generated by genChRanges.py
  123. */
  124. #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
  125. /**
  126. * xmlIsDigitQ:
  127. * @c: char to validate
  128. *
  129. * Automatically generated by genChRanges.py
  130. */
  131. #define xmlIsDigitQ(c) (((c) < 0x100) ? \
  132. xmlIsDigit_ch((c)) : \
  133. xmlCharInRange((c), &xmlIsDigitGroup))
  134. XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
  135. /**
  136. * xmlIsExtender_ch:
  137. * @c: char to validate
  138. *
  139. * Automatically generated by genChRanges.py
  140. */
  141. #define xmlIsExtender_ch(c) (((c) == 0xb7))
  142. /**
  143. * xmlIsExtenderQ:
  144. * @c: char to validate
  145. *
  146. * Automatically generated by genChRanges.py
  147. */
  148. #define xmlIsExtenderQ(c) (((c) < 0x100) ? \
  149. xmlIsExtender_ch((c)) : \
  150. xmlCharInRange((c), &xmlIsExtenderGroup))
  151. XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
  152. /**
  153. * xmlIsIdeographicQ:
  154. * @c: char to validate
  155. *
  156. * Automatically generated by genChRanges.py
  157. */
  158. #define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
  159. 0 :\
  160. (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
  161. ((c) == 0x3007) || \
  162. ((0x3021 <= (c)) && ((c) <= 0x3029))))
  163. XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
  164. XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
  165. /**
  166. * xmlIsPubidChar_ch:
  167. * @c: char to validate
  168. *
  169. * Automatically generated by genChRanges.py
  170. */
  171. #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
  172. /**
  173. * xmlIsPubidCharQ:
  174. * @c: char to validate
  175. *
  176. * Automatically generated by genChRanges.py
  177. */
  178. #define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
  179. xmlIsPubidChar_ch((c)) : 0)
  180. XMLPUBFUN int XMLCALL
  181. xmlIsBaseChar(unsigned int ch);
  182. XMLPUBFUN int XMLCALL
  183. xmlIsBlank(unsigned int ch);
  184. XMLPUBFUN int XMLCALL
  185. xmlIsChar(unsigned int ch);
  186. XMLPUBFUN int XMLCALL
  187. xmlIsCombining(unsigned int ch);
  188. XMLPUBFUN int XMLCALL
  189. xmlIsDigit(unsigned int ch);
  190. XMLPUBFUN int XMLCALL
  191. xmlIsExtender(unsigned int ch);
  192. XMLPUBFUN int XMLCALL
  193. xmlIsIdeographic(unsigned int ch);
  194. XMLPUBFUN int XMLCALL
  195. xmlIsPubidChar(unsigned int ch);
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. #endif /* __XML_CHVALID_H__ */