summary refs log tree commit diff
path: root/locale/programs/ld-ctype.c
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/programs/ld-ctype.c
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/programs/ld-ctype.c')
-rw-r--r--locale/programs/ld-ctype.c65
1 files changed, 60 insertions, 5 deletions
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)