Locale/Languages: restore backwards compatible native language names
[AROS.git] / workbench / locale / languages / german.c
blob89101499f660a4151078eb27722ba3328db847f5
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: german.language description file.
6 */
8 #include <exec/types.h>
9 #include <aros/system.h>
10 #include <exec/resident.h>
11 #include <exec/libraries.h>
12 #include <libraries/locale.h>
14 #include <proto/exec.h>
15 #include <aros/libcall.h>
16 #include <aros/asmcall.h>
18 #include <aros/debug.h>
20 #define LANGSTR "german" /* String version of above */
21 #define NLANGSTR "deutsch" /* Native version of LANGSTR */
22 #define LANGVER 41 /* Version number of language */
23 #define LANGREV 3 /* Revision number of language */
24 #define LANGTAG "\0$VER: " LANGSTR ".language 41.3 (30.09.2014)"
25 #define NLANGTAG "$NLANG:" NLANGSTR
27 AROS_LD1(STRPTR, getlangstring,
28 AROS_LHA(ULONG, id, D0),
29 struct LocaleBase *, LocaleBase, 9, language);
31 /* ----------------------------------------------------------------------- */
33 /* Bit masks for locale .language functions. Only implement GetString() */
34 #define LF_GetLangStr (1L << 3)
36 /* Arrays for German character type/conversion */
37 extern const STRPTR __german_strings[];
39 /* -------------------------------------------------------------------------
40 Library definition, you should not need to change any of this.
41 ------------------------------------------------------------------------- */
43 struct Language
45 struct Library library;
46 struct ExecBase *sysbase;
47 BPTR seglist;
50 extern const UBYTE name[];
51 extern const UBYTE version[];
52 extern const APTR inittabl[4];
53 extern void *const functable[];
54 extern struct Language *AROS_SLIB_ENTRY(init,language,0)();
55 AROS_LD1(struct Language *, open,
56 AROS_LHA(ULONG, version, D0),
57 struct Language *, language, 1, language);
58 AROS_LD0(BPTR, close, struct Language *, language, 2, language);
59 AROS_LD0(BPTR, expunge, struct Language *, language, 3, language);
60 AROS_LD0I(int, null, struct Language *, language, 0, language);
61 AROS_LD0(ULONG, mask, struct Language *, language, 5, language);
62 extern const char end;
64 int entry(void)
66 return -1;
69 const struct Resident languageTag =
71 RTC_MATCHWORD,
72 (struct Resident *)&languageTag,
73 (APTR)&end,
74 RTF_AUTOINIT,
75 LANGVER,
76 NT_LIBRARY,
77 -120,
78 (STRPTR)name,
79 (STRPTR)&version[7],
80 (ULONG *)inittabl
83 const UBYTE name[]=LANGSTR ".language";
84 const UBYTE nativelang[]=NLANGTAG; /* N.B - MUST come before $VER: */
85 const UBYTE version[]=LANGTAG;
87 const ULONG datatable = 0;
89 const APTR inittabl[4] =
91 (APTR)sizeof(struct Language),
92 (APTR)functable,
93 (APTR)&datatable,
94 &AROS_SLIB_ENTRY(init,language,0)
97 struct ExecBase *SysBase;
99 AROS_UFH3(struct Language *, AROS_SLIB_ENTRY(init,language,0),
100 AROS_UFHA(struct Language *, language, D0),
101 AROS_UFHA(BPTR, segList, A0),
102 AROS_UFHA(struct ExecBase *, _SysBase, A6)
105 AROS_USERFUNC_INIT
108 You could just as easily do this bit as the InitResident()
109 datatable, however this works just as well.
111 language->library.lib_Node.ln_Type = NT_LIBRARY;
112 language->library.lib_Node.ln_Pri = -120;
113 language->library.lib_Node.ln_Name = (char *)name;
114 language->library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED;
115 language->library.lib_Version = LANGVER;
116 language->library.lib_Revision = LANGREV;
117 language->library.lib_IdString = (APTR)&version[7];
119 language->seglist = segList;
120 language->sysbase = _SysBase;
121 SysBase = _SysBase;
124 Although it is unlikely, you would return NULL if you for some
125 unknown reason couldn't open.
127 bug("GetLangStr: Loaded at address %p\n", &AROS_SLIB_ENTRY(getlangstring,language,9));
128 return language;
130 AROS_USERFUNC_EXIT
133 #define SysBase language->sysbase
135 AROS_LH1(struct Language *, open,
136 AROS_LHA(ULONG, version, D0),
137 struct Language *, language, 1, language)
139 AROS_LIBFUNC_INIT
140 language->library.lib_OpenCnt++;
141 language->library.lib_Flags &= ~LIBF_DELEXP;
143 /* Again return NULL if you could not open */
144 return language;
146 AROS_LIBFUNC_EXIT
149 AROS_LH0(BPTR, close, struct Language *, language, 2, language)
151 AROS_LIBFUNC_INIT
153 if(! --language->library.lib_OpenCnt)
155 /* Delayed expunge pending? */
156 if(language->library.lib_Flags & LIBF_DELEXP)
158 /* Yes, expunge the library */
159 return AROS_LC0(BPTR, expunge, struct Language *, language, 3, language);
162 return BNULL;
163 AROS_LIBFUNC_EXIT
166 AROS_LH0(BPTR, expunge, struct Language *, language, 3, language)
168 AROS_LIBFUNC_INIT
170 BPTR ret;
171 if(language->library.lib_OpenCnt)
173 /* Can't expunge, we are still open */
174 language->library.lib_Flags |= LIBF_DELEXP;
175 return 0;
178 Remove(&language->library.lib_Node);
179 ret = language->seglist;
181 FreeMem((UBYTE *)language - language->library.lib_NegSize,
182 language->library.lib_PosSize + language->library.lib_NegSize);
184 return ret;
186 AROS_LIBFUNC_EXIT
189 AROS_LH0I(int, null, struct Language *, language, 0, language)
191 AROS_LIBFUNC_INIT
193 return 0;
195 AROS_LIBFUNC_EXIT
198 /* ------------------------------------------------------------------------
199 Language specific functions
200 ------------------------------------------------------------------------ */
202 /* ULONG LanguageMask():
203 This function is to inform locale.library what functions it should
204 use from this library. This is done by returning a bitmask containing
205 1's for functions to use, and 0's for functions to ignore.
207 Unused bits MUST be 0 for future compatibility.
209 AROS_LH0(ULONG, mask, struct Language *, language, 5, language)
211 AROS_LIBFUNC_INIT
213 return ( LF_GetLangStr );
215 AROS_LIBFUNC_EXIT
218 /* STRPTR GetLangString(ULONG num): Language function 3
219 This function is called by GetLocaleStr() and should return
220 the string matching the string id passed in as num.
222 AROS_LH1(STRPTR, getlangstring,
223 AROS_LHA(ULONG, id, D0),
224 struct LocaleBase *, LocaleBase, 9, language)
226 AROS_LIBFUNC_INIT
228 //kprintf("\nWe have got to getlangstring\n");
230 if(id < MAXSTRMSG)
231 return __german_strings[id];
232 else
233 return NULL;
235 AROS_LIBFUNC_EXIT
238 /* -----------------------------------------------------------------------
239 Library function table - you will need to alter this
240 I have this right here at the end of the library so that I do not
241 have to have prototypes for the functions. Although you could do that.
242 ----------------------------------------------------------------------- */
244 void *const functable[] =
246 &AROS_SLIB_ENTRY(open,language,1),
247 &AROS_SLIB_ENTRY(close,language,2),
248 &AROS_SLIB_ENTRY(expunge,language,3),
249 &AROS_SLIB_ENTRY(null,language,0),
250 &AROS_SLIB_ENTRY(mask,language,5),
252 /* Note, shorter function table, as only getlangstring is used */
254 /* 0 - 3 */
255 &AROS_SLIB_ENTRY(null, language, 0),
256 &AROS_SLIB_ENTRY(null, language, 0),
257 &AROS_SLIB_ENTRY(null, language, 0),
258 &AROS_SLIB_ENTRY(getlangstring, language, 9),
259 (void *)-1
263 Note how only the required data structures are kept...
265 This is the list of strings. It is an array of pointers to strings,
266 although how it is laid out is implementation dependant.
268 const STRPTR __german_strings[] =
270 /* A blank string */
273 /* The days of the week. Starts with the first day of the week.
274 In English this would be Sunday, this depends upon the settings
275 of Locale->CalendarType.
278 // NOTICE: stegerg: I think this must always start with Sunday and not what comment above says
280 "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag",
281 "Freitag", "Samstag",
283 /* Abbreviated days of the week */
284 "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa",
286 /* Months of the year */
287 "Januar", "Februar", "März",
288 "April", "Mai", "Juni",
289 "Juli", "August", "September",
290 "Oktober", "November", "Dezember",
292 /* Abbreviated months of the year */
293 "Jan", "Feb", "Mär", "Apr", "Mai", "Jun",
294 "Jul", "Aug", "Sep", "Okt", "Nov", "Dez",
296 "Ja", /* Yes, affirmative response */
297 "Nein", /* No/negative response */
299 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
300 "Vorm.", "Nachm.",
302 /* Soft and hard hyphens */
303 "\xAD", "-",
305 /* Open and close quotes */
306 "\xBB", "\xAB",
308 /* Days: But not actual day names
309 Yesterday - the day before the current
310 Today - the current day
311 Tomorrow - the next day
312 Future.
314 "Gestern", "Heute", "Morgen", "Zukunft",
316 /* Native language name */
317 NLANGSTR
320 /* This is the end of ROMtag marker. */
321 const char end=0;