2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: svenska.language description file.
9 /* Language file for the svenska 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 "svenska" /* 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: svenska.language 41.0 (03.02.2001)"
28 AROS_LD1(STRPTR
, getlangstring
,
29 AROS_LHA(ULONG
, id
, D0
),
30 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 Swedish character type/conversion */
38 extern const STRPTR __svenska_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
)();
56 AROS_LD1(struct Language
*, open
,
57 AROS_LHA(ULONG
, version
, D0
),
58 struct Language
*, language
, 1, language
);
59 AROS_LD0(BPTR
, close
, struct Language
*, language
, 2, language
);
60 AROS_LD0(BPTR
, expunge
, struct Language
*, language
, 3, language
);
61 AROS_LD0I(int, null
, struct Language
*, language
, 4, language
);
62 AROS_LD0(ULONG
, mask
, struct Language
*, language
, 5, language
);
63 extern const char end
;
70 const struct Resident languageTag
=
73 (struct Resident
*)&languageTag
,
84 const UBYTE name
[]=LANGSTR
".language";
85 const UBYTE version
[]=LANGTAG
;
87 const ULONG datatable
= 0;
89 const APTR inittabl
[4] =
91 (APTR
)sizeof(struct Language
),
94 &AROS_SLIB_ENTRY(init
,language
)
97 struct ExecBase
*mySysBase
;
99 AROS_UFH3(struct Language
*, AROS_SLIB_ENTRY(init
,language
),
100 AROS_UFHA(struct Language
*, language
, D0
),
101 AROS_UFHA(BPTR
, segList
, A0
),
102 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)
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
;
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
));
134 #define SysBase language->sysbase
136 AROS_LH1(struct Language
*, open
,
137 AROS_LHA(ULONG
, version
, D0
),
138 struct Language
*, language
, 1, language
)
141 language
->library
.lib_OpenCnt
++;
142 language
->library
.lib_Flags
&= ~LIBF_DELEXP
;
144 /* 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
);
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
);
193 AROS_LH0I(int, null
, struct Language
*, language
, 4, language
)
202 /* ------------------------------------------------------------------------
203 Language specific functions
204 ------------------------------------------------------------------------ */
207 #define SysBase mySysBase
209 /* ULONG LanguageMask():
210 This function is to inform locale.library what functions it should
211 use from this library. This is done by returning a bitmask containing
212 1's for functions to use, and 0's for functions to ignore.
214 Unused bits MUST be 0 for future compatibility.
216 AROS_LH0(ULONG
, mask
, struct Language
*, language
, 5, language
)
220 return ( LF_GetLangStr
);
225 /* STRPTR GetLangString(ULONG num): Language function 3
226 This function is called by GetLocaleStr() and should return
227 the string matching the string id passed in as num.
229 AROS_LH1(STRPTR
, getlangstring
,
230 AROS_LHA(ULONG
, id
, D0
),
231 struct LocaleBase
*, LocaleBase
, 9, language
)
235 //kprintf("\nWe have got to getlangstring\n");
238 return __svenska_strings
[id
];
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
),
254 &AROS_SLIB_ENTRY(close
,language
),
255 &AROS_SLIB_ENTRY(expunge
,language
),
256 &AROS_SLIB_ENTRY(null
,language
),
257 &AROS_SLIB_ENTRY(mask
,language
),
259 /* Note, shorter function table, as only getlangstring is used */
262 &AROS_SLIB_ENTRY(null
, language
),
263 &AROS_SLIB_ENTRY(null
, language
),
264 &AROS_SLIB_ENTRY(null
, language
),
265 &AROS_SLIB_ENTRY(getlangstring
, language
),
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 __svenska_strings
[] =
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 #warning: stegerg: I think this must always start with Sunday and not what comment above says
287 "Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag",
290 /* Abbreviated days of the week */
291 "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör",
293 /* Months of the year */
294 "Januari", "Februari", "Mars",
295 "April", "Maj", "Juni",
296 "Juli", "Augusti", "September",
297 "Oktober", "November", "December",
299 /* Abbreviated months of the year */
300 "Jan", "Feb", "Mar", "Apr", "Maj", "Jun",
301 "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
303 "Ja", /* Yes, affirmative response */
304 "Nej", /* No/negative response */
306 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
309 /* Soft and hard hyphens */
312 /* Open and close quotes */
315 /* Days: But not actual day names
316 Yesterday - the day before the current
317 Today - the current day
318 Tomorrow - the next day
321 "Igår", "Idag", "Imorgon", "Framtid"
324 /* This is the end of ROMtag marker. */