675619666cd6a6bb27368b1db4067abf2fff5dcf
[scp/ocu/5gnr.git] / Include / vos_ctype.h
1 /******************************************************************************
2 ###############################################################################
3 #   Copyright (c) [2017-2020] [ICT/CAS]                                        #
4 #   Licensed under the ORAN Software License v1.0 (License)             #
5 ###############################################################################
6 ******************************************************************************/
7
8
9
10 #ifndef _VOS_CTYPE_H
11 #define _VOS_CTYPE_H
12
13 #include "vos_types.h"
14
15 /*
16  * NOTE! This ctype does not handle EOF like the standard C
17  * library is required to.
18  */
19
20 #define _VOS_U  0x01    /* upper */
21 #define _VOS_L  0x02    /* lower */
22 #define _VOS_D  0x04    /* digit */
23 #define _VOS_C  0x08    /* cntrl */
24 #define _VOS_P  0x10    /* punct */
25 #define _VOS_S  0x20    /* white space (space/lf/tab) */
26 #define _VOS_X  0x40    /* hex digit */
27 #define _VOS_SP 0x80    /* hard space (0x20) */
28
29 extern unsigned char _vos_ctype[];
30
31 #define __vos_ismask(x) (_vos_ctype[(int)(unsigned char)(x)])
32
33 /** 同 isalnum */
34 #define vos_isalnum(c)  ((__vos_ismask(c)&(_VOS_U|_VOS_L|_VOS_D)) != 0)
35
36 /** 同 isalpha */
37 #define vos_isalpha(c)  ((__vos_ismask(c)&(_VOS_U|_VOS_L)) != 0)
38
39 /** 同 iscntrl */
40 #define vos_iscntrl(c)  ((__vos_ismask(c)&(_VOS_C)) != 0)
41
42 /** 同 isdigit */
43 #define vos_isdigit(c)  ((__vos_ismask(c)&(_VOS_D)) != 0)
44
45 /** 同 isgraph */
46 #define vos_isgraph(c)  ((__vos_ismask(c)&(_VOS_P|_VOS_U|_VOS_L|_VOS_D)) != 0)
47
48 /** 同 islower */
49 #define vos_islower(c)  ((__vos_ismask(c)&(_VOS_L)) != 0)
50
51 /** 同 isprint */
52 #define vos_isprint(c)  ((__vos_ismask(c)&(_VOS_P|_VOS_U|_VOS_L|_VOS_D|_VOS_SP)) != 0)
53
54 /** 同 ispunct */
55 #define vos_ispunct(c)  ((__vos_ismask(c)&(_VOS_P)) != 0)
56
57 /** 同 isspace */
58 #define vos_isspace(c)  ((__vos_ismask(c)&(_VOS_S)) != 0)
59
60 /** 同 isupper */
61 #define vos_isupper(c)  ((__vos_ismask(c)&(_VOS_U)) != 0)
62
63 /** 同 isxdigit */
64 #define vos_isxdigit(c) ((__vos_ismask(c)&(_VOS_D|_VOS_X)) != 0)
65
66 /** 同 isascii */
67 #define vos_isascii(c) (((unsigned char)(c))<=0x7f)
68
69 /** 同 toascii */
70 #define vos_toascii(c) (((unsigned char)(c))&0x7f)
71
72 /** 同 tolower */
73 UCHAR vos_tolower(UCHAR c);
74
75 /** 同 toupper */
76 UCHAR vos_toupper(UCHAR c);
77
78 #endif