2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Locale_RawDoFmt - locale.library's private replacement
6 of exec.library/RawDoFmt function. IPrefs will install
12 #include <exec/types.h>
13 #include <proto/exec.h>
14 #include <proto/locale.h>
15 #include "locale_intern.h"
16 #include <aros/asmcall.h>
24 #define ARRAY_FUNC 0x16c04e75
28 MOVEA.L (4).L,A6 ;2C7900000004
29 JSR (-$0204,A6) ;4EAEFDFC
30 MOVEA.L (SP)+,A6 ;2C5F
34 #define SERIAL_FUNC0 0x2f0e2c79
35 #define SERIAL_FUNC1 0x00000004
36 #define SERIAL_FUNC2 0x4eaefdfc
37 #define SERIAL_FUNC3 0x2c5f4e75
45 /* Quick reg layout function
48 char *_PPCCallM68k_RawDoFmt(char MyChar
,
49 char *(*PutChProc
)(char*,char),
52 struct ExecBase
*sysBase
);
54 char *PPCCallM68k_RawDoFmt(char MyChar
,
55 char *(*PutChProc
)(char*,char),
58 struct ExecBase
*sysBase
)
60 /* As we call a *QUICK REG LAYOUT* function
61 * below we must make sure that this function backups/restores
69 return _PPCCallM68k_RawDoFmt(MyChar
,
76 char *PPCCallM68k_RawDoFmt(char MyChar
,
77 char *(*PutChProc
)(char*,char),
80 struct ExecBase
*sysBase
);
82 /* Shitty workaround for release/cisc - ignores r13 clobber */
84 __asm(".section \".text\"\n\t"
86 ".globl PPCCallM68k_RawDoFmt\n\t"
87 ".type PPCCallM68k_RawDoFmt, @function\n"
88 "PPCCallM68k_RawDoFmt:\n\t"
93 "bl _PPCCallM68k_RawDoFmt\n\t"
100 ".size PPCCallM68k_RawDoFmt, .LfeN - PPCCallM68k_RawDoFmt"
107 AROS_UFH3(VOID
, LocRawDoFmtFormatStringFunc
,
108 AROS_UFHA(struct Hook
*, hook
, A0
),
109 AROS_UFHA(struct Locale
*, locale
, A2
),
110 AROS_UFHA(char, fill
, A1
))
116 struct HookData
*data
= hook
->h_Data
;
118 switch ((ULONG
) hook
->h_SubEntry
)
121 /* Standard Array Function */
122 *data
->PutChData
++ = fill
;
125 /* Standard Serial Function */
129 data
->PutChData
= PPCCallM68k_RawDoFmt(fill
,
139 register char *pdata
asm("a3") = hook
->h_Data
;
141 char *pdata
= hook
->h_Data
;
144 if (hook
->h_SubEntry
)
146 AROS_UFC3(void, hook
->h_SubEntry
,
147 AROS_UFCA(char, fill
, D0
),
148 AROS_UFCA(APTR
, pdata
, A3
),
149 AROS_UFCA(struct ExecBase
*, SysBase
, A6
));
156 hook
->h_Data
= pdata
;
164 /*****************************************************************************
167 #include <proto/locale.h>
169 AROS_PLH4(APTR
, LocRawDoFmt
,
172 AROS_LHA(CONST_STRPTR
, FormatString
, A0
),
173 AROS_LHA(APTR
, DataStream
, A1
),
174 AROS_LHA(VOID_FUNC
, PutChProc
, A2
),
175 AROS_LHA(APTR
, PutChData
, A3
),
178 struct ExecBase
*, SysBase
, 31, Locale
)
181 See exec.library/RawDoFmt
184 See exec.library/RawDoFmt
189 This function is not called by apps directly. Instead dos.library/DosGet-
190 LocalizedString is patched to use this function. This means, that the
191 LocaleBase parameter above actually points to SysBase, so we make use of
192 the global LocaleBase variable. This function is marked as private,
193 thus the headers generator won't mind the different basename in the header.
200 RawDoFmt(), FormatString().
205 27-11-96 digulla automatically created from
206 locale_lib.fd and clib/locale_protos.h
208 *****************************************************************************/
216 struct HookData data
;
218 if ((ULONG
) PutChProc
> 1)
220 if (*((ULONG
*) PutChProc
) == ARRAY_FUNC
)
226 * This is the job of exec
228 else if ((((ULONG
*) PutChProc
)[0] == SERIAL_FUNC0
) &&
229 (((ULONG
*) PutChProc
)[1] == SERIAL_FUNC1
) &&
230 (((ULONG
*) PutChProc
)[2] == SERIAL_FUNC2
) &&
231 (((ULONG
*) PutChProc
)[3] == SERIAL_FUNC3
))
233 PutChProc
= (APTR
) 1;
238 hook
.h_Entry
= (HOOKFUNC
)AROS_ASMSYMNAME(LocRawDoFmtFormatStringFunc
);
239 hook
.h_SubEntry
= (HOOKFUNC
)PutChProc
;
241 data
.PutChData
= PutChData
;
246 hook
.h_Entry
= (HOOKFUNC
)AROS_ASMSYMNAME(LocRawDoFmtFormatStringFunc
);
247 hook
.h_SubEntry
= (HOOKFUNC
)PutChProc
;
248 hook
.h_Data
= PutChData
;
252 //kprintf("LocRawDoFmt: FormatString = \"%s\"\n", FormatString);
256 retval
= FormatString(&(IntLB(LocaleBase
)->lb_CurrentLocale
->il_Locale
),
257 (STRPTR
)FormatString
,
263 //kprintf("LocRawDoFmt: FormatString: returning %x\n", retval);