Source code of Windows XP (NT5)
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.

225 lines
7.1 KiB

  1. /***
  2. * mbstring.h - MBCS string manipulation macros and functions
  3. *
  4. * Copyright (c) 1990-1995, 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. ****/
  13. #ifndef _INC_MBSTRING
  14. #define _INC_MBSTRING
  15. #if !defined(_WIN32) && !defined(_MAC)
  16. #error ERROR: Only Mac or Win32 targets supported!
  17. #endif
  18. #ifdef _MSC_VER
  19. /*
  20. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  21. * alignment.
  22. */
  23. #pragma pack(push,8)
  24. #endif /* _MSC_VER */
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  29. #ifndef _CRTAPI1
  30. #if _MSC_VER >= 800 && _M_IX86 >= 300
  31. #define _CRTAPI1 __cdecl
  32. #else
  33. #define _CRTAPI1
  34. #endif
  35. #endif
  36. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  37. #ifndef _CRTAPI2
  38. #if _MSC_VER >= 800 && _M_IX86 >= 300
  39. #define _CRTAPI2 __cdecl
  40. #else
  41. #define _CRTAPI2
  42. #endif
  43. #endif
  44. /* Define _CRTIMP */
  45. #ifndef _CRTIMP
  46. #ifdef _NTSDK
  47. /* definition compatible with NT SDK */
  48. #define _CRTIMP
  49. #else /* ndef _NTSDK */
  50. /* current definition */
  51. #ifdef _DLL
  52. #define _CRTIMP __declspec(dllimport)
  53. #else /* ndef _DLL */
  54. #define _CRTIMP
  55. #endif /* _DLL */
  56. #endif /* _NTSDK */
  57. #endif /* _CRTIMP */
  58. /* Define __cdecl for non-Microsoft compilers */
  59. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  60. #define __cdecl
  61. #endif
  62. #ifndef _SIZE_T_DEFINED
  63. typedef unsigned int size_t;
  64. #define _SIZE_T_DEFINED
  65. #endif
  66. #ifndef _NLSCMP_DEFINED
  67. #define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
  68. #define _NLSCMP_DEFINED
  69. #endif
  70. #ifndef _VA_LIST_DEFINED
  71. #ifdef _M_ALPHA
  72. typedef struct {
  73. char *a0; /* pointer to first homed integer argument */
  74. int offset; /* byte offset of next parameter */
  75. } va_list;
  76. #else
  77. typedef char * va_list;
  78. #endif
  79. #define _VA_LIST_DEFINED
  80. #endif
  81. #ifndef _FILE_DEFINED
  82. struct _iobuf {
  83. char *_ptr;
  84. int _cnt;
  85. char *_base;
  86. int _flag;
  87. int _file;
  88. int _charbuf;
  89. int _bufsiz;
  90. char *_tmpfname;
  91. };
  92. typedef struct _iobuf FILE;
  93. #define _FILE_DEFINED
  94. #endif
  95. /*
  96. * MBCS - Multi-Byte Character Set
  97. */
  98. #ifndef _MBSTRING_DEFINED
  99. /* function prototypes */
  100. _CRTIMP unsigned int __cdecl _mbbtombc(unsigned int);
  101. _CRTIMP int __cdecl _mbbtype(unsigned char, int);
  102. _CRTIMP unsigned int __cdecl _mbctombb(unsigned int);
  103. _CRTIMP int __cdecl _mbsbtype(const unsigned char *, size_t);
  104. _CRTIMP unsigned char * __cdecl _mbscat(unsigned char *, const unsigned char *);
  105. _CRTIMP unsigned char * __cdecl _mbschr(const unsigned char *, unsigned int);
  106. _CRTIMP int __cdecl _mbscmp(const unsigned char *, const unsigned char *);
  107. _CRTIMP int __cdecl _mbscoll(const unsigned char *, const unsigned char *);
  108. _CRTIMP unsigned char * __cdecl _mbscpy(unsigned char *, const unsigned char *);
  109. _CRTIMP size_t __cdecl _mbscspn(const unsigned char *, const unsigned char *);
  110. _CRTIMP unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned char *);
  111. _CRTIMP unsigned char * __cdecl _mbsdup(const unsigned char *);
  112. _CRTIMP int __cdecl _mbsicmp(const unsigned char *, const unsigned char *);
  113. _CRTIMP int __cdecl _mbsicoll(const unsigned char *, const unsigned char *);
  114. _CRTIMP unsigned char * __cdecl _mbsinc(const unsigned char *);
  115. _CRTIMP size_t __cdecl _mbslen(const unsigned char *);
  116. _CRTIMP unsigned char * __cdecl _mbslwr(unsigned char *);
  117. _CRTIMP unsigned char * __cdecl _mbsnbcat(unsigned char *, const unsigned char *, size_t);
  118. _CRTIMP int __cdecl _mbsnbcmp(const unsigned char *, const unsigned char *, size_t);
  119. _CRTIMP int __cdecl _mbsnbcoll(const unsigned char *, const unsigned char *, size_t);
  120. _CRTIMP size_t __cdecl _mbsnbcnt(const unsigned char *, size_t);
  121. _CRTIMP unsigned char * __cdecl _mbsnbcpy(unsigned char *, const unsigned char *, size_t);
  122. _CRTIMP int __cdecl _mbsnbicmp(const unsigned char *, const unsigned char *, size_t);
  123. _CRTIMP int __cdecl _mbsnbicoll(const unsigned char *, const unsigned char *, size_t);
  124. _CRTIMP unsigned char * __cdecl _mbsnbset(unsigned char *, unsigned int, size_t);
  125. _CRTIMP unsigned char * __cdecl _mbsncat(unsigned char *, const unsigned char *, size_t);
  126. _CRTIMP size_t __cdecl _mbsnccnt(const unsigned char *, size_t);
  127. _CRTIMP int __cdecl _mbsncmp(const unsigned char *, const unsigned char *, size_t);
  128. _CRTIMP int __cdecl _mbsncoll(const unsigned char *, const unsigned char *, size_t);
  129. _CRTIMP unsigned char * __cdecl _mbsncpy(unsigned char *, const unsigned char *, size_t);
  130. _CRTIMP unsigned int __cdecl _mbsnextc (const unsigned char *);
  131. _CRTIMP int __cdecl _mbsnicmp(const unsigned char *, const unsigned char *, size_t);
  132. _CRTIMP int __cdecl _mbsnicoll(const unsigned char *, const unsigned char *, size_t);
  133. _CRTIMP unsigned char * __cdecl _mbsninc(const unsigned char *, size_t);
  134. _CRTIMP unsigned char * __cdecl _mbsnset(unsigned char *, unsigned int, size_t);
  135. _CRTIMP unsigned char * __cdecl _mbspbrk(const unsigned char *, const unsigned char *);
  136. _CRTIMP unsigned char * __cdecl _mbsrchr(const unsigned char *, unsigned int);
  137. _CRTIMP unsigned char * __cdecl _mbsrev(unsigned char *);
  138. _CRTIMP unsigned char * __cdecl _mbsset(unsigned char *, unsigned int);
  139. _CRTIMP size_t __cdecl _mbsspn(const unsigned char *, const unsigned char *);
  140. _CRTIMP unsigned char * __cdecl _mbsspnp(const unsigned char *, const unsigned char *);
  141. _CRTIMP unsigned char * __cdecl _mbsstr(const unsigned char *, const unsigned char *);
  142. _CRTIMP unsigned char * __cdecl _mbstok(unsigned char *, const unsigned char *);
  143. _CRTIMP unsigned char * __cdecl _mbsupr(unsigned char *);
  144. _CRTIMP size_t __cdecl _mbclen(const unsigned char *);
  145. _CRTIMP void __cdecl _mbccpy(unsigned char *, const unsigned char *);
  146. #define _mbccmp(_cpc1, _cpc2) _mbsncmp((_cpc1),(_cpc2),1)
  147. /* character routines */
  148. _CRTIMP int __cdecl _ismbcalnum(unsigned int);
  149. _CRTIMP int __cdecl _ismbcalpha(unsigned int);
  150. _CRTIMP int __cdecl _ismbcdigit(unsigned int);
  151. _CRTIMP int __cdecl _ismbcgraph(unsigned int);
  152. _CRTIMP int __cdecl _ismbclegal(unsigned int);
  153. _CRTIMP int __cdecl _ismbclower(unsigned int);
  154. _CRTIMP int __cdecl _ismbcprint(unsigned int);
  155. _CRTIMP int __cdecl _ismbcpunct(unsigned int);
  156. _CRTIMP int __cdecl _ismbcspace(unsigned int);
  157. _CRTIMP int __cdecl _ismbcupper(unsigned int);
  158. _CRTIMP unsigned int __cdecl _mbctolower(unsigned int);
  159. _CRTIMP unsigned int __cdecl _mbctoupper(unsigned int);
  160. #define _MBSTRING_DEFINED
  161. #endif
  162. #ifndef _MBLEADTRAIL_DEFINED
  163. _CRTIMP int __cdecl _ismbblead( unsigned int );
  164. _CRTIMP int __cdecl _ismbbtrail( unsigned int );
  165. _CRTIMP int __cdecl _ismbslead( const unsigned char *, const unsigned char *);
  166. _CRTIMP int __cdecl _ismbstrail( const unsigned char *, const unsigned char *);
  167. #define _MBLEADTRAIL_DEFINED
  168. #endif
  169. /* Kanji specific prototypes. */
  170. _CRTIMP int __cdecl _ismbchira(unsigned int);
  171. _CRTIMP int __cdecl _ismbckata(unsigned int);
  172. _CRTIMP int __cdecl _ismbcsymbol(unsigned int);
  173. _CRTIMP int __cdecl _ismbcl0(unsigned int);
  174. _CRTIMP int __cdecl _ismbcl1(unsigned int);
  175. _CRTIMP int __cdecl _ismbcl2(unsigned int);
  176. _CRTIMP unsigned int __cdecl _mbcjistojms(unsigned int);
  177. _CRTIMP unsigned int __cdecl _mbcjmstojis(unsigned int);
  178. _CRTIMP unsigned int __cdecl _mbctohira(unsigned int);
  179. _CRTIMP unsigned int __cdecl _mbctokata(unsigned int);
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183. #ifdef _MSC_VER
  184. #pragma pack(pop)
  185. #endif /* _MSC_VER */
  186. #endif /* _INC_MBSTRING */