blob: aa655bed71fbf6347f4502e82f30507df6bfae20 (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/***************************************************************
MPU-CTYPE.C
Strict UCS-2 character classification functions.
PART OF : MPUIO - library .
NOTE : Classification is deterministic and does not
depend on the process locale. Surrogate code
units U+D800..U+DFFF are never classified.
Copyright (C) 2000 - 2026 by Andrey V.Kosteltsev.
All Rights Reserved.
***************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libmpuio.h>
#include <mpu-symbols.h>
#include <mpu-ctype.h>
static int
__mpu_ucs2_has_property( __mpu_char16_t c, unsigned char property )
{
if( c >= 0xd800U && c <= 0xdfffU ) return( 0 );
return( (__mpu_ucs2_ctype[(unsigned)c] & property) != 0 );
}
int
mpu_ucs2_isalpha( __mpu_char16_t c )
{
return( __mpu_ucs2_has_property( c, __MPU_UCS2_ALPHA ) );
}
int
mpu_ucs2_isupper( __mpu_char16_t c )
{
return( __mpu_ucs2_has_property( c, __MPU_UCS2_UPPER ) );
}
int
mpu_ucs2_islower( __mpu_char16_t c )
{
return( __mpu_ucs2_has_property( c, __MPU_UCS2_LOWER ) );
}
int
mpu_ucs2_isdigit( __mpu_char16_t c )
{
return( __mpu_ucs2_has_property( c, __MPU_UCS2_DIGIT ) );
}
int
mpu_ucs2_is_xid_start( __mpu_char16_t c )
{
return( __mpu_ucs2_has_property( c, __MPU_UCS2_XID_START ) );
}
int
mpu_ucs2_is_xid_continue( __mpu_char16_t c )
{
return( __mpu_ucs2_has_property( c, __MPU_UCS2_XID_CONTINUE ) );
}
|