add casts to zune macros to silence some warnings
[tangerine.git] / workbench / libs / locale / locdosgetlocalizedstring.c
blob7901b76cb7cf990773d536e8f51fdbf82b0d040e
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: LocStrToDateGetCharFunc - locale.library's private replacement
6 of dos.library/DosGetLocalizedString function. IPrefs will install
7 the patch.
9 Lang: english
12 #include <exec/types.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
15 #include <proto/locale.h>
16 #include "locale_intern.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/locale.h>
23 AROS_PLH1(CONST_STRPTR, LocDosGetLocalizedString,
25 /* SYNOPSIS */
26 AROS_LHA(LONG, stringNum, D1),
28 /* LOCATION */
29 struct DosLibrary *, DOSBase, 38, Locale)
31 /* FUNCTION
32 See dos.library/DosGetLocalizedString
34 INPUTS
35 See dos.library/DosGetLocalizedString
37 RESULT
39 NOTES
40 This function is not called by apps directly. Instead dos.library/DosGet-
41 LocalizedString is patched to use this function. This means, that the
42 LocaleBase parameter above actually points to DOSBase, so we make use of
43 the global LocaleBase variable. This function is marked as private,
44 thus the headers generator won't mind the different basename in the header.
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 dos.library/DosGetString(), dos.library/DosGetLocalizedString()
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 #ifdef __MORPHOS__
62 LONG *p = DOSBase->dl_Errors->estr_Nums;
63 UBYTE *q = DOSBase->dl_Errors->estr_Strings;
64 STRPTR defstr = NULL;
66 /* We should really call the original DosGetString(), but ahwell... */
69 LONG n = p[0];
70 LONG m = p[1];
72 while (n <= m)
74 if (n == stringNum)
76 defstr = q + 1;
79 q += q[0] + 1;
80 ++n;
83 p += 2;
85 while (p[0] != 0);
87 return GetCatalogStr(IntLB(LocaleBase)->lb_CurrentLocale->il_DosCatalog, stringNum, defstr);
88 #else
89 struct Catalog *catalog = (struct Catalog *)DOSBase->dl_Errors;
91 return GetCatalogStr(catalog, ((stringNum >= 0) ? stringNum : -stringNum), NULL);
92 #endif
94 AROS_LIBFUNC_EXIT
96 } /* LocDosGetLocalizedString */
98 #undef LocaleBase