2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: StrConvert - Stub for the Locale StrConvert function.
8 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include "locale_intern.h"
11 #include <aros/asmcall.h>
13 #define DEBUG_STRCONVERT(x) ;
15 /*****************************************************************************
18 #include <proto/locale.h>
20 AROS_LH5(ULONG
, StrConvert
,
23 AROS_LHA(const struct Locale
*, locale
, A0
),
24 AROS_LHA(CONST_STRPTR
, string
, A1
),
25 AROS_LHA(APTR
, buffer
, A2
),
26 AROS_LHA(ULONG
, bufferSize
, D0
),
27 AROS_LHA(ULONG
, type
, D1
),
30 struct LocaleBase
*, LocaleBase
, 29, Locale
)
33 This function will transform the string given and place the
34 result in the supplied buffers, copying at most bufferSize
37 The transformation is such that if the C strcmp() function
38 was called on two strings transformed by this function then
39 the result will be the same as calling the Locale StrnCmp()
40 function on the two strings.
43 locale - the Locale to use for the transformation or
44 NULL for the system default locale.
45 string - the string to be transformed
46 buffer - the destination for the transformed string.
47 This buffer may need to be larger than the
49 bufferSize - the maximum number of bytes to place in
51 type - how to transform the string. See the
52 StrnCmp() function for possible values.
55 Length of the number of BYTES placed in the buffer by
56 the transformation process minus 1 (for NULL termination).
69 *****************************************************************************/
74 struct Locale
*def_locale
= NULL
;
78 locale
= OpenLocale(NULL
);
79 def_locale
= (struct Locale
*)locale
;
82 DEBUG_STRCONVERT(dprintf
83 ("StrConvert: locale 0x%lx <%s> buffer 0x%lx size %ld type 0x%lx\n",
84 locale
, string
, buffer
, bufferSize
, type
));
86 DEBUG_STRCONVERT(dprintf("StrConvert: Function 0x%lx\n",
87 IntL(locale
)->il_LanguageFunctions
[15]));
90 result
= AROS_CALL4(ULONG
, IntL(locale
)->il_LanguageFunctions
[15],
91 AROS_LCA(CONST_STRPTR
, string
, A1
),
92 AROS_LCA(APTR
, buffer
, A2
),
93 AROS_LCA(ULONG
, bufferSize
, D0
),
94 AROS_LCA(ULONG
, type
, D1
), struct LocaleBase
*, LocaleBase
);
96 result
= AROS_UFC4(ULONG
, IntL(locale
)->il_LanguageFunctions
[15],
97 AROS_UFCA(CONST_STRPTR
, string
, A1
),
98 AROS_UFCA(APTR
, buffer
, A2
),
99 AROS_UFCA(ULONG
, bufferSize
, D0
), AROS_UFCA(ULONG
, type
, D1
));
102 DEBUG_STRCONVERT(dprintf("StrConvert: retval %lu\n", result
));
104 CloseLocale(def_locale
);