summary refs log tree commit diff
path: root/locale/programs
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/ld-collate.c6
-rw-r--r--locale/programs/ld-measurement.c1
-rw-r--r--locale/programs/linereader.c113
-rw-r--r--locale/programs/repertoire.c24
-rw-r--r--locale/programs/repertoire.h5
5 files changed, 91 insertions, 58 deletions
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 2cbea388b2..a9f42fe3fc 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -1514,7 +1514,7 @@ collate_finish (struct localedef_t *locale, struct charmap_t *charmap)
 			 to symbols with the same byte sequence.  It is
 			 of course an error.  */
 		      error_at_line (0, 0, (*eptr)->file, (*eptr)->line,
-				     _("symbol `%s' has same encoding as"),
+				     _("symbol `%s' has the same encoding as"),
 				     (*eptr)->name);
 		      error_at_line (0, 0, runp->file, runp->line,
 				     _("symbol `%s'"), runp->name);
@@ -1691,7 +1691,7 @@ Computing table size for collation table might take a while..."),
 			 to symbols with the same byte sequence.  It is
 			 of course an error.  */
 		      error_at_line (0, 0, (*eptr)->file, (*eptr)->line,
-				     _("symbol `%s' has same encoding as"),
+				     _("symbol `%s' has the same encoding as"),
 				     (*eptr)->name);
 		      error_at_line (0, 0, runp->file, runp->line,
 				     _("symbol `%s'"), runp->name);
diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c
index 68bb3a2d3b..e0ee592a3f 100644
--- a/locale/programs/ld-measurement.c
+++ b/locale/programs/ld-measurement.c
@@ -154,7 +154,6 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
 		  struct charmap_t *charmap, const char *repertoire_name,
 		  int ignore_content)
 {
-  struct repertoire_t *repertoire = NULL;
   struct locale_measurement_t *measurement;
   struct token *now;
   struct token *arg;
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 370f091fb8..f6532a4792 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -651,6 +651,7 @@ non-symbolic character value should not be used"));
 
 	      if (cp == &buf[bufact])
 		{
+		  char utmp[10];
 		  const char *symbol = NULL;
 
 		  /* Yes, it is.  */
@@ -663,49 +664,80 @@ non-symbolic character value should not be used"));
 		  if (return_widestr)
 		    ADDWC (wch);
 
-		  /* Now determine from the repertoire the name of the
-		     character and find it in the charmap.  */
-		  if (repertoire != NULL)
-		    symbol = repertoire_find_symbol (repertoire, wch);
+		  /* See whether the charmap contains the Uxxxxxxxx names.  */
+		  snprintf (utmp, sizeof (utmp), "U%08X", wch);
+		  seq = charmap_find_value (charmap, utmp, 9);
 
-		  if (symbol == NULL)
+		  if (seq == NULL)
 		    {
-		      /* We cannot generate a string since we cannot map
-			 from the Unicode number to the character symbol.  */
-		      lr_error (lr,
-			        _("character <U%0*X> not in repertoire map"),
-				wch > 0xffff ? 8 : 4, wch);
+		     /* No, this isn't the case.  Now determine from
+			the repertoire the name of the character and
+			find it in the charmap.  */
+		      if (repertoire != NULL)
+			symbol = repertoire_find_symbol (repertoire, wch);
 
-		      illegal_string = 1;
-		    }
-		  else
-		    {
-		      seq = charmap_find_value (charmap, symbol,
-						strlen (symbol));
-
-		      if (seq == NULL)
+		      if (symbol == NULL)
 			{
-			  /* Not a known name.  */
-			  lr_error (lr,
-				    _("symbol `%s' not in charmap"), symbol);
+			  /* We cannot generate a string since we
+			     cannot map from the Unicode number to the
+			     character symbol.  */
+			  lr_error (lr, _("\
+character <U%0*X> not in repertoire map"),
+				    wch > 0xffff ? 8 : 4, wch);
+
 			  illegal_string = 1;
 			}
 		      else
-		        ADDS (seq->bytes, seq->nbytes);
+			{
+			  seq = charmap_find_value (charmap, symbol,
+						    strlen (symbol));
+
+			  if (seq == NULL)
+			    {
+			      /* Not a known name.  */
+			      lr_error (lr,
+					_("symbol `%s' not in charmap"),
+					symbol);
+			      illegal_string = 1;
+			    }
+			}
 		    }
 
+		  if (seq != NULL)
+		    ADDS (seq->bytes, seq->nbytes);
+
 		  continue;
 		}
 	    }
 
