2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: catalonian.language description file.
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 "catalonian" /* String version of above */
21 #define NLANGSTR "català" /* 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_LDA(ULONG
, id
, D0
),
29 struct LocaleBase
*, LocaleBase
, 9, language
32 /* ----------------------------------------------------------------------- */
34 /* Bit masks for locale .language functions. Only implement GetString() */
35 #define LF_GetLangStr (1L << 3)
37 /* Arrays for Catalan character type/conversion */
38 extern const STRPTR __catalan_strings
[];
40 /* -------------------------------------------------------------------------
41 Library definition, you should not need to change any of this.
42 ------------------------------------------------------------------------- */
46 struct Library library
;
47 struct ExecBase
*sysbase
;
51 extern const UBYTE name
[];
52 extern const UBYTE version
[];
53 extern const APTR inittabl
[4];
54 extern void *const functable
[];
55 extern struct Language
*AROS_SLIB_ENTRY(init
,language
,0)();
56 AROS_LD1(struct Language
*, open
,
57 AROS_LDA(ULONG
, version
, D0
),
58 struct Language
*, language
, 1, language
60 AROS_LD0(BPTR
, close
, struct Language
*, language
, 2, language
);
61 AROS_LD0(BPTR
, expunge
, struct Language
*, language
, 3, language
);
62 AROS_LD0I(int, null
, struct Language
*, language
, 0, language
);
63 AROS_LD0(ULONG
, mask
, struct Language
*, language
, 5, language
);
64 extern const char end
;
71 const struct Resident languageTag
=
74 (struct Resident
*)&languageTag
,
85 const UBYTE name
[]=LANGSTR
".language";
86 const UBYTE nativelang
[]=NLANGTAG
; /* N.B - MUST come before $VER: */
87 const UBYTE version
[]=LANGTAG
;
89 const ULONG datatable
= 0;
91 const APTR inittabl
[4] =
93 (APTR
)sizeof(struct Language
),
96 &AROS_SLIB_ENTRY(init
,language
,0)
99 struct ExecBase
*SysBase
;
101 AROS_UFH3(struct Language
*, AROS_SLIB_ENTRY(init
,language
,0),
102 AROS_UFHA(struct Language
*, language
, D0
),
103 AROS_UFHA(BPTR
, segList
, A0
),
104 AROS_UFHA(struct ExecBase
*, _SysBase
, A6
)
110 You could just as easily do this bit as the InitResident()
111 datatable, however this works just as well.
113 language
->library
.lib_Node
.ln_Type
= NT_LIBRARY
;
114 language
->library
.lib_Node
.ln_Pri
= -120;
115 language
->library
.lib_Node
.ln_Name
= (char *)name
;
116 language
->library
.lib_Flags
= LIBF_SUMUSED
| LIBF_CHANGED
;
117 language
->library
.lib_Version
= LANGVER
;
118 language
->library
.lib_Revision
= LANGREV
;
119 language
->library
.lib_IdString
= (APTR
)&version
[7];
121 language
->seglist
= segList
;
122 language
->sysbase
= _SysBase
;
126 Although it is unlikely, you would return NULL if you for some
127 unknown reason couldn't open.
129 bug("GetLangStr: Loaded at address %p\n", &AROS_SLIB_ENTRY(getlangstring
,language
,9));
135 #define SysBase language->sysbase
137 AROS_LH1(struct Language
*, open
,
138 AROS_LHA(ULONG
, version
, D0
),
139 struct Language
*, language
, 1, language
143 language
->library
.lib_OpenCnt
++;
144 language
->library
.lib_Flags
&= ~LIBF_DELEXP
;
146 /* Again return NULL if you could not open */
152 AROS_LH0(BPTR
, close
, struct Language
*, language
, 2, language
)
156 if(! --language
->library
.lib_OpenCnt
)
158 /* Delayed expunge pending? */
159 if(language
->library
.lib_Flags
& LIBF_DELEXP
)
161 /* Yes, expunge the library */
162 return AROS_LC0(BPTR
, expunge
, struct Language
*, language
, 3, language
);
169 AROS_LH0(BPTR
, expunge
, struct Language
*, language
, 3, language
)
174 if(language
->library
.lib_OpenCnt
)
176 /* Can't expunge, we are still open */
177 language
->library
.lib_Flags
|= LIBF_DELEXP
;
181 Remove(&language
->library
.lib_Node
);
182 ret
= language
->seglist
;
184 FreeMem((UBYTE
*)language
- language
->library
.lib_NegSize
,
185 language
->library
.lib_PosSize
+ language
->library
.lib_NegSize
);
192 AROS_LH0I(int, null
, struct Language
*, language
, 0, language
)
201 /* ------------------------------------------------------------------------
202 Language specific functions
203 ------------------------------------------------------------------------ */
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
232 //kprintf("\nWe have got to getlangstring\n");
235 return __catalan_strings
[id
];
242 /* -----------------------------------------------------------------------
243 Library function table - you will need to alter this
244 I have this right here at the end of the library so that I do not
245 have to have prototypes for the functions. Although you could do that.
246 ----------------------------------------------------------------------- */
248 void *const functable
[] =
250 &AROS_SLIB_ENTRY(open
,language
,1),
251 &AROS_SLIB_ENTRY(close
,language
,2),
252 &AROS_SLIB_ENTRY(expunge
,language
,3),
253 &AROS_SLIB_ENTRY(null
,language
,0),
254 &AROS_SLIB_ENTRY(mask
,language
,5),
256 /* Note, shorter function table, as only getlangstring is used */
259 &AROS_SLIB_ENTRY(null
, language
, 0),
260 &AROS_SLIB_ENTRY(null
, language
, 0),
261 &AROS_SLIB_ENTRY(null
, language
, 0),
262 &AROS_SLIB_ENTRY(getlangstring
, language
, 9),
267 Note how only the required data structures are kept...
269 This is the list of strings. It is an array of pointers to strings,
270 although how it is laid out is implementation dependant.
272 const STRPTR __catalan_strings
[] =
277 /* The days of the week. Starts with the first day of the week.
278 In English this would be Sunday, this depends upon the settings
279 of Locale->CalendarType.
282 /* FIXME: stegerg: I think this must always start with Sunday and not what comment above says */
284 "Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous",
285 "Divendres", "Dissabte",
287 /* Abbreviated days of the week */
288 "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
290 /* Months of the year */
291 "Gener", "Febrer", "Març",
292 "Abril", "Maig", "Juny",
293 "Juliol", "Agost", "Setembre",
294 "Octubre", "Novembre", "Desembre",
296 /* Abbreviated months of the year */
297 "Gn", "Fb", "Mç", "Ab", "Mg", "Jn",
298 "Jl", "Ag", "St", "Oc", "Nv", "Ds",
300 "Sí", /* Yes, affirmative response */
301 "No", /* No/negative response */
303 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
306 /* Soft and hard hyphens */
309 /* Open and close quotes */
312 /* Days: But not actual day names
313 Yesterday - the day before the current
314 Today - the current day
315 Tomorrow - the next day
318 "Ahir", "Avui", "Demà", "Futur",
320 /* Native language name */
324 /* This is the end of ROMtag marker. */