added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / locale / languages / suomi.c
blob8668e3b7738770973106f21c7050b576c273740b
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: suomi.language description file.
6 Lang: English
7 */
9 /* Language file for the suomi 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 "suomi" /* 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: suomi.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 __suomi_strings[];
40 /* -------------------------------------------------------------------------
41 Library definition, you should not need to change any of this.
42 ------------------------------------------------------------------------- */
44 struct Language
46 struct Library library;
47 struct ExecBase *sysbase;
48 BPTR seglist;
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;
65 int entry(void)
67 return -1;
70 const struct Resident languageTag =
72 RTC_MATCHWORD,
73 (struct Resident *)&languageTag,
74 (APTR)&end,
75 RTF_AUTOINIT,
76 LANGVER,
77 NT_LIBRARY,
78 -120,
79 (STRPTR)name,
80 (STRPTR)&version[7],
81 (ULONG *)inittabl
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),
92 (APTR)functable,
93 (APTR)&datatable,
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)
105 AROS_USERFUNC_INIT
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;
121 mySysBase = 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));
128 return language;
130 AROS_USERFUNC_EXIT
134 #define SysBase language->sysbase
136 AROS_LH1(struct Language *, open,
137 AROS_LHA(ULONG, version, D0),
138 struct Language *, language, 1, language)
140 AROS_LIBFUNC_INIT
141 language->library.lib_OpenCnt++;
142 language->library.lib_Flags &= ~LIBF_DELEXP;
144 /* Again return NULL if you could not open */
145 return language;
147 AROS_LIBFUNC_EXIT
151 AROS_LH0(BPTR, close, struct Language *, language, 2, language)
153 AROS_LIBFUNC_INIT
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);
164 return NULL;
165 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
193 AROS_LH0I(int, null, struct Language *, language, 4, language)
195 AROS_LIBFUNC_INIT
197 return 0;
199 AROS_LIBFUNC_EXIT
202 /* ------------------------------------------------------------------------
203 Language specific functions
204 ------------------------------------------------------------------------ */
206 #undef SysBase
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)
218 AROS_LIBFUNC_INIT
220 return ( LF_GetLangStr );
222 AROS_LIBFUNC_EXIT
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)
233 AROS_LIBFUNC_INIT
235 //kprintf("\nWe have got to getlangstring\n");
237 if(id < MAXSTRMSG)
238 return __suomi_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),
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 */
261 /* 0 - 3 */
262 &AROS_SLIB_ENTRY(null, language),
263 &AROS_SLIB_ENTRY(null, language),
264 &AROS_SLIB_ENTRY(null, language),
265 &AROS_SLIB_ENTRY(getlangstring, language),
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 __suomi_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 #warning: stegerg: I think this must always start with Sunday and not what comment above says
287 "Sunnuntai", "Maanantai", "Tiistai", "Keskiviikko", "Torstai",
288 "Perjantai", "Lauantai",
290 /* Abbreviated days of the week */
291 "Su", "Ma", "Ti", "Ke", "To", "Pe", "La",
293 /* Months of the year */
294 "Tammikuu", "Helmikuu", "Maaliskuu",
295 "Huhtikuu", "Toukokuu", "Kesäkuu",
296 "Heinäkuu", "Elokuu", "Syyskuu",
297 "Lokakuu", "Marraskuu", "Joulukuu",
299 /* Abbreviated months of the year */
300 "Tam", "Hel", "Maa", "Huh", "Tou", "Kes",
301 "Hei", "Elo", "Syy", "Lok", "Mar", "Jou",
303 "Kyllä", /* Yes, affirmative response */
304 "Ei", /* No/negative response */
306 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
307 "ap", "ip",
309 /* Soft and hard hyphens */
310 "-", "-",
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 "Eilen", "Tänään", "Huomenna", "Tulevaisuudessa"
324 /* This is the end of ROMtag marker. */
325 const char end = 0;