2007-11-30 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / managed-collation-icall.patch
1 Index: locales.c
2 ===================================================================
3 --- locales.c   (revision 47880)
4 +++ locales.c   (working copy)
5 @@ -19,8 +19,10 @@
6  #include <mono/metadata/exception.h>
7  #include <mono/metadata/monitor.h>
8  #include <mono/metadata/locales.h>
9 +#include <mono/metadata/collation-tables.h>
10  #include <mono/metadata/culture-info.h>
11  #include <mono/metadata/culture-info-tables.h>
12 +#include <mono/metadata/normalization-tables.h>
13  
14  
15  #include <locale.h>
16 @@ -511,6 +513,59 @@
17         return TRUE;
18  }
19  
20 +void ves_icall_Mono_Globalization_Unicode_Normalization_load_normalization_resource (guint8 **argProps, guint8** argMappedChars, guint8** argCharMapIndex, guint8** argHelperIndex, guint8** argMapIdxToComposite, guint8** argCombiningClass)
21 +{
22 +       *argProps = props;
23 +       *argMappedChars = (guint8*) mappedChars;
24 +       *argCharMapIndex = (guint8*) charMapIndex;
25 +       *argHelperIndex = (guint8*) helperIndex;
26 +       *argMapIdxToComposite = (guint8*) mapIdxToComposite;
27 +       *argCombiningClass = combiningClass;
28 +}
29 +
30 +void ves_icall_Mono_Globalization_Unicode_MSCompatUnicodeTable_load_collation_resource (guint32 resource_index, guint8 **location)
31 +{
32 +       switch (resource_index) {
33 +       case 0:
34 +               *location = (void*) collation_table_ignorableFlags;
35 +               break;
36 +       case 1:
37 +               *location = (void*) collation_table_category;
38 +               break;
39 +       case 2:
40 +               *location = (void*) collation_table_level1;
41 +               break;
42 +       case 3:
43 +               *location = (void*) collation_table_level2;
44 +               break;
45 +       case 4:
46 +               *location = (void*) collation_table_level3;
47 +               break;
48 +       case 5:
49 +               *location = (void*) collation_table_tailoring_infos;
50 +               break;
51 +       case 6:
52 +               *location = (void*) collation_table_tailoring;
53 +               break;
54 +       case 7:
55 +               *location = (void*) collation_table_collation_cjk_cjkCHS;
56 +               break;
57 +       case 8:
58 +               *location = (void*) collation_table_collation_cjk_cjkCHT;
59 +               break;
60 +       case 9:
61 +               *location = (void*) collation_table_collation_cjk_cjkJA;
62 +               break;
63 +       case 10:
64 +               *location = (void*) collation_table_collation_cjk_cjkKO;
65 +               break;
66 +       case 11:
67 +               *location = (void*) collation_table_collation_cjk_cjkKOlv2;
68 +               break;
69 +       }
70 +}
71 +
72 +
73  #ifdef HAVE_ICU
74  
75  #include <unicode/utypes.h>
76 Index: locales.h
77 ===================================================================
78 --- locales.h   (revision 47880)
79 +++ locales.h   (working copy)
80 @@ -38,6 +38,8 @@
81  extern void ves_icall_System_Globalization_CompareInfo_construct_compareinfo (MonoCompareInfo *comp, MonoString *locale);
82  extern int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo *this, MonoString *str1, gint32 off1, gint32 len1, MonoString *str2, gint32 off2, gint32 len2, gint32 options);
83  extern void ves_icall_System_Globalization_CompareInfo_free_internal_collator (MonoCompareInfo *this);
84 +extern void ves_icall_Mono_Globalization_Unicode_Normalization_load_normalization_resource (guint8 **argProps, guint8** argMappedChars, guint8** argCharMapIndex, guint8** argHelperIndex, guint8** argMapIdxToComposite, guint8** argCombiningClass);
85 +extern void ves_icall_Mono_Globalization_Unicode_MSCompatUnicodeTable_load_collation_resource (guint32 resource_index, guint8 **location);
86  extern void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this, MonoSortKey *key, MonoString *source, gint32 options);
87  extern int ves_icall_System_Globalization_CompareInfo_internal_index (MonoCompareInfo *this, MonoString *source, gint32 sindex, gint32 count, MonoString *value, gint32 options, MonoBoolean first);
88  extern int ves_icall_System_Globalization_CompareInfo_internal_index_char (MonoCompareInfo *this, MonoString *source, gint32 sindex, gint32 count, gunichar2 value, gint32 options, MonoBoolean first);
89 Index: icall.c
90 ===================================================================
91 --- icall.c     (revision 47880)
92 +++ icall.c     (working copy)
93 @@ -6332,6 +6332,14 @@
94         {"internal_index(string,int,int,string,System.Globalization.CompareOptions,bool)", ves_icall_System_Globalization_CompareInfo_internal_index}
95  };
96  
97 +static const IcallEntry mscompatunicodetable_icalls [] = {
98 +       {"load_collation_resource(int,byte**)", ves_icall_Mono_Globalization_Unicode_MSCompatUnicodeTable_load_collation_resource}
99 +};
100 +
101 +static const IcallEntry normalization_icalls [] = {
102 +       {"load_normalization_resource(byte**,byte**,byte**,byte**,byte**,byte**)", ves_icall_Mono_Globalization_Unicode_Normalization_load_normalization_resource}
103 +};
104 +
105  static const IcallEntry gc_icalls [] = {
106         {"GetTotalMemory", ves_icall_System_GC_GetTotalMemory},
107         {"InternalCollect", ves_icall_System_GC_InternalCollect},
108 @@ -7006,6 +7014,8 @@
109  
110  /* keep the entries all sorted */
111  static const IcallMap icall_entries [] = {
112 +       {"Mono.Globalization.Unicode.MSCompatUnicodeTable", mscompatunicodetable_icalls, G_N_ELEMENTS (mscompatunicodetable_icalls)},
113 +       {"Mono.Globalization.Unicode.Normalization", normalization_icalls, G_N_ELEMENTS (normalization_icalls)},
114         {"Mono.Runtime", runtime_icalls, G_N_ELEMENTS (runtime_icalls)},
115         {"Mono.Security.Cryptography.KeyPairPersistence", keypair_icalls, G_N_ELEMENTS (keypair_icalls)},
116         {"System.Activator", activator_icalls, G_N_ELEMENTS (activator_icalls)},