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.

260 lines
9.2 KiB

  1. /***
  2. *setlocal.h - internal definitions used by locale-dependent functions.
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains internal definitions/declarations for locale-dependent
  8. * functions, in particular those required by setlocale().
  9. *
  10. * [Internal]
  11. *
  12. *Revision History:
  13. * 10-16-91 ETC 32-bit version created from 16-bit setlocal.c
  14. * 12-20-91 ETC Removed GetLocaleInfo structure definitions.
  15. * 08-18-92 KRS Make _CLOCALEHANDLE == LANGNEUTRAL HANDLE = 0.
  16. * 12-17-92 CFW Added LC_ID, LCSTRINGS, and GetQualifiedLocale
  17. * 12-17-92 KRS Change value of NLSCMPERROR from 0 to INT_MAX.
  18. * 01-08-93 CFW Added LC_*_TYPE and _getlocaleinfo (wrapper) prototype.
  19. * 01-13-93 KRS Change LCSTRINGS back to LC_STRINGS for consistency.
  20. * Change _getlocaleinfo prototype again.
  21. * 02-08-93 CFW Added time defintions from locale.h, added 'const' to
  22. * GetQualifiedLocale prototype, added _lconv_static_*.
  23. * 02-16-93 CFW Changed time defs to long and short.
  24. * 03-17-93 CFW Add language and country info definitions.
  25. * 03-23-93 CFW Add _ to GetQualifiedLocale prototype.
  26. * 03-24-93 CFW Change to _get_qualified_locale.
  27. * 04-06-93 SKS Replace _CRTAPI1/2/3 with __cdecl, _CRTVAR1 with nothing
  28. * 04-07-93 CFW Added extern struct lconv definition.
  29. * 09-14-93 CFW Add internal use __aw_* function prototypes.
  30. * 09-15-93 CFW Use ANSI conformant "__" names.
  31. * 09-27-93 CFW Fix function prototypes.
  32. * 11-09-93 CFW Allow user to pass in code page to __crtxxx().
  33. * 02-04-94 CFW Remove unused first param from get_qualified_locale.
  34. * 03-30-93 CFW Move internal use __aw_* function prototypes to awint.h.
  35. * 04-07-94 GJF Added declaration for __lconv. Made declarations of
  36. * __lconv_c, __lconv, __lc_codepage, __lc_handle
  37. * conditional on ndef DLL_FOR_WIN32S. Conditionally
  38. * included win32s.h.
  39. * 04-11-94 CFW Remove NLSCMPERROR.
  40. * 04-13-94 GJF Protected def of tagLC_ID, and typedefs to it, since
  41. * they are duplicated in win32s.h.
  42. * 04-15-94 GJF Added prototypes for locale category initialization
  43. * functions. Added declaration for __clocalestr.
  44. * 02-14-95 CFW Clean up Mac merge.
  45. * 03-29-95 CFW Add error message to internal headers.
  46. * 04-11-95 CFW Make country/language strings pointers.
  47. * 12-14-95 JWM Add "#pragma once".
  48. * 06-05-96 GJF Made __lc_handle and __lc_codepage _CRTIMP. Also,
  49. * cleaned up the formatting a bit.
  50. * 01-31-97 RDK Changed MAX_CP_LENGTH to 8 from 5 to accomodate up to
  51. * 7-digit codepages, e.g., 5-digit ISO codepages.
  52. * 02-05-97 GJF Cleaned out obsolete support for DLL_FOR_WIN32S and
  53. * _NTSDK.
  54. * 01-12-98 GJF Added __lc_collate_cp.
  55. * 09-10-98 GJF Added support for per-thread locale information.
  56. * 11-06-98 GJF Doubled MAX_CP_LEN (8 was a little small).
  57. * 03-25-99 GJF More reference counters for threadlocinfo stuff
  58. * 04-24-99 PML Added lconv_intl_refcount to threadlocinfo.
  59. * 26-01-00 GB Added __lc_clike.
  60. * 06-08-00 PML Rename THREADLOCALEINFO to _THREADLOCALEINFO.
  61. * 09-06-00 GB deleted _wctype and _pwctype from threadlocinfo.
  62. * 01-29-01 GB Added _func function version of data variable used in
  63. * msvcprt.lib to work with STATIC_CPPLIB
  64. * 03-25-01 PML Add ww_caltype & ww_lcid to __lc_time_data (vs7#196892)
  65. *
  66. ****/
  67. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  68. #pragma once
  69. #endif
  70. #ifndef _INC_SETLOCAL
  71. #define _INC_SETLOCAL
  72. #ifndef _CRTBLD
  73. /*
  74. * This is an internal C runtime header file. It is used when building
  75. * the C runtimes only. It is not to be used as a public header file.
  76. */
  77. #error ERROR: Use of C runtime library internal header file.
  78. #endif /* _CRTBLD */
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82. #include <cruntime.h>
  83. #include <oscalls.h>
  84. #include <limits.h>
  85. /* Define _CRTIMP */
  86. #ifndef _CRTIMP
  87. #ifdef CRTDLL
  88. #define _CRTIMP __declspec(dllexport)
  89. #else /* ndef CRTDLL */
  90. #ifdef _DLL
  91. #define _CRTIMP __declspec(dllimport)
  92. #else /* ndef _DLL */
  93. #define _CRTIMP
  94. #endif /* _DLL */
  95. #endif /* CRTDLL */
  96. #endif /* _CRTIMP */
  97. #define ERR_BUFFER_TOO_SMALL 1 // should be in windef.h
  98. #define _CLOCALEHANDLE 0 /* "C" locale handle */
  99. #define _CLOCALECP CP_ACP /* "C" locale Code page */
  100. #define _COFFSET 127 /* offset to where ctype will point,
  101. look in initctype on how it is being
  102. used */
  103. /* Define the max length for each string type including space for a null. */
  104. #define _MAX_WDAY_ABBR 4
  105. #define _MAX_WDAY 10
  106. #define _MAX_MONTH_ABBR 4
  107. #define _MAX_MONTH 10
  108. #define _MAX_AMPM 3
  109. #define _DATE_LENGTH 8 /* mm/dd/yy (null not included) */
  110. #define _TIME_LENGTH 8 /* hh:mm:ss (null not included) */
  111. /* LC_TIME localization structure */
  112. #ifndef __LC_TIME_DATA
  113. struct __lc_time_data {
  114. char *wday_abbr[7];
  115. char *wday[7];
  116. char *month_abbr[12];
  117. char *month[12];
  118. char *ampm[2];
  119. char *ww_sdatefmt;
  120. char *ww_ldatefmt;
  121. char *ww_timefmt;
  122. LCID ww_lcid;
  123. int ww_caltype;
  124. #ifdef _MT
  125. int refcount;
  126. #endif
  127. };
  128. #define __LC_TIME_DATA
  129. #endif
  130. #define MAX_LANG_LEN 64 /* max language name length */
  131. #define MAX_CTRY_LEN 64 /* max country name length */
  132. #define MAX_MODIFIER_LEN 0 /* max modifier name length - n/a */
  133. #define MAX_LC_LEN (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
  134. /* max entire locale string length */
  135. #define MAX_CP_LEN 16 /* max code page name length */
  136. #define CATNAMES_LEN 57 /* "LC_COLLATE=;LC_CTYPE=;..." length */
  137. #define LC_INT_TYPE 0
  138. #define LC_STR_TYPE 1
  139. #ifndef _TAGLC_ID_DEFINED
  140. typedef struct tagLC_ID {
  141. WORD wLanguage;
  142. WORD wCountry;
  143. WORD wCodePage;
  144. } LC_ID, *LPLC_ID;
  145. #define _TAGLC_ID_DEFINED
  146. #endif /* _TAGLC_ID_DEFINED */
  147. typedef struct tagLC_STRINGS {
  148. char szLanguage[MAX_LANG_LEN];
  149. char szCountry[MAX_CTRY_LEN];
  150. char szCodePage[MAX_CP_LEN];
  151. } LC_STRINGS, *LPLC_STRINGS;
  152. #ifdef _MT
  153. #ifndef _THREADLOCALEINFO
  154. typedef struct threadlocaleinfostruct {
  155. int refcount;
  156. UINT lc_codepage;
  157. UINT lc_collate_cp;
  158. LCID lc_handle[6];
  159. int lc_clike;
  160. int mb_cur_max;
  161. int * lconv_intl_refcount;
  162. int * lconv_num_refcount;
  163. int * lconv_mon_refcount;
  164. struct lconv * lconv;
  165. struct lconv * lconv_intl;
  166. int * ctype1_refcount;
  167. unsigned short * ctype1;
  168. const unsigned short * pctype;
  169. struct __lc_time_data * lc_time_curr;
  170. struct __lc_time_data * lc_time_intl;
  171. } threadlocinfo;
  172. typedef threadlocinfo * pthreadlocinfo;
  173. #define _THREADLOCALEINFO
  174. #endif
  175. extern pthreadlocinfo __ptlocinfo;
  176. pthreadlocinfo __cdecl __updatetlocinfo(void);
  177. #endif
  178. extern LC_ID __lc_id[]; /* complete info from GetQualifiedLocale */
  179. _CRTIMP extern LCID __lc_handle[]; /* locale "handles" -- ignores country info */
  180. _CRTIMP extern UINT __lc_codepage; /* code page */
  181. _CRTIMP extern UINT __lc_collate_cp; /* code page for LC_COLLATE */
  182. _CRTIMP extern int __lc_clike; /* if first 127 characters of
  183. current locale are same as
  184. first 127 characters of C_LOCALE */
  185. #ifndef _INTERNAL_IFSTRIP_
  186. /* These functions are for enabling STATIC_CPPLIB functionality */
  187. _CRTIMP LCID* __cdecl ___lc_handle_func(void);
  188. _CRTIMP UINT __cdecl ___lc_codepage_func(void);
  189. _CRTIMP UINT __cdecl ___lc_collate_cp_func(void);
  190. #endif
  191. BOOL __cdecl __get_qualified_locale(const LPLC_STRINGS, LPLC_ID, LPLC_STRINGS);
  192. int __cdecl __getlocaleinfo (int, LCID, LCTYPE, void *);
  193. /* lconv structure for the "C" locale */
  194. extern struct lconv __lconv_c;
  195. /* pointer to current lconv structure */
  196. extern struct lconv * __lconv;
  197. /* Pointer to non-C locale lconv */
  198. extern struct lconv *__lconv_intl;
  199. /* initial values for lconv structure */
  200. extern char __lconv_static_decimal[];
  201. extern char __lconv_static_null[];
  202. ///* language and country string definitions */
  203. //typedef struct tagLANGREC
  204. //{
  205. // CHAR * szLanguage;
  206. // WORD wLanguage;
  207. //} LANGREC;
  208. //extern LANGREC __rg_lang_rec[];
  209. //
  210. ///ypedef struct tagCTRYREC
  211. //{
  212. // CHAR * szCountry;
  213. // WORD wCountry;
  214. //} CTRYREC;
  215. //extern CTRYREC __rg_ctry_rec[];
  216. /* Initialization functions for locale categories */
  217. int __cdecl __init_collate(void);
  218. int __cdecl __init_ctype(void);
  219. int __cdecl __init_monetary(void);
  220. int __cdecl __init_numeric(void);
  221. int __cdecl __init_time(void);
  222. int __cdecl __init_dummy(void);
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226. #endif /* _INC_SETLOCAL */