Locale/Languages: restore backwards compatible native language names
[AROS.git] / workbench / locale / languages / hungarian.c
blob7a589f106c175eb28b4f948438e3b27d6c979e5c
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: hungarian.language description file.
6 Char: ISO 8859-2
7 */
9 /* Collation tables need to be implemented */
11 #include <exec/types.h>
12 #include <aros/system.h>
13 #include <exec/resident.h>
14 #include <exec/libraries.h>
15 #include <libraries/locale.h>
17 #include <proto/exec.h>
18 #include <aros/libcall.h>
19 #include <aros/asmcall.h>
21 #include <aros/debug.h>
23 #define LANGSTR "hungarian" /* String version of above */
24 #define NLANGSTR "magyar" /* Native version of LANGSTR */
25 #define LANGVER 41 /* Version number of language */
26 #define LANGREV 2 /* Revision number of language */
27 #define LANGTAG "\0$VER: " LANGSTR ".language 41.2 (30.09.2014)"
28 #define NLANGTAG "$NLANG:" NLANGSTR
30 AROS_LD1(STRPTR, getlangstring,
31 AROS_LHA(ULONG, id, D0),
32 struct LocaleBase *, LocaleBase, 9, language);
34 /* ----------------------------------------------------------------------- */
36 /* Bit masks for locale .language functions. Only implement GetString() */
37 #define LF_GetLangStr (1L << 3)
39 /* Arrays for German character type/conversion */
40 extern const STRPTR __magyar_strings[];
42 /* -------------------------------------------------------------------------
43 Library definition, you should not need to change any of this.
44 ------------------------------------------------------------------------- */
46 struct Language
48 struct Library library;
49 struct ExecBase *sysbase;
50 BPTR seglist;
53 extern const UBYTE name[];
54 extern const UBYTE version[];
55 extern const APTR inittabl[4];
56 extern void *const functable[];
57 extern struct Language *AROS_SLIB_ENTRY(init,language,0)();
58 AROS_LD1(struct Language *, open,
59 AROS_LHA(ULONG, version, D0),
60 struct Language *, language, 1, language);
61 AROS_LD0(BPTR, close, struct Language *, language, 2, language);
62 AROS_LD0(BPTR, expunge, struct Language *, language, 3, language);
63 AROS_LD0I(int, null, struct Language *, language, 0, language);
64 AROS_LD0(ULONG, mask, struct Language *, language, 5, language);
65 extern const char end;
67 int entry(void)
69 return -1;
72 const struct Resident languageTag =
74 RTC_MATCHWORD,
75 (struct Resident *)&languageTag,
76 (APTR)&end,
77 RTF_AUTOINIT,
78 LANGVER,
79 NT_LIBRARY,
80 -120,
81 (STRPTR)name,
82 (STRPTR)&version[7],
83 (ULONG *)inittabl
86 const UBYTE name[]=LANGSTR ".language";
87 const UBYTE nativelang[]=NLANGTAG; /* N.B - MUST come before $VER: */
88 const UBYTE version[]=LANGTAG;
90 const ULONG datatable = 0;
92 const APTR inittabl[4] =
94 (APTR)sizeof(struct Language),
95 (APTR)functable,
96 (APTR)&datatable,
97 &AROS_SLIB_ENTRY(init,language,0)
100 struct ExecBase *SysBase;
102 AROS_UFH3(struct Language *, AROS_SLIB_ENTRY(init,language,0),
103 AROS_UFHA(struct Language *, language, D0),
104 AROS_UFHA(BPTR, segList, A0),
105 AROS_UFHA(struct ExecBase *, _SysBase, A6)
108 AROS_USERFUNC_INIT
111 You could just as easily do this bit as the InitResident()
112 datatable, however this works just as well.
114 language->library.lib_Node.ln_Type = NT_LIBRARY;
115 language->library.lib_Node.ln_Pri = -120;
116 language->library.lib_Node.ln_Name = (char *)name;
117 language->library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED;
118 language->library.lib_Version = LANGVER;
119 language->library.lib_Revision = LANGREV;
120 language->library.lib_IdString = (APTR)&version[7];
122 language->seglist = segList;
123 language->sysbase = _SysBase;
124 SysBase = _SysBase;
127 Although it is unlikely, you would return NULL if you for some
128 unknown reason couldn't open.
130 bug("GetLangStr: Loaded at address %p\n", &AROS_SLIB_ENTRY(getlangstring,language,9));
131 return language;
133 AROS_USERFUNC_EXIT
137 AROS_LH1(struct Language *, open,
138 AROS_LHA(ULONG, version, D0),
139 struct Language *, language, 1, language)
141 AROS_LIBFUNC_INIT
142 language->library.lib_OpenCnt++;
143 language->library.lib_Flags &= ~LIBF_DELEXP;
145 /* Again return NULL if you could not open */
146 return language;
148 AROS_LIBFUNC_EXIT
151 AROS_LH0(BPTR, close, struct Language *, language, 2, language)
153 AROS_LIBFUNC_INIT
155 if(! --language->library.lib_OpenCnt)
157 /* Delayed expunge pending? */
158 if(language->library.lib_Flags & LIBF_DELEXP)
160 /* Yes, expunge the library */
161 return AROS_LC0(BPTR, expunge, struct Language *, language, 3, language);
164 return BNULL;
165 AROS_LIBFUNC_EXIT
168 AROS_LH0(BPTR, expunge, struct Language *, language, 3, language)
170 AROS_LIBFUNC_INIT
172 BPTR ret;
173 if(language->library.lib_OpenCnt)
175 /* Can't expunge, we are still open */
176 language->library.lib_Flags |= LIBF_DELEXP;
177 return 0;
180 Remove(&language->library.lib_Node);
181 ret = language->seglist;
183 FreeMem((UBYTE *)language - language->library.lib_NegSize,
184 language->library.lib_PosSize + language->library.lib_NegSize);
186 return ret;
188 AROS_LIBFUNC_EXIT
191 AROS_LH0I(int, null, struct Language *, language, 0, language)
193 AROS_LIBFUNC_INIT
195 return 0;
197 AROS_LIBFUNC_EXIT
200 /* ------------------------------------------------------------------------
201 Language specific functions
202 ------------------------------------------------------------------------ */
205 /* ULONG LanguageMask():
206 This function is to inform locale.library what functions it should
207 use from this library. This is done by returning a bitmask containing
208 1's for functions to use, and 0's for functions to ignore.
210 Unused bits MUST be 0 for future compatibility.
212 AROS_LH0(ULONG, mask, struct Language *, language, 5, language)
214 AROS_LIBFUNC_INIT
216 return ( LF_GetLangStr );
218 AROS_LIBFUNC_EXIT
221 /* STRPTR GetLangString(ULONG num): Language function 3
222 This function is called by GetLocaleStr() and should return
223 the string matching the string id passed in as num.
225 AROS_LH1(STRPTR, getlangstring,
226 AROS_LHA(ULONG, id, D0),
227 struct LocaleBase *, LocaleBase, 9, language)
229 AROS_LIBFUNC_INIT
231 //kprintf("\nWe have got to getlangstring\n");
233 if(id < MAXSTRMSG)
234 return __magyar_strings[id];
235 else
236 return NULL;
238 AROS_LIBFUNC_EXIT
241 /* -----------------------------------------------------------------------
242 Library function table - you will need to alter this
243 I have this right here at the end of the library so that I do not
244 have to have prototypes for the functions. Although you could do that.
245 ----------------------------------------------------------------------- */
247 void *const functable[] =
249 &AROS_SLIB_ENTRY(open,language,1),
250 &AROS_SLIB_ENTRY(close,language,2),
251 &AROS_SLIB_ENTRY(expunge,language,3),
252 &AROS_SLIB_ENTRY(null,language,0),
253 &AROS_SLIB_ENTRY(mask,language,5),
255 /* Note, shorter function table, as only getlangstring is used */
257 /* 0 - 3 */
258 &AROS_SLIB_ENTRY(null, language, 0),
259 &AROS_SLIB_ENTRY(null, language, 0),
260 &AROS_SLIB_ENTRY(null, language, 0),
261 &AROS_SLIB_ENTRY(getlangstring, language, 9),
262 (void *)-1
266 Note how only the required data structures are kept...
268 This is the list of strings. It is an array of pointers to strings,
269 although how it is laid out is implementation dependant.
271 const STRPTR __magyar_strings[] =
273 /* A blank string */
276 /* The days of the week. Starts with the first day of the week.
277 In English this would be Sunday, this depends upon the settings
278 of Locale->CalendarType.
280 "Hétfô", "Kedd", "Szerda", "Csütörtök", "Péntek",
281 "Szombat", "Vasárnap",
283 /* Abbreviated days of the week */
284 "H", "K", "Sz", "Cs", "P", "Szo", "V",
286 /* Months of the year */
287 "Január", "Február", "Március",
288 "Április", "Május", "Június",
289 "Julius", "Augusztus", "Szeptember",
290 "Október", "November", "December",
292 /* Abbreviated months of the year */
293 "I", "II", "III", "IV", "V", "VI",
294 "VII", "VIII", "IX", "X", "XI", "XII",
296 "Igen", /* Yes, affirmative response */
297 "Nem", /* No/negative response */
299 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
300 "Délelôtt", "Délután",
302 /* Soft and hard hyphens */
303 "\xAD", "-",
305 /* Open and close quotes */
306 "\"", "\"",
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 "Tegnap", "Ma", "Holnap", "Jövô",
316 /* Native language name */
317 NLANGSTR
320 /* This is the end of ROMtag marker. */
321 const char end=0;