diff options
Diffstat (limited to 'chvalid.h')
-rw-r--r-- | chvalid.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/chvalid.h b/chvalid.h new file mode 100644 index 00000000..0b538ebd --- /dev/null +++ b/chvalid.h @@ -0,0 +1,105 @@ +/* + * chvalid.h: this header exports interfaces for the character + * range validation APIs + * + * This file is automatically generated from the cvs source + * definition files using the genChRanges.py Python script + * + * Generation date: Sat Oct 11 20:57:37 2003 + * Sources: chvalid.def + * William Brack <wbrack@mmm.com.hk> + */ + +#ifndef __XML_CHVALID_H__ +#define __XML_CHVALID_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define our typedefs and structures + * + */ +typedef struct _xmlChSRange xmlChSRange; +typedef xmlChSRange *xmlChSRangePtr; +struct _xmlChSRange { + unsigned short low; + unsigned short high; +}; + +typedef struct _xmlChLRange xmlChLRange; +typedef xmlChLRange *xmlChLRangePtr; +struct _xmlChLRange { + unsigned low; + unsigned high; +}; + +typedef struct _xmlChRangeGroup xmlChRangeGroup; +typedef xmlChRangeGroup *xmlChRangeGroupPtr; +struct _xmlChRangeGroup { + int nbShortRange; + int nbLongRange; + xmlChSRangePtr shortRange; /* points to an array of ranges */ + xmlChLRangePtr longRange; +}; + +/* Range checking routine */ +int xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); + +#define xmlIsBaseChar_ch(c) ( ((0x41<= (c)) && ((c) <= 0x5a)) || \ + ((0x61<= (c)) && ((c) <= 0x7a)) || \ + ((0xc0<= (c)) && ((c) <= 0xd6)) || \ + ((0xd8<= (c)) && ((c) <= 0xf6)) || \ + ((0xf8<= (c)) && ((c) <= 0xff))) +#define xmlIsBaseChar(c) (((c) < 0x100) ? \ + xmlIsBaseChar_ch((c)) : \ + xmlCharInRange((c), &xmlIsBaseCharGroup)) + +extern xmlChRangeGroup xmlIsBaseCharGroup; +#define xmlIsBlank_ch(c) ( ((c) == 0x20) || \ + ((0x9<= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd)) +#define xmlIsBlank(c) (((c) < 0x100) ? \ + xmlIsBlank_ch((c)) : 0) + +#define xmlIsChar_ch(c) ( ((0x9<= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd) || \ + ((0x20<= (c)) && ((c) <= 0xff))) +#define xmlIsChar(c) (((c) < 0x100) ? \ + xmlIsChar_ch((c)) : \ + xmlCharInRange((c), &xmlIsCharGroup)) + +extern xmlChRangeGroup xmlIsCharGroup; +#define xmlIsCombining(c) (((c) < 0x100) ? \ + 0 : \ + xmlCharInRange((c), &xmlIsCombiningGroup)) + +extern xmlChRangeGroup xmlIsCombiningGroup; +#define xmlIsDigit_ch(c) ( ((0x30<= (c)) && ((c) <= 0x39))) +#define xmlIsDigit(c) (((c) < 0x100) ? \ + xmlIsDigit_ch((c)) : \ + xmlCharInRange((c), &xmlIsDigitGroup)) + +extern xmlChRangeGroup xmlIsDigitGroup; +#define xmlIsExtender_ch(c) ( ((c) == 0xb7)) +#define xmlIsExtender(c) (((c) < 0x100) ? \ + xmlIsExtender_ch((c)) : \ + xmlCharInRange((c), &xmlIsExtenderGroup)) + +extern xmlChRangeGroup xmlIsExtenderGroup; +#define xmlIsIdeographic(c) (((c) < 0x100) ? \ + 0 : \ + xmlCharInRange((c), &xmlIsIdeographicGroup)) + +extern xmlChRangeGroup xmlIsIdeographicGroup; +extern unsigned char xmlIsPubidChar_tab[256]; +#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) +#define xmlIsPubidChar(c) (((c) < 0x100) ? \ + xmlIsPubidChar_ch((c)) : 0) + + +#ifdef __cplusplus +} +#endif +#endif /* __XML_CHVALID_H__ */ |