source: Daodan/MinGW/include/locale.h@ 1159

Last change on this file since 1159 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 6.9 KB
Line 
1/*
2 * locale.h
3 *
4 * Functions and types for localization (ie. changing the appearance of
5 * output based on the standards of a certain country, or region).
6 *
7 * $Id: locale.h,v a3059ad5ee79 2016/06/12 19:22:07 keithmarshall $
8 *
9 * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10 * Copyright (C) 1997, 1999-2001, 2003, 2004, 2007, 2016, MinGW.org Project.
11 *
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice, this permission notice, and the following
21 * disclaimer shall be included in all copies or substantial portions of
22 * the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30 * DEALINGS IN THE SOFTWARE.
31 *
32 */
33#ifndef _LOCALE_H
34#pragma GCC system_header
35
36/* Some headers will include this file, just to acquire a globally
37 * consistent definition for the opaque locale_t data object type; it
38 * is only useful on Vista, or for users of non-free MSVCR80.DLL, (or
39 * its later derivatives), so, when either of these is applicable,
40 * ensure that we define it, (if we haven't done so already).
41 */
42#if ! defined __have_typedef_locale_t \
43&& (__MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA)
44/*
45 * FIXME: Do these actually have any value for Vista? Although the Vista
46 * release of MSVCRT.DLL exports several functions which require locale_t
47 * parameters, it appears to lack any mechanism whereby an object of that
48 * type might be created, or otherwise, a reference to such an object may
49 * be acquired.
50 */
51typedef struct __mingw_opaque_locale_t *_locale_t;
52typedef struct __mingw_opaque_locale_t * locale_t;
53
54/* Set a (private) pre-processor flag, to indicate that these data types
55 * have been defined; although GCC versions from 4.x onwards may accept
56 * repeated (consistent) definitions, this flag gives us the facility to
57 * avoid the overhead of repeatedly parsing this file, just to satisfy a
58 * __need_locale_t request which has been satisfied already.
59 */
60#define __have_typedef_locale_t 1
61#endif /* !__have_typedef_locale_t */
62
63/* When we are interested in more than just locale_t...
64 */
65#ifndef __need_locale_t
66/* ...content from <locale.h> is selectively shared with <wchar.h>;
67 * defer definition of the normal repeat inclusion guard, until...
68 */
69#ifndef __WCHAR_H_SOURCED__
70 /* ...we have confirmed that this inclusion is NOT the <wchar.h>
71 * selective request, or just a __need_locale_t request.
72 */
73#define _LOCALE_H
74
75/* All MinGW headers should include <_mingw.h>; do so only when NOT
76 * sourced by <wchar.h>, (which should have included it already).
77 */
78#include <_mingw.h>
79
80#define LC_ALL 0
81#define LC_COLLATE 1
82#define LC_CTYPE 2
83#define LC_MONETARY 3
84#define LC_NUMERIC 4
85#define LC_TIME 5
86#define LC_MIN LC_ALL
87#define LC_MAX LC_TIME
88
89#ifndef RC_INVOKED
90/* Both ISO-C and POSIX stipulate that <locale.h> should reproduce the
91 * definition of NULL, from <stddef.h>; although not required by either
92 * standard, we also require wchar_t, to support our declaration of the
93 * Microsoft specific _wsetlocale() function, below.
94 */
95#define __need_NULL
96#define __need_wchar_t
97#include <stddef.h>
98
99struct lconv
100{ /* The structure returned by the localeconv() function.
101 *
102 * AUTHOR'S NOTE:
103 * I have tried to test this, but I am limited by my knowledge of
104 * locale issues. The structure does not bomb if you look at the
105 * values, and 'decimal_point' even seems to be correct, but the
106 * rest of the values may, by default, not be particularly useful;
107 * indeed, they may even be meaningless, and in no way related to
108 * the international settings of the system.
109 */
110 char *decimal_point;
111 char *thousands_sep;
112 char *grouping;
113 char *int_curr_symbol;
114 char *currency_symbol;
115 char *mon_decimal_point;
116 char *mon_thousands_sep;
117 char *mon_grouping;
118 char *positive_sign;
119 char *negative_sign;
120 char int_frac_digits;
121 char frac_digits;
122 char p_cs_precedes;
123 char p_sep_by_space;
124 char n_cs_precedes;
125 char n_sep_by_space;
126 char p_sign_posn;
127 char n_sign_posn;
128};
129
130#endif /* ! RC_INVOKED */
131#endif /* !__WCHAR_H_SOURCED__ */
132
133#ifndef RC_INVOKED
134
135_BEGIN_C_DECLS
136
137#ifdef _LOCALE_H
138 /* The following pair of function prototypes are to be declared
139 * only when including <locale.h> in its own right, (i.e. when NOT
140 * sourced by <wchar.h>)...
141 */
142_CRTIMP __cdecl __MINGW_NOTHROW char *setlocale (int, const char *);
143_CRTIMP __cdecl __MINGW_NOTHROW struct lconv *localeconv (void);
144
145#endif
146 /* ...whereas, this must be declared in either case; (note that it
147 * not necessary to guard against a possible repeat declaration, as
148 * the compiler should accept this, without complaint, provided any
149 * prior declaration is consistent).
150 */
151_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wsetlocale (int, const wchar_t *);
152
153#if __MSVCRT_VERSION__ >= __MSVCR80_DLL
154/* The following are available to users of non-free MSVCR80.DLL, and
155 * its later derivatives. They are REQUIRED to create, or otherwise
156 * acquire a reference to, a locale_t object; they SHOULD also have
157 * been made available in MSVCRT.DLL, from Vista onwards, to support
158 * the use of functions added in that release which require locale_t
159 * parameters, but it seems that Microsoft, exhibiting their usual
160 * ineptitude, have neglected that requirement.
161 */
162#ifdef _LOCALE_H
163/* This triplet of functions are to be declared only when <locale.h>
164 * is included directly, and so is parsed in full...
165 */
166_CRTIMP __cdecl __MINGW_NOTHROW _locale_t _create_locale (int, const char *);
167_CRTIMP __cdecl __MINGW_NOTHROW _locale_t _get_current_locale (void);
168_CRTIMP __cdecl __MINGW_NOTHROW void _free_locale (locale_t);
169
170#endif
171/* ...whereas, this is required both when included directly, and also
172 * when indirectly included by <wchar.h>
173 */
174_CRTIMP __cdecl __MINGW_NOTHROW _locale_t _wcreate_locale (int, const wchar_t *);
175
176#endif /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */
177
178_END_C_DECLS
179
180#endif /* ! RC_INVOKED */
181#endif /* !__need_locale_t */
182
183/* We've already handled any pending __need_locale_t request; ensure
184 * that we cancel it, so that any more comprehensive further request,
185 * before _LOCALE_H is defined, will be handled appropriately.
186 */
187#undef __need_locale_t
188
189#endif /* !_LOCALE_H: $RCSfile: locale.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.