File: ctype16.h

package info (click to toggle)
rxp 1.1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 416 kB
  • ctags: 899
  • sloc: ansic: 8,784; makefile: 102; sh: 3
file content (40 lines) | stat: -rw-r--r-- 1,157 bytes parent folder | download
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
#ifndef CTYPE16_H
#define CTYPE16_H

#ifndef FOR_LT
#define STD_API
#endif

/* XML character types */

STD_API void init_ctype16(void);
STD_API int Toupper(int c);
STD_API int Tolower(int c);

extern STD_API unsigned char xml_char_map[];

#define xml_legal      0x01
#define xml_namestart  0x02
#define xml_namechar   0x04
#define xml_whitespace 0x08

#if CHAR_SIZE == 8

/* And with 0xff so that it works if char is signed */
#define is_xml_legal(c) (xml_char_map[(int)(c) & 0xff] & xml_legal)
#define is_xml_namestart(c) (xml_char_map[(int)(c) & 0xff] & xml_namestart)
#define is_xml_namechar(c) (xml_char_map[(int)(c) & 0xff] & xml_namechar)
#define is_xml_whitespace(c) (xml_char_map[(int)(c) & 0xff] & xml_whitespace)

#else

/* Note!  these macros evaluate their argument more than once! */

#define is_xml_legal(c) (c < 0x110000 && (c >= 0x10000 || (xml_char_map[c] & xml_legal)))
#define is_xml_namestart(c) (c < 0x10000 && (xml_char_map[c] & xml_namestart))
#define is_xml_namechar(c) (c < 0x10000 && (xml_char_map[c] & xml_namechar))
#define is_xml_whitespace(c) (c < 0x10000 && (xml_char_map[c] & xml_whitespace))

#endif

#endif /* CTYPE16_H */