Locale/Languages: restore backwards compatible native language names
[AROS.git] / workbench / locale / languages / italian.c
blob1dc90a91b29a34c0277fe243ae2801df4cd796e3
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: italian.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 "italian" /* String version of above */
21 #define NLANGSTR "italiano" /* Native version of LANGSTR */
22 #define LANGVER 41 /* Version number of language */
23 #define LANGREV 2 /* Revision number of language */
24 #define LANGTAG "\0$VER: " LANGSTR ".language 41.2 (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 Italian character type/conversion */
37 extern const STRPTR __italian_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
134 AROS_LH1(struct Language *, open,
135 AROS_LHA(ULONG, version, D0),
136 struct Language *, language, 1, language)
138 AROS_LIBFUNC_INIT
139 language->library.lib_OpenCnt++;
140 language->library.lib_Flags &= ~LIBF_DELEXP;
142 /* Again return NULL if you could not open */
143 return language;
145 AROS_LIBFUNC_EXIT
148 AROS_LH0(BPTR, close, struct Language *, language, 2, language)
150 AROS_LIBFUNC_INIT
152 if(! --language->library.lib_OpenCnt)
154 /* Delayed expunge pending? */
155 if(language->library.lib_Flags & LIBF_DELEXP)
157 /* Yes, expunge the library */
158 return AROS_LC0(BPTR, expunge, struct Language *, language, 3, language);
161 return BNULL;
162 AROS_LIBFUNC_EXIT
165 AROS_LH0(BPTR, expunge, struct Language *, language, 3, language)
167 AROS_LIBFUNC_INIT
169 BPTR ret;
170 if(language->library.lib_OpenCnt)
172 /* Can't expunge, we are still open */
173 language->library.lib_Flags |= LIBF_DELEXP;
174 return 0;
177 Remove(&language->library.lib_Node);
178 ret = language->seglist;
180 FreeMem((UBYTE *)language - language->library.lib_NegSize,
181 language->library.lib_PosSize + language->library.lib_NegSize);
183 return ret;
185 AROS_LIBFUNC_EXIT
188 AROS_LH0I(int, null, struct Language *, language, 0, language)
190 AROS_LIBFUNC_INIT
192 return 0;
194 AROS_LIBFUNC_EXIT
197 /* ------------------------------------------------------------------------
198 Language specific functions
199 ------------------------------------------------------------------------ */
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 __italian_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 __italian_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.
277 "Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì",
278 "Venerdì", "Sabato",
280 /* Abbreviated days of the week */
281 "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab",
283 /* Months of the year */
284 "Gennaio", "Febbraio", "Marzo",
285 "Aprile", "Maggio", "Giugno",
286 "Luglio", "Agosto", "Settembre",
287 "Ottobre", "Novembre", "Dicembre",
289 /* Abbreviated months of the year */
290 "Gen", "Feb", "Mar", "Apr", "Mag", "Giu",
291 "Lug", "Ago", "Set", "Ott", "Nov", "Dic",
293 "Si", /* Yes, affirmative response */
294 "No", /* No/negative response */
296 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
297 "AM", "PM",
299 /* Soft and hard hyphens */
300 "-", "-",
302 /* Open and close quotes */
303 "\"", "\"",
305 /* Days: But not actual day names
306 Yesterday - the day before the current
307 Today - the current day
308 Tomorrow - the next day
309 Future.
311 "Ieri", "Oggi", "Domani", "Futuro",
313 /* Native language name */
314 NLANGSTR
317 /* This is the end of ROMtag marker. */
318 const char end=0;