source: tags/ms_r17q2/SOURCE_TOOLS/arb_main.h

Last change on this file was 13018, checked in by westram, 10 years ago
File size: 2.5 KB
Line 
1// ================================================================ //
2//                                                                  //
3//   File      : arb_main.h                                         //
4//   Purpose   : code executed at start of main()                   //
5//                                                                  //
6//   Coded by Ralf Westram (coder@reallysoft.de) in February 2014   //
7//   http://www.arb-home.de/                                        //
8//                                                                  //
9// ================================================================ //
10
11#ifndef ARB_MAIN_H
12#define ARB_MAIN_H
13
14#include <locale.h>
15
16static void start_of_main() {
17    // const char *USER_LOCALE = ""; // -> use user-defined locale
18    // const char *USER_LOCALE = "de_DE.UTF-8"; // use german locale
19
20
21    // gtk apparently calls 'setlocale(LC_ALL, "");'
22    // @@@ we should already call it here, to make ARB-motif-version behave samesame.
23
24    // --------------------------------------------------------------------------------
25    // Fails-counts mentioned below were determined under ubuntu 13.10/64bit.
26    // Make sure only one section is enabled!
27
28#if 1
29    // enabling this section does not fail any unit test
30    setlocale(LC_ALL,  "C");
31    // overwritten as soon as gtk-GUI starts (causing wrong behavior throughout ARB)
32#endif
33
34#if 0
35    // enabling this section does not fail any unit test
36    setlocale(LC_ALL,     USER_LOCALE);
37    setlocale(LC_NUMERIC, "C");
38#endif
39
40#if 0
41    // enabling this section does not fail any unit test
42    setlocale(LC_ALL,      "C");
43    setlocale(LC_COLLATE,  USER_LOCALE);
44    setlocale(LC_CTYPE,    USER_LOCALE);
45    setlocale(LC_MESSAGES, USER_LOCALE);
46    setlocale(LC_MONETARY, USER_LOCALE);
47    setlocale(LC_TIME,     USER_LOCALE);
48#endif
49
50
51#if 0
52    // enabling this section fails 57 unit tests (for german USER_LOCALE)
53    setlocale(LC_ALL, USER_LOCALE);
54#endif
55
56#if 0
57    // enabling this section fails 57 unit tests (for german USER_LOCALE)
58    setlocale(LC_COLLATE,  "C");
59    setlocale(LC_CTYPE,    "C");
60    setlocale(LC_MESSAGES, "C");
61    setlocale(LC_MONETARY, "C");
62    setlocale(LC_NUMERIC,  USER_LOCALE);
63    setlocale(LC_TIME,     "C");
64#endif
65
66#if 0
67    // enabling this section fails 57 unit tests (for german USER_LOCALE)
68    // (fails 57 unit tests under ubuntu 13.10, centos 5 and 6)
69    setlocale(LC_ALL,     "C");
70    setlocale(LC_NUMERIC, USER_LOCALE);
71#endif
72}
73
74#else
75#error arb_main.h included twice
76#endif // ARB_MAIN_H
Note: See TracBrowser for help on using the repository browser.