Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 16 Jun 2000 23:04:41 +0000 (23:04 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 16 Jun 2000 23:04:41 +0000 (23:04 +0000)
2000-06-16  Ulrich Drepper  <drepper@redhat.com>

* iconv/gconv_int.h (norm_add_slashes): Optionally add given suffix.
* iconv/gconv_open.c: Remove error handling specification from `from'
character set name.
* intl/loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with
new parameter to always enable transliteration.
* locale/localeinfo.h (LIMAGIC): Bump number because of incompatible
change.
(struct locale_data): Add new members use_translit and options.
* locale/findlocale.c (_nl_find_locale): Set use_translit flag is
character set name contained modifier TRANSLIT.
* locale/loadlocale.c (_nl_load_locale): Initialize new use_translit
and options fields.
(_nl_unload_locale): Free options string if necessary.
* wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Enable translation if
the locale names suggested this.
* locale/C-address.c: Add two new initialilzers to adjust data
structure for new format.
* locale/C-collate.c: Likewise.
* locale/C-ctype.c: Likewise.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-messages.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-time.c: Likewise.

* locale/setlocale.c: Add some more __builtin_expect.

45 files changed:
ChangeLog
iconv/gconv_int.h
iconv/gconv_open.c
iconvdata/8bit-gap.c
iconvdata/8bit-generic.c
iconvdata/ansi_x3.110.c
iconvdata/big5.c
iconvdata/big5hkscs.c
iconvdata/euc-cn.c
iconvdata/euc-jp.c
iconvdata/euc-kr.c
iconvdata/euc-tw.c
iconvdata/gbgbk.c
iconvdata/gbk.c
iconvdata/iso-2022-cn.c
iconvdata/iso-2022-jp.c
iconvdata/iso-2022-kr.c
iconvdata/iso646.c
iconvdata/iso8859-1.c
iconvdata/iso_6937-2.c
iconvdata/iso_6937.c
iconvdata/johab.c
iconvdata/sjis.c
iconvdata/t.61.c
iconvdata/uhc.c
iconvdata/unicode.c
iconvdata/utf-16.c
intl/loadmsgcat.c
locale/C-address.c
locale/C-collate.c
locale/C-ctype.c
locale/C-identification.c
locale/C-measurement.c
locale/C-messages.c
locale/C-monetary.c
locale/C-name.c
locale/C-numeric.c
locale/C-paper.c
locale/C-telephone.c
locale/C-time.c
locale/findlocale.c
locale/loadlocale.c
locale/localeinfo.h
locale/setlocale.c
wcsmbs/wcsmbsload.c

index 72e3748..fd3bb20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2000-06-16  Ulrich Drepper  <drepper@redhat.com>
+
+       * iconv/gconv_int.h (norm_add_slashes): Optionally add given suffix.
+       * iconv/gconv_open.c: Remove error handling specification from `from'
+       character set name.
+       * intl/loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with
+       new parameter to always enable transliteration.
+       * locale/localeinfo.h (LIMAGIC): Bump number because of incompatible
+       change.
+       (struct locale_data): Add new members use_translit and options.
+       * locale/findlocale.c (_nl_find_locale): Set use_translit flag is
+       character set name contained modifier TRANSLIT.
+       * locale/loadlocale.c (_nl_load_locale): Initialize new use_translit
+       and options fields.
+       (_nl_unload_locale): Free options string if necessary.
+       * wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Enable translation if
+       the locale names suggested this.
+       * locale/C-address.c: Add two new initialilzers to adjust data
+       structure for new format.
+       * locale/C-collate.c: Likewise.
+       * locale/C-ctype.c: Likewise.
+       * locale/C-identification.c: Likewise.
+       * locale/C-measurement.c: Likewise.
+       * locale/C-messages.c: Likewise.
+       * locale/C-monetary.c: Likewise.
+       * locale/C-name.c: Likewise.
+       * locale/C-numeric.c: Likewise.
+       * locale/C-paper.c: Likewise.
+       * locale/C-telephone.c: Likewise.
+       * locale/C-time.c: Likewise.
+
+       * locale/setlocale.c: Add some more __builtin_expect.
+
 2000-06-15  Ulrich Drepper  <drepper@redhat.com>
 
        * iconv/gconv.h (__gconv_fct): Change type of fifth parameter to
index 34dff7d..5bdf714 100644 (file)
@@ -102,18 +102,19 @@ extern struct gconv_module *__gconv_modules_db;
 
 /* The gconv functions expects the name to be in upper case and complete,
    including the trailing slashes if necessary.  */
-#define norm_add_slashes(str) \
+#define norm_add_slashes(str,suffix) \
   ({                                                                         \
     const char *cp = (str);                                                  \
     char *result;                                                            \
     char *tmp;                                                               \
     size_t cnt = 0;                                                          \
+    size_t suffix_len = suffix == NULL ? 0 : strlen (suffix);                \
                                                                              \
     while (*cp != '\0')                                                              \
       if (*cp++ == '/')                                                              \
        ++cnt;                                                                \
                                                                              \
-    tmp = result = alloca (cp - (str) + 3);                                  \
+    tmp = result = alloca (cp - (str) + 3 + suffix_len);                     \
     cp = (str);                                                                      \
     while (*cp != '\0')                                                              \
       *tmp++ = _toupper (*cp++);                                             \
@@ -121,7 +122,11 @@ extern struct gconv_module *__gconv_modules_db;
       {                                                                              \
        *tmp++ = '/';                                                         \
        if (cnt < 1)                                                          \
-         *tmp++ = '/';                                                       \
+         {                                                                   \
+           *tmp++ = '/';                                                     \
+           if (suffix != NULL)                                               \
+             tmp = __mempcpy (tmp, suffix, suffix_len);                      \
+         }                                                                   \
       }                                                                              \
     *tmp = '\0';                                                             \
     result;                                                                  \
index 14f1d5e..d2963fa 100644 (file)
@@ -37,6 +37,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
   int res;
   int conv_flags = 0;
   const char *errhand;
+  const char *ignore;
 
   /* Find out whether any error handling method is specified.  */
   errhand = strchr (toset, '/');
@@ -44,7 +45,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
     errhand = strchr (errhand + 1, '/');
   if (__builtin_expect (errhand != NULL, 1))
     {
-      if (errhand[1] == '\0')
+      if (*++errhand == '\0')
        errhand = NULL;
       else
        {
@@ -56,7 +57,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
 
          flags = __GCONV_IGNORE_ERRORS;
 
-         if (strcasecmp (errhand, "IGNORE") == 0)
+         if (__strcasecmp (errhand, "IGNORE") == 0)
            {
              /* Found it.  This means we should ignore conversion errors.  */
              flags = __GCONV_IGNORE_ERRORS;
@@ -65,6 +66,18 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
        }
     }
 
+  /* For the source character set we ignore the error handler specification.
+     XXX Is this really always the best?  */
+  ignore = strchr (fromset, '/');
+  if (ignore != NULL && (ignore = strchr (ignore + 1, '/')) != NULL
+      && *++ignore != '\0')
+    {
+      char *newfromset = (char *) alloca (ignore - fromset + 1);
+
+      newfromset[ignore - fromset] = '\0';
+      fromset = memcpy (newfromset, fromset, ignore - fromset);
+    }
+
   res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags);
   if (res == __GCONV_OK)
     {
@@ -78,7 +91,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
       if (errhand != NULL)
        {
          /* Find the appropriate transliteration handling.  */
-         if (strcasecmp (errhand, "TRANSLIT") == 0)
+         if (__strcasecmp (errhand, "TRANSLIT") == 0)
            {
              /* It's the builtin transliteration handling.  We only
                  suport for it working on the internal encoding.  */
@@ -89,7 +102,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
              trans_fct = __gconv_transliterate;
              /* No context, init, or end function.  */
            }
-         else if (strcasecmp (errhand, "WORK AROUND A GCC BUG") == 0)
+         else if (__strcasecmp (errhand, "WORK AROUND A GCC BUG") == 0)
            {
              trans_init_fct = (__gconv_trans_init_fct) 1;
            }
@@ -151,7 +164,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
              /* Now see whether we can use the transliteration module
                 for this step.  */
              for (n = 0; n < ncsnames; ++n)
-               if (strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
+               if (__strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
                  {
                    /* Match!  Now try the initializer.  */
                    if (trans_init_fct == NULL
@@ -182,7 +195,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
          /* Now see whether we can use the transliteration module
             for this step.  */
          for (n = 0; n < ncsnames; ++n)
-           if (strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
+           if (__strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
              {
                /* Match!  Now try the initializer.  */
                if (trans_init_fct == NULL
index 6394065..a4a32d3 100644 (file)
@@ -89,7 +89,7 @@ struct gap
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
@@ -112,7 +112,7 @@ struct gap
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
@@ -137,7 +137,7 @@ struct gap
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index 1478c5b..02d972e 100644 (file)
@@ -72,7 +72,7 @@
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index f338055..6ec09c3 100644 (file)
@@ -501,7 +501,7 @@ static const char from_ucs4[][2] =
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
@@ -559,7 +559,7 @@ static const char from_ucs4[][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
@@ -587,7 +587,7 @@ static const char from_ucs4[][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
index 8cad304..947a92a 100644 (file)
@@ -8589,7 +8589,7 @@ static const char from_ucs4_tab13[][2] =
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index 0859dd8..64923d4 100644 (file)
@@ -12746,7 +12746,7 @@ static const char from_ucs4_tab14[][2] =
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index 075970c..18e73fd 100644 (file)
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
index 771dc06..3e21d55 100644 (file)
                      {                                                       \
                        result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
                                              (step, step_data, *inptrp,      \
-                                              &inptr, inend, &outbuf,        \
+                                              &inptr, inend, &outptr,        \
                                               irreversible));                \
                        if (result != __GCONV_OK)                             \
                          break;                                              \
index e953df5..c32b9b3 100644 (file)
@@ -150,7 +150,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index f315247..b4cf21b 100644 (file)
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
index 15e72d9..0afcd72 100644 (file)
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
index 669e4a9..4505b65 100644 (file)
@@ -13456,7 +13456,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
            {                                                                 \
              result = DL_CALL_FCT (step_data->__trans.__trans_fct,           \
                                    (step, step_data, *inptrp, &inptr, inend, \
-                                    &outbuf, irreversible));                 \
+                                    &outptr, irreversible));                 \
              if (result != __GCONV_OK)                                       \
                break;                                                        \
            }                                                                 \
index 818f2a7..f217069 100644 (file)
@@ -328,7 +328,7 @@ enum
                      {                                                       \
                        result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
                                              (step, step_data, *inptrp,      \
-                                              &inptr, inend, &outbuf,        \
+                                              &inptr, inend, &outptr,        \
                                               irreversible));                \
                        if (result != __GCONV_OK)                             \
                          break;                                              \
index b66c950..ab42bcc 100644 (file)
@@ -707,7 +707,7 @@ gconv_end (struct __gconv_step *data)
                      {                                                       \
                        result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
                                              (step, step_data, *inptrp,      \
-                                              &inptr, inend, &outbuf,        \
+                                              &inptr, inend, &outptr,        \
                                               irreversible));                \
                        if (result != __GCONV_OK)                             \
                          break;                                              \
@@ -894,7 +894,7 @@ gconv_end (struct __gconv_step *data)
                                            result = DL_CALL_FCT              \
                                              (step_data->__trans.__trans_fct,\
                                               (step, step_data, *inptrp,     \
-                                               &inptr, inend, &outbuf,       \
+                                               &inptr, inend, &outptr,       \
                                                irreversible));               \
                                            if (result != __GCONV_OK)         \
                                              break;                          \
index d3cca52..52031ca 100644 (file)
@@ -259,7 +259,7 @@ enum
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
index df81ee2..66f8958 100644 (file)
@@ -889,7 +889,7 @@ gconv_end (struct __gconv_step *data)
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index d69a201..a613481 100644 (file)
@@ -53,7 +53,7 @@
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index 536d896..cde2108 100644 (file)
@@ -569,7 +569,7 @@ static const char from_ucs4[][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
@@ -594,7 +594,7 @@ static const char from_ucs4[][2] =
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index f812ce2..e767291 100644 (file)
@@ -546,7 +546,7 @@ static const char from_ucs4[][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
@@ -571,7 +571,7 @@ static const char from_ucs4[][2] =
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index ac3bf82..d2947dc 100644 (file)
@@ -400,7 +400,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
@@ -445,7 +445,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
index 806579b..aa51259 100644 (file)
@@ -4472,7 +4472,7 @@ static const char from_ucs4_extra[0x100][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
@@ -4500,7 +4500,7 @@ static const char from_ucs4_extra[0x100][2] =
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index a7d4227..3c1a69e 100644 (file)
@@ -473,7 +473,7 @@ static const char from_ucs4[][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
@@ -510,7 +510,7 @@ static const char from_ucs4[][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
index 9c494ff..5526e9b 100644 (file)
@@ -3225,7 +3225,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
@@ -3265,7 +3265,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
              {                                                               \
                result = DL_CALL_FCT (step_data->__trans.__trans_fct,         \
                                      (step, step_data, *inptrp, &inptr,      \
-                                      inend, &outbuf, irreversible));        \
+                                      inend, &outptr, irreversible));        \
                if (result != __GCONV_OK)                                     \
                  break;                                                      \
              }                                                               \
index e818c54..9caa95d 100644 (file)
@@ -156,7 +156,7 @@ gconv_end (struct __gconv_step *data)
          {                                                                   \
            result = DL_CALL_FCT (step_data->__trans.__trans_fct,             \
                                  (step, step_data, *inptrp, &inptr, inend,   \
-                                  &outbuf, irreversible));                   \
+                                  &outptr, irreversible));                   \
            if (result != __GCONV_OK)                                         \
              break;                                                          \
          }                                                                   \
index 44911fe..fd7bba7 100644 (file)
@@ -206,7 +206,7 @@ gconv_end (struct __gconv_step *data)
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
@@ -249,7 +249,7 @@ gconv_end (struct __gconv_step *data)
                  {                                                           \
                    result = DL_CALL_FCT (step_data->__trans.__trans_fct,     \
                                          (step, step_data, *inptrp, &inptr,  \
-                                          inend, &outbuf, irreversible));    \
+                                          inend, &outptr, irreversible));    \
                    if (result != __GCONV_OK)                                 \
                      break;                                                  \
                  }                                                           \
index 4009525..398d751 100644 (file)
@@ -315,8 +315,9 @@ _nl_load_domain (domain_file)
            }
 
 # ifdef _LIBC
-         outcharset = norm_add_slashes (outcharset);
-         charset = norm_add_slashes (charset);
+         /* We always want to use transliteration.  */
+         outcharset = norm_add_slashes (outcharset, "TRANSLIT");
+         charset = norm_add_slashes (charset, NULL);
          if (__gconv_open (outcharset, charset, &domain->conv,
                            GCONV_AVOID_NOCONV)
              != __GCONV_OK)
index 8b37639..75a51d2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_ADDRESS =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   12,
   {
     { string: "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N" },
index 0ad0efe..f8d1430 100644 (file)
@@ -97,6 +97,8 @@ const struct locale_data _nl_C_LC_COLLATE =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   18,
   {
     { word: 0 },
index 8c85d6e..4ab3f01 100644 (file)
@@ -343,6 +343,8 @@ const struct locale_data _nl_C_LC_CTYPE =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   62,
   {
     { string: _nl_C_LC_CTYPE_class },
index 10d9ae9..89ebf31 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_IDENTIFICATION =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   15,
   {
     { string: "ISO/IEC 14652 i18n FDCC-set" },
index 37db30d..92de2a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_MEASUREMENT =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   1,
   {
     { string: "\1" }
index 0363020..3f96bb0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_MESSAGES =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   4,
   {
     { string: "^[yY]" },
index 96a1e52..39d061d 100644 (file)
@@ -33,6 +33,8 @@ const struct locale_data _nl_C_LC_MONETARY =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   45,
   {
     { string: "" },
index 4b31370..fdce4cb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_NAME =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   6,
   {
     { string: "%p%t%g%t%m%t%f" },
index fc2e104..65fc273 100644 (file)
@@ -32,6 +32,8 @@ const struct locale_data _nl_C_LC_NUMERIC =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   5,
   {
     { string: "." },
index fa3e855..19f847c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_PAPER =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   2,
   {
     { word: 297 },
index 9647ac0..adf407d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,8 @@ const struct locale_data _nl_C_LC_TELEPHONE =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   4,
   {
     { string: "+%c %a %l" },
index 9be32c0..18bd645 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -28,6 +28,8 @@ const struct locale_data _nl_C_LC_TIME =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   UNDELETABLE,
+  0,
+  NULL,
   62,
   {
     { string: "Sun" },
index f0c911d..7567744 100644 (file)
@@ -181,6 +181,11 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
     }
   *name = (char *) ((struct locale_data *) locale_file->data)->name;
 
+  /* Determine whether the user wants transliteration or not.  */
+  if ((modifier != NULL && __strcasecmp (modifier, "TRANSLIT") == 0)
+      || (special != NULL && __strcasecmp (special, "TRANSLIT") == 0))
+    ((struct locale_data *) locale_file->data)->use_translit = 1;
+
   /* Increment the usage count.  */
   if (((struct locale_data *) locale_file->data)->usage_count
       < MAX_USAGE_COUNT)
index cc454ab..36ce5f4 100644 (file)
@@ -202,6 +202,8 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
   newdata->filesize = st.st_size;
   newdata->mmaped = mmaped;
   newdata->usage_count = 0;
+  newdata->use_translit = 0;
+  newdata->options = NULL;
   newdata->nstrings = filedata->nstrings;
   for (cnt = 0; cnt < newdata->nstrings; ++cnt)
     {
@@ -232,5 +234,8 @@ _nl_unload_locale (struct locale_data *locale)
 #endif
     free ((void *) locale->filedata);
 
+  if (locale->options != NULL)
+    free (locale->options);
+
   free (locale);
 }
index ced96ac..b5dfcd9 100644 (file)
@@ -1,5 +1,5 @@
 /* Declarations for internal libc locale interfaces
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,7 +33,7 @@
 #include <intl/loadinfo.h>     /* For loaded_l10nfile definition.  */
 
 /* Magic number at the beginning of a locale data file for CATEGORY.  */
-#define        LIMAGIC(category)       (0x980505 ^ (category))
+#define        LIMAGIC(category)       (0x20000616 ^ (category))
 
 /* Two special weight constants for the collation data.  */
 #define IGNORE_CHAR    2
@@ -53,6 +53,11 @@ struct locale_data
 
   unsigned int usage_count;    /* Counter for users.  */
 
+  int use_translit;            /* Nonzero if the mb*towv*() and wc*tomb()
+                                  functions should use transliteration.  */
+  const char *options;         /* Extra options from the locale name,
+                                  not used in the path to the locale data.  */
+
   unsigned int nstrings;       /* Number of strings below.  */
   union locale_data_value
   {
index 0bf9eee..03456fb 100644 (file)
@@ -220,7 +220,8 @@ setlocale (int category, const char *locale)
   char *composite;
 
   /* Sanity check for CATEGORY argument.  */
-  if (category < 0 || category >= __LC_LAST)
+  if (__builtin_expect (category, 0) < 0
+      || __builtin_expect (category, 0) >= __LC_LAST)
     ERROR_RETURN;
 
   /* Does user want name of current locale?  */
@@ -261,7 +262,7 @@ setlocale (int category, const char *locale)
        if (category != LC_ALL)
          newnames[category] = (char *) locale;
 
-      if (strchr (locale, ';') != NULL)
+      if (__builtin_expect (strchr (locale, ';') != NULL, 0))
        {
          /* This is a composite name.  Make a copy and split it up.  */
          char *np = strdupa (locale);
index 55d19ff..b152b35 100644 (file)
@@ -146,7 +146,7 @@ __wcsmbs_load_conv (const struct locale_data *new_category)
 
   /* We should repeat the test since while we waited some other thread
      might have run this function.  */
-  if (__wcsmbs_last_locale != new_category)
+  if (__builtin_expect (__wcsmbs_last_locale != new_category, 1))
     {
       if (new_category->name == _nl_C_name)    /* Yes, pointer comparison.  */
        {
@@ -161,6 +161,7 @@ __wcsmbs_load_conv (const struct locale_data *new_category)
          const char *complete_name;
          struct __gconv_step *new_towc;
          struct __gconv_step *new_tomb;
+         int use_translit;
 
          /* Free the old conversions.  */
          __gconv_close_transform (__wcsmbs_gconv_fcts.tomb, 1);
@@ -169,10 +170,17 @@ __wcsmbs_load_conv (const struct locale_data *new_category)
          /* Get name of charset of the locale.  */
          charset_name = new_category->values[_NL_ITEM_INDEX(CODESET)].string;
 
+         /* Does the user want transliteration?  */
+         use_translit = new_category->use_translit;
+
          /* Normalize the name and add the slashes necessary for a
              complete lookup.  */
-         complete_name = norm_add_slashes (charset_name);
+         complete_name = norm_add_slashes (charset_name,
+                                           use_translit ? "TRANSLIT" : NULL);
 
+         /* It is not necessary to use transliteration in this direction
+            since the internal character set is supposed to be able to
+            represent all others.  */
          new_towc = getfct ("INTERNAL", complete_name);
          if (new_towc != NULL)
            new_tomb = getfct (complete_name, "INTERNAL");