about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-17 07:39:18 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-17 07:39:18 +0000
commita8e4c924e8cdd2db10de2175f73c70ad43aa931b (patch)
tree9555863a7c6c9b6f3a98ed5b4bc33b60c7208163 /locale
parent1d96d74da7f6adccd82e4000efe38900b295467a (diff)
downloadglibc-a8e4c924e8cdd2db10de2175f73c70ad43aa931b.tar.gz
glibc-a8e4c924e8cdd2db10de2175f73c70ad43aa931b.tar.xz
glibc-a8e4c924e8cdd2db10de2175f73c70ad43aa931b.zip
Update.
2000-06-17  Ulrich Drepper  <drepper@redhat.com>

	* iconv/gconv_trans.c: Implement handling if translit_ignore.
	* locale/langinfo.h: Add entries for translit_ignore information.
	* locale/categories.def: Add entries for new LC_CTYPE elements.
	* locale/C-ctype.c: Add initializers for new fields.  Use NULL
	pointer instead of "" where possible.
	* locale/programs/ld-ctype.c: Write out translit_ignore information.
	* intl/Depend: Add localedata.
	* intl/tst-gettext.c: Call setlocale for LC_CTYPE.
	* intl/tst-gettext.sh: Set LOCPATH to localedata build dir.
Diffstat (limited to 'locale')
-rw-r--r--locale/C-ctype.c14
-rw-r--r--locale/categories.def4
-rw-r--r--locale/langinfo.h4
-rw-r--r--locale/programs/ld-ctype.c65
4 files changed, 74 insertions, 13 deletions
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index 04eb091e62..344596d972 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -345,7 +345,7 @@ const struct locale_data _nl_C_LC_CTYPE =
   UNDELETABLE,
   0,
   NULL,
-  64,
+  66,
   {
     { string: _nl_C_LC_CTYPE_class },
     { string: (const char *) _nl_C_LC_CTYPE_toupper },
@@ -419,11 +419,13 @@ const struct locale_data _nl_C_LC_CTYPE =
     { word: L'9' },
     { word: 0 },
     { word: 0 },
-    { string: "" },
-    { string: "" },
-    { string: "" },
-    { string: "" },
+    { string: NULL },
+    { string: NULL },
+    { string: NULL },
+    { string: NULL },
+    { word: 1 },
     { wstr: (uint32_t *) L"?" },
-    { word: 1 }
+    { word: 0 },
+    { wstr: NULL }
   }
 };
diff --git a/locale/categories.def b/locale/categories.def
index e1f3f054b9..b71d44469b 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -132,8 +132,10 @@ DEFINE_CATEGORY
   DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_FROM_TBL, "ctype-translit-from-tbl", std, string)
   DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TO_IDX, "ctype-translit-to-idx", std, string)
   DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_TO_TBL, "ctype-translit-to-tbl", std, string)
-  DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING, "ctype-translit-default-missing", std, string)
   DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, "ctype-translit-default-missing-len", std, word)
+  DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING, "ctype-translit-default-missing", std, string)
+  DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE_LEN, "ctype-translit-ignore-len", std, word)
+  DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE, "ctype-translit-ignore", std, string)
   ), _nl_postload_ctype)
 
 
diff --git a/locale/langinfo.h b/locale/langinfo.h
index 11ab68ef63..582253c9cc 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -319,8 +319,10 @@ enum
   _NL_CTYPE_TRANSLIT_FROM_TBL,
   _NL_CTYPE_TRANSLIT_TO_IDX,
   _NL_CTYPE_TRANSLIT_TO_TBL,
-  _NL_CTYPE_TRANSLIT_DEFAULT_MISSING,
   _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN,
+  _NL_CTYPE_TRANSLIT_DEFAULT_MISSING,
+  _NL_CTYPE_TRANSLIT_IGNORE_LEN,
+  _NL_CTYPE_TRANSLIT_IGNORE,
   _NL_NUM_LC_CTYPE,
 
   /* LC_MONETARY category: formatting of monetary quantities.
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index e899649d65..bda89ec9bc 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -154,6 +154,7 @@ struct locale_ctype_t
   const char *translit_copy_repertoire;
   struct translit_t *translit;
   struct translit_ignore_t *translit_ignore;
+  uint32_t ntranslit_ignore;
 
   uint32_t *default_missing;
   const char *default_missing_file;
@@ -774,6 +775,33 @@ not all characters used in `outdigit' are available in the repertoire"));
 
 	ctype->wcoutdigits[cnt] = L'?';
       }
+
+  /* Sort the entries in the translit_ignore list.  */
+  if (ctype->translit_ignore != NULL)
+    {
+      struct translit_ignore_t *firstp = ctype->translit_ignore;
+      struct translit_ignore_t *runp;
+
+      ctype->ntranslit_ignore = 1;
+
+      for (runp = firstp->next; runp != NULL; runp = runp->next)
+	{
+	  struct translit_ignore_t *lastp = NULL;
+	  struct translit_ignore_t *cmpp;
+
+	  ++ctype->ntranslit_ignore;
+
+	  for (cmpp = firstp; cmpp != NULL; lastp = cmpp, cmpp = cmpp->next)
+	    if (runp->from < cmpp->from)
+	      break;
+
+	  runp->next = lastp;
+	  if (lastp == NULL)
+	    firstp = runp;
+	}
+
+      ctype->translit_ignore = firstp;
+    }
 }
 
 
@@ -1007,6 +1035,15 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
 	    break;
 
+	  case _NL_ITEM_INDEX(_NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN):
+	    default_missing_len = (ctype->default_missing
+				   ? wcslen ((wchar_t *)ctype->default_missing)
+				   : 1);
+	    iov[2 + elem + offset].iov_base = &default_missing_len;
+	    iov[2 + elem + offset].iov_len = sizeof (uint32_t);
+	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
+	    break;
+
 	  case _NL_ITEM_INDEX(_NL_CTYPE_TRANSLIT_DEFAULT_MISSING):
 	    iov[2 + elem + offset].iov_base =
 	      ctype->default_missing ?: (uint32_t *) L"";
@@ -1015,12 +1052,30 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
 	    break;
 
-	  case _NL_ITEM_INDEX(_NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN):
-	    default_missing_len = (ctype->default_missing
-				   ? wcslen ((wchar_t *)ctype->default_missing)
-				   : 1);
-	    iov[2 + elem + offset].iov_base = &default_missing_len;
+	  case _NL_ITEM_INDEX(_NL_CTYPE_TRANSLIT_IGNORE_LEN):
+	    iov[2 + elem + offset].iov_base = &ctype->ntranslit_ignore;
 	    iov[2 + elem + offset].iov_len = sizeof (uint32_t);
+	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
+	    break;
+
+	  case _NL_ITEM_INDEX(_NL_CTYPE_TRANSLIT_IGNORE):
+	    {
+	      uint32_t *ranges = (uint32_t *) alloca (ctype->ntranslit_ignore
+						      * 3 * sizeof (uint32_t));
+	      struct translit_ignore_t *runp;
+
+	      iov[2 + elem + offset].iov_base = ranges;
+	      iov[2 + elem + offset].iov_len = (ctype->ntranslit_ignore
+						* 3 * sizeof (uint32_t));
+
+	      for (runp = ctype->translit_ignore; runp != NULL;
+		   runp = runp->next)
+		{
+		  *ranges++ = runp->from;
+		  *ranges++ = runp->to;
+		  *ranges++ = runp->step;
+		}
+	    }
 	    /* Remove the following line in case a new entry is added
 	       after _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN.  */
 	    if (elem < nelems)