2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: norwegian.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 "norwegian" /* String version of above */
21 #define NLANGSTR "Norsk" /* Native version of LANGSTR */
22 #define LANGVER 41 /* Version number of language */
23 #define LANGREV 1 /* Revision number of language */
24 #define LANGTAG "\0$VER: " LANGSTR ".language 41.1 (14.04.2013)"
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 __norsk_strings
[];
39 /* -------------------------------------------------------------------------
40 Library definition, you should not need to change any of this.
41 ------------------------------------------------------------------------- */
45 struct Library library
;
46 struct ExecBase
*sysbase
;
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
;
69 const struct Resident languageTag
=
72 (struct Resident
*)&languageTag
,
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
),
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
)
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
,9));
134 AROS_LH1(struct Language
*, open
,
135 AROS_LHA(ULONG
, version
, D0
),
136 struct Language
*, language
, 1, language
)
139 language
->library
.lib_OpenCnt
++;
140 language
->library
.lib_Flags
&= ~LIBF_DELEXP
;
142 /* Again return NULL if you could not open */
148 AROS_LH0(BPTR
, close
, struct Language
*, language
, 2, language
)
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
);
165 AROS_LH0(BPTR
, expunge
, struct Language
*, language
, 3, language
)
170 if(language
->library
.lib_OpenCnt
)
172 /* Can't expunge, we are still open */
173 language
->library
.lib_Flags
|= LIBF_DELEXP
;
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
);
188 AROS_LH0I(int, null
, struct Language
*, language
, 0, language
)
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
)
213 return ( LF_GetLangStr
);
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
)
228 //kprintf("\nWe have got to getlangstring\n");
231 return __norsk_strings
[id
];
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 */
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),
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 __norsk_strings
[] =
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.
278 // NOTICE: stegerg: I think this must always start with Sunday and not what comment above says
280 "Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag",
283 /* Abbreviated days of the week */
284 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør",
286 /* Months of the year */
287 "Januar", "Februar", "Mars",
288 "April", "Mai", "Juni",
289 "Juli", "August", "September",
290 "Oktober", "November", "Desember",
292 /* Abbreviated months of the year */
293 "Jan", "Feb", "Mar", "Apr", "Mai", "Jun",
294 "Jul", "Aug", "Sep", "Okt", "Nov", "Des",
296 "Ja", /* Yes, affirmative response */
297 "Nei", /* 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 "I går", "I dag", "I morgen", "Fremtid"
317 /* This is the end of ROMtag marker. */