about summary refs log tree commit diff
path: root/locale/programs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-01 18:59:42 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-01 18:59:42 +0000
commit4a9dcff10ec07770aaf0b4dedaac44eacbbaa110 (patch)
treeab9c931b7f57f4ef5e82dc2260717b621f3650ff /locale/programs
parent70440f48d8c4aa57f030485b60a7faf686f1dd4d (diff)
downloadglibc-4a9dcff10ec07770aaf0b4dedaac44eacbbaa110.tar.gz
glibc-4a9dcff10ec07770aaf0b4dedaac44eacbbaa110.tar.xz
glibc-4a9dcff10ec07770aaf0b4dedaac44eacbbaa110.zip
Update.
	* charmaps/ISO-IR-197: Remove alias "none".

2000-09-30  Bruno Haible  <haible@clisp.cons.org>
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/charmap.c10
-rw-r--r--locale/programs/config.h4
-rw-r--r--locale/programs/ld-ctype.c40
3 files changed, 38 insertions, 16 deletions
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index f76bc24709..b8e994fdac 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -120,7 +120,7 @@ charmap_read (const char *filename)
 	}
     }
 
-  if (result == NULL)
+  if (result == NULL && filename != NULL)
     {
       /* OK, one more try.  We also accept the names given to the
 	 character sets in the files.  Sometimes they differ from the
@@ -155,12 +155,9 @@ charmap_read (const char *filename)
 			char junk[BUFSIZ];
 
 			if (fscanf (fp, " <code_set_name> %as", &name) == 1
-			    || (fscanf (fp, " <code_set_name> \"%as\"", &name)
-				== 1)
 			    || fscanf (fp, "%% alias %as", &name) == 1)
 			  {
-			    if (filename != NULL
-				&& strcasecmp (name, filename) == 0)
+			    if (strcasecmp (name, filename) == 0)
 			      break;
 
 			    free (name);
@@ -189,9 +186,6 @@ charmap_read (const char *filename)
 			result = (cmfile == NULL
 				  ? NULL : parse_charmap (cmfile));
 
-			if (result)
-			  return result;
-
 			break;
 		      }
 		  }
diff --git a/locale/programs/config.h b/locale/programs/config.h
index a293da3b09..512350449e 100644
--- a/locale/programs/config.h
+++ b/locale/programs/config.h
@@ -1,5 +1,5 @@
 /* Configuration for localedef program.
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -28,7 +28,7 @@
 #include "../../version.h"
 #endif
 
-#define DEFAULT_CHARMAP "POSIX"
+#define DEFAULT_CHARMAP "ANSI_X3.4-1968" /* ASCII */
 
 #ifndef PARAMS
 # if __STDC__
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 1d10cec618..4f5653af23 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1309,6 +1309,10 @@ find_idx (struct locale_ctype_t *ctype, uint32_t **table, size_t *max,
     /* We have done everything we are asked to do.  */
     return NULL;
 
+  if (max == NULL)
+    /* The caller does not want to extend the table.  */
+    return (cnt >= *act ? NULL : &(*table)[cnt]);
+
   if (cnt >= *act)
     {
       if (cnt >= *max)
@@ -3732,8 +3736,13 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charmap_t *charmap,
   ctype->class_offset = _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1);
   ctype->map_offset = ctype->class_offset + ctype->nr_charclass;
 
-  /* Array for width information.  Because the expected width are very
-     small we use only one single byte.  This saves space.  */
+  /* Array for width information.  Because the expected widths are very
+     small (never larger than 2) we use only one single byte.  This
+     saves space.
+     We put only printable characters in the table.  wcwidth is specified
+     to return -1 for non-printable characters.  Doing the check here
+     saves a run-time check.
+     But we put L'\0' in the table.  This again saves a run-time check.  */
   {
     struct wcwidth_table t;
 
@@ -3741,7 +3750,8 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charmap_t *charmap,
     t.q = 9;
     wcwidth_table_init (&t);
 
-    /* First set all the characters of the character set to the default width.  */
+    /* First set all the printable characters of the character set to
+       the default width.  */
     curs = NULL;
     while (iterate_table (&charmap->char_table, &curs, &key, &len, &vdata) == 0)
       {
@@ -3752,7 +3762,14 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charmap_t *charmap,
 					      data->name, len);
 
 	if (data->ucs4 != ILLEGAL_CHAR_VALUE)
-	  wcwidth_table_add (&t, data->ucs4, charmap->width_default);
+	  {
+	    uint32_t *class_bits =
+	      find_idx (ctype, &ctype->class_collection, NULL,
+			&ctype->class_collection_act, data->ucs4);
+
+	    if (class_bits != NULL && (*class_bits & BITw (tok_print)))
+	      wcwidth_table_add (&t, data->ucs4, charmap->width_default);
+	  }
       }
 
     /* Now add the explicitly specified widths.  */
@@ -3792,8 +3809,16 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charmap_t *charmap,
 					       strlen (seq->name));
 
 		if (wch != ILLEGAL_CHAR_VALUE)
-		  /* Store the value.  */
-		  wcwidth_table_add (&t, wch, charmap->width_rules[cnt].width);
+		  {
+		    /* Store the value.  */
+		    uint32_t *class_bits =
+		      find_idx (ctype, &ctype->class_collection, NULL,
+				&ctype->class_collection_act, wch);
+
+		    if (class_bits != NULL && (*class_bits & BITw (tok_print)))
+		      wcwidth_table_add (&t, wch,
+					 charmap->width_rules[cnt].width);
+		  }
 
 		/* "Increment" the bytes sequence.  */
 		inner = nbytes - 1;
@@ -3820,6 +3845,9 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charmap_t *charmap,
 	  }
       }
 
+    /* Set the width of L'\0' to 0.  */
+    wcwidth_table_add (&t, 0, 0);
+
     wcwidth_table_finalize (&t);
 
     if (verbose)