about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-25 01:00:37 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-25 01:00:37 +0000
commitdb76d9433c8b71eb3677ff5ca5b94e084e73e468 (patch)
treeb02fb38974b74d7711821b95e94e798e1e67db53
parent973209d8b04730a5f39dbcb015cc9836add665c1 (diff)
downloadglibc-db76d9433c8b71eb3677ff5ca5b94e084e73e468.tar.gz
glibc-db76d9433c8b71eb3677ff5ca5b94e084e73e468.tar.xz
glibc-db76d9433c8b71eb3677ff5ca5b94e084e73e468.zip
Update.
	* locale/programs/ld-collate.c (collate_output): Also handle
	IGNOREd characters in the simple way when generating the multibyte
	table.

	* locale/programs/ld-ctype.c (allocate_arrays): Move codeset_name
	handling to ...
	(ctype_finish): ...here.  Check for missing codeset name.
-rw-r--r--ChangeLog8
-rw-r--r--locale/programs/ld-collate.c15
-rw-r--r--locale/programs/ld-ctype.c16
-rw-r--r--localedata/ChangeLog3
-rw-r--r--localedata/tests/test5.ds24
-rwxr-xr-xlocaledata/tst-locale.sh3
6 files changed, 60 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index d55d385add..a8387f837e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2000-01-24  Ulrich Drepper  <drepper@cygnus.com>
 
+	* locale/programs/ld-collate.c (collate_output): Also handle
+	IGNOREd characters in the simple way when generating the multibyte
+	table.
+
+	* locale/programs/ld-ctype.c (allocate_arrays): Move codeset_name
+	handling to ...
+	(ctype_finish): ...here.  Check for missing codeset name.
+
 	* sysdeps/unix/sysv/linux/Dist: Add ipc_priv.h.
 	* sysdeps/unix/sysv/linux/alpha/Dist: Likewise.
 
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 226bf23b4a..eb0c55ee63 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2000,7 +2000,7 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
 
   for (ch = 1; ch < 256; ++ch)
     if (collate->mbheads[ch]->mbnext == NULL
-	&& collate->mbheads[ch]->nmbs == 1)
+	&& collate->mbheads[ch]->nmbs <= 1)
       {
 	tablemb[ch] = output_weight (&weightpool, collate,
 				     collate->mbheads[ch]);
@@ -2025,6 +2025,9 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
 	struct element_t *runp = collate->mbheads[ch];
 	struct element_t *lastp;
 
+	assert ((obstack_object_size (&extrapool)
+		 & (__alignof__ (int32_t) - 1)) == 0);
+
 	tablemb[ch] = -obstack_object_size (&extrapool);
 
 	do
@@ -2081,6 +2084,7 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
 		/* Now walk backward from here to the beginning.  */
 		curp = runp;
 
+		assert (runp->nmbs <= 256);
 		obstack_1grow_fast (&extrapool, curp->nmbs - 1);
 		for (i = 1; i < curp->nmbs; ++i)
 		  obstack_1grow_fast (&extrapool, curp->mbs[i]);
@@ -2125,13 +2129,17 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
 		added = ((sizeof (int32_t) + 1 + runp->nmbs - 1
 			  + __alignof__ (int32_t) - 1)
 			 & ~(__alignof__ (int32_t) - 1));
+		assert ((obstack_object_size (&extrapool)
+			 & (__alignof__ (int32_t) - 1)) == 0);
 		obstack_make_room (&extrapool, added);
 
 		if (sizeof (int32_t) == sizeof (int))
 		  obstack_int_grow_fast (&extrapool, weightidx);
 		else
 		  obstack_grow (&extrapool, &weightidx, sizeof (int32_t));
+		assert (runp->nmbs <= 256);
 		obstack_1grow_fast (&extrapool, runp->nmbs - 1);
+
 		for (i = 1; i < runp->nmbs; ++i)
 		  obstack_1grow_fast (&extrapool, runp->mbs[i]);
 	      }
@@ -2147,11 +2155,14 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
 	  }
 	while (runp != NULL);
 
