|
|
|
1 |
|
/*** |
2 |
|
*mbctype.h - MBCS character conversion macros |
3 |
|
* |
4 |
|
* Copyright (c) Microsoft Corporation. All rights reserved. |
5 |
|
* |
6 |
|
*Purpose: |
7 |
|
* Defines macros for MBCS character classification/conversion. |
8 |
|
* |
9 |
|
* [Public] |
10 |
|
* |
11 |
|
****/ |
12 |
|
|
13 |
|
#if _MSC_VER > 1000 |
14 |
|
#pragma once |
15 |
|
#endif |
16 |
|
|
17 |
|
#ifndef _INC_MBCTYPE |
18 |
|
#define _INC_MBCTYPE |
19 |
|
|
20 |
|
#include <crtdefs.h> |
21 |
|
#include <ctype.h> |
22 |
|
|
23 |
|
#ifdef __cplusplus |
24 |
|
extern "C" { |
25 |
|
#endif |
26 |
|
|
27 |
|
|
28 |
|
/* |
29 |
|
* MBCS - Multi-Byte Character Set |
30 |
|
*/ |
31 |
|
|
32 |
|
/* |
33 |
|
* This declaration allows the user access the _mbctype[] look-up array. |
34 |
|
*/ |
35 |
|
#if !defined(_M_CEE_PURE) |
36 |
|
/* No data exports in pure code */ |
37 |
|
_CRTIMP extern unsigned char _mbctype[]; |
38 |
|
_CRTIMP extern unsigned char _mbcasemap[]; |
39 |
|
#else |
40 |
|
_Check_return_ _CRTIMP unsigned char * __cdecl __p__mbctype(void); |
41 |
|
_Check_return_ _CRTIMP unsigned char * __cdecl __p__mbcasemap(void); |
42 |
|
#define _mbctype (__p__mbctype()) |
43 |
|
#define _mbcasemap (__p__mbcasemap()) |
44 |
|
#endif /* !defined(_M_CEE_PURE) */ |
45 |
|
|
46 |
|
|
47 |
|
/* bit masks for MBCS character types */ |
48 |
|
|
59 |
|
#define _MBC_SINGLE 0 /* valid single byte char */ |
60 |
|
#define _MBC_LEAD 1 /* lead byte */ |
61 |
|
#define _MBC_TRAIL 2 /* trailing byte */ |
62 |
|
#define _MBC_ILLEGAL (-1) /* illegal byte */ |
63 |
|
|
64 |
|
#define _KANJI_CP 932 |
65 |
|
|
66 |
|
/* _setmbcp parameter defines */ |
67 |
|
#define _MB_CP_SBCS 0 |
68 |
|
#define _MB_CP_OEM -2 |
69 |
|
#define _MB_CP_ANSI -3 |
70 |
|
#define _MB_CP_LOCALE -4 |
71 |
|
|
72 |
|
|
73 |
|
#ifndef _MBCTYPE_DEFINED |
74 |
|
|
75 |
|
/* MB control routines */ |
76 |
|
|
77 |
|
_CRTIMP int __cdecl _setmbcp(_In_ int _CodePage); |
78 |
|
_CRTIMP int __cdecl _getmbcp(void); |
79 |
|
|
80 |
|
|
81 |
|
/* MBCS character classification function prototypes */ |
82 |
|
|
83 |
|
|
84 |
|
/* byte routines */ |
85 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkalnum( _In_ unsigned int _C ); |
86 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkalnum_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
87 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkana( _In_ unsigned int _C ); |
88 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkana_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
89 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkpunct( _In_ unsigned int _C ); |
90 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkpunct_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
91 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkprint( _In_ unsigned int _C ); |
92 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbkprint_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
93 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbalpha( _In_ unsigned int _C ); |
94 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbalpha_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
95 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbpunct( _In_ unsigned int _C ); |
96 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbpunct_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
97 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbalnum( _In_ unsigned int _C ); |
98 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbalnum_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
99 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbprint( _In_ unsigned int _C ); |
100 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbprint_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
101 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbgraph( _In_ unsigned int _C ); |
102 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbgraph_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale); |
103 |
|
|
104 |
|
#ifndef _MBLEADTRAIL_DEFINED |
105 |
|
_Check_return_ _CRTIMP int __cdecl _ismbblead( _In_ unsigned int _C); |
106 |
|
_Check_return_ _CRTIMP int __cdecl _ismbblead_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale ); |
107 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbtrail( _In_ unsigned int _C); |
108 |
|
_Check_return_ _CRTIMP int __cdecl _ismbbtrail_l(_In_ unsigned int _C, _In_opt_ _locale_t _Locale ); |
109 |
|
_Check_return_ _CRTIMP int __cdecl _ismbslead(_In_bytecount_x_(_Pos - _Str+1) _Pre_z_ const unsigned char * _Str, _In_z_ const unsigned char * _Pos); |
110 |
|
_Check_return_ _CRTIMP int __cdecl _ismbslead_l(_In_bytecount_x_(_Pos - _Str+1) _Pre_z_ const unsigned char * _Str, _In_z_ const unsigned char * _Pos, _In_opt_ _locale_t _Locale); |
111 |
|
_Check_return_ _CRTIMP int __cdecl _ismbstrail(_In_bytecount_x_(_Pos - _Str+1) _Pre_z_ const unsigned char * _Str, _In_z_ const unsigned char * _Pos); |
112 |
|
_Check_return_ _CRTIMP int __cdecl _ismbstrail_l(_In_bytecount_x_(_Pos - _Str+1) _Pre_z_ const unsigned char * _Str, _In_z_ const unsigned char * _Pos, _In_opt_ _locale_t _Locale); |
113 |
|
|
114 |
|
#define _MBLEADTRAIL_DEFINED |
115 |
|
#endif |
116 |
|
|
117 |
|
#define _MBCTYPE_DEFINED |
118 |
|
#endif |
119 |
|
|
120 |
|
/* |
121 |
|
* char byte classification macros |
122 |
|
*/ |
123 |
|
|
124 |
|
#if defined(_CRT_DISABLE_PERFCRIT_LOCKS) && !defined(_DLL) |
125 |
|
#define _ismbbkalnum(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MS) |
126 |
|
#define _ismbbkprint(_c) ((_mbctype+1)[(unsigned char)(_c)] & (_MS|_MP)) |
127 |
|
#define _ismbbkpunct(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MP) |
128 |
|
|
129 |
|
#define _ismbbalnum(_c) (((_pctype)[(unsigned char)(_c)] & (_ALPHA|_DIGIT))||_ismbbkalnum(_c)) |
130 |
|
#define _ismbbalpha(_c) (((_pctype)[(unsigned char)(_c)] & (_ALPHA))||_ismbbkalnum(_c)) |
131 |
|
#define _ismbbgraph(_c) (((_pctype)[(unsigned char)(_c)] & (_PUNCT|_ALPHA|_DIGIT))||_ismbbkprint(_c)) |
132 |
|
#define _ismbbprint(_c) (((_pctype)[(unsigned char)(_c)] & (_BLANK|_PUNCT|_ALPHA|_DIGIT))||_ismbbkprint(_c)) |
133 |
|
#define _ismbbpunct(_c) (((_pctype)[(unsigned char)(_c)] & _PUNCT)||_ismbbkpunct(_c)) |
134 |
|
|
135 |
|
#define _ismbblead(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M1) |
136 |
|
#define _ismbbtrail(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M2) |
137 |
|
|
138 |
|
#define _ismbbkana(_c) ((_mbctype+1)[(unsigned char)(_c)] & (_MS|_MP)) |
139 |
|
#endif |
140 |
|
|
141 |
|
|
142 |
|
#ifdef __cplusplus |
143 |
|
} |
144 |
|
#endif |
145 |
|
|
146 |
|
#endif /* _INC_MBCTYPE */ |
147 |
|
|
|
|
|