aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-06 17:13:27 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-06 17:13:27 +0000
commit91933d2372559ae8986c703efd4561f489ce697b (patch)
tree26b9f037668bc893186c01179f7f7396ef9baec4 /locale
parentc9326ed5e2b13a01b380d5bace6ffbd652c633d7 (diff)
downloadglibc-91933d2372559ae8986c703efd4561f489ce697b.zip
glibc-91933d2372559ae8986c703efd4561f489ce697b.tar.gz
glibc-91933d2372559ae8986c703efd4561f489ce697b.tar.bz2
Update.
2000-08-06 Ulrich Drepper <drepper@redhat.com> * locale/programs/ld-collate.c (struct symbol_t): Add name element. (new_symbol): Take new parameters with name of the symbol. Adjust callers. (handle_ellipsis): Don't only allow character symbols. (collate_read): Allow string of collating elements contain invalid characters; ignore entry in this case. Handle ellipsis of collating symbols before first order_start. Allow ellipsis in state 0.
Diffstat (limited to 'locale')
-rw-r--r--locale/programs/ld-collate.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index df59c33..9443ddf 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -129,6 +129,8 @@ struct element_t
/* Data type for collating symbol. */
struct symbol_t
{
+ const char *name;
+
/* Point to place in the order list. */
struct element_t *order;
@@ -332,12 +334,13 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
static struct symbol_t *
-new_symbol (struct locale_collate_t *collate)
+new_symbol (struct locale_collate_t *collate, const char *name, size_t len)
{
struct symbol_t *newp;
newp = (struct symbol_t *) obstack_alloc (&collate->mempool, sizeof (*newp));
+ newp->name = obstack_copy0 (&collate->mempool, name, len);
newp->order = NULL;
newp->file = NULL;
@@ -910,7 +913,8 @@ insert_value (struct linereader *ldfile, const char *symstr, size_t symlen,
elem = sym->order;
if (elem == NULL)
- elem = sym->order = new_element (collate, NULL, 0, NULL, NULL, 0,
+ elem = sym->order = new_element (collate, NULL, 0, NULL,
+ sym->name, strlen (sym->name),
0);
}
else if (find_entry (&collate->elem_table, symstr, symlen,
@@ -1007,6 +1011,9 @@ handle_ellipsis (struct linereader *ldfile, const char *symstr, size_t symlen,
endp = collate->cursor->next;
assert (symstr == NULL || endp != NULL);
+ /* XXX The following is probably very wrong since also collating symbols
+ can appear in ranges. But do we want/can refine the test for that? */
+#if 0
/* Both, the start and the end symbol, must stand for characters. */
if ((startp != NULL && (startp->name == NULL || ! startp->is_character))
|| (endp != NULL && (endp->name == NULL|| ! endp->is_character)))
@@ -1016,6 +1023,7 @@ handle_ellipsis (struct linereader *ldfile, const char *symstr, size_t symlen,
"LC_COLLATE");
return;
}
+#endif
if (ellipsis == tok_ellipsis3)
{
@@ -2907,12 +2915,13 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
repertoire, symbol, symbol_len))
goto col_elem_free;
- insert_entry (&collate->elem_table, symbol, symbol_len,
- new_element (collate,
- arg->val.str.startmb,
- arg->val.str.lenmb - 1,
- arg->val.str.startwc,
- symbol, symbol_len, 0));
+ if (arg->val.str.startmb != NULL)
+ insert_entry (&collate->elem_table, symbol, symbol_len,
+ new_element (collate,
+ arg->val.str.startmb,
+ arg->val.str.lenmb - 1,
+ arg->val.str.startwc,
+ symbol, symbol_len, 0));
}
else
{
@@ -2992,7 +3001,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
goto col_sym_free;
insert_entry (&collate->sym_table, symbol, symbol_len,
- new_symbol (collate));
+ new_symbol (collate, symbol, symbol_len));
}
else if (symbol_len != endsymbol_len)
{
@@ -3052,7 +3061,9 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
goto col_sym_free;
insert_entry (&collate->sym_table, symbuf,
- symbol_len, new_symbol (collate));
+ symbol_len,
+ new_symbol (collate, symbuf,
+ symbol_len));
/* Increment the counter. */
++from;
@@ -3602,6 +3613,19 @@ error while adding equivalent collating symbol"));
collate->sections = collate->current_section =
&collate->symbol_section;
}
+
+ if (was_ellipsis != tok_none)
+ {
+
+ handle_ellipsis (ldfile, symstr, symlen, was_ellipsis,
+ charmap, repertoire, collate);
+
+ /* Remember that we processed the ellipsis. */
+ was_ellipsis = tok_none;
+
+ /* And don't add the value a second time. */
+ break;
+ }
}
else if (state == 3)
{
@@ -3772,7 +3796,7 @@ error while adding equivalent collating symbol"));
if (was_ellipsis != tok_none)
goto err_label;
- if (state != 1 && state != 3)
+ if (state != 0 && state != 1 && state != 3)
goto err_label;
was_ellipsis = nowtok;