added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / locale / languages / russian.c
blobb9ae915f171e6fc72bf1cc497786f5b1daeed898
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: russian.language description file.
6 Lang: russian
7 Char: CP-1251
8 */
10 /* Language file for the Russian language. Collation tables need to be implemented */
12 #include <exec/types.h>
13 #include <aros/system.h>
14 #include <exec/resident.h>
15 #include <exec/libraries.h>
16 #include <libraries/locale.h>
18 #include <proto/exec.h>
19 #include <aros/libcall.h>
20 #include <aros/asmcall.h>
22 #include <aros/debug.h>
24 #define LANGSTR "russian" /* String version of above */
25 #define LANGVER 41 /* Version number of language */
26 #define LANGREV 0 /* Revision number of language */
27 #define LANGTAG "\0$VER: russian.language 41.0 (11.05.2006)"
29 AROS_LD1(STRPTR, getlangstring,
30 AROS_LHA(ULONG, id, D0),
31 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 German character type/conversion */
39 extern const STRPTR __russian_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)();
57 AROS_LD1(struct Language *, open,
58 AROS_LHA(ULONG, version, D0),
59 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, 4, language);
63 AROS_LD0(ULONG, mask, struct Language *, language, 5, language);
64 extern const char end;
66 int entry(void)
68 return -1;
71 const struct Resident languageTag =
73 RTC_MATCHWORD,
74 (struct Resident *)&languageTag,
75 (APTR)&end,
76 RTF_AUTOINIT,
77 LANGVER,
78 NT_LIBRARY,
79 -120,
80 (STRPTR)name,
81 (STRPTR)&version[7],
82 (ULONG *)inittabl
85 const UBYTE name[]=LANGSTR ".language";
86 const UBYTE version[]=LANGTAG;
88 const ULONG datatable = 0;
90 const APTR inittabl[4] =
92 (APTR)sizeof(struct Language),
93 (APTR)functable,
94 (APTR)&datatable,
95 &AROS_SLIB_ENTRY(init,language)
98 struct ExecBase *mySysBase;
100 AROS_UFH3(struct Language *, AROS_SLIB_ENTRY(init,language),
101 AROS_UFHA(struct Language *, language, D0),
102 AROS_UFHA(BPTR, segList, A0),
103 AROS_UFHA(struct ExecBase *, SysBase, A6)
106 AROS_USERFUNC_INIT
109 You could just as easily do this bit as the InitResident()
110 datatable, however this works just as well.
112 language->library.lib_Node.ln_Type = NT_LIBRARY;
113 language->library.lib_Node.ln_Pri = -120;
114 language->library.lib_Node.ln_Name = (char *)name;
115 language->library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED;
116 language->library.lib_Version = LANGVER;
117 language->library.lib_Revision = LANGREV;
118 language->library.lib_IdString = (APTR)&version[7];
120 language->seglist = segList;
121 language->sysbase = SysBase;
122 mySysBase = SysBase;
125 Although it is unlikely, you would return NULL if you for some
126 unknown reason couldn't open.
128 bug("GetLangStr: Loaded at address %p\n", &AROS_SLIB_ENTRY(getlangstring,language));
129 return language;
131 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
150 AROS_LH0(BPTR, close, struct Language *, language, 2, language)
152 AROS_LIBFUNC_INIT
154 if(! --language->library.lib_OpenCnt)
156 /* Delayed expunge pending? */
157 if(language->library.lib_Flags & LIBF_DELEXP)
159 /* Yes, expunge the library */
160 return AROS_LC0(BPTR, expunge, struct Language *, language, 3, language);
163 return NULL;
164 AROS_LIBFUNC_EXIT
167 AROS_LH0(BPTR, expunge, struct Language *, language, 3, language)
169 AROS_LIBFUNC_INIT
171 BPTR ret;
172 if(language->library.lib_OpenCnt)
174 /* Can't expunge, we are still open */
175 language->library.lib_Flags |= LIBF_DELEXP;
176 return 0;
179 Remove(&language->library.lib_Node);
180 ret = language->seglist;
182 FreeMem((UBYTE *)language - language->library.lib_NegSize,
183 language->library.lib_PosSize + language->library.lib_NegSize);
185 return ret;
187 AROS_LIBFUNC_EXIT
190 AROS_LH0I(int, null, struct Language *, language, 4, language)
192 AROS_LIBFUNC_INIT
194 return 0;
196 AROS_LIBFUNC_EXIT
199 /* ------------------------------------------------------------------------
200 Language specific functions
201 ------------------------------------------------------------------------ */
203 #undef SysBase
204 #define SysBase mySysBase
206 /* ULONG LanguageMask():
207 This function is to inform locale.library what functions it should
208 use from this library. This is done by returning a bitmask containing
209 1's for functions to use, and 0's for functions to ignore.
211 Unused bits MUST be 0 for future compatibility.
213 AROS_LH0(ULONG, mask, struct Language *, language, 5, language)
215 AROS_LIBFUNC_INIT
217 return ( LF_GetLangStr );
219 AROS_LIBFUNC_EXIT
222 /* STRPTR GetLangString(ULONG num): Language function 3
223 This function is called by GetLocaleStr() and should return
224 the string matching the string id passed in as num.
226 AROS_LH1(STRPTR, getlangstring,
227 AROS_LHA(ULONG, id, D0),
228 struct LocaleBase *, LocaleBase, 9, language)
230 AROS_LIBFUNC_INIT
232 //kprintf("\nWe have got to getlangstring\n");
234 if(id < MAXSTRMSG)
235 return __russian_strings[id];
236 else
237 return NULL;
239 AROS_LIBFUNC_EXIT
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),
251 &AROS_SLIB_ENTRY(close,language),
252 &AROS_SLIB_ENTRY(expunge,language),
253 &AROS_SLIB_ENTRY(null,language),
254 &AROS_SLIB_ENTRY(mask,language),
256 /* Note, shorter function table, as only getlangstring is used */
258 /* 0 - 3 */
259 &AROS_SLIB_ENTRY(null, language),
260 &AROS_SLIB_ENTRY(null, language),
261 &AROS_SLIB_ENTRY(null, language),
262 &AROS_SLIB_ENTRY(getlangstring, language),
263 (void *)-1
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 __russian_strings[] =
274 /* A blank string */
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.
281 "Âîñêðåñåíüå", "Ïîíåäåëüíèê", "Âòîðíèê", "Ñðåäà",
282 "×åòâåðã", "Ïÿòíèöà", "Ñóááîòà",
284 /* Abbreviated days of the week */
285 "Âñ", "Ïí", "Âò", "Ñð", "×ò", "Ïò", "Ñá",
287 /* Months of the year */
288 "ßíâàðü", "Ôåâðàëü", "Ìàðò",
289 "Àïðåëü", "Ìàé", "Èþíü",
290 "Èþëü", "Àâãóñò", "Ñåíòÿáðü",
291 "Îêòÿáðü", "Íîÿáðü", "Äåêàáðü",
293 /* Abbreviated months of the year */
294 "ßíâ", "Ôåâ", "Ìàð", "Àïð", "Ìàé", "Èþí",
295 "Èþë", "àâã", "Ñåí", "Îêò", "Íîÿ", "Äåê",
297 "Äà", /* Yes, affirmative response */
298 "Íåò", /* No/negative response */
300 /* AM/PM strings AM 0000 -> 1159, PM 1200 -> 2359 */
301 "am", "pm",
302 /* Soft and hard hyphens */
303 "-", "-",
305 /* Open and close quotes */
306 "\"", "\"",
308 /* Days: But not actual day names
309 Yesterday - the day before the current
310 Today - the current day
311 Tomorrow - the next day
312 Future.
314 "Â÷åðà", "Ñåãîäíÿ", "Çàâòðà", "Áóäóùåå"
317 /* This is the end of ROMtag marker. */
318 const char end=0;