home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / setlocal.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  4KB  |  156 lines

  1. /***
  2. *setlocal.h - internal definitions used by locale-dependent functions.
  3. *
  4. *       Copyright (c) 1991-1998, 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. ****/
  13.  
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif  /* _MSC_VER > 1000 */
  17.  
  18. #ifndef _INC_SETLOCAL
  19. #define _INC_SETLOCAL
  20.  
  21. #ifndef _CRTBLD
  22. /*
  23.  * This is an internal C runtime header file. It is used when building
  24.  * the C runtimes only. It is not to be used as a public header file.
  25.  */
  26. #error ERROR: Use of C runtime library internal header file.
  27. #endif  /* _CRTBLD */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif  /* __cplusplus */
  32.  
  33. #include <cruntime.h>
  34. #include <oscalls.h>
  35. #include <limits.h>
  36.  
  37. /* Define _CRTIMP */
  38.  
  39. #ifndef _CRTIMP
  40. #ifdef CRTDLL
  41. #define _CRTIMP __declspec(dllexport)
  42. #else  /* CRTDLL */
  43. #ifdef _DLL
  44. #define _CRTIMP __declspec(dllimport)
  45. #else  /* _DLL */
  46. #define _CRTIMP
  47. #endif  /* _DLL */
  48. #endif  /* CRTDLL */
  49. #endif  /* _CRTIMP */
  50.  
  51. #define ERR_BUFFER_TOO_SMALL    1   // should be in windef.h
  52.  
  53. #define _CLOCALEHANDLE  0       /* "C" locale handle */
  54. #define _CLOCALECP      CP_ACP  /* "C" locale Code page */
  55.  
  56. /* Define the max length for each string type including space for a null. */
  57.  
  58. #define _MAX_WDAY_ABBR  4
  59. #define _MAX_WDAY   10
  60. #define _MAX_MONTH_ABBR 4
  61. #define _MAX_MONTH 10
  62. #define _MAX_AMPM   3
  63.  
  64. #define _DATE_LENGTH    8       /* mm/dd/yy (null not included) */
  65. #define _TIME_LENGTH    8       /* hh:mm:ss (null not included) */
  66.  
  67. /* LC_TIME localization structure */
  68.  
  69. struct __lc_time_data {
  70.         char *wday_abbr[7];
  71.         char *wday[7];
  72.         char *month_abbr[12];
  73.         char *month[12];
  74.         char *ampm[2];
  75.         char *ww_sdatefmt;
  76.         char *ww_ldatefmt;
  77.         char *ww_timefmt;
  78. };
  79.  
  80.  
  81. #define MAX_LANG_LEN        64  /* max language name length */
  82. #define MAX_CTRY_LEN        64  /* max country name length */
  83. #define MAX_MODIFIER_LEN    0   /* max modifier name length - n/a */
  84. #define MAX_LC_LEN          (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
  85.                                 /* max entire locale string length */
  86. #define MAX_CP_LEN          8   /* max code page name length */
  87. #define CATNAMES_LEN        57  /* "LC_COLLATE=;LC_CTYPE=;..." length */
  88.  
  89. #define LC_INT_TYPE         0
  90. #define LC_STR_TYPE         1
  91.  
  92. #ifndef _TAGLC_ID_DEFINED
  93. typedef struct tagLC_ID {
  94.         WORD wLanguage;
  95.         WORD wCountry;
  96.         WORD wCodePage;
  97. } LC_ID, *LPLC_ID;
  98. #define _TAGLC_ID_DEFINED
  99. #endif  /* _TAGLC_ID_DEFINED */
  100.  
  101.  
  102. typedef struct tagLC_STRINGS {
  103.         char szLanguage[MAX_LANG_LEN];
  104.         char szCountry[MAX_CTRY_LEN];
  105.         char szCodePage[MAX_CP_LEN];
  106. } LC_STRINGS, *LPLC_STRINGS;
  107.  
  108. extern LC_ID __lc_id[];                 /* complete info from GetQualifiedLocale */
  109. _CRTIMP extern LCID __lc_handle[];      /* locale "handles" -- ignores country info */
  110. _CRTIMP extern UINT __lc_codepage;      /* code page */
  111. _CRTIMP extern UINT __lc_collate_cp;    /* code page for LC_COLLATE */
  112.  
  113. BOOL __cdecl __get_qualified_locale(const LPLC_STRINGS, LPLC_ID, LPLC_STRINGS);
  114.  
  115. int __cdecl __getlocaleinfo (int, LCID, LCTYPE, void *);
  116.  
  117. /* lconv structure for the "C" locale */
  118. extern struct lconv __lconv_c;
  119.  
  120. /* pointer to current lconv structure */
  121. extern struct lconv * __lconv;
  122.  
  123. /* initial values for lconv structure */
  124. extern char __lconv_static_decimal[];
  125. extern char __lconv_static_null[];
  126.  
  127. ///* language and country string definitions */
  128. //typedef struct tagLANGREC
  129. //{
  130. //        CHAR * szLanguage;
  131. //        WORD wLanguage;
  132. //} LANGREC;
  133. //extern LANGREC __rg_lang_rec[];
  134. //
  135. ///ypedef struct tagCTRYREC
  136. //{
  137. //        CHAR * szCountry;
  138. //        WORD wCountry;
  139. //} CTRYREC;
  140. //extern CTRYREC __rg_ctry_rec[];
  141.  
  142. /* Initialization functions for locale categories */
  143.  
  144. int __cdecl __init_collate(void);
  145. int __cdecl __init_ctype(void);
  146. int __cdecl __init_monetary(void);
  147. int __cdecl __init_numeric(void);
  148. int __cdecl __init_time(void);
  149. int __cdecl __init_dummy(void);
  150.  
  151. #ifdef __cplusplus
  152. }
  153. #endif  /* __cplusplus */
  154.  
  155. #endif  /* _INC_SETLOCAL */
  156.