+	assert ((obstack_object_size (&extrapool)
+		 & (__alignof__ (int32_t) - 1)) == 0);
+
 	/* If the final entry in the list is not a single character we
            add an UNDEFINED entry here.  */
 	if (lastp->nmbs != 1)
 	  {
-	    int added = ((sizeof (int32_t) + 1 + 1 + __alignof__ (int32_t))
+	    int added = ((sizeof (int32_t) + 1 + 1 + __alignof__ (int32_t) - 1)
 			 & ~(__alignof__ (int32_t) - 1));
 	    obstack_make_room (&extrapool, added);
 
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 3ffe9ea5bd..7b2f7c113d 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -379,6 +379,17 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	ctype->repertoire = repertoire_read (repertoire_name);
     }
 
+  /* We need the name of the currently used 8-bit character set to
+     make correct conversion between this 8-bit representation and the
+     ISO 10646 character set used internally for wide characters.  */
+  ctype->codeset_name = charmap->code_set_name;
+  if (ctype->codeset_name == NULL)
+    {
+      if (! be_quiet)
+	error (0, 0, "no character set name specified in charmap");
+      ctype->codeset_name = "//UNKNOWN//";
+    }
+
   /* Set default value for classes not specified.  */
   set_class_defaults (ctype, charmap, ctype->repertoire);
 
@@ -3304,11 +3315,6 @@ Computing table size for character classes might take a while..."),
   /* Set MB_CUR_MAX.  */
   ctype->mb_cur_max = charmap->mb_cur_max;
 
-  /* We need the name of the currently used 8-bit character set to
-     make correct conversion between this 8-bit representation and the
-     ISO 10646 character set used internally for wide characters.  */
-  ctype->codeset_name = charmap->code_set_name;
-
   /* Now determine the table for the transliteration information.
 
      XXX It is not yet clear to me whether it is worth implementing a
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 7c411e80ad..4001a4dcbb 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,5 +1,8 @@
 2000-01-24  Ulrich Drepper  <drepper@cygnus.com>
 
+	* tst-locale.sh: Also enable test5.
+	* tests/test5.ds: New file.
+
 	* locales/gl_ES: New file.
 	Contributed by Jacobo Tarrio <jtarrio@ceu.fi.udc.es>.
 
diff --git a/localedata/tests/test5.ds b/localedata/tests/test5.ds
new file mode 100644
index 0000000000..261e1eb126
--- /dev/null
+++ b/localedata/tests/test5.ds
@@ -0,0 +1,24 @@
+escape_char /
+<k0101>		<UAC00>
+<k0102>		<UAC01>
+<k0103>		<UAC02>
+<k4001>		<U2170>
+<k4002>		<U2171>
+<k4003>		<U2172>
+<k4036>		<U0394>
+<k5001>		<U2500>
+<k5002>		<U2502>
+<k5003>		<U250C>
+<k6001>		<U3395>
+<k6002>		<U3396>
+<k6003>		<U3397>
+<0>		<U0030>
+<1>		<U0031>
+<2>		<U0032>
+<3>		<U0033>
+<4>		<U0034>
+<5>		<U0035>
+<6>		<U0036>
+<7>		<U0037>
+<8>		<U0038>
+<9>		<U0039>
diff --git a/localedata/tst-locale.sh b/localedata/tst-locale.sh
index ed62c71138..6851c364c8 100755
--- a/localedata/tst-locale.sh
+++ b/localedata/tst-locale.sh
@@ -44,8 +44,7 @@ test_locale tests/test1.cm tests/test1.def test1 mnemonic.ds
 test_locale tests/test2.cm tests/test2.def test2 mnemonic.ds
 test_locale tests/test3.cm tests/test3.def test3 mnemonic.ds
 test_locale tests/test4.cm tests/test4.def test4 mnemonic.ds
-# I know that multi-byte charsets do not yet work. --drepper
-# test_locale tests/test5.cm tests/test5.def test5 mnemonic.ds
+test_locale tests/test5.cm tests/test5.def test5 tests/test5.ds
 
 exit 0