2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: StrnCmp() - Stub for the Locale StrnCmp() function.
8 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include "locale_intern.h"
11 #include <aros/asmcall.h>
13 #define DEBUG_STRNCMP(x) ;
15 /*****************************************************************************
18 #include <proto/locale.h>
20 AROS_LH5(LONG
, StrnCmp
,
23 AROS_LHA(const struct Locale
*, locale
, A0
),
24 AROS_LHA(CONST_STRPTR
, string1
, A1
),
25 AROS_LHA(CONST_STRPTR
, string2
, A2
),
26 AROS_LHA(LONG
, length
, D0
),
27 AROS_LHA(ULONG
, type
, D1
),
30 struct LocaleBase
*, LocaleBase
, 30, Locale
)
33 StrnCmp() will compare two strings, up to a maximum length
34 of length using a specific kind of collation information
35 according to the locale.
37 The result will be less than zero, zero, or greater than zero
38 depending upon whether the string string1 is less than, equal
39 to, or greater than the string pointed to string2.
42 locale - Which locale to use for this comparison or
43 NULL for the system default locale.
44 string1 - NULL terminated string.
45 string2 - NULL terminated string.
46 length - Maximum length of string to compare, or -1 to
47 compare entire strings.
48 type - How to compare the strings, values are:
51 Perform a simple ASCII case-insensitive comparison.
52 This is the fastest comparison, but considers that
53 accented characters are different to non-accented
57 This sorts using the "primary sorting order". This
58 means that characters such as 'e' and 'é' will be
59 considered the same. This method also ignores
63 This will sort using both the primary and secondary
64 sorting order. This is the slowest sorting method
65 and should be used when presenting data to a user.
67 The first pass is the same as SC_COLLATE1, meaning
68 that two strings such as "role" and "rôle" would
69 be sorted identically. The second pass will
70 compare the diacritical marks.
73 The relationship between the two strings.
75 < 0 means string1 < string2
76 = 0 means string1 == string2
77 > 0 means string1 > string2
86 OpenLocale(), CloseLocale(), StrConvert()
90 *****************************************************************************/
95 struct Locale
*def_locale
= NULL
;
99 locale
= OpenLocale(NULL
);
100 def_locale
= (struct Locale
*)locale
;
103 DEBUG_STRNCMP(dprintf
104 ("StrnCmp: locale 0x%lx <%s> <%s> len %ld type 0x%lx\n", locale
,
105 string1
, string2
, length
, type
));
107 DEBUG_STRNCMP(dprintf("StrnCmp: Function 0x%lx\n",
108 IntL(locale
)->il_LanguageFunctions
[16]));
111 result
= AROS_CALL4(ULONG
, IntL(locale
)->il_LanguageFunctions
[16],
112 AROS_LCA(CONST_STRPTR
, string1
, A1
),
113 AROS_LCA(CONST_STRPTR
, string2
, A2
),
114 AROS_LCA(ULONG
, length
, D0
),
115 AROS_LCA(ULONG
, type
, D1
), struct LocaleBase
*, LocaleBase
);
117 result
= AROS_UFC4(ULONG
, IntL(locale
)->il_LanguageFunctions
[16],
118 AROS_UFCA(CONST_STRPTR
, string1
, A1
),
119 AROS_UFCA(CONST_STRPTR
, string2
, A2
),
120 AROS_UFCA(ULONG
, length
, D0
), AROS_UFCA(ULONG
, type
, D1
));
123 CloseLocale(def_locale
);
125 DEBUG_STRNCMP(dprintf("StrnCmp: retval %ld\n", result
));