gint32 len1, MonoString *str2,
gint32 off2, gint32 len2,
gint32 options);
-static MonoString *string_invariant_replace (MonoString *me,
- MonoString *oldValue,
- MonoString *newValue);
static gint32 string_invariant_indexof (MonoString *source, gint32 sindex,
gint32 count, MonoString *value,
MonoBoolean first);
static const RegionInfoEntry* region_info_entry_from_lcid (int lcid);
+/* Lazy class loading functions */
+static GENERATE_GET_CLASS_WITH_CACHE (culture_info, System.Globalization, CultureInfo)
+
static int
culture_lcid_locator (const void *a, const void *b)
{
ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean neutral,
MonoBoolean specific, MonoBoolean installed)
{
+ MonoError error;
MonoArray *ret;
MonoClass *klass;
MonoCultureInfo *culture;
len++;
}
- klass = mono_class_from_name (mono_get_corlib (),
- "System.Globalization", "CultureInfo");
+ klass = mono_class_get_culture_info_class ();
/* The InvariantCulture is not in culture_entries */
/* We reserve the first slot in the array for it */
ci = &culture_entries [i];
is_neutral = ci->territory == 0;
if ((neutral && is_neutral) || (specific && !is_neutral)) {
- culture = (MonoCultureInfo *) mono_object_new (domain, klass);
- mono_runtime_object_init ((MonoObject *) culture);
+ culture = (MonoCultureInfo *) mono_object_new_checked (domain, klass, &error);
+ if (!is_ok (&error)) goto fail;
+ mono_runtime_object_init_checked ((MonoObject *) culture, &error);
+ if (!is_ok (&error)) goto fail;
construct_culture (culture, ci);
culture->use_user_override = TRUE;
mono_array_setref (ret, len++, culture);
}
return ret;
+
+fail:
+ mono_error_set_pending_exception (&error);
+ return ret;
}
int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo *this_obj, MonoString *str1, gint32 off1, gint32 len1, MonoString *str2, gint32 off2, gint32 len2, gint32 options)
return(0x007F);
}
-MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this_obj, MonoString *old, MonoString *new_, MonoCompareInfo *comp)
-{
- /* Do a normal ascii string compare and replace, as we only
- * know the invariant locale if we dont have ICU
- */
- return(string_invariant_replace (this_obj, old, new_));
-}
-
static gint32 string_invariant_compare_char (gunichar2 c1, gunichar2 c2,
gint32 options)
{
return(string_invariant_compare_char(ustr1[pos], ustr2[pos], options));
}
-static MonoString *string_invariant_replace (MonoString *me,
- MonoString *oldValue,
- MonoString *newValue)
-{
- MonoError error;
- MonoString *ret;
- gunichar2 *src;
- gunichar2 *dest=NULL; /* shut gcc up */
- gunichar2 *oldstr;
- gunichar2 *newstr=NULL; /* shut gcc up here too */
- gint32 i, destpos;
- gint32 occurr;
- gint32 newsize;
- gint32 oldstrlen;
- gint32 newstrlen;
- gint32 srclen;
-
- occurr = 0;
- destpos = 0;
-
- oldstr = mono_string_chars(oldValue);
- oldstrlen = mono_string_length(oldValue);
-
- if (NULL != newValue) {
- newstr = mono_string_chars(newValue);
- newstrlen = mono_string_length(newValue);
- } else
- newstrlen = 0;
-
- src = mono_string_chars(me);
- srclen = mono_string_length(me);
-
- if (oldstrlen != newstrlen) {
- i = 0;
- while (i <= srclen - oldstrlen) {
- if (0 == memcmp(src + i, oldstr, oldstrlen * sizeof(gunichar2))) {
- occurr++;
- i += oldstrlen;
- }
- else
- i ++;
- }
- if (occurr == 0)
- return me;
- newsize = srclen + ((newstrlen - oldstrlen) * occurr);
- } else
- newsize = srclen;
-
- ret = NULL;
- i = 0;
- while (i < srclen) {
- if (0 == memcmp(src + i, oldstr, oldstrlen * sizeof(gunichar2))) {
- if (ret == NULL) {
- ret = mono_string_new_size_checked (mono_domain_get (), newsize, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
- dest = mono_string_chars(ret);
- memcpy (dest, src, i * sizeof(gunichar2));
- }
- if (newstrlen > 0) {
- memcpy(dest + destpos, newstr, newstrlen * sizeof(gunichar2));
- destpos += newstrlen;
- }
- i += oldstrlen;
- continue;
- } else if (ret != NULL) {
- dest[destpos] = src[i];
- }
- destpos++;
- i++;
- }
-
- if (ret == NULL)
- return me;
-
- return ret;
-}
-
static gint32 string_invariant_indexof (MonoString *source, gint32 sindex,
gint32 count, MonoString *value,
MonoBoolean first)
}
}
-void load_normalization_resource (guint8 **argProps,
- guint8 **argMappedChars,
- guint8 **argCharMapIndex,
- guint8 **argHelperIndex,
- guint8 **argMapIdxToComposite,
- guint8 **argCombiningClass)
+void ves_icall_System_Text_Normalization_load_normalization_resource (guint8 **argProps,
+ guint8 **argMappedChars,
+ guint8 **argCharMapIndex,
+ guint8 **argHelperIndex,
+ guint8 **argMapIdxToComposite,
+ guint8 **argCombiningClass)
{
#ifdef DISABLE_NORMALIZATION
mono_set_pending_exception (mono_get_exception_not_supported ("This runtime has been compiled without string normalization support."));