Edinburgh Speech Tools  2.1-release
ctype16.h
Go to the documentation of this file.
1 /*************************************************************************/
2 /* */
3 /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */
4 /* University of Edinburgh. */
5 /* */
6 /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */
7 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
8 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
9 /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */
10 /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */
11 /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */
12 /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
13 /* */
14 /*************************************************************************/
15 #ifndef CTYPE16_H
16 #define CTYPE16_H
17 
18 #ifndef FOR_LT
19 #define STD_API
20 #endif
21 
22 /* XML character types */
23 
24 STD_API void init_ctype16(void);
25 STD_API int Toupper(int c);
26 STD_API int Tolower(int c);
27 
28 extern STD_API unsigned char xml_char_map[];
29 
30 #define xml_legal 0x01
31 #define xml_namestart 0x02
32 #define xml_namechar 0x04
33 #define xml_whitespace 0x08
34 
35 #if CHAR_SIZE == 8
36 
37 /* And with 0xff so that it works if char is signed */
38 #define is_xml_legal(c) (xml_char_map[(int)(c) & 0xff] & xml_legal)
39 #define is_xml_namestart(c) (xml_char_map[(int)(c) & 0xff] & xml_namestart)
40 #define is_xml_namechar(c) (xml_char_map[(int)(c) & 0xff] & xml_namechar)
41 #define is_xml_whitespace(c) (xml_char_map[(int)(c) & 0xff] & xml_whitespace)
42 
43 #else
44 
45 /* Note! these macros evaluate their argument more than once! */
46 
47 #define is_xml_legal(c) (c < 0x110000 && (c >= 0x10000 || (xml_char_map[c] & xml_legal)))
48 #define is_xml_namestart(c) (c < 0x10000 && (xml_char_map[c] & xml_namestart))
49 #define is_xml_namechar(c) (c < 0x10000 && (xml_char_map[c] & xml_namechar))
50 #define is_xml_whitespace(c) (c < 0x10000 && (xml_char_map[c] & xml_whitespace))
51 
52 #endif
53 
54 #endif /* CTYPE16_H */
#define STD_API
Definition: ctype16.h:19
STD_API int Toupper(int c)
Definition: ctype16.c:52
STD_API int Tolower(int c)
Definition: ctype16.c:39
STD_API unsigned char xml_char_map[]
Definition: ctype16.c:24
STD_API void init_ctype16(void)
Definition: ctype16.c:26