2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: maltese.language description file.
9 #include <exec/types.h>
10 #include <aros/system.h>
11 #include <exec/resident.h>
12 #include <exec/libraries.h>
13 #include <libraries/locale.h>
15 #include <proto/exec.h>
16 #include <aros/libcall.h>
17 #include <aros/asmcall.h>
19 #include <aros/debug.h>
21 #define LANGSTR "maltese" /* String version of above */
22 #define NLANGSTR "Malti" /* Native version of LANGSTR */
23 #define LANGVER 41 /* Version number of language */
24 #define LANGREV 1 /* Revision number of language */
25 #define LANGTAG "\0$VER: " LANGSTR ".language 41.1 (14.04.2013)"
26 #define NLANGTAG "$NLANG:" NLANGSTR
28 AROS_LD1(STRPTR
, getlangstring
,
29 AROS_LDA(ULONG
, id
, D0
),
30 struct LocaleBase
*, LocaleBase
, 9, language
33 /* ----------------------------------------------------------------------- */
35 /* Bit masks for locale .language functions. Only implement GetString() */
36 #define LF_GetLangStr (1L << 3)
38 /* Arrays for German character type/conversion */
39 extern const STRPTR __malti_strings
[];
41 /* -------------------------------------------------------------------------
42 Library definition, you should not need to change any of this.
43 ------------------------------------------------------------------------- */
47 struct Library library
;
48 struct ExecBase
*sysbase
;
52 extern const UBYTE name
[];
53 extern const UBYTE version
[];
54 extern const APTR inittabl
[4];
55 extern void *const functable
[];
56 extern struct Language
*AROS_SLIB_ENTRY(init
,language
,0)();
57 AROS_LD1(struct Language
*, open
,
58 AROS_LDA(ULONG
, version
, D0
),
59 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
;
72 const struct Resident languageTag
=
75 (struct Resident
*)&languageTag
,
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
),
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
)
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
;
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));
137 AROS_LH1(struct Language
*, open
,
138 AROS_LHA(ULONG
, version
, D0
),
139 struct Language
*, language
, 1, language
)
142 language
->library
.lib_OpenCnt
++;
143 language
->library
.lib_Flags
&= ~LIBF_DELEXP
;
145 /* Again return NULL if you could not open */
151 AROS_LH0(BPTR
, close
, struct Language
*, language
, 2, language
)
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
);
168 AROS_LH0(BPTR
, expunge
, struct Language
*, language
, 3, language
)
173 if(language
->library
.lib_OpenCnt
)
175 /* Can't expunge, we are still open */
176 language
->library
.lib_Flags
|= LIBF_DELEXP
;
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
);
191 AROS_LH0I(int, null
, struct Language
*, language
, 0, language
)
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
)
216 return ( LF_GetLangStr
);
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
)
231 //kprintf("\nWe have got to getlangstring\n");
234 return __malti_strings
[id
];
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 */
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),
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 __malti_strings
[] =
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 "il-¡add", "it-Tnejn", "it-Tlieta", "l-Erbg±a", "il-¡amis",
281 "il-Õimg±a0", "is-Sibt",
283 /* Abbreviated days of the week */
284 "¡ad", "Tne", "Tli", "Erb", "¡am", "Õim", "Sib",
286 /* Months of the year */
287 "Jannar", "Frar", "Marzu",
288 "April", "Mejju", "Õunju",
289 "Lulju", "Awissu", "Settembru",
290 "Ottubru", "Novembru", "Diåembru",
292 /* Abbreviated months of the year */
293 "Jan", "Fra", "Mar", "Apr", "Mej", "Õun",
294 "Lul", "Awi", "Set", "Ott", "Nov", "Diå",
296 "Iva", /* Yes, affirmative response */
297 "Le", /* No/negative response */
299 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
302 /* Soft and hard hyphens */
305 /* Open and close quotes */
308 /* Days: But not actual day names
309 Yesterday - the day before the current
310 Today - the current day
311 Tomorrow - the next day
314 "Ilbiera±", "Illum", "G±ada", "Fil-futur"
317 /* This is the end of ROMtag marker. */