about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--locale/programs/ld-ctype.c29
-rw-r--r--locale/programs/ld-monetary.c12
-rw-r--r--localedata/tests/test6.c138
-rw-r--r--localedata/tests/test6.cm93
-rw-r--r--localedata/tests/test6.def20
-rw-r--r--localedata/tests/test6.mne113
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap64.S4
8 files changed, 400 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index a7a4aaed45..695337eda0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 1999-12-08  Ulrich Drepper  <drepper@cygnus.com>
 
+	* locale/programs/ld-ctype.c (ctype_output): Correct sizes of mapping
+	arrays.
+	(allocate_arrays): Allocate memory for map32.  Correctly install
+	default values in it and install defined mappings.
+
+	* locale/programs/ld-monetary.c (monetary_finish): Provide default
+	value for mon_grouping.
+
 	* elf/readlib.c: Include a.out.h last since the Linux/Alpha
 	headers are not clean enough.
 
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 1b8775efeb..5dcb01360f 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -787,20 +787,18 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 
 	  CTYPE_DATA (_NL_CTYPE_TOUPPER,
 		      ctype->map[0],
-		      (ctype->plane_size * ctype->plane_cnt + 128)
-		      * sizeof (uint32_t));
+		      (256 + 128) * sizeof (uint32_t));
 	  CTYPE_DATA (_NL_CTYPE_TOLOWER,
 		      ctype->map[1],
-		      (ctype->plane_size * ctype->plane_cnt + 128)
-		      * sizeof (uint32_t));
+		      (256 + 128) * sizeof (uint32_t));
 
 	  CTYPE_DATA (_NL_CTYPE_TOUPPER32,
 		      ctype->map32[0],
-		      (ctype->plane_size * ctype->plane_cnt + 128)
+		      (ctype->plane_size * ctype->plane_cnt)
 		      * sizeof (uint32_t));
 	  CTYPE_DATA (_NL_CTYPE_TOLOWER32,
 		      ctype->map32[1],
-		      (ctype->plane_size * ctype->plane_cnt + 128)
+		      (ctype->plane_size * ctype->plane_cnt)
 		      * sizeof (uint32_t));
 
 	  CTYPE_DATA (_NL_CTYPE_CLASS32,
@@ -981,7 +979,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 
 	  iov[2 + elem + offset].iov_base = ctype->map32[nr];
 	  iov[2 + elem + offset].iov_len = ((ctype->plane_size
-					     * ctype->plane_cnt + 128)
+					     * ctype->plane_cnt)
 					    * sizeof (uint32_t));
 
 	  idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
@@ -3059,18 +3057,25 @@ Computing table size for character classes might take a while..."),
       unsigned int idx2;
 
       /* Allocate table.  */
-      ctype->map[idx] = (uint32_t *) xmalloc (ctype->plane_size
-					      * ctype->plane_cnt
-					      * sizeof (uint32_t));
+      ctype->map32[idx] = (uint32_t *) xmalloc (ctype->plane_size
+						* ctype->plane_cnt
+						* sizeof (uint32_t));
 
       /* Copy default value (identity mapping).  */
-      memcpy (ctype->map[idx], ctype->names,
+      memcpy (ctype->map32[idx], ctype->names,
 	      ctype->plane_size * ctype->plane_cnt * sizeof (uint32_t));
 
       /* Copy values from collection.  */
       for (idx2 = 0; idx2 < 256; ++idx2)
 	if (ctype->map_collection[idx][idx2] != 0)
-	  ctype->map[idx][idx2] = ctype->map_collection[idx][idx2];
+	  ctype->map32[idx][idx2] = ctype->map_collection[idx][idx2];
+
+      while (idx2 < ctype->map_collection_act[idx])
+	if (ctype->map_collection[idx][idx2] != 0)
+	  *find_idx (ctype, &ctype->map32[idx],
+		     &ctype->map_collection_max[idx],
+		     &ctype->map_collection_act[idx],
+		     ctype->names[idx2]) = ctype->map_collection[idx][idx2];
     }
 
   /* Extra array for class and map names.  */
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index 31846b11cf..afad481f0a 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -241,9 +241,15 @@ not correspond to a valid name in ISO 4217"),
 	     "LC_MONETARY", "mon_decimal_point");
     }
 
