Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

288 lines
11 KiB

  1. /***
  2. * mbstring.h - MBCS string manipulation macros and functions
  3. *
  4. * Copyright (c) 1990-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains macros and function declarations for the MBCS
  8. * string manipulation functions.
  9. *
  10. * [Public]
  11. *
  12. *Revision History:
  13. * 11-19-92 KRS Ported from 16-bit sources.
  14. * 02-23-93 SKS Update copyright to 1993
  15. * 05-24-93 KRS Added new functions from Ikura.
  16. * 07-09-93 KRS Put proper switches around _ismbblead/trail.
  17. * 07-14-93 KRS Add new mbsnbxxx functions: byte-count versions.
  18. * 08-12-93 CFW Fix ifstrip macro name.
  19. * 10-07-93 GJF Merged Cuda and NT versions. Added _CRTIMP.
  20. * 10-13-93 GJF Deleted obsolete COMBOINC check.
  21. * 10-19-93 CFW Remove _MBCS test and SBCS defines.
  22. * 10-22-93 CFW Add new ismbc* function prototypes.
  23. * 12-08-93 CFW Remove type-safe macros.
  24. * 12-17-93 CFW Remove wide char version mappings.
  25. * 04-11-94 CFW Add _NLSCMPERROR.
  26. * 05-23-94 CFW Add _mbs*coll.
  27. * 11-03-94 GJF Ensure 8 byte alignment.
  28. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  29. * 02-14-95 CFW Clean up Mac merge.
  30. * 12-14-95 JWM Add "#pragma once".
  31. * 02-20-97 GJF Cleaned out obsolete support for _CRTAPI* and _NTSDK.
  32. * Also, detab-ed.
  33. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  34. * 10-07-97 RDL Added IA64.
  35. * 04-21-98 GJF Added support for per-thread mbc information.
  36. * 12-15-98 GJF Changes for 64-bit size_t.
  37. * 05-13-99 PML Remove _CRTAPI1
  38. * 05-17-99 PML Remove all Macintosh support.
  39. * 10-06-99 PML Add _W64 modifier to types which are 32 bits in Win32,
  40. * 64 bits in Win64.
  41. * 11-03-99 PML Add va_list definition for _M_CEE.
  42. * 06-08-00 PML Remove threadmbcinfo.{pprev,pnext}. Rename
  43. * THREADMBCINFO to _THREADMBCINFO.
  44. * 09-07-00 PML Remove va_list definition for _M_CEE (vs7#159777)
  45. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  46. *
  47. ****/
  48. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  49. #pragma once
  50. #endif
  51. #ifndef _INC_MBSTRING
  52. #define _INC_MBSTRING
  53. #if !defined(_WIN32)
  54. #error ERROR: Only Win32 target supported!
  55. #endif
  56. #ifndef _CRTBLD
  57. /* This version of the header files is NOT for user programs.
  58. * It is intended for use when building the C runtimes ONLY.
  59. * The version intended for public use will not have this message.
  60. */
  61. #error ERROR: Use of C runtime library internal header file.
  62. #endif /* _CRTBLD */
  63. #ifdef _MSC_VER
  64. /*
  65. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  66. * alignment.
  67. */
  68. #pragma pack(push,8)
  69. #endif /* _MSC_VER */
  70. #ifdef __cplusplus
  71. extern "C" {
  72. #endif
  73. #if !defined(_W64)
  74. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  75. #define _W64 __w64
  76. #else
  77. #define _W64
  78. #endif
  79. #endif
  80. /* Define _CRTIMP */
  81. #ifndef _CRTIMP
  82. #ifdef CRTDLL
  83. #define _CRTIMP __declspec(dllexport)
  84. #else /* ndef CRTDLL */
  85. #ifdef _DLL
  86. #define _CRTIMP __declspec(dllimport)
  87. #else /* ndef _DLL */
  88. #define _CRTIMP
  89. #endif /* _DLL */
  90. #endif /* CRTDLL */
  91. #endif /* _CRTIMP */
  92. /* Define __cdecl for non-Microsoft compilers */
  93. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  94. #define __cdecl
  95. #endif
  96. #ifndef _SIZE_T_DEFINED
  97. #ifdef _WIN64
  98. typedef unsigned __int64 size_t;
  99. #else
  100. typedef _W64 unsigned int size_t;
  101. #endif
  102. #define _SIZE_T_DEFINED
  103. #endif
  104. #ifndef _NLSCMP_DEFINED
  105. #define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
  106. #define _NLSCMP_DEFINED
  107. #endif
  108. #ifndef _VA_LIST_DEFINED
  109. typedef char * va_list;
  110. #define _VA_LIST_DEFINED
  111. #endif
  112. #ifndef _FILE_DEFINED
  113. struct _iobuf {
  114. char *_ptr;
  115. int _cnt;
  116. char *_base;
  117. int _flag;
  118. int _file;
  119. int _charbuf;
  120. int _bufsiz;
  121. char *_tmpfname;
  122. };
  123. typedef struct _iobuf FILE;
  124. #define _FILE_DEFINED
  125. #endif
  126. /*
  127. * MBCS - Multi-Byte Character Set
  128. */
  129. #ifndef _INTERNAL_IFSTRIP_
  130. #ifdef _MT
  131. #ifndef _THREADMBCINFO
  132. typedef struct threadmbcinfostruct {
  133. int refcount;
  134. int mbcodepage;
  135. int ismbcodepage;
  136. int mblcid;
  137. unsigned short mbulinfo[6];
  138. char mbctype[257];
  139. char mbcasemap[256];
  140. } threadmbcinfo;
  141. typedef threadmbcinfo * pthreadmbcinfo;
  142. #define _THREADMBCINFO
  143. #endif
  144. extern pthreadmbcinfo __ptmbcinfo;
  145. pthreadmbcinfo __cdecl __updatetmbcinfo(void);
  146. #endif
  147. #endif /* _INTERNAL_IFSTRIP_ */
  148. #ifndef _MBSTRING_DEFINED
  149. /* function prototypes */
  150. _CRTIMP unsigned int __cdecl _mbbtombc(unsigned int);
  151. _CRTIMP int __cdecl _mbbtype(unsigned char, int);
  152. _CRTIMP unsigned int __cdecl _mbctombb(unsigned int);
  153. _CRTIMP int __cdecl _mbsbtype(const unsigned char *, size_t);
  154. _CRTIMP unsigned char * __cdecl _mbscat(unsigned char *, const unsigned char *);
  155. _CRTIMP unsigned char * __cdecl _mbschr(const unsigned char *, unsigned int);
  156. _CRTIMP int __cdecl _mbscmp(const unsigned char *, const unsigned char *);
  157. _CRTIMP int __cdecl _mbscoll(const unsigned char *, const unsigned char *);
  158. _CRTIMP unsigned char * __cdecl _mbscpy(unsigned char *, const unsigned char *);
  159. _CRTIMP size_t __cdecl _mbscspn(const unsigned char *, const unsigned char *);
  160. _CRTIMP unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned char *);
  161. _CRTIMP unsigned char * __cdecl _mbsdup(const unsigned char *);
  162. _CRTIMP int __cdecl _mbsicmp(const unsigned char *, const unsigned char *);
  163. _CRTIMP int __cdecl _mbsicoll(const unsigned char *, const unsigned char *);
  164. _CRTIMP unsigned char * __cdecl _mbsinc(const unsigned char *);
  165. _CRTIMP size_t __cdecl _mbslen(const unsigned char *);
  166. _CRTIMP unsigned char * __cdecl _mbslwr(unsigned char *);
  167. _CRTIMP unsigned char * __cdecl _mbsnbcat(unsigned char *, const unsigned char *, size_t);
  168. _CRTIMP int __cdecl _mbsnbcmp(const unsigned char *, const unsigned char *, size_t);
  169. _CRTIMP int __cdecl _mbsnbcoll(const unsigned char *, const unsigned char *, size_t);
  170. _CRTIMP size_t __cdecl _mbsnbcnt(const unsigned char *, size_t);
  171. _CRTIMP unsigned char * __cdecl _mbsnbcpy(unsigned char *, const unsigned char *, size_t);
  172. _CRTIMP int __cdecl _mbsnbicmp(const unsigned char *, const unsigned char *, size_t);
  173. _CRTIMP int __cdecl _mbsnbicoll(const unsigned char *, const unsigned char *, size_t);
  174. _CRTIMP unsigned char * __cdecl _mbsnbset(unsigned char *, unsigned int, size_t);
  175. _CRTIMP unsigned char * __cdecl _mbsncat(unsigned char *, const unsigned char *, size_t);
  176. _CRTIMP size_t __cdecl _mbsnccnt(const unsigned char *, size_t);
  177. _CRTIMP int __cdecl _mbsncmp(const unsigned char *, const unsigned char *, size_t);
  178. _CRTIMP int __cdecl _mbsncoll(const unsigned char *, const unsigned char *, size_t);
  179. _CRTIMP unsigned char * __cdecl _mbsncpy(unsigned char *, const unsigned char *, size_t);
  180. _CRTIMP unsigned int __cdecl _mbsnextc (const unsigned char *);
  181. _CRTIMP int __cdecl _mbsnicmp(const unsigned char *, const unsigned char *, size_t);
  182. _CRTIMP int __cdecl _mbsnicoll(const unsigned char *, const unsigned char *, size_t);
  183. _CRTIMP unsigned char * __cdecl _mbsninc(const unsigned char *, size_t);
  184. _CRTIMP unsigned char * __cdecl _mbsnset(unsigned char *, unsigned int, size_t);
  185. _CRTIMP unsigned char * __cdecl _mbspbrk(const unsigned char *, const unsigned char *);
  186. _CRTIMP unsigned char * __cdecl _mbsrchr(const unsigned char *, unsigned int);
  187. _CRTIMP unsigned char * __cdecl _mbsrev(unsigned char *);
  188. _CRTIMP unsigned char * __cdecl _mbsset(unsigned char *, unsigned int);
  189. _CRTIMP size_t __cdecl _mbsspn(const unsigned char *, const unsigned char *);
  190. _CRTIMP unsigned char * __cdecl _mbsspnp(const unsigned char *, const unsigned char *);
  191. _CRTIMP unsigned char * __cdecl _mbsstr(const unsigned char *, const unsigned char *);
  192. _CRTIMP unsigned char * __cdecl _mbstok(unsigned char *, const unsigned char *);
  193. _CRTIMP unsigned char * __cdecl _mbsupr(unsigned char *);
  194. _CRTIMP size_t __cdecl _mbclen(const unsigned char *);
  195. _CRTIMP void __cdecl _mbccpy(unsigned char *, const unsigned char *);
  196. #define _mbccmp(_cpc1, _cpc2) _mbsncmp((_cpc1),(_cpc2),1)
  197. /* character routines */
  198. _CRTIMP int __cdecl _ismbcalnum(unsigned int);
  199. _CRTIMP int __cdecl _ismbcalpha(unsigned int);
  200. _CRTIMP int __cdecl _ismbcdigit(unsigned int);
  201. _CRTIMP int __cdecl _ismbcgraph(unsigned int);
  202. _CRTIMP int __cdecl _ismbclegal(unsigned int);
  203. _CRTIMP int __cdecl _ismbclower(unsigned int);
  204. _CRTIMP int __cdecl _ismbcprint(unsigned int);
  205. _CRTIMP int __cdecl _ismbcpunct(unsigned int);
  206. _CRTIMP int __cdecl _ismbcspace(unsigned int);
  207. _CRTIMP int __cdecl _ismbcupper(unsigned int);
  208. _CRTIMP unsigned int __cdecl _mbctolower(unsigned int);
  209. _CRTIMP unsigned int __cdecl _mbctoupper(unsigned int);
  210. #ifndef _INTERNAL_IFSTRIP_
  211. #ifdef _MT
  212. int __cdecl __mbbtype_mt(pthreadmbcinfo, unsigned char, int);
  213. int __cdecl __mbsbtype_mt(pthreadmbcinfo, const unsigned char *, size_t);
  214. size_t __cdecl __mbscspn_mt(pthreadmbcinfo, const unsigned char *, const unsigned char *);
  215. size_t __cdecl __mbsnbcnt_mt(pthreadmbcinfo, const unsigned char *, size_t);
  216. unsigned char * __cdecl __mbspbrk_mt(pthreadmbcinfo, const unsigned char *, const unsigned char *);
  217. size_t __cdecl __mbsspn_mt(pthreadmbcinfo, const unsigned char *, const unsigned char *);
  218. unsigned char * __cdecl __mbsspnp_mt(pthreadmbcinfo, const unsigned char *, const unsigned char *);
  219. #endif
  220. #endif /* _INTERNAL_IFSTRIP_ */
  221. #define _MBSTRING_DEFINED
  222. #endif
  223. #ifndef _MBLEADTRAIL_DEFINED
  224. _CRTIMP int __cdecl _ismbblead(unsigned int);
  225. _CRTIMP int __cdecl _ismbbtrail(unsigned int);
  226. _CRTIMP int __cdecl _ismbslead(const unsigned char *, const unsigned char *);
  227. _CRTIMP int __cdecl _ismbstrail(const unsigned char *, const unsigned char *);
  228. #ifndef _INTERNAL_IFSTRIP_
  229. #ifdef _MT
  230. _CRTIMP int __cdecl __ismbslead_mt(pthreadmbcinfo, const unsigned char *,
  231. const unsigned char *);
  232. #endif
  233. #endif /* _INTERNAL_IFSTRIP_ */
  234. #define _MBLEADTRAIL_DEFINED
  235. #endif
  236. /* Kanji specific prototypes. */
  237. _CRTIMP int __cdecl _ismbchira(unsigned int);
  238. _CRTIMP int __cdecl _ismbckata(unsigned int);
  239. _CRTIMP int __cdecl _ismbcsymbol(unsigned int);
  240. _CRTIMP int __cdecl _ismbcl0(unsigned int);
  241. _CRTIMP int __cdecl _ismbcl1(unsigned int);
  242. _CRTIMP int __cdecl _ismbcl2(unsigned int);
  243. _CRTIMP unsigned int __cdecl _mbcjistojms(unsigned int);
  244. _CRTIMP unsigned int __cdecl _mbcjmstojis(unsigned int);
  245. _CRTIMP unsigned int __cdecl _mbctohira(unsigned int);
  246. _CRTIMP unsigned int __cdecl _mbctokata(unsigned int);
  247. #ifdef __cplusplus
  248. }
  249. #endif
  250. #ifdef _MSC_VER
  251. #pragma pack(pop)
  252. #endif /* _MSC_VER */
  253. #endif /* _INC_MBSTRING */