add casts to zune macros to silence some warnings
[tangerine.git] / workbench / libs / locale / patches.c
blob7fe5488ab9e1e16ed6a4dd30a458797c90b0492c
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*********************************************************************************************/
8 #include "locale_intern.h"
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
15 #include <proto/utility.h>
16 #include <proto/locale.h>
18 /*********************************************************************************************/
20 #define LIB_EXEC 1
21 #define LIB_UTILITY 2
22 #define LIB_DOS 3
23 #define LIB_LOCALE 4
25 /*********************************************************************************************/
27 #ifdef __MORPHOS__
29 extern void LIB_LocRawDoFmt(void);
30 extern void LIB_LocStrnicmp(void);
31 extern void LIB_LocStricmp(void);
32 extern void LIB_LocToLower(void);
33 extern void LIB_LocToUpper(void);
34 extern void LIB_LocDateToStr(void);
35 extern void LIB_LocStrToDate(void);
36 extern void LIB_LocDosGetLocalizedString(void);
38 #endif
40 /*********************************************************************************************/
42 #ifdef __MORPHOS__
43 static struct patchinfo
45 WORD library;
46 WORD whichfunc;
47 APTR whichpatchfunc;
49 pi [] =
51 {LIB_EXEC , 87 , LIB_LocRawDoFmt},
52 {LIB_UTILITY, 28 , LIB_LocStrnicmp},
53 {LIB_UTILITY, 27 , LIB_LocStricmp},
54 {LIB_UTILITY, 30 , LIB_LocToLower},
55 {LIB_UTILITY, 29 , LIB_LocToUpper},
56 {LIB_DOS , 124, LIB_LocDateToStr},
57 {LIB_DOS , 125, LIB_LocStrToDate},
58 {LIB_DOS , 163, LIB_LocDosGetLocalizedString},
59 {NULL}
62 #else
63 static struct patchinfo
65 WORD library;
66 WORD whichfunc;
67 WORD patchlibrary;
68 WORD whichpatchfunc;
70 pi [] =
72 {LIB_EXEC , 87 , LIB_LOCALE, 31}, /* RawDoFmt */
73 {LIB_UTILITY, 28 , LIB_LOCALE, 32}, /* Strnicmp */
74 {LIB_UTILITY, 27 , LIB_LOCALE, 33}, /* Stricmp */
75 {LIB_UTILITY, 30 , LIB_LOCALE, 34}, /* ToLower */
76 {LIB_UTILITY, 29 , LIB_LOCALE, 35}, /* ToUpper */
77 {LIB_DOS , 124, LIB_LOCALE, 36}, /* DateToStr */
78 {LIB_DOS , 125, LIB_LOCALE, 37}, /* StrToDate */
79 {LIB_DOS , 154, LIB_LOCALE, 38}, /* DosGetLocalizedString */
80 {0 }
82 #endif
84 /*********************************************************************************************/
86 static struct Library *GetLib(WORD which)
88 struct Library *lib = NULL;
90 switch(which)
92 case LIB_EXEC:
93 lib = (struct Library *)SysBase;
94 break;
96 case LIB_DOS:
97 lib = (struct Library *)DOSBase;
98 break;
100 case LIB_UTILITY:
101 lib = (struct Library *)UtilityBase;
102 break;
104 case LIB_LOCALE:
105 lib = (struct Library *)LocaleBase;
106 break;
109 return lib;
112 /*********************************************************************************************/
114 void InstallPatches(void)
116 WORD i;
118 #ifdef __MORPHOS__
119 static const struct TagItem PatchTags[] =
121 {SETFUNCTAG_MACHINE, MACHINE_PPC},
122 {SETFUNCTAG_TYPE, SETFUNCTYPE_NORMAL},
123 {SETFUNCTAG_IDNAME, (ULONG) "locale.library Language Patch"},
124 {SETFUNCTAG_DELETE, TRUE},
125 {TAG_DONE}
127 #endif
129 Forbid();
130 for(i = 0; pi[i].library; i++)
132 #ifdef __MORPHOS__
133 NewSetFunction(GetLib(pi[i].library), pi[i].whichpatchfunc, -pi[i].whichfunc * LIB_VECTSIZE, PatchTags);
134 #else
135 SetFunction(GetLib(pi[i].library),
136 -pi[i].whichfunc * LIB_VECTSIZE,
137 __AROS_GETVECADDR(GetLib(pi[i].patchlibrary), pi[i].whichpatchfunc));
138 #endif
140 Permit();
141 LocaleBase->lb_SysPatches = TRUE;
145 /*********************************************************************************************/