mbgtools-lx  4.2.8
charcode.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: charcode.h 1.4 2016/08/10 12:25:41 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions and prototypes for pcpslstr.c.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: charcode.h $
13  * Revision 1.4 2016/08/10 12:25:41 martin
14  * Check for MBG_TGT_POSIX instead of MBG_TGT_UNIX.
15  * Revision 1.3 2015/11/11 14:55:59 martin
16  * Support Unicode and UTF-8 encodings.
17  * Revision 1.2 2014/04/24 14:13:17 martin
18  * Added new codes and conversion table initializers.
19  * Revision 1.1 2012/11/20 13:41:24 martin
20  * Initial revision.
21  *
22  **************************************************************************/
23 
24 #ifndef _CHARCODE_H
25 #define _CHARCODE_H
26 
27 
28 /* Other headers to be included */
29 
30 #include <mbg_tgt.h>
31 
32 #if MBG_TGT_HAS_WCHAR_T
33  #include <wchar.h>
34 #endif
35 
36 #ifdef _CHARCODE
37  #define _ext
38  #define _DO_INIT
39 #else
40  #define _ext extern
41 #endif
42 
43 
44 /* Start of header body */
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 
51 #if defined( MBG_TGT_LINUX )
52 
53  #define MBG_UML_UTF8
54 
55 #elif defined( MBG_TGT_WIN32 ) \
56  || defined( MBG_TGT_POSIX ) \
57  || defined( MBG_TGT_QNX )
58 
59  #define MBG_UML_ANSI
60 
61 #else
62 
63  #define MBG_UML_DOS
64 
65 #endif
66 
67 
68 
69 // upper case 'A' umlaut
70 #define ANSI_UC_A_UML '\xC4' // uppercase ANSI char
71 #define ANSI_US_A_UML "\xC4" // uppercase ANSI string literal
72 
73 #define DOS_UC_A_UML '\x8E' // uppercase DOS char
74 #define DOS_US_A_UML "\x8E" // uppercase DOS string literal
75 
76 #define UNICODE_US_A_UML "\u00C4" // uppercase Unicode string literal
77 
78 #define UTF8_US_A_UML "\xc3\x84" // uppercase UTF-8 string literal
79 
80 
81 
82 // upper case 'O' umlaut
83 #define ANSI_UC_O_UML '\xD6' // uppercase ANSI char
84 #define ANSI_US_O_UML "\xD6" // uppercase ANSI string literal
85 
86 #define DOS_UC_O_UML '\x99' // uppercase DOS char
87 #define DOS_US_O_UML "\x99" // uppercase DOS string literal
88 
89 #define UNICODE_US_O_UML "\u00D6" // uppercase Unicode string literal
90 
91 #define UTF8_US_O_UML "\xc3\x96" // uppercase UTF-8 string literal
92 
93 
94 
95 // upper case 'U' umlaut
96 #define ANSI_UC_U_UML '\xDC' // uppercase ANSI char
97 #define ANSI_US_U_UML "\xDC" // uppercase ANSI string literal
98 
99 #define DOS_UC_U_UML '\x9A' // uppercase DOS char
100 #define DOS_US_U_UML "\x9A" // uppercase DOS string literal
101 
102 #define UNICODE_US_U_UML "\u00DC" // uppercase Unicode string literal
103 
104 #define UTF8_US_U_UML "\xc3\x9c" // uppercase UTF-8 string literal
105 
106 
107 
108 // lower case 'a' umlaut
109 #define ANSI_LC_A_UML '\xE4' // lowercase ANSI char
110 #define ANSI_LS_A_UML "\xE4" // lowercase ANSI string literal
111 
112 #define DOS_LC_A_UML '\x84' // lowercase DOS char
113 #define DOS_LS_A_UML "\x84" // lowercase DOS string literal
114 
115 #define UNICODE_LS_A_UML "\u00E4" // lowercase Unicode string literal
116 
117 #define UTF8_LS_A_UML "\xc3\xa4" // lowercase UTF-8 string literal
118 
119 
120 
121 // lower case 'o' umlaut
122 #define ANSI_LC_O_UML '\xF6' // lowercase ANSI char
123 #define ANSI_LS_O_UML "\xF6" // lowercase ANSI string literal
124 
125 #define DOS_LC_O_UML '\x94' // lowercase DOS char
126 #define DOS_LS_O_UML "\x94" // lowercase DOS string literal
127 
128 #define UNICODE_LS_O_UML "\u00F6" // lowercase Unicode string literal
129 
130 #define UTF8_LS_O_UML "\xc3\xb6" // lowercase UTF-8 string literal
131 
132 
133 
134 // lower case 'u' umlaut
135 #define ANSI_LC_U_UML '\xFC' // lowercase ANSI char
136 #define ANSI_LS_U_UML "\xFC" // lowercase ANSI string literal
137 
138 #define DOS_LC_U_UML '\x81' // lowercase DOS char
139 #define DOS_LS_U_UML "\x81" // lowercase DOS string literal
140 
141 #define UNICODE_LS_U_UML "\u00FC" // lowercase Unicode string literal
142 
143 #define UTF8_LS_U_UML "\xc3\xbc" // lowercase UTF-8 string literal
144 
145 
146 
147 // 'sz' umlaut
148 #define ANSI_LC_SZ_UML '\xDF' // ANSI char
149 #define ANSI_LS_SZ_UML "\xDF" // ANSI string literal
150 
151 #define DOS_LC_SZ_UML '\xE1' // DOS char
152 #define DOS_LS_SZ_UML "\xE1" // DOS string literal
153 
154 #define UNICODE_LS_SZ_UML "\u00DF" // Unicode string literal
155 
156 #define UTF8_LS_SZ_UML "\xc3\x9f" // UTF-8 string literal
157 
158 
159 
160 // degree character
161 #define ANSI_C_DEGREE '\xB0' // ANSI char
162 #define ANSI_S_DEGREE "\xB0" // ANSI string literal
163 
164 #define DOS_C_DEGREE '\xF8' // DOS char
165 #define DOS_S_DEGREE "\xF8" // DOS string literal
166 
167 #define UNICODE_S_DEGREE "\u00E0" // Unicode string liter
168 
169 #define UTF8_S_DEGREE "\xc2\xb0" // UTF-8 string literal
170 
171 
172 
173 // greek mu character (micro sign)
174 #define ANSI_C_MU '\xB5' // ANSI char
175 #define ANSI_S_MU "\xB5" // ANSI string literal
176 
177 #define DOS_C_MU '\xE6' // DOS char
178 #define DOS_S_MU "\xE6" // DOS string literal
179 
180 #define UNICODE_S_MU "\u00B5" // Unicode string liter
181 
182 #define UTF8_S_MU "\xc2\xb5" // UTF-8 string literal
183 
184 
185 
186 #if defined( MBG_UML_UTF8 )
187 
188  #define UCAE UTF8_US_A_UML
189  #define UCOE UTF8_US_O_UML
190  #define UCUE UTF8_US_U_UML
191 
192  #define LCAE UTF8_LS_A_UML
193  #define LCOE UTF8_LS_O_UML
194  #define LCUE UTF8_LS_U_UML
195 
196  #define LCSZ UTF8_LS_SZ_UML
197  #define DEG UTF8_S_DEGREE
198  #define MU UTF8_S_MU
199 
200 #elif defined( MBG_UML_ANSI )
201 
202  #define UCAE ANSI_US_A_UML
203  #define UCOE ANSI_US_O_UML
204  #define UCUE ANSI_US_U_UML
205 
206  #define LCAE ANSI_LS_A_UML
207  #define LCOE ANSI_LS_O_UML
208  #define LCUE ANSI_LS_U_UML
209 
210  #define LCSZ ANSI_LS_SZ_UML
211  #define DEG ANSI_S_DEGREE
212  #define MU ANSI_S_MU
213 
214 #elif defined( MBG_UML_DOS )
215 
216  #define UCAE DOS_US_A_UML
217  #define UCOE DOS_US_O_UML
218  #define UCUE DOS_US_U_UML
219 
220  #define LCAE DOS_LS_A_UML
221  #define LCOE DOS_LS_O_UML
222  #define LCUE DOS_LS_U_UML
223 
224  #define LCSZ DOS_LS_SZ_UML
225  #define DEG DOS_S_DEGREE
226  #define MU DOS_S_MU
227 
228 #else
229 
230  #error Need to define default encoding for umlauts.
231 
232 #endif
233 
234 
235 
236 // A string initializer which can be used to set up a string
237 // to check if all umlauts are displayed correctly.
238 #define UMLAUTS_STRING UCAE UCOE UCUE LCAE LCOE LCUE LCSZ DEG MU
239 
240 
241 #define ANSI_UMLAUTS \
242 { \
243  ANSI_UC_A_UML, ANSI_UC_O_UML, ANSI_UC_U_UML, \
244  ANSI_LC_A_UML, ANSI_LC_O_UML, ANSI_LC_U_UML, \
245  ANSI_LC_SZ_UML, ANSI_C_DEGREE, ANSI_C_MU, 0 \
246 }
247 
248 
249 #define DOS_UMLAUTS \
250 { \
251  DOS_UC_A_UML, DOS_UC_O_UML, DOS_UC_U_UML, \
252  DOS_LC_A_UML, DOS_LC_O_UML, DOS_LC_U_UML, \
253  DOS_LC_SZ_UML, DOS_C_DEGREE, DOS_S_MU, 0 \
254 }
255 
256 
257 /* ----- function prototypes begin ----- */
258 
259 /* This section was generated automatically */
260 /* by MAKEHDR, do not remove the comments. */
261 
262 /* (no header definitions found) */
263 
264 /* ----- function prototypes end ----- */
265 
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 /* End of header body */
271 
272 #undef _ext
273 #undef _DO_INIT
274 
275 #endif /* _CHARCODE_H */