Improved support for Makefiles that need to recurse in subdirectories.
[wine/multimedia.git] / misc / main.c
blob9214206b245e0aa37bde294df18d117bc5a13066
1 /*
2 * Main function.
4 * Copyright 1994 Alexandre Julliard
5 */
7 #include "config.h"
9 #include <locale.h>
10 #include <ctype.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <unistd.h>
14 #ifdef MALLOC_DEBUGGING
15 # include <malloc.h>
16 #endif
18 #include "winbase.h"
19 #include "winsock.h"
20 #include "heap.h"
21 #include "message.h"
22 #include "msdos.h"
23 #include "color.h"
24 #include "options.h"
25 #include "builtin32.h"
26 #include "debugtools.h"
27 #include "debugdefs.h"
28 #include "module.h"
29 #include "version.h"
30 #include "winnls.h"
31 #include "console.h"
32 #include "monitor.h"
33 #include "keyboard.h"
34 #include "gdi.h"
35 #include "user.h"
36 #include "windef.h"
37 #include "wingdi.h"
38 #include "wine/winuser16.h"
39 #include "tweak.h"
40 #include "winerror.h"
42 /**********************************************************************/
44 USER_DRIVER *USER_Driver = NULL;
46 /* when adding new languages look at ole/ole2nls.c
47 * for proper iso name and Windows code (add 0x0400
48 * to the code listed there)
50 const WINE_LANGUAGE_DEF Languages[] =
52 {"En",0x0409}, /* LANG_En */
53 {"Es",0x040A}, /* LANG_Es */
54 {"De",0x0407}, /* LANG_De */
55 {"No",0x0414}, /* LANG_No */
56 {"Fr",0x040C}, /* LANG_Fr */
57 {"Fi",0x040B}, /* LANG_Fi */
58 {"Da",0x0406}, /* LANG_Da */
59 {"Cs",0x0405}, /* LANG_Cs */
60 {"Eo",0x048f}, /* LANG_Eo */
61 {"It",0x0410}, /* LANG_It */
62 {"Ko",0x0412}, /* LANG_Ko */
63 {"Hu",0x040e}, /* LANG_Hu */
64 {"Pl",0x0415}, /* LANG_Pl */
65 {"Pt",0x0416}, /* LANG_Pt */
66 {"Sk",0x041b}, /* LANG_Sk */
67 {"Sv",0x041d}, /* LANG_Sv */
68 {"Ca",0x0403}, /* LANG_Ca */
69 {"Nl",0x0413}, /* LANG_Nl */
70 {"Ru",0x0419}, /* LANG_Ru */
71 {"Wa",0x0490}, /* LANG_Wa */
72 {"Ga",0x043c}, /* LANG_Ga */
73 {"Gd",0x083c}, /* LANG_Gd */
74 {"Gv",0x0c3c}, /* LANG_Gv */
75 {"Kw",0x0491}, /* LANG_Kw */
76 {"Cy",0x0492}, /* LANG_Cy */
77 {"Br",0x0493}, /* LANG_Br */
78 {"Ja",0x0411}, /* LANG_Ja */
79 {NULL,0}
82 WORD WINE_LanguageId = 0x409; /* english as default */
84 struct options Options =
85 { /* default options */
86 0, /* argc */
87 NULL, /* argv */
88 NULL, /* desktopGeometry */
89 NULL, /* display */
90 NULL, /* dllFlags */
91 FALSE, /* synchronous */
92 FALSE, /* debug */
93 0, /* language */
94 FALSE, /* Managed windows */
95 NULL /* Alternate config file name */
98 const char *argv0;
100 /***********************************************************************
101 * MAIN_ParseDebugOptions
103 * Turns specific debug messages on or off, according to "options".
105 void MAIN_ParseDebugOptions( const char *arg )
107 /* defined in relay32/relay386.c */
108 extern char **debug_relay_includelist;
109 extern char **debug_relay_excludelist;
110 /* defined in relay32/snoop.c */
111 extern char **debug_snoop_includelist;
112 extern char **debug_snoop_excludelist;
114 int i;
115 int l, cls, dotracerelay = TRACE_ON(relay);
117 char *options = strdup(arg);
119 l = strlen(options);
120 if (l<2) goto error;
122 if (options[l-1]=='\n') options[l-1]='\0';
125 if ((*options!='+')&&(*options!='-')){
126 int j;
128 for(j=0; j<DEBUG_CLASS_COUNT; j++)
129 if(!lstrncmpiA(options, debug_cl_name[j], strlen(debug_cl_name[j])))
130 break;
131 if(j==DEBUG_CLASS_COUNT)
132 goto error;
133 options += strlen(debug_cl_name[j]);
134 if ((*options!='+')&&(*options!='-'))
135 goto error;
136 cls = j;
138 else
139 cls = -1; /* all classes */
141 if (strchr(options,','))
142 l=strchr(options,',')-options;
143 else
144 l=strlen(options);
146 if (!lstrncmpiA(options+1,"all",l-1))
148 int i, j;
149 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
150 for(j=0; j<DEBUG_CLASS_COUNT; j++)
151 if(cls == -1 || cls == j)
152 __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
154 else if (!lstrncmpiA(options+1, "relay=", 6) ||
155 !lstrncmpiA(options+1, "snoop=", 6))
157 int i, j;
158 char *s, *s2, ***output, c;
160 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
161 if (!strncasecmp( debug_channels[i] + 1, options + 1, 5))
163 for(j=0; j<DEBUG_CLASS_COUNT; j++)
164 if(cls == -1 || cls == j)
165 __SET_DEBUGGING( j, debug_channels[i], 1 );
166 break;
168 /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
169 if (i==DEBUG_CHANNEL_COUNT)
170 goto error;
171 output = (*options == '+') ?
172 ((*(options+1) == 'r') ?
173 &debug_relay_includelist :
174 &debug_snoop_includelist) :
175 ((*(options+1) == 'r') ?
176 &debug_relay_excludelist :
177 &debug_snoop_excludelist);
178 s = options + 7;
179 /* if there are n ':', there are n+1 modules, and we need n+2 slots
180 * last one being for the sentinel (NULL) */
181 i = 2;
182 while((s = strchr(s, ':'))) i++, s++;
183 *output = malloc(sizeof(char **) * i);
184 i = 0;
185 s = options + 7;
186 while((s2 = strchr(s, ':'))) {
187 c = *s2;
188 *s2 = '\0';
189 *((*output)+i) = CharUpperA(strdup(s));
190 *s2 = c;
191 s = s2 + 1;
192 i++;
194 c = *(options + l);
195 *(options + l) = '\0';
196 *((*output)+i) = CharUpperA(strdup(s));
197 *(options + l) = c;
198 *((*output)+i+1) = NULL;
200 else
202 int i, j;
203 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
204 if (!strncasecmp( debug_channels[i] + 1, options + 1, l - 1) && !debug_channels[i][l])
206 for(j=0; j<DEBUG_CLASS_COUNT; j++)
207 if(cls == -1 || cls == j)
208 __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
209 break;
211 if (i==DEBUG_CHANNEL_COUNT)
212 goto error;
214 options+=l;
216 while((*options==',')&&(*(++options)));
218 /* special handling for relay debugging */
219 if (dotracerelay != TRACE_ON(relay))
220 BUILTIN32_SwitchRelayDebug( TRACE_ON(relay) );
222 if (!*options) return;
224 error:
225 MESSAGE("%s: Syntax: -debugmsg [class]+xxx,... or "
226 "-debugmsg [class]-xxx,...\n",argv0);
227 MESSAGE("Example: -debugmsg +all,warn-heap\n"
228 " turn on all messages except warning heap messages\n");
229 MESSAGE("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
230 " turn on -debugmsg +relay only as specified\n"
231 "Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
232 " turn on -debugmsg +relay except as specified\n"
233 "Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
235 MESSAGE("Available message classes:\n");
236 for(i=0;i<DEBUG_CLASS_COUNT;i++)
237 MESSAGE( "%-9s", debug_cl_name[i]);
238 MESSAGE("\n\n");
240 MESSAGE("Available message types:\n");
241 MESSAGE("%-9s ","all");
242 for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
243 MESSAGE("%-9s%c",debug_channels[i] + 1,
244 (((i+2)%8==0)?'\n':' '));
245 MESSAGE("\n\n");
246 ExitProcess(1);
249 /***********************************************************************
250 * MAIN_GetLanguageID
252 * INPUT:
253 * Lang: a string whose two first chars are the iso name of a language.
254 * Country: a string whose two first chars are the iso name of country
255 * Charset: a string defining the chossen charset encoding
256 * Dialect: a string defining a variation of the locale
258 * all those values are from the standardized format of locale
259 * name in unix which is: Lang[_Country][.Charset][@Dialect]
261 * RETURNS:
262 * the numeric code of the language used by Windows (or 0x00)
264 int MAIN_GetLanguageID(LPCSTR Lang,LPCSTR Country,LPCSTR Charset,LPCSTR Dialect)
266 char lang[3]="??", country[3]={0,0,0};
267 char *charset=NULL, *dialect=NULL;
268 int i,j,ret=0;
270 if (Lang==NULL) return 0x00;
271 if (Lang[0]) lang[0]=tolower(Lang[0]);
272 if (Lang[1]) lang[1]=tolower(Lang[1]);
274 if (Country!=NULL) {
275 if (Country[0]) country[0]=toupper(Country[0]);
276 if (Country[1]) country[1]=toupper(Country[1]);
279 if (Charset!=NULL) {
280 j=strlen(Charset);
281 charset=(char*)malloc(j+1);
282 for (i=0;i<j;i++)
283 charset[i]=toupper(Charset[i]);
284 charset[i]='\0';
287 if (Dialect!=NULL) {
288 j=strlen(Dialect);
289 dialect=(char*)malloc(j+1);
290 for (i=0;i<j;i++)
291 dialect[i]=tolower(Dialect[i]);
292 dialect[i]='\0';
293 } else {
294 dialect = malloc(1);
295 dialect[0] = '\0';
298 #define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
299 if (!country[0]) { \
300 ret=LANG_##y ; \
301 goto end_MAIN_GetLanguageID; \
303 #define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) { \
304 ret = MAKELANGID( LANG_##y , SUBLANG_##z ); \
305 goto end_MAIN_GetLanguageID; \
307 #define LANG_DIALECT_ENTRY(x,y) { ret = MAKELANGID(LANG_##x , SUBLANG_##y ); \
308 goto end_MAIN_GetLanguageID; }
309 #define LANG_ENTRY_END(x) ret = MAKELANGID(LANG_##x , SUBLANG_DEFAULT); \
310 goto end_MAIN_GetLanguageID; \
313 /*x01*/ LANG_ENTRY_BEGIN( "ar", ARABIC )
314 LANG_SUB_ENTRY( "SA", ARABIC, ARABIC)
315 LANG_SUB_ENTRY( "IQ", ARABIC, ARABIC_IRAQ )
316 LANG_SUB_ENTRY( "EG", ARABIC, ARABIC_EGYPT )
317 LANG_SUB_ENTRY( "LY", ARABIC, ARABIC_LIBYA )
318 LANG_SUB_ENTRY( "DZ", ARABIC, ARABIC_ALGERIA )
319 LANG_SUB_ENTRY( "MA", ARABIC, ARABIC_MOROCCO )
320 LANG_SUB_ENTRY( "TN", ARABIC, ARABIC_TUNISIA )
321 LANG_SUB_ENTRY( "OM", ARABIC, ARABIC_OMAN )
322 LANG_SUB_ENTRY( "YE", ARABIC, ARABIC_YEMEN )
323 LANG_SUB_ENTRY( "SY", ARABIC, ARABIC_SYRIA )
324 LANG_SUB_ENTRY( "JO", ARABIC, ARABIC_JORDAN )
325 LANG_SUB_ENTRY( "LB", ARABIC, ARABIC_LEBANON )
326 LANG_SUB_ENTRY( "KW", ARABIC, ARABIC_KUWAIT )
327 LANG_SUB_ENTRY( "AE", ARABIC, ARABIC_UAE )
328 LANG_SUB_ENTRY( "BH", ARABIC, ARABIC_BAHRAIN )
329 LANG_SUB_ENTRY( "QA", ARABIC, ARABIC_QATAR )
330 LANG_ENTRY_END( ARABIC )
331 /*x02*/ LANG_ENTRY_BEGIN( "bu", BULGARIAN )
332 LANG_ENTRY_END( BULGARIAN )
333 /*x03*/ LANG_ENTRY_BEGIN( "ca", CATALAN )
334 LANG_ENTRY_END( CATALAN )
335 /*x04*/ LANG_ENTRY_BEGIN( "zh", CHINESE )
336 LANG_SUB_ENTRY( "TW", CHINESE, CHINESE_TRADITIONAL )
337 LANG_SUB_ENTRY( "CN", CHINESE, CHINESE_SIMPLIFIED )
338 LANG_SUB_ENTRY( "HK", CHINESE, CHINESE_HONGKONG )
339 LANG_SUB_ENTRY( "SG", CHINESE, CHINESE_SINGAPORE )
340 LANG_SUB_ENTRY( "MO", CHINESE, CHINESE_MACAU )
341 LANG_ENTRY_END( CHINESE )
342 /*x05*/ LANG_ENTRY_BEGIN( "cs", CZECH )
343 LANG_ENTRY_END( CZECH )
344 /*x06*/ LANG_ENTRY_BEGIN( "da", DANISH )
345 LANG_ENTRY_END( DANISH )
346 /*x07*/ LANG_ENTRY_BEGIN( "de", GERMAN )
347 LANG_SUB_ENTRY( "DE", GERMAN, GERMAN )
348 LANG_SUB_ENTRY( "CH", GERMAN, GERMAN_SWISS )
349 LANG_SUB_ENTRY( "AT", GERMAN, GERMAN_AUSTRIAN )
350 LANG_SUB_ENTRY( "LU", GERMAN, GERMAN_LUXEMBOURG )
351 LANG_SUB_ENTRY( "LI", GERMAN, GERMAN_LIECHTENSTEIN )
352 LANG_ENTRY_END( GERMAN )
353 /*x08*/ LANG_ENTRY_BEGIN( "el", GREEK )
354 LANG_ENTRY_END( GREEK )
355 /*x09*/ LANG_ENTRY_BEGIN( "en", ENGLISH )
356 LANG_SUB_ENTRY( "US", ENGLISH, ENGLISH_US )
357 LANG_SUB_ENTRY( "UK", ENGLISH, ENGLISH_UK )
358 LANG_SUB_ENTRY( "GB", ENGLISH, ENGLISH_UK )
359 LANG_SUB_ENTRY( "AU", ENGLISH, ENGLISH_AUS )
360 LANG_SUB_ENTRY( "CA", ENGLISH, ENGLISH_CAN )
361 LANG_SUB_ENTRY( "NZ", ENGLISH, ENGLISH_NZ )
362 LANG_SUB_ENTRY( "EI", ENGLISH, ENGLISH_EIRE )
363 LANG_SUB_ENTRY( "ZA", ENGLISH, ENGLISH_SAFRICA )
364 LANG_SUB_ENTRY( "JM", ENGLISH, ENGLISH_JAMAICA )
365 /* LANG_SUB_ENTRY( "AG", ENGLISH, ENGLISH_CARIBBEAN ) */
366 LANG_SUB_ENTRY( "BZ", ENGLISH, ENGLISH_BELIZE )
367 LANG_SUB_ENTRY( "TT", ENGLISH, ENGLISH_TRINIDAD )
368 LANG_SUB_ENTRY( "ZW", ENGLISH, ENGLISH_ZIMBABWE )
369 LANG_SUB_ENTRY( "PH", ENGLISH, ENGLISH_PHILIPPINES )
370 LANG_ENTRY_END( ENGLISH )
371 /*x0a*/ LANG_ENTRY_BEGIN( "es", SPANISH )
372 /* traditional sorting */
373 if (!strcmp(dialect,"tradicional"))
374 LANG_DIALECT_ENTRY( SPANISH, SPANISH )
375 LANG_SUB_ENTRY( "MX", SPANISH, SPANISH_MEXICAN )
376 LANG_SUB_ENTRY( "ES", SPANISH, SPANISH_MODERN )
377 LANG_SUB_ENTRY( "GT", SPANISH, SPANISH_GUATEMALA )
378 LANG_SUB_ENTRY( "CR", SPANISH, SPANISH_COSTARICA )
379 LANG_SUB_ENTRY( "PA", SPANISH, SPANISH_PANAMA )
380 LANG_SUB_ENTRY( "DO", SPANISH, SPANISH_DOMINICAN )
381 LANG_SUB_ENTRY( "VE", SPANISH, SPANISH_VENEZUELA )
382 LANG_SUB_ENTRY( "CO", SPANISH, SPANISH_COLOMBIA )
383 LANG_SUB_ENTRY( "PE", SPANISH, SPANISH_PERU )
384 LANG_SUB_ENTRY( "AR", SPANISH, SPANISH_ARGENTINA )
385 LANG_SUB_ENTRY( "EC", SPANISH, SPANISH_ECUADOR )
386 LANG_SUB_ENTRY( "CL", SPANISH, SPANISH_CHILE )
387 LANG_SUB_ENTRY( "UY", SPANISH, SPANISH_URUGUAY )
388 LANG_SUB_ENTRY( "PY", SPANISH, SPANISH_PARAGUAY )
389 LANG_SUB_ENTRY( "BO", SPANISH, SPANISH_BOLIVIA )
390 LANG_SUB_ENTRY( "HN", SPANISH, SPANISH_HONDURAS )
391 LANG_SUB_ENTRY( "NI", SPANISH, SPANISH_NICARAGUA )
392 LANG_SUB_ENTRY( "PR", SPANISH, SPANISH_PUERTO_RICO )
393 LANG_ENTRY_END( SPANISH )
394 /*x0b*/ LANG_ENTRY_BEGIN( "fi", FINNISH )
395 LANG_ENTRY_END( FINNISH )
396 /*x0c*/ LANG_ENTRY_BEGIN( "fr", FRENCH )
397 LANG_SUB_ENTRY( "FR", FRENCH, FRENCH )
398 LANG_SUB_ENTRY( "BE", FRENCH, FRENCH_BELGIAN )
399 LANG_SUB_ENTRY( "CA", FRENCH, FRENCH_CANADIAN )
400 LANG_SUB_ENTRY( "CH", FRENCH, FRENCH_SWISS )
401 LANG_SUB_ENTRY( "LU", FRENCH, FRENCH_LUXEMBOURG )
402 LANG_SUB_ENTRY( "MC", FRENCH, FRENCH_MONACO )
403 LANG_ENTRY_END( FRENCH )
404 /*x0d*/ LANG_ENTRY_BEGIN( "iw", HEBREW )
405 LANG_ENTRY_END( HEBREW )
406 /*x0e*/ LANG_ENTRY_BEGIN( "hu", HUNGARIAN )
407 LANG_ENTRY_END( HUNGARIAN )
408 /*x0f*/ LANG_ENTRY_BEGIN( "ic", ICELANDIC )
409 LANG_ENTRY_END( ICELANDIC )
410 /*x10*/ LANG_ENTRY_BEGIN( "it", ITALIAN )
411 LANG_SUB_ENTRY( "IT", ITALIAN, ITALIAN )
412 LANG_SUB_ENTRY( "CH", ITALIAN, ITALIAN_SWISS )
413 LANG_ENTRY_END( ITALIAN )
414 /*x11*/ LANG_ENTRY_BEGIN( "ja", JAPANESE )
415 LANG_ENTRY_END( JAPANESE )
416 /*x12*/ LANG_ENTRY_BEGIN( "ko", KOREAN )
417 /* JOHAB encoding */
418 if (!strcmp(charset,"JOHAB"))
419 LANG_DIALECT_ENTRY( KOREAN, KOREAN_JOHAB )
420 else
421 LANG_DIALECT_ENTRY( KOREAN, KOREAN )
422 LANG_ENTRY_END( KOREAN )
423 /*x13*/ LANG_ENTRY_BEGIN( "nl", DUTCH )
424 LANG_SUB_ENTRY( "NL", DUTCH, DUTCH )
425 LANG_SUB_ENTRY( "BE", DUTCH, DUTCH_BELGIAN )
426 LANG_SUB_ENTRY( "SR", DUTCH, DUTCH_SURINAM )
427 LANG_ENTRY_END( DUTCH )
428 /*x14*/ LANG_ENTRY_BEGIN( "no", NORWEGIAN )
429 /* nynorsk */
430 if (!strcmp(dialect,"nynorsk"))
431 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_NYNORSK )
432 else
433 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_BOKMAL )
434 LANG_ENTRY_END( NORWEGIAN )
435 /*x15*/ LANG_ENTRY_BEGIN( "pl", POLISH )
436 LANG_ENTRY_END( POLISH )
437 /*x16*/ LANG_ENTRY_BEGIN( "pt", PORTUGUESE )
438 LANG_SUB_ENTRY( "BR", PORTUGUESE, PORTUGUESE_BRAZILIAN )
439 LANG_SUB_ENTRY( "PT", PORTUGUESE, PORTUGUESE )
440 LANG_ENTRY_END( PORTUGUESE )
441 /*x17*/ LANG_ENTRY_BEGIN( "rm", RHAETO_ROMANCE )
442 LANG_ENTRY_END( RHAETO_ROMANCE )
443 /*x18*/ LANG_ENTRY_BEGIN( "ro", ROMANIAN )
444 LANG_SUB_ENTRY( "RO", ROMANIAN, ROMANIAN )
445 LANG_SUB_ENTRY( "MD", ROMANIAN, ROMANIAN_MOLDAVIA )
446 LANG_ENTRY_END( ROMANIAN )
447 /*x19*/ LANG_ENTRY_BEGIN( "ru", RUSSIAN )
448 LANG_SUB_ENTRY( "RU", RUSSIAN, RUSSIAN )
449 LANG_SUB_ENTRY( "MD", RUSSIAN, RUSSIAN_MOLDAVIA )
450 LANG_ENTRY_END( RUSSIAN )
451 /*x1a*/ if (!strcmp(lang,"sh") || !strcmp(lang,"hr") || !strcmp(lang,"sr")) {
452 if (!country[0])
453 LANG_DIALECT_ENTRY( SERBO_CROATIAN, NEUTRAL)
454 if (!strcmp(charset,"ISO-8859-5"))
455 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN )
456 LANG_SUB_ENTRY( "HR", SERBO_CROATIAN, CROATIAN )
457 if (!strcmp(country,"YU") && !strcmp(charset,"ISO-8859-2"))
458 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
459 LANG_SUB_ENTRY( "YU", SERBO_CROATIAN, SERBIAN )
460 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
462 /*x1b*/ LANG_ENTRY_BEGIN( "sk", SLOVAK )
463 LANG_ENTRY_END( SLOVAK )
464 /*x1c*/ LANG_ENTRY_BEGIN( "sq", ALBANIAN )
465 LANG_ENTRY_END( ALBANIAN )
466 /*x1d*/ LANG_ENTRY_BEGIN( "sv", SWEDISH )
467 LANG_SUB_ENTRY( "SE", SWEDISH, SWEDISH )
468 LANG_SUB_ENTRY( "FI", SWEDISH, SWEDISH_FINLAND )
469 LANG_ENTRY_END( SWEDISH )
470 /*x1e*/ LANG_ENTRY_BEGIN( "th", THAI )
471 LANG_ENTRY_END( THAI )
472 /*x1f*/ LANG_ENTRY_BEGIN( "tr", TURKISH )
473 LANG_ENTRY_END( TURKISH )
474 /*x20*/ LANG_ENTRY_BEGIN( "ur", URDU )
475 LANG_ENTRY_END( URDU )
476 /*x21*/ LANG_ENTRY_BEGIN( "in", INDONESIAN )
477 LANG_ENTRY_END( INDONESIAN )
478 /*x22*/ LANG_ENTRY_BEGIN( "uk", UKRAINIAN )
479 LANG_ENTRY_END( UKRAINIAN )
480 /*x23*/ LANG_ENTRY_BEGIN( "be", BYELORUSSIAN )
481 LANG_ENTRY_END( BYELORUSSIAN )
482 /*x24*/ LANG_ENTRY_BEGIN( "sl", SLOVENIAN )
483 LANG_ENTRY_END( SLOVENIAN )
484 /*x25*/ LANG_ENTRY_BEGIN( "et", ESTONIAN )
485 LANG_ENTRY_END( ESTONIAN )
486 /*x26*/ LANG_ENTRY_BEGIN( "lv", LATVIAN )
487 LANG_ENTRY_END( LATVIAN )
488 /*x27*/ LANG_ENTRY_BEGIN( "lt", LITHUANIAN )
489 /* traditional sorting ? */
490 if (!strcmp(dialect,"classic") || !strcmp(dialect,"traditional"))
491 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN_CLASSIC )
492 else
493 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN )
494 LANG_ENTRY_END( LITHUANIAN )
495 /*x28*/ LANG_ENTRY_BEGIN( "mi", MAORI )
496 LANG_ENTRY_END( MAORI )
497 /*x29*/ LANG_ENTRY_BEGIN( "fa", FARSI )
498 LANG_ENTRY_END( FARSI )
499 /*x2a*/ LANG_ENTRY_BEGIN( "vi", VIETNAMESE )
500 LANG_ENTRY_END( VIETNAMESE )
501 /*x2b*/ LANG_ENTRY_BEGIN( "hy", ARMENIAN )
502 LANG_ENTRY_END( ARMENIAN )
503 /*x2c*/ LANG_ENTRY_BEGIN( "az", AZERI )
504 /* Cyrillic */
505 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
506 LANG_DIALECT_ENTRY( AZERI, AZERI_CYRILLIC )
507 else
508 LANG_DIALECT_ENTRY( AZERI, AZERI )
509 LANG_ENTRY_END( AZERI )
510 /*x2d*/ LANG_ENTRY_BEGIN( "eu", BASQUE )
511 LANG_ENTRY_END( BASQUE )
512 /*x2e*/ /*LANG_ENTRY_BEGIN( "??", SORBIAN )
513 LANG_ENTRY_END( SORBIAN ) */
514 /*x2f*/ LANG_ENTRY_BEGIN( "mk", MACEDONIAN )
515 LANG_ENTRY_END( MACEDONIAN )
516 /*x30*/ /*LANG_ENTRY_BEGIN( "??", SUTU )
517 LANG_ENTRY_END( SUTU ) */
518 /*x31*/ LANG_ENTRY_BEGIN( "ts", TSONGA )
519 LANG_ENTRY_END( TSONGA )
520 /*x32*/ /*LANG_ENTRY_BEGIN( "??", TSWANA )
521 LANG_ENTRY_END( TSWANA ) */
522 /*x33*/ /*LANG_ENTRY_BEGIN( "??", VENDA )
523 LANG_ENTRY_END( VENDA ) */
524 /*x34*/ LANG_ENTRY_BEGIN( "xh", XHOSA )
525 LANG_ENTRY_END( XHOSA )
526 /*x35*/ LANG_ENTRY_BEGIN( "zu", ZULU )
527 LANG_ENTRY_END( ZULU )
528 /*x36*/ LANG_ENTRY_BEGIN( "af", AFRIKAANS )
529 LANG_ENTRY_END( AFRIKAANS )
530 /*x37*/ LANG_ENTRY_BEGIN( "ka", GEORGIAN )
531 LANG_ENTRY_END( GEORGIAN )
532 /*x38*/ LANG_ENTRY_BEGIN( "fo", FAEROESE )
533 LANG_ENTRY_END( FAEROESE )
534 /*x39*/ LANG_ENTRY_BEGIN( "hi", HINDI )
535 LANG_ENTRY_END( HINDI )
536 /*x3a*/ LANG_ENTRY_BEGIN( "mt", MALTESE )
537 LANG_ENTRY_END( MALTESE )
538 /*x3b*/ /*LANG_ENTRY_BEGIN( "??", SAAMI )
539 LANG_ENTRY_END( SAAMI ) */
540 /*x3c*/ LANG_ENTRY_BEGIN( "ga", GAELIC )
541 LANG_DIALECT_ENTRY( GAELIC, GAELIC )
542 LANG_ENTRY_END( GAELIC )
543 /*x3c*/ LANG_ENTRY_BEGIN( "gd", GAELIC )
544 LANG_DIALECT_ENTRY( GAELIC, GAELIC_SCOTTISH )
545 LANG_ENTRY_END( GAELIC )
546 /* 0x3d */
547 /*x3e*/ LANG_ENTRY_BEGIN( "ms", MALAY )
548 LANG_SUB_ENTRY( "MY", MALAY, MALAY )
549 LANG_SUB_ENTRY( "BN", MALAY, MALAY_BRUNEI_DARUSSALAM )
550 LANG_ENTRY_END( MALAY )
551 /*x3f*/ LANG_ENTRY_BEGIN( "kk", KAZAKH )
552 LANG_ENTRY_END( KAZAKH )
553 /* 0x40 */
554 /*x41*/ LANG_ENTRY_BEGIN( "sw", SWAHILI )
555 LANG_ENTRY_END( SWAHILI )
556 /* 0x42 */
557 /*x43*/ LANG_ENTRY_BEGIN( "uz", UZBEK )
558 /* Cyrillic */
559 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
560 LANG_DIALECT_ENTRY( UZBEK, UZBEK_CYRILLIC )
561 else
562 LANG_DIALECT_ENTRY( UZBEK, UZBEK )
563 LANG_ENTRY_END( UZBEK )
564 /*x44*/ LANG_ENTRY_BEGIN( "tt", TATAR )
565 LANG_ENTRY_END( TATAR )
566 /*x45*/ LANG_ENTRY_BEGIN( "bn", BENGALI )
567 LANG_ENTRY_END( BENGALI )
568 /*x46*/ LANG_ENTRY_BEGIN( "pa", PUNJABI )
569 LANG_ENTRY_END( PUNJABI )
570 /*x47*/ LANG_ENTRY_BEGIN( "gu", GUJARATI )
571 LANG_ENTRY_END( GUJARATI )
572 /*x48*/ LANG_ENTRY_BEGIN( "or", ORIYA )
573 LANG_ENTRY_END( ORIYA )
574 /*x49*/ LANG_ENTRY_BEGIN( "ta", TAMIL )
575 LANG_ENTRY_END( TAMIL )
576 /*x4a*/ LANG_ENTRY_BEGIN( "te", TELUGU )
577 LANG_ENTRY_END( TELUGU )
578 /*x4b*/ LANG_ENTRY_BEGIN( "kn", KANNADA )
579 LANG_ENTRY_END( KANNADA )
580 /*x4c*/ LANG_ENTRY_BEGIN( "ml", MALAYALAM )
581 LANG_ENTRY_END( MALAYALAM )
582 /*x4d*/ LANG_ENTRY_BEGIN( "as", ASSAMESE )
583 LANG_ENTRY_END( ASSAMESE )
584 /*x4e*/ LANG_ENTRY_BEGIN( "mr", MARATHI )
585 LANG_ENTRY_END( MARATHI )
586 /*x4f*/ LANG_ENTRY_BEGIN( "sa", SANSKRIT )
587 LANG_ENTRY_END( SANSKRIT )
588 /* 0x50 -> 0x56 */
589 /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI )
590 LANG_ENTRY_END( KONKANI ) */
591 /* 0x58 -> ... */
592 LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */
593 LANG_ENTRY_END( ESPERANTO )
594 LANG_ENTRY_BEGIN( "wa", WALON ) /* not official */
595 LANG_ENTRY_END( WALON )
597 ret = LANG_ENGLISH;
599 end_MAIN_GetLanguageID:
600 if (Charset) free(charset);
601 free(dialect);
603 return ret;
606 /***********************************************************************
607 * MAIN_ParseLanguageOption
609 * Parse -language option.
611 void MAIN_ParseLanguageOption( const char *arg )
613 const WINE_LANGUAGE_DEF *p = Languages;
615 Options.language = LANG_Xx; /* First (dummy) language */
616 for (;p->name;p++)
618 if (!lstrcmpiA( p->name, arg ))
620 WINE_LanguageId = p->langid;
621 return;
623 Options.language++;
625 MESSAGE( "Invalid language specified '%s'. Supported languages are: ", arg );
626 for (p = Languages; p->name; p++) MESSAGE( "%s ", p->name );
627 MESSAGE( "\n" );
628 ExitProcess(1);
632 /***********************************************************************
633 * called_at_exit
635 static void called_at_exit(void)
637 CONSOLE_Close();
640 /***********************************************************************
641 * MAIN_WineInit
643 * Wine initialisation and command-line parsing
645 BOOL MAIN_WineInit( int argc, char *argv[] )
647 struct timeval tv;
649 #ifdef MALLOC_DEBUGGING
650 char *trace;
652 mcheck(NULL);
653 if (!(trace = getenv("MALLOC_TRACE")))
655 MESSAGE( "MALLOC_TRACE not set. No trace generated\n" );
657 else
659 MESSAGE( "malloc trace goes to %s\n", trace );
660 mtrace();
662 #endif
664 setbuf(stdout,NULL);
665 setbuf(stderr,NULL);
667 setlocale(LC_CTYPE,"");
668 gettimeofday( &tv, NULL);
669 MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
671 OPTIONS_ParseOptions( argc, argv );
673 atexit(called_at_exit);
674 return TRUE;
677 /***********************************************************************
678 * MessageBeep16 (USER.104)
680 void WINAPI MessageBeep16( UINT16 i )
682 MessageBeep( i );
686 /***********************************************************************
687 * MessageBeep (USER32.390)
689 BOOL WINAPI MessageBeep( UINT i )
691 KEYBOARD_Beep();
692 return TRUE;
696 /***********************************************************************
697 * Beep (KERNEL32.11)
699 BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
701 /* dwFreq and dwDur are ignored by Win95 */
702 KEYBOARD_Beep();
703 return TRUE;
707 /***********************************************************************
708 * FileCDR (KERNEL.130)
710 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
712 FIXME_(file)("(0x%8x): stub\n", (int) x);
713 return (FARPROC16)TRUE;
716 /***********************************************************************
717 * GetTickCount (USER.13) (KERNEL32.299)
719 * Returns the number of milliseconds, modulo 2^32, since the start
720 * of the current session.
722 DWORD WINAPI GetTickCount(void)
724 struct timeval t;
725 gettimeofday( &t, NULL );
726 return ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - MSG_WineStartTicks;