aboutsummaryrefslogtreecommitdiff
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
parent70440f48d8c4aa57f030485b60a7faf686f1dd4d (diff)
downloadglibc-4a9dcff10ec07770aaf0b4dedaac44eacbbaa110.zip
glibc-4a9dcff10ec07770aaf0b4dedaac44eacbbaa110.tar.gz
glibc-4a9dcff10ec07770aaf0b4dedaac44eacbbaa110.tar.bz2
Update.
* charmaps/ISO-IR-197: Remove alias "none". 2000-09-30 Bruno Haible <haible@clisp.cons.org>
-rw-r--r--locale/C-ctype.c19
-rw-r--r--locale/programs/charmap.c10
-rw-r--r--locale/programs/config.h4
-rw-r--r--locale/programs/ld-ctype.c40
-rw-r--r--localedata/ChangeLog4
-rw-r--r--localedata/charmaps/ISO-IR-1976
-rw-r--r--wcsmbs/wcwidth.h13
7 files changed, 62 insertions, 34 deletions
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index f9eee1c..6e036f6 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -504,18 +504,27 @@ const struct
{
uint32_t header[5];
uint32_t level1[1];
- uint32_t level2[1];
- uint8_t level3[1];
+ uint32_t level2[8];
+ int8_t level3[33];
}
_nl_C_LC_CTYPE_width =
{
- { 7, 1, 0, 0, 0 },
+ { 7, 1, 4, 7, 15 },
/* 1st-level table */
{ 6 * sizeof (uint32_t) },
/* 2nd-level table */
- { 7 * sizeof (uint32_t) },
+ {
+ 14 * sizeof (uint32_t) + 0, 0,
+ 14 * sizeof (uint32_t) + 16, 14 * sizeof (uint32_t) + 16,
+ 14 * sizeof (uint32_t) + 16, 14 * sizeof (uint32_t) + 16,
+ 14 * sizeof (uint32_t) + 16, 14 * sizeof (uint32_t) + 17
+ },
/* 3rd-level table */
- { 1 }
+ {
+ 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ -1
+ }
};
/* Number of fields with fixed meanings, starting at 0. */
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index f76bc24..b8e994f 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 a293da3..5123504 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 1d10cec..4f5653a 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)
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 7fb70dd..fcfac24 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,5 +1,9 @@
2000-09-30 Bruno Haible <haible@clisp.cons.org>
+ * charmaps/ISO-IR-197: Remove alias "none".
+
+2000-09-30 Bruno Haible <haible@clisp.cons.org>
+
* charmaps/UTF-8: Add the correct Hangul syllable names. Change the
width of format control characters to 0.
diff --git a/localedata/charmaps/ISO-IR-197 b/localedata/charmaps/ISO-IR-197
index 6b2866d..4334077 100644
--- a/localedata/charmaps/ISO-IR-197
+++ b/localedata/charmaps/ISO-IR-197
@@ -1,12 +1,10 @@
-<code_set_name>ISO-IR-197
+<code_set_name> ISO-IR-197
<comment_char> %
<escape_char> /
% source: http://www.itek.norut.no/project/barent/barsek/ip/197t.html
% author: Petter Reinholdtsen <pere@td.org.uit.no>
% date: 1998-08-31
-% comment: Proposed nothern sami charset. Superseeded by WS2
-
-% alias none
+% comment: Proposed nothern sami charset. Superseded by WS2
CHARMAP
<U0000> /x00 NULL (NUL)
diff --git a/wcsmbs/wcwidth.h b/wcsmbs/wcwidth.h
index d13a5f5..49ad7c0 100644
--- a/wcsmbs/wcwidth.h
+++ b/wcsmbs/wcwidth.h
@@ -22,9 +22,6 @@
#include <wctype.h>
#include "../wctype/wchar-lookup.h"
-/* Tables containing character property information. */
-extern const char *__ctype32_wctype[12];
-
/* Table containing width information. */
extern const char *__ctype32_width;
@@ -33,12 +30,10 @@ internal_wcwidth (wint_t wc)
{
unsigned char res;
- if (wc == L'\0')
- return 0;
-
- if (wctype_table_lookup (__ctype32_wctype[__ISwprint], wc) == 0)
- return -1;
-
+ /* The tables have been prepared in such a way that
+ 1. wc == L'\0' yields res = 0,
+ 2. !iswprint (wc) implies res = '\xff'. */
res = wcwidth_table_lookup (__ctype32_width, wc);
+
return res == (unsigned char) '\xff' ? -1 : (int) res;
}