Release 951003
[wine/multimedia.git] / misc / ole2nls.c
blob5915ce8d828e206c7fe23f4bce42c7ff287a4169
1 /*
2 * OLE2NLS library
4 * Copyright 1995 Martin von Loewis
5 */
7 /* At the moment, these are only empty stubs.
8 */
10 #include <string.h>
11 #include "windows.h"
12 #include "ole.h"
13 #include "winnls.h"
14 #include "stddebug.h"
15 #include "debug.h"
17 /***********************************************************************
18 * GetUserDefaultLCID (OLE2NLS.1)
20 DWORD WINAPI GetUserDefaultLCID()
22 /* Default sorting, neutral sublanguage */
23 #if #LANG(En)
24 return 9;
25 #elif #LANG(De)
26 return 7;
27 #elif #LANG(Es)
28 return 7; /* Just a Guess :-) */
29 #elif #LANG(Fr)
30 return 7; /* ditto :-) */
31 #elif #LANG(No)
32 return 0x14;
33 #else
34 /* Neutral language */
35 return 0;
36 #endif
39 /***********************************************************************
40 * GetSystemDefaultLCID (OLE2NLS.2)
42 DWORD WINAPI GetSystemDefaultLCID()
44 return GetUserDefaultLCID();
47 /***********************************************************************
48 * GetUserDefaultLangID (OLE2NLS.3)
50 WORD WINAPI GetUserDefaultLangID()
52 return (WORD)GetUserDefaultLCID();
55 /***********************************************************************
56 * GetSystemDefaultLangID (OLE2NLS.4)
58 WORD WINAPI GetSystemDefaultLangID()
60 return GetUserDefaultLangID();
63 /***********************************************************************
64 * GetLocaleInfoA (OLE2NLS.5)
65 * Is the last parameter really WORD for Win16?
67 int WINAPI GetLocaleInfoA(DWORD lcid,DWORD LCType,LPSTR buf,WORD len)
69 char *retString;
70 int retLen;
71 dprintf_ole(stddeb,"GetLocaleInfoA(%8lX,%8lX,%p,%4X)\n",
72 lcid,LCType,buf,len);
73 /* Wine is supporting only the default locale */
74 if(lcid!=GetUserDefaultLCID())
76 dprintf_ole(stdnimp,"GetLocaleInfoA: Unknown locale\n");
77 return 0;
79 /* As an option, we could obtain the value from win.ini.
80 This would not match the Wine compile-time option.
81 Also, not all identifiers are available from win.ini */
82 retString=0;
83 retLen=0;
84 /* If we are through all of this, retLen should not be zero anymore.
85 If it is, the value is not supported */
86 #define LOCVAL(type,value) if(type==LCType) \
87 {retLen=strlen(value)+1;\
88 retString=value; \
90 #define UNSUPPORTED(type) if(type==lcid)retString=#type;
92 /* I really wish I would know a better way to do this */
93 UNSUPPORTED(LOCALE_ILANGUAGE)
94 UNSUPPORTED(LOCALE_SLANGUAGE)
95 UNSUPPORTED(LOCALE_SENGLANGUAGE)
96 UNSUPPORTED(LOCALE_SABBREVLANGNAME)
97 UNSUPPORTED(LOCALE_SNATIVELANGNAME)
98 UNSUPPORTED(LOCALE_ICOUNTRY)
99 UNSUPPORTED(LOCALE_SCOUNTRY)
100 UNSUPPORTED(LOCALE_SENGCOUNTRY)
101 UNSUPPORTED(LOCALE_SABBREVCTRYNAME)
102 UNSUPPORTED(LOCALE_SNATIVECTRYNAME)
103 UNSUPPORTED(LOCALE_IDEFAULTLANGUAGE)
104 UNSUPPORTED(LOCALE_IDEFAULTCOUNTRY)
105 UNSUPPORTED(LOCALE_IDEFAULTCODEPAGE)
106 UNSUPPORTED(LOCALE_IDEFAULTANSICODEPAGE)
107 UNSUPPORTED(LOCALE_SLIST)
108 UNSUPPORTED(LOCALE_IMEASURE)
109 UNSUPPORTED(LOCALE_SDECIMAL)
110 UNSUPPORTED(LOCALE_STHOUSAND)
111 UNSUPPORTED(LOCALE_SGROUPING)
112 UNSUPPORTED(LOCALE_IDIGITS)
113 UNSUPPORTED(LOCALE_ILZERO)
114 UNSUPPORTED(LOCALE_INEGNUMBER)
115 UNSUPPORTED(LOCALE_SNATIVEDIGITS)
116 UNSUPPORTED(LOCALE_SCURRENCY)
117 UNSUPPORTED(LOCALE_SINTLSYMBOL)
118 UNSUPPORTED(LOCALE_SMONDECIMALSEP)
119 UNSUPPORTED(LOCALE_SMONTHOUSANDSEP)
120 UNSUPPORTED(LOCALE_SMONGROUPING)
121 UNSUPPORTED(LOCALE_ICURRDIGITS)
122 UNSUPPORTED(LOCALE_IINTLCURRDIGITS)
123 UNSUPPORTED(LOCALE_ICURRENCY)
124 UNSUPPORTED(LOCALE_INEGCURR)
125 UNSUPPORTED(LOCALE_SDATE)
126 UNSUPPORTED(LOCALE_STIME)
127 UNSUPPORTED(LOCALE_SSHORTDATE)
128 UNSUPPORTED(LOCALE_SLONGDATE)
129 UNSUPPORTED(LOCALE_STIMEFORMAT)
130 UNSUPPORTED(LOCALE_IDATE)
131 UNSUPPORTED(LOCALE_ILDATE)
132 UNSUPPORTED(LOCALE_ITIME)
133 UNSUPPORTED(LOCALE_ITIMEMARKPOSN)
134 UNSUPPORTED(LOCALE_ICENTURY)
135 UNSUPPORTED(LOCALE_ITLZERO)
136 UNSUPPORTED(LOCALE_IDAYLZERO)
137 UNSUPPORTED(LOCALE_IMONLZERO)
138 UNSUPPORTED(LOCALE_S1159)
139 UNSUPPORTED(LOCALE_S2359)
140 UNSUPPORTED(LOCALE_ICALENDARTYPE)
141 UNSUPPORTED(LOCALE_IOPTIONALCALENDAR)
142 UNSUPPORTED(LOCALE_IFIRSTDAYOFWEEK)
143 UNSUPPORTED(LOCALE_IFIRSTWEEKOFYEAR)
144 UNSUPPORTED(LOCALE_SDAYNAME1)
145 UNSUPPORTED(LOCALE_SDAYNAME2)
146 UNSUPPORTED(LOCALE_SDAYNAME3)
147 UNSUPPORTED(LOCALE_SDAYNAME4)
148 UNSUPPORTED(LOCALE_SDAYNAME5)
149 UNSUPPORTED(LOCALE_SDAYNAME6)
150 UNSUPPORTED(LOCALE_SDAYNAME7)
151 UNSUPPORTED(LOCALE_SABBREVDAYNAME1)
152 UNSUPPORTED(LOCALE_SABBREVDAYNAME2)
153 UNSUPPORTED(LOCALE_SABBREVDAYNAME3)
154 UNSUPPORTED(LOCALE_SABBREVDAYNAME4)
155 UNSUPPORTED(LOCALE_SABBREVDAYNAME5)
156 UNSUPPORTED(LOCALE_SABBREVDAYNAME6)
157 UNSUPPORTED(LOCALE_SABBREVDAYNAME7)
158 UNSUPPORTED(LOCALE_SMONTHNAME1)
159 UNSUPPORTED(LOCALE_SMONTHNAME2)
160 UNSUPPORTED(LOCALE_SMONTHNAME3)
161 UNSUPPORTED(LOCALE_SMONTHNAME4)
162 UNSUPPORTED(LOCALE_SMONTHNAME5)
163 UNSUPPORTED(LOCALE_SMONTHNAME6)
164 UNSUPPORTED(LOCALE_SMONTHNAME7)
165 UNSUPPORTED(LOCALE_SMONTHNAME8)
166 UNSUPPORTED(LOCALE_SMONTHNAME9)
167 UNSUPPORTED(LOCALE_SMONTHNAME10)
168 UNSUPPORTED(LOCALE_SMONTHNAME11)
169 UNSUPPORTED(LOCALE_SMONTHNAME12)
170 UNSUPPORTED(LOCALE_SMONTHNAME13)
171 UNSUPPORTED(LOCALE_SABBREVMONTHNAME1)
172 UNSUPPORTED(LOCALE_SABBREVMONTHNAME2)
173 UNSUPPORTED(LOCALE_SABBREVMONTHNAME3)
174 UNSUPPORTED(LOCALE_SABBREVMONTHNAME4)
175 UNSUPPORTED(LOCALE_SABBREVMONTHNAME5)
176 UNSUPPORTED(LOCALE_SABBREVMONTHNAME6)
177 UNSUPPORTED(LOCALE_SABBREVMONTHNAME7)
178 UNSUPPORTED(LOCALE_SABBREVMONTHNAME8)
179 UNSUPPORTED(LOCALE_SABBREVMONTHNAME9)
180 UNSUPPORTED(LOCALE_SABBREVMONTHNAME10)
181 UNSUPPORTED(LOCALE_SABBREVMONTHNAME11)
182 UNSUPPORTED(LOCALE_SABBREVMONTHNAME12)
183 UNSUPPORTED(LOCALE_SABBREVMONTHNAME13)
184 UNSUPPORTED(LOCALE_SPOSITIVESIGN)
185 UNSUPPORTED(LOCALE_SNEGATIVESIGN)
186 UNSUPPORTED(LOCALE_IPOSSIGNPOSN)
187 UNSUPPORTED(LOCALE_INEGSIGNPOSN)
188 UNSUPPORTED(LOCALE_IPOSSYMPRECEDES)
189 UNSUPPORTED(LOCALE_IPOSSEPBYSPACE)
190 UNSUPPORTED(LOCALE_INEGSYMPRECEDES)
191 UNSUPPORTED(LOCALE_INEGSEPBYSPACE)
193 /* Now, the language specific definitions. They don't have to be
194 complete */
195 #if #LANG(De)
196 /* This definitions apply to Germany only. Users in Austria
197 or Switzerland might want to modify them */
198 LOCVAL(LOCALE_ILANGUAGE,"9")
199 LOCVAL(LOCALE_SLANGUAGE,"Deutsch")
200 LOCVAL(LOCALE_SENGLANGUAGE,"German")
201 LOCVAL(LOCALE_SABBREVLANGNAME,"deu")
202 LOCVAL(LOCALE_SNATIVELANGNAME,"Deutsch")
203 LOCVAL(LOCALE_ICOUNTRY,"49")
204 LOCVAL(LOCALE_SCOUNTRY,"Deutschland")
205 LOCVAL(LOCALE_SENGCOUNTRY,"Deutschland")
206 LOCVAL(LOCALE_SABBREVCTRYNAME,"De")
207 LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland")
208 LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9")
209 LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49")
210 /* Dunno
211 LOCVAL(LOCALE_IDEFAULTCODEPAGE)
212 LOCVAL(LOCALE_IDEFAULTANSICODEPAGE)
214 LOCVAL(LOCALE_SLIST,";")
215 LOCVAL(LOCALE_IMEASURE,"0")
216 LOCVAL(LOCALE_SDECIMAL,",")
217 LOCVAL(LOCALE_STHOUSAND,".")
219 LOCVAL(LOCALE_SGROUPING)
221 LOCVAL(LOCALE_IDIGITS,"2")
222 LOCVAL(LOCALE_ILZERO,"1")
224 LOCVAL(LOCALE_INEGNUMBER)
225 Is this "0123456789" ??
226 LOCVAL(LOCALE_SNATIVEDIGITS)
228 LOCVAL(LOCALE_SCURRENCY,"DM")
230 LOCVAL(LOCALE_SINTLSYMBOL)
231 LOCVAL(LOCALE_SMONDECIMALSEP)
232 LOCVAL(LOCALE_SMONTHOUSANDSEP)
233 LOCVAL(LOCALE_SMONGROUPING)
235 LOCVAL(LOCALE_ICURRDIGITS,"2")
237 LOCVAL(LOCALE_IINTLCURRDIGITS)
239 LOCVAL(LOCALE_ICURRENCY,"3")
240 LOCVAL(LOCALE_INEGCURR,"8")
241 LOCVAL(LOCALE_SDATE,".")
242 LOCVAL(LOCALE_STIME,":")
243 LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
244 LOCVAL(LOCALE_SLONGDATE,"ddd, d. MMMM yyyy")
246 LOCVAL(LOCALE_STIMEFORMAT)
248 LOCVAL(LOCALE_IDATE,"1")
250 LOCVAL(LOCALE_ILDATE)
252 LOCVAL(LOCALE_ITIME,"1")
254 LOCVAL(LOCALE_ITIMEMARKPOSN)
255 LOCVAL(LOCALE_ICENTURY)
257 LOCVAL(LOCALE_ITLZERO,"1")
259 LOCVAL(LOCALE_IDAYLZERO)
260 LOCVAL(LOCALE_IMONLZERO)
261 LOCVAL(LOCALE_S1159)
262 LOCVAL(LOCALE_S2359)
263 LOCVAL(LOCALE_ICALENDARTYPE)
264 LOCVAL(LOCALE_IOPTIONALCALENDAR)
265 LOCVAL(LOCALE_IFIRSTDAYOFWEEK)
266 LOCVAL(LOCALE_IFIRSTWEEKOFYEAR)
268 LOCVAL(LOCALE_SDAYNAME1,"Montag")
269 LOCVAL(LOCALE_SDAYNAME2,"Dienstag")
270 LOCVAL(LOCALE_SDAYNAME3,"Mittwoch")
271 LOCVAL(LOCALE_SDAYNAME4,"Donnerstag")
272 LOCVAL(LOCALE_SDAYNAME5,"Freitag")
273 LOCVAL(LOCALE_SDAYNAME6,"Sonnabend")
274 LOCVAL(LOCALE_SDAYNAME7,"Sonntag")
275 LOCVAL(LOCALE_SABBREVDAYNAME1,"Mo")
276 LOCVAL(LOCALE_SABBREVDAYNAME2,"Di")
277 LOCVAL(LOCALE_SABBREVDAYNAME3,"Mi")
278 LOCVAL(LOCALE_SABBREVDAYNAME4,"Do")
279 LOCVAL(LOCALE_SABBREVDAYNAME5,"Fr")
280 LOCVAL(LOCALE_SABBREVDAYNAME6,"Sa")
281 LOCVAL(LOCALE_SABBREVDAYNAME7,"So")
282 LOCVAL(LOCALE_SMONTHNAME1,"Januar")
283 LOCVAL(LOCALE_SMONTHNAME2,"Februar")
284 LOCVAL(LOCALE_SMONTHNAME3,"März")
285 LOCVAL(LOCALE_SMONTHNAME4,"April")
286 LOCVAL(LOCALE_SMONTHNAME5,"Mai")
287 LOCVAL(LOCALE_SMONTHNAME6,"Juni")
288 LOCVAL(LOCALE_SMONTHNAME7,"Juli")
289 LOCVAL(LOCALE_SMONTHNAME8,"August")
290 LOCVAL(LOCALE_SMONTHNAME9,"September")
291 LOCVAL(LOCALE_SMONTHNAME10,"Oktober")
292 LOCVAL(LOCALE_SMONTHNAME11,"November")
293 LOCVAL(LOCALE_SMONTHNAME12,"Dezember")
294 LOCVAL(LOCALE_SMONTHNAME13,"")
295 LOCVAL(LOCALE_SABBREVMONTHNAME1,"Jan")
296 LOCVAL(LOCALE_SABBREVMONTHNAME2,"Feb")
297 LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mär")
298 LOCVAL(LOCALE_SABBREVMONTHNAME4,"Apr")
299 LOCVAL(LOCALE_SABBREVMONTHNAME5,"Mai")
300 LOCVAL(LOCALE_SABBREVMONTHNAME6,"Jun")
301 LOCVAL(LOCALE_SABBREVMONTHNAME7,"Jul")
302 LOCVAL(LOCALE_SABBREVMONTHNAME8,"Aug")
303 LOCVAL(LOCALE_SABBREVMONTHNAME9,"Sep")
304 LOCVAL(LOCALE_SABBREVMONTHNAME10,"Okt")
305 LOCVAL(LOCALE_SABBREVMONTHNAME11,"Nov")
306 LOCVAL(LOCALE_SABBREVMONTHNAME12,"Dez")
307 LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
309 LOCVAL(LOCALE_SPOSITIVESIGN)
310 LOCVAL(LOCALE_SNEGATIVESIGN)
311 LOCVAL(LOCALE_IPOSSIGNPOSN)
312 LOCVAL(LOCALE_INEGSIGNPOSN)
313 LOCVAL(LOCALE_IPOSSYMPRECEDES)
314 LOCVAL(LOCALE_IPOSSEPBYSPACE)
315 LOCVAL(LOCALE_INEGSYMPRECEDES)
316 LOCVAL(LOCALE_INEGSEPBYSPACE)
318 #endif /* LANG(De) */
320 /*Insert other languages here*/
324 if(!retLen)
326 if(!retString)fprintf(stderr,"Unkown LC type %lX\n",LCType);
327 else fprintf(stderr,"'%s' not supported for your language.\n",
328 retString);
329 return 0;
332 if(retLen>len)retLen=len;
333 strncpy(buf,retString,len);
334 return retLen;
338 /***********************************************************************
339 * CompareStringA (OLE2NLS.8)
340 * This implementation ignores the locale, and trusts in libc
342 int CompareStringA(DWORD lcid, DWORD fdwStyle,
343 char *s1, int l1, char *s2,int l2)
345 int len,ret;
346 if(fdwStyle & NORM_IGNORENONSPACE)
348 fprintf(stdnimp, "CompareStringA: IGNORENONSPACE not supprted\n");
350 if(fdwStyle & NORM_IGNORESYMBOLS)
351 fprintf(stdnimp, "CompareStringA: IGNORESYMBOLS not supported\n");
352 /* Is strcmp defaulting to string sort or to word sort?? */
353 /* FIXME: Handle NORM_STRINGSORT */
354 l1 = (l1==-1)?strlen(s1):l1;
355 l2 = (l2==-1)?strlen(s2):l2;
356 len = l1<l2 ? l1:l2;
357 ret = (fdwStyle & NORM_IGNORECASE) ?
358 strncasecmp(s1,s2,len) :
359 strncmp(s1,s2,len);
360 /* not equal, return 1 or 3 */
361 if(ret!=0)return ret+2;
362 /* same len, return 2 */
363 if(l1==l2)return 2;
364 /* the longer one is lexically greater */
365 return (l1<l2)? 1 : 3;