+	  /* We now have the symbolic name in buf[startidx] to
+	     buf[bufact-1].  Now find out the value for this character
+	     in the charmap as well as in the repertoire map (in this
+	     order).  */
+	  seq = charmap_find_value (charmap, &buf[startidx],
+				    bufact - startidx);
+
+	  if (seq == NULL)
+	    {
+	      /* This name is not in the charmap.  */
+	      lr_error (lr, _("symbol `%.*s' not in charmap"),
+			(int) (bufact - startidx), &buf[startidx]);
+	      illegal_string = 1;
+	    }
+
 	  if (return_widestr)
 	    {
-	      /* We now have the symbolic name in buf[startidx] to
-		 buf[bufact-1].  Now find out the value for this
-		 character in the repertoire map as well as in the
-		 charmap (in this order).  */
-	      wch = repertoire_find_value (repertoire, &buf[startidx],
-					   bufact - startidx);
+	      /* Now the same for the multibyte representation.  */
+	      if (seq != NULL && seq->ucs4 != UNINITIALIZED_CHAR_VALUE)
+		wch = seq->ucs4;
+	      else
+		{
+		  wch = repertoire_find_value (repertoire, &buf[startidx],
+					       bufact - startidx);
+		  if (seq != NULL)
+		    seq->ucs4 = wch;
+		}
+
 	      if (wch == ILLEGAL_CHAR_VALUE)
 		{
 		  /* This name is not in the repertoire map.  */
@@ -717,27 +749,12 @@ non-symbolic character value should not be used"));
 		ADDWC (wch);
 	    }
 
-	  /* Now the same for the multibyte representation.  */
-	  seq = charmap_find_value (charmap, &buf[startidx],
-				    bufact - startidx);
+	  /* Now forget about the name we just added.  */
+	  bufact = startidx;
 
-	  if (seq == NULL)
-	    {
-	      /* This name is not in the charmap.  */
-	      lr_error (lr, _("symbol `%.*s' not in charmap"),
-			(int) (bufact - startidx), &buf[startidx]);
-	      illegal_string = 1;
-
-	      /* Now forget about the name we just added.  */
-	      bufact = startidx;
-	    }
-	  else
-	    {
-	      /* Now forget about the name we just added.  */
-	      bufact = startidx;
-
-	      ADDS (seq->bytes, seq->nbytes);
-	    }
+	  /* And copy the bytes.  */
+	  if (seq != NULL)
+	    ADDS (seq->bytes, seq->nbytes);
 	}
 
       if (ch == '\n' || ch == EOF)
diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c
index 9293c03b7e..91ed41e48a 100644
--- a/locale/programs/repertoire.c
+++ b/locale/programs/repertoire.c
@@ -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.
 
@@ -49,6 +49,10 @@ static int repertoire_compare (const void *p1, const void *p2);
 /* Already known repertoire maps.  */
 static void *known;
 
+/* List of repertoire maps which are not available and which have been
+   reported to not be.  */
+static void *unavailable;
+
 
 struct repertoire_t *
 repertoire_read (const char *filename)
@@ -115,10 +119,7 @@ repertoire_read (const char *filename)
 	}
 
       if (repfile == NULL)
-	{
-	  error (0, errno, _("repertoire map file `%s' not found"), filename);
-	  return NULL;
-	}
+	return NULL;
     }
 
   /* We don't want symbolic names in string to be translated.  */
@@ -333,6 +334,19 @@ argument to <%s> must be a single character"),
 }
 
 
+void
+repertoire_complain (const char *name)
+{
+  if (tfind (name, &unavailable, (__compar_fn_t) strcmp) == NULL)
+    {
+      error (0, errno, _("repertoire map file `%s' not found"), name);
+
+      /* Remember that we reported this map.  */
+      tsearch (name, &unavailable, (__compar_fn_t) strcmp);
+    }
+}
+
+
 static int
 repertoire_compare (const void *p1, const void *p2)
 {
diff --git a/locale/programs/repertoire.h b/locale/programs/repertoire.h
index ef80369ae4..d89d4cbf77 100644
--- a/locale/programs/repertoire.h
+++ b/locale/programs/repertoire.h
@@ -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.
 
@@ -48,6 +48,9 @@ struct repertoire_t
 /* Prototypes for repertoire map handling functions.  */
 extern struct repertoire_t *repertoire_read (const char *filename);
 
+/* Report missing repertoire map.  */
+extern void repertoire_complain (const char *name);
+
 /* Return UCS4 value of character with given NAME.  */
 extern uint32_t repertoire_find_value (const struct repertoire_t *repertoire,
 				       const char *name, size_t len);