workbench/locale/languages: Use AROS_LDn macro to get prototype of AROS_LHn defined...
[AROS.git] / workbench / locale / languages / català.c
blobeacca5d5f0d08cb56a06adeae7e4b66381899902
1 /*
2 Copyright © 1995-1998, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: català.language description file.
6 Lang: English
7 */
9 /* Language file for the Catalan language. */
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 "català" /* String version of above */
24 #define LANGVER 41 /* Version number of language */
25 #define LANGREV 0 /* Revision number of language */
26 #define LANGTAG "\0$VER: "LANGSTR".language 41.0 (08.01.1998)"
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 Catalan character type/conversion */
39 extern const STRPTR __catalan_strings[];
41 /* -------------------------------------------------------------------------
42 Library definition, you should not need to change any of this.
43 ------------------------------------------------------------------------- */
45 struct Language
47 struct Library library;
48 struct ExecBase *sysbase;
49 BPTR seglist;
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;
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 version[]=LANGTAG;
89 const ULONG datatable = 0;
91 const APTR inittabl[4] =
93 (APTR)sizeof(struct Language),
94 (APTR)functable,
95 (APTR)&datatable,
96 &AROS_SLIB_ENTRY(init,language,0)
99 struct ExecBase *mySysBase;
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)
107 AROS_USERFUNC_INIT
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;
123 mySysBase = 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));
130 return language;
132 AROS_USERFUNC_EXIT
135 #define SysBase language->sysbase
137 AROS_LH1(struct Language *, open,
138 AROS_LHA(ULONG, version, D0),
139 struct Language *, language, 1, language
142 AROS_LIBFUNC_INIT
143 language->library.lib_OpenCnt++;
144 language->library.lib_Flags &= ~LIBF_DELEXP;
146 /* Again return NULL if you could not open */
147 return language;
149 AROS_LIBFUNC_EXIT
152 AROS_LH0(BPTR, close, struct Language *, language, 2, language)
154 AROS_LIBFUNC_INIT
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);
165 return BNULL;
166 AROS_LIBFUNC_EXIT
169 AROS_LH0(BPTR, expunge, struct Language *, language, 3, language)
171 AROS_LIBFUNC_INIT
173 BPTR ret;
174 if(language->library.lib_OpenCnt)
176 /* Can't expunge, we are still open */
177 language->library.lib_Flags |= LIBF_DELEXP;
178 return 0;
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);
187 return ret;
189 AROS_LIBFUNC_EXIT
192 AROS_LH0I(int, null, struct Language *, language, 0, language)
194 AROS_LIBFUNC_INIT
196 return 0;
198 AROS_LIBFUNC_EXIT
201 /* ------------------------------------------------------------------------
202 Language specific functions
203 ------------------------------------------------------------------------ */
205 #undef SysBase
206 #define SysBase mySysBase
208 /* ULONG LanguageMask():
209 This function is to inform locale.library what functions it should
210 use from this library. This is done by returning a bitmask containing
211 1's for functions to use, and 0's for functions to ignore.
213 Unused bits MUST be 0 for future compatibility.
215 AROS_LH0(ULONG, mask, struct Language *, language, 5, language)
217 AROS_LIBFUNC_INIT
219 return ( LF_GetLangStr );
221 AROS_LIBFUNC_EXIT
224 /* STRPTR GetLangString(ULONG num): Language function 3
225 This function is called by GetLocaleStr() and should return
226 the string matching the string id passed in as num.
228 AROS_LH1(STRPTR, getlangstring,
229 AROS_LHA(ULONG, id, D0),
230 struct LocaleBase *, LocaleBase, 9, language
233 AROS_LIBFUNC_INIT
235 //kprintf("\nWe have got to getlangstring\n");
237 if(id < MAXSTRMSG)
238 return __catalan_strings[id];
239 else
240 return NULL;
242 AROS_LIBFUNC_EXIT
245 /* -----------------------------------------------------------------------
246 Library function table - you will need to alter this
247 I have this right here at the end of the library so that I do not
248 have to have prototypes for the functions. Although you could do that.
249 ----------------------------------------------------------------------- */
251 void *const functable[] =
253 &AROS_SLIB_ENTRY(open,language,1),
254 &AROS_SLIB_ENTRY(close,language,2),
255 &AROS_SLIB_ENTRY(expunge,language,3),
256 &AROS_SLIB_ENTRY(null,language,0),
257 &AROS_SLIB_ENTRY(mask,language,5),
259 /* Note, shorter function table, as only getlangstring is used */
261 /* 0 - 3 */
262 &AROS_SLIB_ENTRY(null, language, 0),
263 &AROS_SLIB_ENTRY(null, language, 0),
264 &AROS_SLIB_ENTRY(null, language, 0),
265 &AROS_SLIB_ENTRY(getlangstring, language, 9),
266 (void *)-1
270 Note how only the required data structures are kept...
272 This is the list of strings. It is an array of pointers to strings,
273 although how it is laid out is implementation dependant.
275 const STRPTR __catalan_strings[] =
277 /* A blank string */
280 /* The days of the week. Starts with the first day of the week.
281 In English this would be Sunday, this depends upon the settings
282 of Locale->CalendarType.
285 /* FIXME: stegerg: I think this must always start with Sunday and not what comment above says */
287 "Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous",
288 "Divendres", "Dissabte",
290 /* Abbreviated days of the week */
291 "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
293 /* Months of the year */
294 "Gener", "Febrer", "Març",
295 "Abril", "Maig", "Juny",
296 "Juliol", "Agost", "Setembre",
297 "Octubre", "Novembre", "Desembre",
299 /* Abbreviated months of the year */
300 "Gn", "Fb", "Mç", "Ab", "Mg", "Jn",
301 "Jl", "Ag", "St", "Oc", "Nv", "Ds",
303 "Sí", /* Yes, affirmative response */
304 "No", /* No/negative response */
306 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
307 "AM", "PM",
309 /* Soft and hard hyphens */
310 "\xAD", "-",
312 /* Open and close quotes */
313 "\"", "\"",
315 /* Days: But not actual day names
316 Yesterday - the day before the current
317 Today - the current day
318 Tomorrow - the next day
319 Future.
321 "Ahir", "Avui", "Demà", "Futur"
324 /* This is the end of ROMtag marker. */
325 const char end=0;