1 | /* $Id: lang.cpp,v 1.2 1999-05-31 22:08:09 phaller Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | *
|
---|
5 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
6 | *
|
---|
7 | */
|
---|
8 | /*
|
---|
9 | * Win32 language API functions for OS/2
|
---|
10 | *
|
---|
11 | * Copyright 1998 Sander van Leeuwen
|
---|
12 | * Copyright 1998 Patrick Haller
|
---|
13 | *
|
---|
14 | */
|
---|
15 | #include <os2win.h>
|
---|
16 | #include <winnls.h>
|
---|
17 | #include "unicode.h"
|
---|
18 | #include "misc.h"
|
---|
19 |
|
---|
20 | //******************************************************************************
|
---|
21 | //******************************************************************************
|
---|
22 | BOOL WIN32API IsValidCodePage(UINT CodePage)
|
---|
23 | {
|
---|
24 | dprintf(("KERNEL32: IsValidCodePage not implemented\n"));
|
---|
25 | return(TRUE);
|
---|
26 | }
|
---|
27 | //******************************************************************************
|
---|
28 | //******************************************************************************
|
---|
29 | LCID WIN32API GetUserDefaultLCID(void)
|
---|
30 | {
|
---|
31 | dprintf(("KERNEL32: OS2GetUserDefaultLCID: always retuns US English!\n"));
|
---|
32 | return(0x409); //US English
|
---|
33 | }
|
---|
34 | //******************************************************************************
|
---|
35 | //******************************************************************************
|
---|
36 | LCID WIN32API GetSystemDefaultLCID(void)
|
---|
37 | {
|
---|
38 | dprintf(("KERNEL32: OS2GetSystemDefaultLCID: always retuns US English!\n"));
|
---|
39 | return(0x409); //US English
|
---|
40 | }
|
---|
41 | //******************************************************************************
|
---|
42 | //******************************************************************************
|
---|
43 | LANGID WIN32API GetUserDefaultLangID()
|
---|
44 | {
|
---|
45 | dprintf(("KERNEL32: OS2GetUserDefaultLangID, always returns US English\n"));
|
---|
46 | return(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
---|
47 | }
|
---|
48 | //******************************************************************************
|
---|
49 | //******************************************************************************
|
---|
50 | LANGID WIN32API GetSystemDefaultLangID(void)
|
---|
51 | {
|
---|
52 | dprintf(("KERNEL32: OS2GetSystemDefaultLangID, always returns US English\n"));
|
---|
53 | return(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
---|
54 | }
|
---|
55 | //******************************************************************************
|
---|
56 | //TODO: Not complete (far from actually)!!
|
---|
57 | //******************************************************************************
|
---|
58 | int WIN32API GetLocaleInfoA(LCID lcid, LCTYPE LCType, LPSTR lpLCData, int cchData)
|
---|
59 | {
|
---|
60 | dprintf(("KERNEL32: OS2GetLocaleInfoA: Not complete!\n"));
|
---|
61 | if(cchData == 0)
|
---|
62 | return(1);
|
---|
63 | *lpLCData = '1';
|
---|
64 | return(1);
|
---|
65 | }
|
---|
66 | //******************************************************************************
|
---|
67 | //******************************************************************************
|
---|
68 | int WIN32API GetLocaleInfoW(LCID lcid, LCTYPE LCType, LPWSTR lpLCData, int cchData)
|
---|
69 | {
|
---|
70 | dprintf(("KERNEL32: OS2GetLocaleInfoA: Not complete!\n"));
|
---|
71 | if(cchData == 0)
|
---|
72 | return(1*sizeof(USHORT));
|
---|
73 | *lpLCData = (USHORT)'1';
|
---|
74 | return(sizeof(USHORT));
|
---|
75 | }
|
---|
76 | //******************************************************************************
|
---|
77 | //******************************************************************************
|
---|
78 | BOOL WIN32API IsValidLocale(LCID Locale, DWORD dwFlags)
|
---|
79 | {
|
---|
80 | dprintf(("KERNEL32: OS2IsValidLocale, always returns TRUE\n"));
|
---|
81 | return(TRUE);
|
---|
82 | }
|
---|
83 | //******************************************************************************
|
---|
84 | //******************************************************************************
|
---|
85 | LCID WIN32API GetThreadLocale()
|
---|
86 | {
|
---|
87 | dprintf(("KERNEL32: OS2GetThreadLocale always return US English!\n"));
|
---|
88 | return(0x409); //US English
|
---|
89 | }
|
---|
90 | //******************************************************************************
|
---|
91 | //******************************************************************************
|
---|
92 | //******************************************************************************
|
---|
93 | BOOL WIN32API SetThreadLocale( LCID locale )
|
---|
94 | {
|
---|
95 | dprintf(("KERNEL32: OS2SetThreadLocale not implemented!\n"));
|
---|
96 | return(TRUE);
|
---|
97 | }
|
---|
98 | //******************************************************************************
|
---|
99 | //******************************************************************************
|
---|
100 | BOOL WIN32API EnumSystemLocalesA(LOCALE_ENUMPROCA lpLocaleEnumProc,
|
---|
101 | DWORD dwFlags)
|
---|
102 | {
|
---|
103 | dprintf(("EnumSystemLocalesA %X %X\n", lpLocaleEnumProc, dwFlags));
|
---|
104 | if(lpLocaleEnumProc == NULL || ((dwFlags & LCID_INSTALLED) && (dwFlags & LCID_SUPPORTED))) {
|
---|
105 | dprintf(("Invalid parameter\n"));
|
---|
106 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
107 | return(FALSE);
|
---|
108 | }
|
---|
109 | lpLocaleEnumProc("OS/2 US English");
|
---|
110 | return(TRUE);
|
---|
111 | }
|
---|
112 | //******************************************************************************
|
---|
113 | //******************************************************************************
|
---|
114 | BOOL WIN32API EnumSystemLocalesW(LOCALE_ENUMPROCW lpLocaleEnumProc,
|
---|
115 | DWORD dwFlags)
|
---|
116 | {
|
---|
117 | WCHAR locStr[32];
|
---|
118 |
|
---|
119 | dprintf(("EnumSystemLocalesW %X %X\n", lpLocaleEnumProc, dwFlags));
|
---|
120 | if(lpLocaleEnumProc == NULL || ((dwFlags & LCID_INSTALLED) && (dwFlags & LCID_SUPPORTED))) {
|
---|
121 | dprintf(("Invalid parameter\n"));
|
---|
122 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
123 | return(FALSE);
|
---|
124 | }
|
---|
125 | AsciiToUnicode("OS/2 US English", locStr);
|
---|
126 | lpLocaleEnumProc(locStr);
|
---|
127 | return(TRUE);
|
---|
128 | }
|
---|
129 | //******************************************************************************
|
---|
130 | //******************************************************************************
|
---|
131 |
|
---|
132 |
|
---|
133 | /*****************************************************************************
|
---|
134 | * Name : BOOL SetLocaleInfoA
|
---|
135 | * Purpose : The SetLocaleInfoA function sets an item of locale information.
|
---|
136 | * It does so by making an entry in the process portion of the
|
---|
137 | * locale table. This setting only affects the user override portion
|
---|
138 | * of the locale settings; it does not set the system defaults.
|
---|
139 | * Only certain types of locale information, or LCTYPE values, can
|
---|
140 | * be set by this function. See the following Remarks section for a
|
---|
141 | * list of valid LCTYPE values.
|
---|
142 | * The locale information is always passed in as a null-terminated
|
---|
143 | * Unicode string in the Unicode (W) version of the function, and as
|
---|
144 | * a null-terminated ANSI string in the ANSI (A) version. No integers
|
---|
145 | * are allowed by this function; any numeric values must be specified
|
---|
146 | * as Unicode or ANSI text. Each LCTYPE has a particular format, as
|
---|
147 | * noted in Locale Identifiers.
|
---|
148 | * Parameters: LCID Locale locale identifier
|
---|
149 | * LCTYPE LCType type of information to set
|
---|
150 | * LPCTSTR lpLCData pointer to information to set
|
---|
151 | * Variables :
|
---|
152 | * Result : TRUE / FALSE
|
---|
153 | * Remark :
|
---|
154 | * Status : UNTESTED STUB
|
---|
155 | *
|
---|
156 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
157 | *****************************************************************************/
|
---|
158 |
|
---|
159 | BOOL WIN32API SetLocaleInfoA(LCID Locale,
|
---|
160 | LCTYPE LCType,
|
---|
161 | LPCSTR lpLCData)
|
---|
162 | {
|
---|
163 | dprintf(("KERNEL32: SetLocaleInfoA(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
164 | Locale,
|
---|
165 | LCType,
|
---|
166 | lpLCData));
|
---|
167 |
|
---|
168 | return (FALSE);
|
---|
169 | }
|
---|
170 |
|
---|
171 |
|
---|
172 | /*****************************************************************************
|
---|
173 | * Name : BOOL SetLocaleInfoW
|
---|
174 | * Purpose : The SetLocaleInfoW function sets an item of locale information.
|
---|
175 | * It does so by making an entry in the process portion of the
|
---|
176 | * locale table. This setting only affects the user override portion
|
---|
177 | * of the locale settings; it does not set the system defaults.
|
---|
178 | * Only certain types of locale information, or LCTYPE values, can
|
---|
179 | * be set by this function. See the following Remarks section for a
|
---|
180 | * list of valid LCTYPE values.
|
---|
181 | * The locale information is always passed in as a null-terminated
|
---|
182 | * Unicode string in the Unicode (W) version of the function, and as
|
---|
183 | * a null-terminated ANSI string in the ANSI (A) version. No integers
|
---|
184 | * are allowed by this function; any numeric values must be specified
|
---|
185 | * as Unicode or ANSI text. Each LCTYPE has a particular format, as
|
---|
186 | * noted in Locale Identifiers.
|
---|
187 | * Parameters: LCID Locale locale identifier
|
---|
188 | * LCTYPE LCType type of information to set
|
---|
189 | * LPCTSTR lpLCData pointer to information to set
|
---|
190 | * Variables :
|
---|
191 | * Result : TRUE / FALSE
|
---|
192 | * Remark :
|
---|
193 | * Status : UNTESTED STUB
|
---|
194 | *
|
---|
195 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
196 | *****************************************************************************/
|
---|
197 |
|
---|
198 | BOOL WIN32API SetLocaleInfoW(LCID Locale,
|
---|
199 | LCTYPE LCType,
|
---|
200 | LPCWSTR lpLCData)
|
---|
201 | {
|
---|
202 | dprintf(("KERNEL32: SetLocaleInfoW(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
203 | Locale,
|
---|
204 | LCType,
|
---|
205 | lpLCData));
|
---|
206 |
|
---|
207 | return (FALSE);
|
---|
208 | }
|
---|
209 |
|
---|
210 |
|
---|
211 | /*****************************************************************************
|
---|
212 | * Name : DWORD VerLanguageNameA
|
---|
213 | * Purpose : The VerLanguageNameA function converts the specified binary
|
---|
214 | * Microsoft language identifier into a text representation of the language.
|
---|
215 | * Parameters: DWORD idLang Microsoft language identifier
|
---|
216 | * LPTSTR lpszLang address of buffer for language string
|
---|
217 | * DWORD cbLang size of buffer
|
---|
218 | * Variables :
|
---|
219 | * Result : size of target buffer
|
---|
220 | * Remark :
|
---|
221 | * Status : UNTESTED STUB
|
---|
222 | *
|
---|
223 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
224 | *****************************************************************************/
|
---|
225 |
|
---|
226 | DWORD WIN32API VerLanguageNameA(UINT idLang,
|
---|
227 | LPSTR lpszLang,
|
---|
228 | UINT cbLang)
|
---|
229 | {
|
---|
230 | dprintf(("KERNEL32: VerLanguageNameA(%08x,%08x,%08x) not implemented.\n",
|
---|
231 | idLang,
|
---|
232 | lpszLang,
|
---|
233 | cbLang));
|
---|
234 |
|
---|
235 | return (0);
|
---|
236 | }
|
---|
237 |
|
---|
238 |
|
---|
239 | /*****************************************************************************
|
---|
240 | * Name : DWORD VerLanguageNameW
|
---|
241 | * Purpose : The VerLanguageNameW function converts the specified binary
|
---|
242 | * Microsoft language identifier into a text representation of the language.
|
---|
243 | * Parameters: DWORD idLang Microsoft language identifier
|
---|
244 | * LPTSTR lpszLang address of buffer for language string
|
---|
245 | * DWORD cbLang size of buffer
|
---|
246 | * Variables :
|
---|
247 | * Result : size of target buffer
|
---|
248 | * Remark :
|
---|
249 | * Status : UNTESTED STUB
|
---|
250 | *
|
---|
251 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
252 | *****************************************************************************/
|
---|
253 |
|
---|
254 | DWORD WIN32API VerLanguageNameW(UINT idLang,
|
---|
255 | LPWSTR lpszLang,
|
---|
256 | UINT cbLang)
|
---|
257 | {
|
---|
258 | dprintf(("KERNEL32: VerLanguageNameW(%08x,%08x,%08x) not implemented.\n",
|
---|
259 | idLang,
|
---|
260 | lpszLang,
|
---|
261 | cbLang));
|
---|
262 |
|
---|
263 | return (0);
|
---|
264 | }
|
---|
265 |
|
---|
266 |
|
---|