-  if (monetary->mon_grouping_len == 0 && ! be_quiet && ! nothing)
-    error (0, 0, _("%s: field `%s' not defined"),
-	   "LC_MONETARY", "mon_grouping");
+  if (monetary->mon_grouping_len == 0)
+    {
+      if (! be_quiet && ! nothing)
+	error (0, 0, _("%s: field `%s' not defined"),
+	       "LC_MONETARY", "mon_grouping");
+
+      monetary->mon_grouping = "\177";
+      monetary->mon_grouping_len = 1;
+    }
 
 #undef TEST_ELEM
 #define TEST_ELEM(cat, min, max) \
diff --git a/localedata/tests/test6.c b/localedata/tests/test6.c
new file mode 100644
index 0000000000..735b1adde8
--- /dev/null
+++ b/localedata/tests/test6.c
@@ -0,0 +1,138 @@
+/* Test program for character classes and mappings.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <ctype.h>
+#include <locale.h>
+#include <wchar.h>
+
+
+int
+main (void)
+{
+  const char lower[] = "abcdefghijklmnopqrstuvwxyz";
+  const char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+#define LEN (sizeof (upper) - 1)
+  const wchar_t wlower[] = L"abcdefghijklmnopqrstuvwxyz";
+  const wchar_t wupper[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+  int i;
+  int result = 0;
+
+  setlocale (LC_ALL, "test6");
+
+  for (i = 0; i < LEN; ++i)
+    {
+      /* Test basic table handling (basic == not more than 256 characters).
+	 The charmaps swaps the normal lower-upper case meaning of the
+	 ASCII characters used in the source code while the Unicode mapping
+	 in the repertoire map has the normal correspondants.  This test
+	 shows the independence of the tables for `char' and `wchar_t'
+	 characters.  */
+
+      if (islower (lower[i]))
+	{
+	  printf ("islower ('%c') false\n", lower[i]);
+	  result = 1;
+	}
+      if (! isupper (lower[i]))
+	{
+	  printf ("isupper ('%c') false\n", lower[i]);
+	  result = 1;
+	}
+
+      if (! islower (upper[i]))
+	{
+	  printf ("islower ('%c') false\n", upper[i]);
+	  result = 1;
+	}
+      if (isupper (upper[i]))
+	{
+	  printf ("isupper ('%c') false\n", upper[i]);
+	  result = 1;
+	}
+
+      if (toupper (lower[i]) != lower[i])
+	{
+	  printf ("toupper ('%c') false\n", lower[i]);
+	  result = 1;
+	}
+      if (tolower (lower[i]) != upper[i])
+	{
+	  printf ("tolower ('%c') false\n", lower[i]);
+	  result = 1;
+	}
+
+      if (tolower (upper[i]) != upper[i])
+	{
+	  printf ("tolower ('%c') false\n", upper[i]);
+	  result = 1;
+	}
+      if (toupper (upper[i]) != lower[i])
+	{
+	  printf ("toupper ('%c') false\n", upper[i]);
+	  result = 1;
+	}
+
+      if (iswlower (wupper[i]))
+	{
+	  printf ("iswlower (L'%c') false\n", upper[i]);
+	  result = 1;
+	}
+      if (! iswupper (wupper[i]))
+	{
+	  printf ("iswupper (L'%c') false\n", upper[i]);
+	  result = 1;
+	}
+
+      if (iswupper (wlower[i]))
+	{
+	  printf ("iswupper (L'%c') false\n", lower[i]);
+	  result = 1;
+	}
+      if (! iswlower (wlower[i]))
+	{
+	  printf ("iswlower (L'%c') false\n", lower[i]);
+	  result = 1;
+	}
+
+      if (towupper (wlower[i]) != wupper[i])
+	{
+	  printf ("towupper ('%c') false\n", lower[i]);
+	  result = 1;
+	}
+      if (towlower (wlower[i]) != wlower[i])
+	{
+	  printf ("towlower ('%c') false\n", lower[i]);
+	  result = 1;
+	}
+
+      if (towlower (wupper[i]) != wlower[i])
+	{
+	  printf ("towlower ('%c') false\n", upper[i]);
+	  result = 1;
+	}
+      if (towupper (wupper[i]) != wupper[i])
+	{
+	  printf ("towupper ('%c') false\n", upper[i]);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
diff --git a/localedata/tests/test6.cm b/localedata/tests/test6.cm
new file mode 100644
index 0000000000..3711495d86
--- /dev/null
+++ b/localedata/tests/test6.cm
@@ -0,0 +1,93 @@
+<code_set_name> test6
+
+CHARMAP
+<tab>                  \x09
+<newline>              \x0A
+<vertical-tab>         \x0B
+<form-feed>            \x0C
+<carriage-return>      \x0D
+<SP>                   \x20
+<space>                \x20
+<!>                    \x21
+<">                    \x22
+<%>                    \x25
+<&>                    \x26
+<'>                    \x27
+<(>                    \x28
+<)>                    \x29
+<*>                    \x2A
+<+>                    \x2B
+<,>                    \x2C
+<->                    \x2D
+<.>                    \x2E
+<\\>                   \x2F
+<0>                    \x30
+<1>                    \x31
+<2>                    \x32
+<3>                    \x33
+<4>                    \x34
+<5>                    \x35
+<6>                    \x36
+<7>                    \x37
+<8>                    \x38
+<9>                    \x39
+<:>                    \x3A
+<;>                    \x3B
+<<>                    \x3C
+<=>                    \x3D
+<\>>                   \x3E
+<?>                    \x3F
+<a>                    \x41
+<b>                    \x42
+<c>                    \x43
+<d>                    \x44
+<e>                    \x45
+<f>                    \x46
+<g>                    \x47
+<h>                    \x48
+<i>                    \x49
+<j>                    \x4A
+<k>                    \x4B
+<l>                    \x4C
+<m>                    \x4D
+<n>                    \x4E
+<o>                    \x4F
+<p>                    \x50
+<q>                    \x51
+<r>                    \x52
+<s>                    \x53
+<t>                    \x54
+<u>                    \x55
+<v>                    \x56
+<w>                    \x57
+<x>                    \x58
+<y>                    \x59
+<z>                    \x5A
+<_>                    \x5F
+<A>                    \x61
+<B>                    \x62
+<C>                    \x63
+<D>                    \x64
+<E>                    \x65
+<F>                    \x66
+<G>                    \x67
+<H>                    \x68
+<I>                    \x69
+<J>                    \x6A
+<K>                    \x6B
+<L>                    \x6C
+<M>                    \x6D
+<N>                    \x6E
+<O>                    \x6F
+<P>                    \x70
+<Q>                    \x71
+<R>                    \x72
+<S>                    \x73
+<T>                    \x74
+<U>                    \x75
+<V>                    \x76
+<W>                    \x77
+<X>                    \x78
+<Y>                    \x79
+<Z>                    \x7A
+END CHARMAP
diff --git a/localedata/tests/test6.def b/localedata/tests/test6.def
new file mode 100644
index 0000000000..f8f88b3296
--- /dev/null
+++ b/localedata/tests/test6.def
@@ -0,0 +1,20 @@
+LC_CTYPE
+
+lower <a>;<b>;<c>;<d>;<e>;<f>;<g>;<h>;<i>;<j>;<k>;<l>;<m>;<n>;<o>;<p>;<q>; \
+      <r>;<s>;<t>;<u>;<v>;<w>;<x>;<y>;<z>
+upper <A>;<B>;<C>;<D>;<E>;<F>;<G>;<H>;<I>;<J>;<K>;<L>;<M>;<N>;<O>;<P>;<Q>; \
+      <R>;<S>;<T>;<U>;<V>;<W>;<X>;<Y>;<Z>
+
+tolower (<A>,<a>);(<B>,<b>);(<C>,<c>);(<D>,<d>);(<E>,<e>);(<F>,<f>); \
+        (<G>,<g>);(<H>,<h>);(<I>,<i>);(<J>,<j>);(<K>,<k>);(<L>,<l>); \
+        (<M>,<m>);(<N>,<n>);(<O>,<o>);(<P>,<p>);(<Q>,<q>);(<R>,<r>); \
+        (<S>,<s>);(<T>,<t>);(<U>,<u>);(<V>,<v>);(<W>,<w>);(<X>,<x>); \
+        (<Y>,<y>);(<Z>,<z>)
+
+toupper (<a>,<A>);(<b>,<B>);(<c>,<C>);(<d>,<D>);(<e>,<E>);(<f>,<F>); \
+        (<g>,<G>);(<h>,<H>);(<i>,<I>);(<j>,<J>);(<k>,<K>);(<l>,<L>); \
+        (<m>,<M>);(<n>,<N>);(<o>,<O>);(<p>,<P>);(<q>,<Q>);(<r>,<R>); \
+        (<s>,<S>);(<t>,<T>);(<u>,<U>);(<v>,<V>);(<w>,<W>);(<x>,<X>); \
+        (<y>,<Y>);(<z>,<Z>)
+
+END LC_CTYPE
diff --git a/localedata/tests/test6.mne b/localedata/tests/test6.mne
new file mode 100644
index 0000000000..bb1218569d
--- /dev/null
+++ b/localedata/tests/test6.mne
@@ -0,0 +1,113 @@
+<tab>                  <U0009> HORIZONTAL TABULATION
+<newline>              <U000A> LINE FEED
+<vertical-tab>         <U000B> VERTICAL TABULATION
+<form-feed>            <U000C> FORM FEED
+<carriage-return>      <U000D> CARRIAGE RETURN
+<SP>                   <U0020> SPACE
+<space>                <U0020> SPACE
+<!>                    <U0021> EXCLAMATION MARK
+<">                    <U0022> QUOTATION MARK
+<Nb>                   <U0023> NUMBER SIGN
+<DO>                   <U0024> DOLLAR SIGN
+<!S>                   <U0024> DOLLAR SIGN
+<%>                    <U0025> PERCENT SIGN
+<&>                    <U0026> AMPERSAND
+<'>                    <U0027> APOSTROPHE
+<(>                    <U0028> LEFT PARENTHESIS
+<)>                    <U0029> RIGHT PARENTHESIS
+<*>                    <U002A> ASTERISK
+<+>                    <U002B> PLUS SIGN
+<,>                    <U002C> COMMA
+<->                    <U002D> HYPHEN-MINUS
+<.>                    <U002E> FULL STOP
+</>                    <U002F> SOLIDUS
+<0>                    <U0030> DIGIT ZERO
+<1>                    <U0031> DIGIT ONE
+<2>                    <U0032> DIGIT TWO
+<3>                    <U0033> DIGIT THREE
+<4>                    <U0034> DIGIT FOUR
+<5>                    <U0035> DIGIT FIVE
+<6>                    <U0036> DIGIT SIX
+<7>                    <U0037> DIGIT SEVEN
+<8>                    <U0038> DIGIT EIGHT
+<9>                    <U0039> DIGIT NINE
+<:>                    <U003A> COLON
+<;>                    <U003B> SEMICOLON
+<<>                    <U003C> LESS-THAN SIGN
+<=>                    <U003D> EQUALS SIGN
+<\>>                   <U003E> GREATER-THAN SIGN
+<?>                    <U003F> QUESTION MARK
+<@>                    <U0040> COMMERCIAL AT
+<A>                    <U0041> LATIN CAPITAL LETTER A
+<B>                    <U0042> LATIN CAPITAL LETTER B
+<C>                    <U0043> LATIN CAPITAL LETTER C
+<D>                    <U0044> LATIN CAPITAL LETTER D
+<E>                    <U0045> LATIN CAPITAL LETTER E
+<F>                    <U0046> LATIN CAPITAL LETTER F
+<G>                    <U0047> LATIN CAPITAL LETTER G
+<H>                    <U0048> LATIN CAPITAL LETTER H
+<I>                    <U0049> LATIN CAPITAL LETTER I
+<J>                    <U004A> LATIN CAPITAL LETTER J
+<K>                    <U004B> LATIN CAPITAL LETTER K
+<L>                    <U004C> LATIN CAPITAL LETTER L
+<M>                    <U004D> LATIN CAPITAL LETTER M
+<N>                    <U004E> LATIN CAPITAL LETTER N
+<O>                    <U004F> LATIN CAPITAL LETTER O
+<P>                    <U0050> LATIN CAPITAL LETTER P
+<Q>                    <U0051> LATIN CAPITAL LETTER Q
+<R>                    <U0052> LATIN CAPITAL LETTER R
+<S>                    <U0053> LATIN CAPITAL LETTER S
+<T>                    <U0054> LATIN CAPITAL LETTER T
+<U>                    <U0055> LATIN CAPITAL LETTER U
+<V>                    <U0056> LATIN CAPITAL LETTER V
+<W>                    <U0057> LATIN CAPITAL LETTER W
+<X>                    <U0058> LATIN CAPITAL LETTER X
+<Y>                    <U0059> LATIN CAPITAL LETTER Y
+<Z>                    <U005A> LATIN CAPITAL LETTER Z
+<<(>                   <U005B> LEFT SQUARE BRACKET
+<left-square-bracket>  <U005B> LEFT SQUARE BRACKET
+<//>                 <U005C> REVERSE SOLIDUS
+<backslash>            <U005C> REVERSE SOLIDUS
+<reverse-solidus>      <U005C> REVERSE SOLIDUS
+<)\>>                  <U005D> RIGHT SQUARE BRACKET
+<right-square-bracket> <U005D> RIGHT SQUARE BRACKET
+<'\>>                  <U005E> CIRCUMFLEX ACCENT
+<circumflex>           <U005E> CIRCUMFLEX ACCENT
+<circumflex-accent>    <U005E> CIRCUMFLEX ACCENT
+<_>                    <U005F> LOW LINE
+<low-line>             <U005F> LOW LINE
+<underscore>           <U005F> LOW LINE
+<'!>                   <U0060> GRAVE ACCENT
+<grave-accent>         <U0060> GRAVE ACCENT
+<a>                    <U0061> LATIN SMALL LETTER A
+<b>                    <U0062> LATIN SMALL LETTER B
+<c>                    <U0063> LATIN SMALL LETTER C
+<d>                    <U0064> LATIN SMALL LETTER D
+<e>                    <U0065> LATIN SMALL LETTER E
+<f>                    <U0066> LATIN SMALL LETTER F
+<g>                    <U0067> LATIN SMALL LETTER G
+<h>                    <U0068> LATIN SMALL LETTER H
+<i>                    <U0069> LATIN SMALL LETTER I
+<j>                    <U006A> LATIN SMALL LETTER J
+<k>                    <U006B> LATIN SMALL LETTER K
+<l>                    <U006C> LATIN SMALL LETTER L
+<m>                    <U006D> LATIN SMALL LETTER M
+<n>                    <U006E> LATIN SMALL LETTER N
+<o>                    <U006F> LATIN SMALL LETTER O
+<p>                    <U0070> LATIN SMALL LETTER P
+<q>                    <U0071> LATIN SMALL LETTER Q
+<r>                    <U0072> LATIN SMALL LETTER R
+<s>                    <U0073> LATIN SMALL LETTER S
+<t>                    <U0074> LATIN SMALL LETTER T
+<u>                    <U0075> LATIN SMALL LETTER U
+<v>                    <U0076> LATIN SMALL LETTER V
+<w>                    <U0077> LATIN SMALL LETTER W
+<x>                    <U0078> LATIN SMALL LETTER X
+<y>                    <U0079> LATIN SMALL LETTER Y
+<z>                    <U007A> LATIN SMALL LETTER Z
+<(!>                   <U007B> LEFT CURLY BRACKET
+<!!>                   <U007C> VERTICAL LINE
+<vertical-line>        <U007C> VERTICAL LINE
+<!)>                   <U007D> RIGHT CURLY BRACKET
+<'?>                   <U007E> TILDE
+<DT>                   <U007F> DELETE
diff --git a/sysdeps/unix/sysv/linux/i386/mmap64.S b/sysdeps/unix/sysv/linux/i386/mmap64.S
index 916149a78a..4a30185f25 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap64.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap64.S
@@ -22,7 +22,7 @@
 
 #define EINVAL	22
 #define ENOSYS	38
-	
+
 	.text
 
 ENTRY (__mmap64)
@@ -51,7 +51,7 @@ ENTRY (__mmap64)
 	movl 36(%esp), %edi
 
 	/* Do the system call trap.  */
-L(do_syscal):
+L(do_syscall):
 	int $0x80
 
 	/* If 0 > %eax > -4096 there was an error.  */