reversed back to GLibC 2.2.5, added a Jamfile
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11642 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1998.
|
||||
|
||||
@@ -24,27 +24,27 @@
|
||||
/* This table's entries are taken from ISO 14652, the table in section
|
||||
4.10 "LC_ADDRESS". */
|
||||
|
||||
const struct locale_data _nl_C_LC_ADDRESS attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_ADDRESS =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
13,
|
||||
{
|
||||
{ .string = "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1995.
|
||||
|
||||
@@ -98,52 +98,52 @@ static const uint32_t collseqwc[] =
|
||||
L'\xf8', L'\xf9', L'\xfa', L'\xfb', L'\xfc', L'\xfd', L'\xfe', L'\xff'
|
||||
};
|
||||
|
||||
const struct locale_data _nl_C_LC_COLLATE attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_COLLATE =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
19,
|
||||
{
|
||||
/* _NL_COLLATE_NRULES */
|
||||
{ .word = 0 },
|
||||
{ word: 0 },
|
||||
/* _NL_COLLATE_RULESETS */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_TABLEMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_WEIGHTMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_EXTRAMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_INDIRECTMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_GAP1 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_GAP2 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_GAP3 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_TABLEWC */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_WEIGHTWC */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_EXTRAWC */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_INDIRECTWC */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_SYMB_HASH_SIZEMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_SYMB_TABLEMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_SYMB_EXTRAMB */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_COLLATE_COLLSEQMB */
|
||||
{ .string = collseqmb },
|
||||
{ string: collseqmb },
|
||||
/* _NL_COLLATE_COLLSEQWC */
|
||||
{ .string = (const char *) collseqwc },
|
||||
{ string: (const char *) collseqwc },
|
||||
/* _NL_COLLATE_CODESET */
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 1995.
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
In the `_nl_C_LC_CTYPE_class' array the value for EOF (== -1)
|
||||
is set to always return 0 and the conversion arrays return EOF. */
|
||||
|
||||
const char _nl_C_LC_CTYPE_class[768] attribute_hidden =
|
||||
const char _nl_C_LC_CTYPE_class[768] =
|
||||
/* 0x80 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
|
||||
/* 0x86 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
|
||||
/* 0x8c */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
|
||||
@@ -96,7 +96,7 @@ const char _nl_C_LC_CTYPE_class[768] attribute_hidden =
|
||||
/* 0xf4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
|
||||
/* 0xfa */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
|
||||
;
|
||||
const char _nl_C_LC_CTYPE_class32[1024] attribute_hidden =
|
||||
const char _nl_C_LC_CTYPE_class32[1024] =
|
||||
/* 0x00 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
|
||||
/* 0x03 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
|
||||
/* 0x06 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
|
||||
@@ -184,7 +184,7 @@ const char _nl_C_LC_CTYPE_class32[1024] attribute_hidden =
|
||||
/* 0xfc */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
|
||||
/* 0xff */ "\000\000\000\000"
|
||||
;
|
||||
const uint32_t _nl_C_LC_CTYPE_toupper[384] attribute_hidden =
|
||||
const uint32_t _nl_C_LC_CTYPE_toupper[384] =
|
||||
{
|
||||
/* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
/* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
@@ -235,7 +235,7 @@ const uint32_t _nl_C_LC_CTYPE_toupper[384] attribute_hidden =
|
||||
/* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
/* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||
};
|
||||
const uint32_t _nl_C_LC_CTYPE_tolower[384] attribute_hidden =
|
||||
const uint32_t _nl_C_LC_CTYPE_tolower[384] =
|
||||
{
|
||||
/* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
/* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
@@ -297,7 +297,7 @@ const uint32_t _nl_C_LC_CTYPE_tolower[384] attribute_hidden =
|
||||
uint32_t level3[1 << p]; \
|
||||
}
|
||||
|
||||
const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_upper attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_upper =
|
||||
{
|
||||
{ 0x00000000, 0x00000000, 0x07fffffe, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -310,7 +310,7 @@ const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_upper attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x07fffffe, 0x00000000 }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_lower attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_lower =
|
||||
{
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x07fffffe,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -323,7 +323,7 @@ const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_lower attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000000, 0x07fffffe }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_alpha attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_alpha =
|
||||
{
|
||||
{ 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -336,7 +336,7 @@ const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_alpha attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x07fffffe, 0x07fffffe }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_digit attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_digit =
|
||||
{
|
||||
{ 0x00000000, 0x03ff0000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -349,7 +349,7 @@ const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_digit attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000000, 0x03ff0000 }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_xdigit attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_xdigit =
|
||||
{
|
||||
{ 0x00000000, 0x03ff0000, 0x0000007e, 0x0000007e,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -362,7 +362,7 @@ const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_xdigit attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000000, 0x03ff0000, 0x0000007e, 0x0000007e }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_space attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_space =
|
||||
{
|
||||
{ 0x00003e00, 0x00000001, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -375,7 +375,7 @@ const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_space attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00003e00, 0x00000001 }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_print attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_print =
|
||||
{
|
||||
{ 0x00000000, 0xffffffff, 0xffffffff, 0x7fffffff,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -388,7 +388,7 @@ const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_print attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000000, 0xffffffff, 0xffffffff, 0x7fffffff }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_graph attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_graph =
|
||||
{
|
||||
{ 0x00000000, 0xfffffffe, 0xffffffff, 0x7fffffff,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -401,7 +401,7 @@ const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_graph attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000000, 0xfffffffe, 0xffffffff, 0x7fffffff }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_blank attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_blank =
|
||||
{
|
||||
{ 0x00000200, 0x00000001, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -414,7 +414,7 @@ const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_blank attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000200, 0x00000001 }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_cntrl attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_cntrl =
|
||||
{
|
||||
{ 0xffffffff, 0x00000000, 0x00000000, 0x80000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -427,7 +427,7 @@ const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_cntrl attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0xffffffff, 0x00000000, 0x00000000, 0x80000000 }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_punct attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_punct =
|
||||
{
|
||||
{ 0x00000000, 0xfc00fffe, 0xf8000001, 0x78000001,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -440,7 +440,7 @@ const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_punct attribute_hidden =
|
||||
/* 3rd-level table */
|
||||
{ 0x00000000, 0xfc00fffe, 0xf8000001, 0x78000001 }
|
||||
};
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_alnum attribute_hidden =
|
||||
const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_alnum =
|
||||
{
|
||||
{ 0x00000000, 0x03ff0000, 0x07fffffe, 0x07fffffe,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
@@ -461,7 +461,7 @@ const struct
|
||||
uint32_t level2[4];
|
||||
int32_t level3[32];
|
||||
}
|
||||
_nl_C_LC_CTYPE_map_toupper attribute_hidden =
|
||||
_nl_C_LC_CTYPE_map_toupper =
|
||||
{
|
||||
{ 7, 1, 5, 3, 31 },
|
||||
/* 1st-level table */
|
||||
@@ -480,7 +480,7 @@ _nl_C_LC_CTYPE_map_toupper attribute_hidden =
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
}
|
||||
},
|
||||
_nl_C_LC_CTYPE_map_tolower attribute_hidden =
|
||||
_nl_C_LC_CTYPE_map_tolower =
|
||||
{
|
||||
{ 7, 1, 5, 3, 31 },
|
||||
/* 1st-level table */
|
||||
@@ -507,7 +507,7 @@ const struct
|
||||
uint32_t level2[8];
|
||||
int8_t level3[33];
|
||||
}
|
||||
_nl_C_LC_CTYPE_width attribute_hidden =
|
||||
_nl_C_LC_CTYPE_width =
|
||||
{
|
||||
{ 7, 1, 4, 7, 15 },
|
||||
/* 1st-level table */
|
||||
@@ -538,37 +538,37 @@ _nl_C_LC_CTYPE_width attribute_hidden =
|
||||
NR_FIXED == _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1). */
|
||||
typedef int assertion1[1 - 2 * (NR_FIXED != _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1))];
|
||||
|
||||
const struct locale_data _nl_C_LC_CTYPE attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_CTYPE =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
1, /* Enable transliteration by default. */
|
||||
NULL,
|
||||
NR_FIXED + NR_CLASSES + NR_MAPS,
|
||||
{
|
||||
/* _NL_CTYPE_CLASS */
|
||||
{ .string = _nl_C_LC_CTYPE_class },
|
||||
{ string: _nl_C_LC_CTYPE_class },
|
||||
/* _NL_CTYPE_TOUPPER */
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_toupper },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_toupper },
|
||||
/* _NL_CTYPE_GAP1 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_CTYPE_TOLOWER */
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_tolower },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_tolower },
|
||||
/* _NL_CTYPE_GAP2 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_CTYPE_CLASS32 */
|
||||
{ .string = _nl_C_LC_CTYPE_class32 },
|
||||
{ string: _nl_C_LC_CTYPE_class32 },
|
||||
/* _NL_CTYPE_GAP3 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_CTYPE_GAP4 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_CTYPE_GAP5 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_CTYPE_GAP6 */
|
||||
{ .string = NULL },
|
||||
{ string: NULL },
|
||||
/* _NL_CTYPE_CLASS_NAMES */
|
||||
{ .string = "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
|
||||
{ string: "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
|
||||
"print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0"
|
||||
#ifdef PREDEFINED_CLASSES
|
||||
"left_to_right\0" "right_to_left\0" "num_terminator\0"
|
||||
@@ -580,106 +580,106 @@ const struct locale_data _nl_C_LC_CTYPE attribute_hidden =
|
||||
#endif
|
||||
},
|
||||
/* _NL_CTYPE_MAP_NAMES */
|
||||
{ .string = "toupper\0" "tolower\0"
|
||||
{ string: "toupper\0" "tolower\0"
|
||||
#ifdef PREDEFINED_CLASSES
|
||||
"tosymmetric\0"
|
||||
#endif
|
||||
},
|
||||
/* _NL_CTYPE_WIDTH */
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_width.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_width.header },
|
||||
/* _NL_CTYPE_MB_CUR_MAX */
|
||||
{ .word = 1 },
|
||||
{ word: 1 },
|
||||
/* _NL_CTYPE_CODESET_NAME */
|
||||
{ .string = _nl_C_codeset },
|
||||
{ string: _nl_C_codeset },
|
||||
/* _NL_CTYPE_TOUPPER32 */
|
||||
{ .string = (const char *) &_nl_C_LC_CTYPE_toupper[128] },
|
||||
{ string: (const char *) &_nl_C_LC_CTYPE_toupper[128] },
|
||||
/* _NL_CTYPE_TOLOWER32 */
|
||||
{ .string = (const char *) &_nl_C_LC_CTYPE_tolower[128] },
|
||||
{ string: (const char *) &_nl_C_LC_CTYPE_tolower[128] },
|
||||
/* _NL_CTYPE_CLASS_OFFSET */
|
||||
{ .word = NR_FIXED },
|
||||
{ word: NR_FIXED },
|
||||
/* _NL_CTYPE_MAP_OFFSET */
|
||||
{ .word = NR_FIXED + NR_CLASSES },
|
||||
{ word: NR_FIXED + NR_CLASSES },
|
||||
/* _NL_CTYPE_INDIGITS_MB_LEN */
|
||||
{ .word = 1 },
|
||||
{ word: 1 },
|
||||
/* _NL_CTYPE_INDIGITS0_MB .. _NL_CTYPE_INDIGITS9_MB */
|
||||
{ .string = "0" },
|
||||
{ .string = "1" },
|
||||
{ .string = "2" },
|
||||
{ .string = "3" },
|
||||
{ .string = "4" },
|
||||
{ .string = "5" },
|
||||
{ .string = "6" },
|
||||
{ .string = "7" },
|
||||
{ .string = "8" },
|
||||
{ .string = "9" },
|
||||
{ string: "0" },
|
||||
{ string: "1" },
|
||||
{ string: "2" },
|
||||
{ string: "3" },
|
||||
{ string: "4" },
|
||||
{ string: "5" },
|
||||
{ string: "6" },
|
||||
{ string: "7" },
|
||||
{ string: "8" },
|
||||
{ string: "9" },
|
||||
/* _NL_CTYPE_INDIGITS_WC_LEN */
|
||||
{ .word = 1 },
|
||||
{ word: 1 },
|
||||
/* _NL_CTYPE_INDIGITS0_WC .. _NL_CTYPE_INDIGITS9_WC */
|
||||
{ .wstr = (uint32_t *) L"0" },
|
||||
{ .wstr = (uint32_t *) L"1" },
|
||||
{ .wstr = (uint32_t *) L"2" },
|
||||
{ .wstr = (uint32_t *) L"3" },
|
||||
{ .wstr = (uint32_t *) L"4" },
|
||||
{ .wstr = (uint32_t *) L"5" },
|
||||
{ .wstr = (uint32_t *) L"6" },
|
||||
{ .wstr = (uint32_t *) L"7" },
|
||||
{ .wstr = (uint32_t *) L"8" },
|
||||
{ .wstr = (uint32_t *) L"9" },
|
||||
{ wstr: (uint32_t *) L"0" },
|
||||
{ wstr: (uint32_t *) L"1" },
|
||||
{ wstr: (uint32_t *) L"2" },
|
||||
{ wstr: (uint32_t *) L"3" },
|
||||
{ wstr: (uint32_t *) L"4" },
|
||||
{ wstr: (uint32_t *) L"5" },
|
||||
{ wstr: (uint32_t *) L"6" },
|
||||
{ wstr: (uint32_t *) L"7" },
|
||||
{ wstr: (uint32_t *) L"8" },
|
||||
{ wstr: (uint32_t *) L"9" },
|
||||
/* _NL_CTYPE_OUTDIGIT0_MB .. _NL_CTYPE_OUTDIGIT9_MB */
|
||||
{ .string = "0" },
|
||||
{ .string = "1" },
|
||||
{ .string = "2" },
|
||||
{ .string = "3" },
|
||||
{ .string = "4" },
|
||||
{ .string = "5" },
|
||||
{ .string = "6" },
|
||||
{ .string = "7" },
|
||||
{ .string = "8" },
|
||||
{ .string = "9" },
|
||||
{ string: "0" },
|
||||
{ string: "1" },
|
||||
{ string: "2" },
|
||||
{ string: "3" },
|
||||
{ string: "4" },
|
||||
{ string: "5" },
|
||||
{ string: "6" },
|
||||
{ string: "7" },
|
||||
{ string: "8" },
|
||||
{ string: "9" },
|
||||
/* _NL_CTYPE_OUTDIGIT0_WC .. _NL_CTYPE_OUTDIGIT9_WC */
|
||||
{ .word = L'0' },
|
||||
{ .word = L'1' },
|
||||
{ .word = L'2' },
|
||||
{ .word = L'3' },
|
||||
{ .word = L'4' },
|
||||
{ .word = L'5' },
|
||||
{ .word = L'6' },
|
||||
{ .word = L'7' },
|
||||
{ .word = L'8' },
|
||||
{ .word = L'9' },
|
||||
{ word: L'0' },
|
||||
{ word: L'1' },
|
||||
{ word: L'2' },
|
||||
{ word: L'3' },
|
||||
{ word: L'4' },
|
||||
{ word: L'5' },
|
||||
{ word: L'6' },
|
||||
{ word: L'7' },
|
||||
{ word: L'8' },
|
||||
{ word: L'9' },
|
||||
/* _NL_CTYPE_TRANSLIT_TAB_SIZE */
|
||||
{ .word = NTRANSLIT },
|
||||
{ word: NTRANSLIT },
|
||||
/* _NL_CTYPE_TRANSLIT_FROM_IDX */
|
||||
{ .wstr = translit_from_idx },
|
||||
{ wstr: translit_from_idx },
|
||||
/* _NL_CTYPE_TRANSLIT_FROM_TBL */
|
||||
{ .wstr = (uint32_t *) translit_from_tbl },
|
||||
{ wstr: (uint32_t *) translit_from_tbl },
|
||||
/* _NL_CTYPE_TRANSLIT_TO_IDX */
|
||||
{ .wstr = translit_to_idx },
|
||||
{ wstr: translit_to_idx },
|
||||
/* _NL_CTYPE_TRANSLIT_TO_TBL */
|
||||
{ .wstr = (uint32_t *) translit_to_tbl },
|
||||
{ wstr: (uint32_t *) translit_to_tbl },
|
||||
/* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN */
|
||||
{ .word = 1 },
|
||||
{ word: 1 },
|
||||
/* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING */
|
||||
{ .wstr = (uint32_t *) L"?" },
|
||||
{ wstr: (uint32_t *) L"?" },
|
||||
/* _NL_CTYPE_TRANSLIT_IGNORE_LEN */
|
||||
{ .word = 0 },
|
||||
{ word: 0 },
|
||||
/* _NL_CTYPE_TRANSLIT_IGNORE */
|
||||
{ .wstr = NULL },
|
||||
{ wstr: NULL },
|
||||
/* NR_CLASSES wctype_tables */
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_upper.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_lower.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_alpha.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_digit.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_xdigit.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_space.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_print.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_graph.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_blank.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_cntrl.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_punct.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_class_alnum.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_upper.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_lower.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_alpha.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_digit.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_xdigit.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_space.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_print.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_graph.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_blank.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_cntrl.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_punct.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_class_alnum.header },
|
||||
/* NR_MAPS wctrans_tables */
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_map_toupper.header },
|
||||
{ .string = (const char *) _nl_C_LC_CTYPE_map_tolower.header }
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_map_toupper.header },
|
||||
{ string: (const char *) _nl_C_LC_CTYPE_map_tolower.header }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -24,34 +24,34 @@
|
||||
/* This table's entries are taken from ISO 14652, the table in section
|
||||
4.12 "LC_IDENTIFICATION". */
|
||||
|
||||
const struct locale_data _nl_C_LC_IDENTIFICATION attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_IDENTIFICATION =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
16,
|
||||
{
|
||||
{ .string = "ISO/IEC 14652 i18n FDCC-set" },
|
||||
{ .string = "ISO/IEC JTC1/SC22/WG20 - internationalization" },
|
||||
{ .string = "C/o Keld Simonsen, Skt. Jorgens Alle 8, DK-1615 Kobenhavn V" },
|
||||
{ .string = "Keld Simonsen" },
|
||||
{ .string = "[email protected]" },
|
||||
{ .string = "+45 3122-6543" },
|
||||
{ .string = "+45 3325-6543" },
|
||||
{ .string = "" },
|
||||
{ .string = "ISO" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "1.0" },
|
||||
{ .string = "1997-12-20" },
|
||||
{ .string = "i18n:1999\0" "i18n:1999\0" "i18n:1999\0" "i18n:1999\0"
|
||||
{ string: "ISO/IEC 14652 i18n FDCC-set" },
|
||||
{ string: "ISO/IEC JTC1/SC22/WG20 - internationalization" },
|
||||
{ string: "C/o Keld Simonsen, Skt. Jorgens Alle 8, DK-1615 Kobenhavn V" },
|
||||
{ string: "Keld Simonsen" },
|
||||
{ string: "[email protected]" },
|
||||
{ string: "+45 3122-6543" },
|
||||
{ string: "+45 3325-6543" },
|
||||
{ string: "" },
|
||||
{ string: "ISO" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "1.0" },
|
||||
{ string: "1997-12-20" },
|
||||
{ string: "i18n:1999\0" "i18n:1999\0" "i18n:1999\0" "i18n:1999\0"
|
||||
"i18n:1999\0" "i18n:1999\0" "\0" "i18n:1999\0"
|
||||
"i18n:1999\0" "i18n:1999\0" "i18n:1999\0" "i18n:1999\0"
|
||||
"i18n:1999\0" "i18n:1999\0" "i18n:1999\0" "i18n:1999\0"
|
||||
"i18n:1999" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
/* This table's entries are taken from ISO 14652, the table in section
|
||||
4.12 "LC_MEASUREMENT". */
|
||||
|
||||
const struct locale_data _nl_C_LC_MEASUREMENT attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_MEASUREMENT =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
2,
|
||||
{
|
||||
{ .string = "\1" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "\1" },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995,1996,1997,2000,2001,2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
@@ -24,19 +24,19 @@
|
||||
|
||||
The last two fields are a GNU extension. */
|
||||
|
||||
const struct locale_data _nl_C_LC_MESSAGES attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_MESSAGES =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
5,
|
||||
{
|
||||
{ .string = "^[yY]" },
|
||||
{ .string = "^[nN]" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "^[yY]" },
|
||||
{ string: "^[nN]" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
@@ -28,60 +28,60 @@ static const char not_available[] = "\377";
|
||||
static const char not_available[] = "\177";
|
||||
#endif
|
||||
|
||||
const struct locale_data _nl_C_LC_MONETARY attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_MONETARY =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
46,
|
||||
{
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = "-" },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .string = not_available },
|
||||
{ .word = 10101 },
|
||||
{ .word = 99991231 },
|
||||
{ .word = 10101 },
|
||||
{ .word = 99991231 },
|
||||
{ .word = 1 },
|
||||
{ .word = (unsigned int) L'\0' },
|
||||
{ .word = (unsigned int) L'\0' },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: "-" },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ string: not_available },
|
||||
{ word: 10101 },
|
||||
{ word: 99991231 },
|
||||
{ word: 10101 },
|
||||
{ word: 99991231 },
|
||||
{ word: 1 },
|
||||
{ word: (unsigned int) L'\0' },
|
||||
{ word: (unsigned int) L'\0' },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -24,21 +24,21 @@
|
||||
/* This table's entries are taken from ISO 14652, the table in section
|
||||
4.9 "LC_NAME". */
|
||||
|
||||
const struct locale_data _nl_C_LC_NAME attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_NAME =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
7,
|
||||
{
|
||||
{ .string = "%p%t%g%t%m%t%f" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "%p%t%g%t%m%t%f" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995,1996,1997,2000,2001,2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
@@ -21,20 +21,20 @@
|
||||
|
||||
/* This table's entries are taken from POSIX.2 Table 2-10
|
||||
``LC_NUMERIC Category Definition in the POSIX Locale''. */
|
||||
const struct locale_data _nl_C_LC_NUMERIC attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_NUMERIC =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
6,
|
||||
{
|
||||
{ .string = "." },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .word = (unsigned int) L'.' },
|
||||
{ .word = (unsigned int) L'\0' },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "." },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ word: (unsigned int) L'.' },
|
||||
{ word: (unsigned int) L'\0' },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -24,17 +24,17 @@
|
||||
/* This table's entries are taken from ISO 14652, the table in section
|
||||
4.8 "LC_PAPER". */
|
||||
|
||||
const struct locale_data _nl_C_LC_PAPER attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_PAPER =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
3,
|
||||
{
|
||||
{ .word = 297 },
|
||||
{ .word = 210 },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ word: 297 },
|
||||
{ word: 210 },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -24,19 +24,19 @@
|
||||
/* This table's entries are taken from ISO 14652, the table in section
|
||||
4.11 "LC_TELEPHONE". */
|
||||
|
||||
const struct locale_data _nl_C_LC_TELEPHONE attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_TELEPHONE =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
5,
|
||||
{
|
||||
{ .string = "+%c %a %l" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "+%c %a %l" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -23,125 +23,125 @@
|
||||
``LC_TIME Category Definition in the POSIX Locale'',
|
||||
with additions from ISO 14652, section 4.6. */
|
||||
|
||||
const struct locale_data _nl_C_LC_TIME attribute_hidden =
|
||||
const struct locale_data _nl_C_LC_TIME =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
{ NULL, }, /* no cached data */
|
||||
NULL, 0, 0, /* no file mapped */
|
||||
UNDELETABLE,
|
||||
0,
|
||||
NULL,
|
||||
111,
|
||||
{
|
||||
{ .string = "Sun" },
|
||||
{ .string = "Mon" },
|
||||
{ .string = "Tue" },
|
||||
{ .string = "Wed" },
|
||||
{ .string = "Thu" },
|
||||
{ .string = "Fri" },
|
||||
{ .string = "Sat" },
|
||||
{ .string = "Sunday" },
|
||||
{ .string = "Monday" },
|
||||
{ .string = "Tuesday" },
|
||||
{ .string = "Wednesday" },
|
||||
{ .string = "Thursday" },
|
||||
{ .string = "Friday" },
|
||||
{ .string = "Saturday" },
|
||||
{ .string = "Jan" },
|
||||
{ .string = "Feb" },
|
||||
{ .string = "Mar" },
|
||||
{ .string = "Apr" },
|
||||
{ .string = "May" },
|
||||
{ .string = "Jun" },
|
||||
{ .string = "Jul" },
|
||||
{ .string = "Aug" },
|
||||
{ .string = "Sep" },
|
||||
{ .string = "Oct" },
|
||||
{ .string = "Nov" },
|
||||
{ .string = "Dec" },
|
||||
{ .string = "January" },
|
||||
{ .string = "February" },
|
||||
{ .string = "March" },
|
||||
{ .string = "April" },
|
||||
{ .string = "May" },
|
||||
{ .string = "June" },
|
||||
{ .string = "July" },
|
||||
{ .string = "August" },
|
||||
{ .string = "September" },
|
||||
{ .string = "October" },
|
||||
{ .string = "November" },
|
||||
{ .string = "December" },
|
||||
{ .string = "AM" },
|
||||
{ .string = "PM" },
|
||||
{ .string = "%a %b %e %H:%M:%S %Y" },
|
||||
{ .string = "%m/%d/%y" },
|
||||
{ .string = "%H:%M:%S" },
|
||||
{ .string = "%I:%M:%S %p" },
|
||||
{ .string = NULL },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .string = "" },
|
||||
{ .word = 0 },
|
||||
{ .string = "" },
|
||||
{ .wstr = (const uint32_t *) L"Sun" },
|
||||
{ .wstr = (const uint32_t *) L"Mon" },
|
||||
{ .wstr = (const uint32_t *) L"Tue" },
|
||||
{ .wstr = (const uint32_t *) L"Wed" },
|
||||
{ .wstr = (const uint32_t *) L"Thu" },
|
||||
{ .wstr = (const uint32_t *) L"Fri" },
|
||||
{ .wstr = (const uint32_t *) L"Sat" },
|
||||
{ .wstr = (const uint32_t *) L"Sunday" },
|
||||
{ .wstr = (const uint32_t *) L"Monday" },
|
||||
{ .wstr = (const uint32_t *) L"Tuesday" },
|
||||
{ .wstr = (const uint32_t *) L"Wednesday" },
|
||||
{ .wstr = (const uint32_t *) L"Thursday" },
|
||||
{ .wstr = (const uint32_t *) L"Friday" },
|
||||
{ .wstr = (const uint32_t *) L"Saturday" },
|
||||
{ .wstr = (const uint32_t *) L"Jan" },
|
||||
{ .wstr = (const uint32_t *) L"Feb" },
|
||||
{ .wstr = (const uint32_t *) L"Mar" },
|
||||
{ .wstr = (const uint32_t *) L"Apr" },
|
||||
{ .wstr = (const uint32_t *) L"May" },
|
||||
{ .wstr = (const uint32_t *) L"Jun" },
|
||||
{ .wstr = (const uint32_t *) L"Jul" },
|
||||
{ .wstr = (const uint32_t *) L"Aug" },
|
||||
{ .wstr = (const uint32_t *) L"Sep" },
|
||||
{ .wstr = (const uint32_t *) L"Oct" },
|
||||
{ .wstr = (const uint32_t *) L"Nov" },
|
||||
{ .wstr = (const uint32_t *) L"Dec" },
|
||||
{ .wstr = (const uint32_t *) L"January" },
|
||||
{ .wstr = (const uint32_t *) L"February" },
|
||||
{ .wstr = (const uint32_t *) L"March" },
|
||||
{ .wstr = (const uint32_t *) L"April" },
|
||||
{ .wstr = (const uint32_t *) L"May" },
|
||||
{ .wstr = (const uint32_t *) L"June" },
|
||||
{ .wstr = (const uint32_t *) L"July" },
|
||||
{ .wstr = (const uint32_t *) L"August" },
|
||||
{ .wstr = (const uint32_t *) L"September" },
|
||||
{ .wstr = (const uint32_t *) L"October" },
|
||||
{ .wstr = (const uint32_t *) L"November" },
|
||||
{ .wstr = (const uint32_t *) L"December" },
|
||||
{ .wstr = (const uint32_t *) L"AM" },
|
||||
{ .wstr = (const uint32_t *) L"PM" },
|
||||
{ .wstr = (const uint32_t *) L"%a %b %e %H:%M:%S %Y" },
|
||||
{ .wstr = (const uint32_t *) L"%m/%d/%y" },
|
||||
{ .wstr = (const uint32_t *) L"%H:%M:%S" },
|
||||
{ .wstr = (const uint32_t *) L"%I:%M:%S %p" },
|
||||
{ .wstr = (const uint32_t *) L"" },
|
||||
{ .wstr = (const uint32_t *) L"" },
|
||||
{ .wstr = (const uint32_t *) L"" },
|
||||
{ .wstr = (const uint32_t *) L"" },
|
||||
{ .wstr = (const uint32_t *) L"" },
|
||||
{ .string = "\7" },
|
||||
{ .word = 19971130 },
|
||||
{ .string = "\4" },
|
||||
{ .string = "\7" },
|
||||
{ .string = "\1" },
|
||||
{ .string = "\1" },
|
||||
{ .string = "" },
|
||||
{ .string = "%a %b %e %H:%M:%S %Z %Y" },
|
||||
{ .wstr = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y" },
|
||||
{ .string = _nl_C_codeset }
|
||||
{ string: "Sun" },
|
||||
{ string: "Mon" },
|
||||
{ string: "Tue" },
|
||||
{ string: "Wed" },
|
||||
{ string: "Thu" },
|
||||
{ string: "Fri" },
|
||||
{ string: "Sat" },
|
||||
{ string: "Sunday" },
|
||||
{ string: "Monday" },
|
||||
{ string: "Tuesday" },
|
||||
{ string: "Wednesday" },
|
||||
{ string: "Thursday" },
|
||||
{ string: "Friday" },
|
||||
{ string: "Saturday" },
|
||||
{ string: "Jan" },
|
||||
{ string: "Feb" },
|
||||
{ string: "Mar" },
|
||||
{ string: "Apr" },
|
||||
{ string: "May" },
|
||||
{ string: "Jun" },
|
||||
{ string: "Jul" },
|
||||
{ string: "Aug" },
|
||||
{ string: "Sep" },
|
||||
{ string: "Oct" },
|
||||
{ string: "Nov" },
|
||||
{ string: "Dec" },
|
||||
{ string: "January" },
|
||||
{ string: "February" },
|
||||
{ string: "March" },
|
||||
{ string: "April" },
|
||||
{ string: "May" },
|
||||
{ string: "June" },
|
||||
{ string: "July" },
|
||||
{ string: "August" },
|
||||
{ string: "September" },
|
||||
{ string: "October" },
|
||||
{ string: "November" },
|
||||
{ string: "December" },
|
||||
{ string: "AM" },
|
||||
{ string: "PM" },
|
||||
{ string: "%a %b %e %H:%M:%S %Y" },
|
||||
{ string: "%m/%d/%y" },
|
||||
{ string: "%H:%M:%S" },
|
||||
{ string: "%I:%M:%S %p" },
|
||||
{ string: NULL },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ word: 0 },
|
||||
{ string: "" },
|
||||
{ wstr: (const uint32_t *) L"Sun" },
|
||||
{ wstr: (const uint32_t *) L"Mon" },
|
||||
{ wstr: (const uint32_t *) L"Tue" },
|
||||
{ wstr: (const uint32_t *) L"Wed" },
|
||||
{ wstr: (const uint32_t *) L"Thu" },
|
||||
{ wstr: (const uint32_t *) L"Fri" },
|
||||
{ wstr: (const uint32_t *) L"Sat" },
|
||||
{ wstr: (const uint32_t *) L"Sunday" },
|
||||
{ wstr: (const uint32_t *) L"Monday" },
|
||||
{ wstr: (const uint32_t *) L"Tuesday" },
|
||||
{ wstr: (const uint32_t *) L"Wednesday" },
|
||||
{ wstr: (const uint32_t *) L"Thursday" },
|
||||
{ wstr: (const uint32_t *) L"Friday" },
|
||||
{ wstr: (const uint32_t *) L"Saturday" },
|
||||
{ wstr: (const uint32_t *) L"Jan" },
|
||||
{ wstr: (const uint32_t *) L"Feb" },
|
||||
{ wstr: (const uint32_t *) L"Mar" },
|
||||
{ wstr: (const uint32_t *) L"Apr" },
|
||||
{ wstr: (const uint32_t *) L"May" },
|
||||
{ wstr: (const uint32_t *) L"Jun" },
|
||||
{ wstr: (const uint32_t *) L"Jul" },
|
||||
{ wstr: (const uint32_t *) L"Aug" },
|
||||
{ wstr: (const uint32_t *) L"Sep" },
|
||||
{ wstr: (const uint32_t *) L"Oct" },
|
||||
{ wstr: (const uint32_t *) L"Nov" },
|
||||
{ wstr: (const uint32_t *) L"Dec" },
|
||||
{ wstr: (const uint32_t *) L"January" },
|
||||
{ wstr: (const uint32_t *) L"February" },
|
||||
{ wstr: (const uint32_t *) L"March" },
|
||||
{ wstr: (const uint32_t *) L"April" },
|
||||
{ wstr: (const uint32_t *) L"May" },
|
||||
{ wstr: (const uint32_t *) L"June" },
|
||||
{ wstr: (const uint32_t *) L"July" },
|
||||
{ wstr: (const uint32_t *) L"August" },
|
||||
{ wstr: (const uint32_t *) L"September" },
|
||||
{ wstr: (const uint32_t *) L"October" },
|
||||
{ wstr: (const uint32_t *) L"November" },
|
||||
{ wstr: (const uint32_t *) L"December" },
|
||||
{ wstr: (const uint32_t *) L"AM" },
|
||||
{ wstr: (const uint32_t *) L"PM" },
|
||||
{ wstr: (const uint32_t *) L"%a %b %e %H:%M:%S %Y" },
|
||||
{ wstr: (const uint32_t *) L"%m/%d/%y" },
|
||||
{ wstr: (const uint32_t *) L"%H:%M:%S" },
|
||||
{ wstr: (const uint32_t *) L"%I:%M:%S %p" },
|
||||
{ wstr: (const uint32_t *) L"" },
|
||||
{ wstr: (const uint32_t *) L"" },
|
||||
{ wstr: (const uint32_t *) L"" },
|
||||
{ wstr: (const uint32_t *) L"" },
|
||||
{ wstr: (const uint32_t *) L"" },
|
||||
{ string: "\7" },
|
||||
{ word: 19971130 },
|
||||
{ string: "\4" },
|
||||
{ string: "\7" },
|
||||
{ string: "\1" },
|
||||
{ string: "\1" },
|
||||
{ string: "" },
|
||||
{ string: "%a %b %e %H:%M:%S %Z %Y" },
|
||||
{ wstr: (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y" },
|
||||
{ string: _nl_C_codeset }
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/* Transliteration for the C locale. -*-C-*-
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <[email protected]>, 2000.
|
||||
|
||||
@@ -94,14 +94,8 @@
|
||||
"\x2039" "<" /* <U2039> SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
"\x203a" ">" /* <U203A> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
"\x203c" "!!" /* <U203C> DOUBLE EXCLAMATION MARK */
|
||||
"\x2047" "??" /* <U2047> DOUBLE QUESTION MARK */
|
||||
"\x2048" "?!" /* <U2048> QUESTION EXCLAMATION MARK */
|
||||
"\x2049" "!?" /* <U2049> EXCLAMATION QUESTION MARK */
|
||||
"\x205f" " " /* <U205F> MEDIUM MATHEMATICAL SPACE */
|
||||
"\x2060" "" /* <U2060> WORD JOINER */
|
||||
"\x2061" "" /* <U2061> FUNCTION APPLICATION */
|
||||
"\x2062" "" /* <U2062> INVISIBLE TIMES */
|
||||
"\x2063" "" /* <U2063> INVISIBLE SEPARATOR */
|
||||
"\x20a8" "Rs" /* <U20A8> RUPEE SIGN */
|
||||
"\x20ac" "EUR" /* <U20AC> EURO SIGN */
|
||||
"\x2100" "a/c" /* <U2100> ACCOUNT OF */
|
||||
@@ -139,11 +133,6 @@
|
||||
"\x2133" "M" /* <U2133> SCRIPT CAPITAL M */
|
||||
"\x2134" "o" /* <U2134> SCRIPT SMALL O */
|
||||
"\x2139" "i" /* <U2139> INFORMATION SOURCE */
|
||||
"\x2145" "D" /* <U2145> DOUBLE-STRUCK ITALIC CAPITAL D */
|
||||
"\x2146" "d" /* <U2146> DOUBLE-STRUCK ITALIC SMALL D */
|
||||
"\x2147" "e" /* <U2147> DOUBLE-STRUCK ITALIC SMALL E */
|
||||
"\x2148" "i" /* <U2148> DOUBLE-STRUCK ITALIC SMALL I */
|
||||
"\x2149" "j" /* <U2149> DOUBLE-STRUCK ITALIC SMALL J */
|
||||
"\x2153" " 1/3 " /* <U2153> VULGAR FRACTION ONE THIRD */
|
||||
"\x2154" " 2/3 " /* <U2154> VULGAR FRACTION TWO THIRDS */
|
||||
"\x2155" " 1/5 " /* <U2155> VULGAR FRACTION ONE FIFTH */
|
||||
@@ -395,41 +384,7 @@
|
||||
"\x2534" "+" /* <U2534> BOX DRAWINGS LIGHT UP AND HORIZONTAL */
|
||||
"\x253c" "+" /* <U253C> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
|
||||
"\x25e6" "o" /* <U25E6> WHITE BULLET */
|
||||
"\x2a74" "::=" /* <U2A74> DOUBLE COLON EQUAL */
|
||||
"\x2a75" "==" /* <U2A75> TWO CONSECUTIVE EQUALS SIGNS */
|
||||
"\x2a76" "===" /* <U2A76> THREE CONSECUTIVE EQUALS SIGNS */
|
||||
"\x3000" " " /* <U3000> IDEOGRAPHIC SPACE */
|
||||
"\x30a0" "=" /* <U30A0> KATAKANA-HIRAGANA DOUBLE HYPHEN */
|
||||
"\x3251" "(21)" /* <U3251> CIRCLED NUMBER TWENTY ONE */
|
||||
"\x3252" "(22)" /* <U3252> CIRCLED NUMBER TWENTY TWO */
|
||||
"\x3253" "(23)" /* <U3253> CIRCLED NUMBER TWENTY THREE */
|
||||
"\x3254" "(24)" /* <U3254> CIRCLED NUMBER TWENTY FOUR */
|
||||
"\x3255" "(25)" /* <U3255> CIRCLED NUMBER TWENTY FIVE */
|
||||
"\x3256" "(26)" /* <U3256> CIRCLED NUMBER TWENTY SIX */
|
||||
"\x3257" "(27)" /* <U3257> CIRCLED NUMBER TWENTY SEVEN */
|
||||
"\x3258" "(28)" /* <U3258> CIRCLED NUMBER TWENTY EIGHT */
|
||||
"\x3259" "(29)" /* <U3259> CIRCLED NUMBER TWENTY NINE */
|
||||
"\x325a" "(30)" /* <U325A> CIRCLED NUMBER THIRTY */
|
||||
"\x325b" "(31)" /* <U325B> CIRCLED NUMBER THIRTY ONE */
|
||||
"\x325c" "(32)" /* <U325C> CIRCLED NUMBER THIRTY TWO */
|
||||
"\x325d" "(33)" /* <U325D> CIRCLED NUMBER THIRTY THREE */
|
||||
"\x325e" "(34)" /* <U325E> CIRCLED NUMBER THIRTY FOUR */
|
||||
"\x325f" "(35)" /* <U325F> CIRCLED NUMBER THIRTY FIVE */
|
||||
"\x32b1" "(36)" /* <U32B1> CIRCLED NUMBER THIRTY SIX */
|
||||
"\x32b2" "(37)" /* <U32B2> CIRCLED NUMBER THIRTY SEVEN */
|
||||
"\x32b3" "(38)" /* <U32B3> CIRCLED NUMBER THIRTY EIGHT */
|
||||
"\x32b4" "(39)" /* <U32B4> CIRCLED NUMBER THIRTY NINE */
|
||||
"\x32b5" "(40)" /* <U32B5> CIRCLED NUMBER FORTY */
|
||||
"\x32b6" "(41)" /* <U32B6> CIRCLED NUMBER FORTY ONE */
|
||||
"\x32b7" "(42)" /* <U32B7> CIRCLED NUMBER FORTY TWO */
|
||||
"\x32b8" "(43)" /* <U32B8> CIRCLED NUMBER FORTY THREE */
|
||||
"\x32b9" "(44)" /* <U32B9> CIRCLED NUMBER FORTY FOUR */
|
||||
"\x32ba" "(45)" /* <U32BA> CIRCLED NUMBER FORTY FIVE */
|
||||
"\x32bb" "(46)" /* <U32BB> CIRCLED NUMBER FORTY SIX */
|
||||
"\x32bc" "(47)" /* <U32BC> CIRCLED NUMBER FORTY SEVEN */
|
||||
"\x32bd" "(48)" /* <U32BD> CIRCLED NUMBER FORTY EIGHT */
|
||||
"\x32be" "(49)" /* <U32BE> CIRCLED NUMBER FORTY NINE */
|
||||
"\x32bf" "(50)" /* <U32BF> CIRCLED NUMBER FIFTY */
|
||||
"\x3371" "hPa" /* <U3371> SQUARE HPA */
|
||||
"\x3372" "da" /* <U3372> SQUARE DA */
|
||||
"\x3373" "AU" /* <U3373> SQUARE AU */
|
||||
@@ -535,22 +490,6 @@
|
||||
"\xfb04" "ffl" /* <UFB04> LATIN SMALL LIGATURE FFL */
|
||||
"\xfb06" "st" /* <UFB06> LATIN SMALL LIGATURE ST */
|
||||
"\xfb29" "+" /* <UFB29> HEBREW LETTER ALTERNATIVE PLUS SIGN */
|
||||
"\xfe00" "" /* VARIATION SELECTOR-1 */
|
||||
"\xfe01" "" /* VARIATION SELECTOR-2 */
|
||||
"\xfe02" "" /* VARIATION SELECTOR-3 */
|
||||
"\xfe03" "" /* VARIATION SELECTOR-4 */
|
||||
"\xfe04" "" /* VARIATION SELECTOR-5 */
|
||||
"\xfe05" "" /* VARIATION SELECTOR-6 */
|
||||
"\xfe06" "" /* VARIATION SELECTOR-7 */
|
||||
"\xfe07" "" /* VARIATION SELECTOR-8 */
|
||||
"\xfe08" "" /* VARIATION SELECTOR-9 */
|
||||
"\xfe09" "" /* VARIATION SELECTOR-10 */
|
||||
"\xfe0a" "" /* VARIATION SELECTOR-11 */
|
||||
"\xfe0b" "" /* VARIATION SELECTOR-12 */
|
||||
"\xfe0c" "" /* VARIATION SELECTOR-13 */
|
||||
"\xfe0d" "" /* VARIATION SELECTOR-14 */
|
||||
"\xfe0e" "" /* VARIATION SELECTOR-15 */
|
||||
"\xfe0f" "" /* VARIATION SELECTOR-16 */
|
||||
"\xfe4d" "_" /* <UFE4D> DASHED LOW LINE */
|
||||
"\xfe4e" "_" /* <UFE4E> CENTRELINE LOW LINE */
|
||||
"\xfe4f" "_" /* <UFE4F> WAVY LOW LINE */
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
SubDir OBOS_TOP src kernel libroot posix glibc locale ;
|
||||
|
||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include arch $(OBOS_ARCH) ;
|
||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include ;
|
||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc locale ;
|
||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc ;
|
||||
|
||||
KernelMergeObject posix_gnu_locale.o :
|
||||
C-ctype.c
|
||||
C-monetary.c
|
||||
C_name.c
|
||||
C-numeric.c
|
||||
lc-ctype.c
|
||||
lc-monetary.c
|
||||
lc-numeric.c
|
||||
mb_cur_max.c
|
||||
: -fPIC -DPIC
|
||||
;
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991,92,1995-1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92, 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -26,7 +26,6 @@ distribute = localeinfo.h categories.def iso-639.def iso-3166.def \
|
||||
iso-4217.def weight.h weightwc.h strlen-hash.h elem-hash.h \
|
||||
indigits.h indigitswc.h outdigits.h outdigitswc.h \
|
||||
coll-lookup.h C-translit.h.in C-translit.h gen-translit.pl \
|
||||
locarchive.h hashval.h \
|
||||
$(addprefix programs/, \
|
||||
locale.c localedef.c \
|
||||
$(localedef-modules:=.c) $(locale-modules:=.c) \
|
||||
@@ -34,20 +33,20 @@ distribute = localeinfo.h categories.def iso-639.def iso-3166.def \
|
||||
charmap-kw.gperf charmap-kw.h locfile-token.h \
|
||||
locfile-kw.gperf locfile-kw.h linereader.h \
|
||||
locfile.h charmap.h repertoire.h localedef.h \
|
||||
3level.h charmap-dir.h locarchive.c)
|
||||
routines = setlocale findlocale loadlocale loadarchive \
|
||||
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
|
||||
newlocale duplocale freelocale uselocale
|
||||
3level.h charmap-dir.h)
|
||||
routines = setlocale findlocale loadlocale localeconv nl_langinfo \
|
||||
nl_langinfo_l mb_cur_max \
|
||||
newlocale duplocale freelocale
|
||||
tests = tst-C-locale
|
||||
categories = ctype messages monetary numeric time paper name \
|
||||
address telephone measurement identification collate
|
||||
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
|
||||
xlocale localename global-locale
|
||||
xlocale
|
||||
others = localedef locale
|
||||
#others-static = localedef locale
|
||||
install-bin = localedef locale
|
||||
extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
|
||||
$(locale-modules:=.o) $(lib-modules:=.o)
|
||||
extra-objs = $(localedef-modules:=.o) $(locale-modules:=.o) \
|
||||
$(lib-modules:=.o)
|
||||
|
||||
extra-libs = libBrokenLocale
|
||||
extra-libs-others = $(extra-libs)
|
||||
@@ -55,13 +54,12 @@ extra-libs-others = $(extra-libs)
|
||||
libBrokenLocale-routines = broken_cur_max
|
||||
|
||||
subdir-dirs = programs
|
||||
vpath %.c programs ../crypt
|
||||
vpath %.c programs
|
||||
vpath %.h programs
|
||||
vpath %.gperf programs
|
||||
|
||||
localedef-modules := $(categories:%=ld-%) charmap linereader locfile \
|
||||
repertoire locarchive
|
||||
localedef-aux := md5
|
||||
repertoire
|
||||
locale-modules := locale-spec
|
||||
lib-modules := charmap-dir simple-hash xmalloc xstrdup
|
||||
|
||||
@@ -76,7 +74,6 @@ programs/%-kw.h: programs/%-kw.gperf
|
||||
mv -f $@.new $@
|
||||
|
||||
$(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
|
||||
$(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o)
|
||||
$(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
|
||||
$(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
|
||||
|
||||
@@ -101,12 +98,6 @@ CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
|
||||
CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
|
||||
CFLAGS-charmap-dir.c = -Wno-write-strings
|
||||
|
||||
# This makes sure -DNOT_IN_libc is passed for all these modules.
|
||||
cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
|
||||
$(locale-modules) $(lib-modules))
|
||||
lib := nonlib
|
||||
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
||||
|
||||
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
|
||||
# This ensures they will load libc.so for needed symbols if loaded by
|
||||
# a statically-linked program that hasn't already loaded it.
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
so the string constant is not repeated in dozens of object files. */
|
||||
|
||||
const char _libc_intl_domainname[] = "libc";
|
||||
INTDEF(_libc_intl_domainname)
|
||||
|
||||
@@ -7,7 +7,9 @@ libBrokenLocale {
|
||||
libc {
|
||||
GLIBC_2.0 {
|
||||
# global variables
|
||||
_libc_intl_domainname;
|
||||
__collate_element_hash; __collate_element_strings;
|
||||
__collate_symbol_classes; __collate_symbol_hash; __collate_symbol_strings;
|
||||
_libc_intl_domainname; _nl_current_LC_COLLATE; _nl_current_LC_CTYPE;
|
||||
|
||||
# functions used in inline functions or macros
|
||||
__ctype_get_mb_cur_max;
|
||||
@@ -46,29 +48,4 @@ libc {
|
||||
# missing function from the experimental locale implementation
|
||||
__nl_langinfo_l;
|
||||
}
|
||||
GLIBC_2.3 {
|
||||
# the new "experimental" interface is now public
|
||||
newlocale; duplocale; freelocale; uselocale;
|
||||
|
||||
# this name is used by libstdc++ as well as libpthread
|
||||
__uselocale;
|
||||
|
||||
isalnum_l; isalpha_l; isascii_l; isblank_l; iscntrl_l;
|
||||
isdigit_l; isgraph_l; islower_l; isprint_l; ispunct_l;
|
||||
isspace_l; isupper_l; iswalnum_l; iswalpha_l; iswblank_l;
|
||||
iswcntrl_l; iswctype_l; iswdigit_l; iswgraph_l; iswlower_l;
|
||||
iswprint_l; iswpunct_l; iswspace_l; iswupper_l; iswxdigit_l;
|
||||
isxdigit_l; strcasecmp_l; strcoll_l; strfmon_l; strncasecmp_l;
|
||||
strtod_l; strtof_l; strtol_l; strtold_l; strtoul_l;
|
||||
strxfrm_l; toascii_l; tolower_l; toupper_l;
|
||||
towctrans_l; towlower_l; towupper_l; wcscasecmp_l; wcscoll_l;
|
||||
wcsncasecmp_l; wcstod_l; wcstof_l; wcstol_l; wcstold_l;
|
||||
wcstoll_l; wcstoul_l; wcstoull_l; wcsxfrm_l; wctype_l;
|
||||
wctrans_l; nl_langinfo_l;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
# global variables
|
||||
__collate_element_hash; __collate_element_strings;
|
||||
__collate_symbol_classes; __collate_symbol_hash; __collate_symbol_strings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@
|
||||
size_t
|
||||
__ctype_get_mb_cur_max (void)
|
||||
{
|
||||
union locale_data_value u;
|
||||
size_t correct_value = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX);
|
||||
|
||||
u.string = nl_langinfo (_NL_CTYPE_MB_CUR_MAX);
|
||||
return ((size_t []) { 1, 1, 1, 2, 2, 3, 4 })[u.word];
|
||||
return ((size_t []) { 1, 1, 1, 2, 2, 3, 4 })[correct_value];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Definition of all available locale categories and their items. -*- C -*-
|
||||
Copyright (C) 1995-2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -247,7 +247,7 @@ DEFINE_CATEGORY
|
||||
DEFINE_ELEMENT (_DATE_FMT, "date_fmt", opt, string)
|
||||
DEFINE_ELEMENT (_NL_W_DATE_FMT, "wide-date_fmt", opt, wstring)
|
||||
DEFINE_ELEMENT (_NL_TIME_CODESET, "time-codeset", std, string)
|
||||
), NO_POSTLOAD)
|
||||
), _nl_postload_time)
|
||||
|
||||
|
||||
DEFINE_CATEGORY
|
||||
@@ -335,7 +335,7 @@ DEFINE_CATEGORY
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_LANGUAGE, "language", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_TERRITORY, "territory", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_AUDIENCE, "audience", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_APPLICATION, "application", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_APPLICATION, "applcation", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_ABBREVIATION, "abbreviation", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_REVISION, "revision", std, string)
|
||||
DEFINE_ELEMENT (_NL_IDENTIFICATION_DATE, "date", std, string)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Duplicate handle for selection of locales.
|
||||
Copyright (C) 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@@ -21,66 +21,43 @@
|
||||
#include <locale.h>
|
||||
#include <bits/libc-lock.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <localeinfo.h>
|
||||
|
||||
|
||||
/* Lock for protecting global data. */
|
||||
__libc_lock_define (extern , __libc_setlocale_lock attribute_hidden)
|
||||
__libc_lock_define (extern , __libc_setlocale_lock)
|
||||
|
||||
|
||||
__locale_t
|
||||
__duplocale (__locale_t dataset)
|
||||
{
|
||||
/* This static object is returned for newlocale (LC_ALL_MASK, "C"). */
|
||||
if (dataset == &_nl_C_locobj)
|
||||
return dataset;
|
||||
|
||||
__locale_t result;
|
||||
int cnt;
|
||||
size_t names_len = 0;
|
||||
|
||||
/* Calculate the total space we need to store all the names. */
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
if (cnt != LC_ALL && dataset->__names[cnt] != _nl_C_name)
|
||||
names_len += strlen (dataset->__names[cnt]) + 1;
|
||||
/* We modify global data. */
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
/* Get memory. */
|
||||
result = malloc (sizeof (struct __locale_struct) + names_len);
|
||||
|
||||
result = (__locale_t) malloc (sizeof (struct __locale_struct));
|
||||
if (result != NULL)
|
||||
{
|
||||
char *namep = (char *) (result + 1);
|
||||
|
||||
/* We modify global data (the usage counts). */
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
int cnt;
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
if (cnt != LC_ALL)
|
||||
{
|
||||
result->__locales[cnt] = dataset->__locales[cnt];
|
||||
if (result->__locales[cnt]->usage_count < MAX_USAGE_COUNT)
|
||||
++result->__locales[cnt]->usage_count;
|
||||
|
||||
if (dataset->__names[cnt] == _nl_C_name)
|
||||
result->__names[cnt] = _nl_C_name;
|
||||
else
|
||||
{
|
||||
result->__names[cnt] = namep;
|
||||
namep = __stpcpy (namep, dataset->__names[cnt]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the special members. */
|
||||
result->__ctype_b = dataset->__ctype_b;
|
||||
result->__ctype_tolower = dataset->__ctype_tolower;
|
||||
result->__ctype_toupper = dataset->__ctype_toupper;
|
||||
|
||||
/* It's done. */
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
}
|
||||
|
||||
/* Update the special members. */
|
||||
result->__ctype_b = dataset->__ctype_b;
|
||||
result->__ctype_tolower = dataset->__ctype_tolower;
|
||||
result->__ctype_toupper = dataset->__ctype_toupper;
|
||||
|
||||
/* It's done. */
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
|
||||
return result;
|
||||
}
|
||||
weak_alias (__duplocale, duplocale)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@@ -30,36 +30,16 @@
|
||||
#include "../iconv/gconv_charset.h"
|
||||
|
||||
|
||||
#ifdef NL_CURRENT_INDIRECT
|
||||
# define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
extern struct locale_data _nl_C_##category; \
|
||||
weak_extern (_nl_C_##category)
|
||||
# include "categories.def"
|
||||
# undef DEFINE_CATEGORY
|
||||
|
||||
/* Array indexed by category of pointers to _nl_C_CATEGORY slots.
|
||||
Elements are zero for categories whose data is never used. */
|
||||
struct locale_data *const _nl_C[] attribute_hidden =
|
||||
{
|
||||
# define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = &_nl_C_##category,
|
||||
# include "categories.def"
|
||||
# undef DEFINE_CATEGORY
|
||||
};
|
||||
#else
|
||||
# define _nl_C (_nl_C_locobj.__locales)
|
||||
#endif
|
||||
/* Constant data defined in setlocale.c. */
|
||||
extern struct locale_data *const _nl_C[];
|
||||
|
||||
|
||||
/* For each category we keep a list of records for the locale files
|
||||
which are somehow addressed. */
|
||||
struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
|
||||
|
||||
const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
|
||||
|
||||
|
||||
struct locale_data *
|
||||
internal_function
|
||||
_nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
int category, const char **name)
|
||||
{
|
||||
@@ -71,6 +51,9 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
const char *territory;
|
||||
const char *codeset;
|
||||
const char *normalized_codeset;
|
||||
const char *special;
|
||||
const char *sponsor;
|
||||
const char *revision;
|
||||
struct loaded_l10nfile *locale_file;
|
||||
|
||||
if ((*name)[0] == '\0')
|
||||
@@ -98,19 +81,6 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
return _nl_C[category];
|
||||
}
|
||||
|
||||
/* We really have to load some data. First we try the archive,
|
||||
but only if there was no LOCPATH environment variable specified. */
|
||||
if (__builtin_expect (locale_path == NULL, 1))
|
||||
{
|
||||
struct locale_data *data = _nl_load_locale_from_archive (category, name);
|
||||
if (__builtin_expect (data != NULL, 1))
|
||||
return data;
|
||||
|
||||
/* Nothing in the archive. Set the default path to search below. */
|
||||
locale_path = _nl_default_locale_path;
|
||||
locale_path_len = sizeof _nl_default_locale_path;
|
||||
}
|
||||
|
||||
/* We really have to load some data. First see whether the name is
|
||||
an alias. Please note that this makes it impossible to have "C"
|
||||
or "POSIX" as aliases. */
|
||||
@@ -126,24 +96,33 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
|
||||
language[_territory[.codeset]][@modifier]
|
||||
|
||||
and six parts for the CEN syntax:
|
||||
|
||||
language[_territory][+audience][+special][,[sponsor][_revision]]
|
||||
|
||||
Beside the first all of them are allowed to be missing. If the
|
||||
full specified locale is not found, the less specific one are
|
||||
looked for. The various part will be stripped off according to
|
||||
looked for. The various part will be stripped of according to
|
||||
the following order:
|
||||
(1) codeset
|
||||
(2) normalized codeset
|
||||
(3) territory
|
||||
(4) modifier
|
||||
(1) revision
|
||||
(2) sponsor
|
||||
(3) special
|
||||
(4) codeset
|
||||
(5) normalized codeset
|
||||
(6) territory
|
||||
(7) audience/modifier
|
||||
*/
|
||||
mask = _nl_explode_name (loc_name, &language, &modifier, &territory,
|
||||
&codeset, &normalized_codeset);
|
||||
&codeset, &normalized_codeset, &special,
|
||||
&sponsor, &revision);
|
||||
|
||||
/* If exactly this locale was already asked for we have an entry with
|
||||
the complete name. */
|
||||
locale_file = _nl_make_l10nflist (&_nl_locale_file_list[category],
|
||||
locale_path, locale_path_len, mask,
|
||||
language, territory, codeset,
|
||||
normalized_codeset, modifier,
|
||||
normalized_codeset, modifier, special,
|
||||
sponsor, revision,
|
||||
_nl_category_names[category], 0);
|
||||
|
||||
if (locale_file == NULL)
|
||||
@@ -153,7 +132,8 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
locale_file = _nl_make_l10nflist (&_nl_locale_file_list[category],
|
||||
locale_path, locale_path_len, mask,
|
||||
language, territory, codeset,
|
||||
normalized_codeset, modifier,
|
||||
normalized_codeset, modifier, special,
|
||||
sponsor, revision,
|
||||
_nl_category_names[category], 1);
|
||||
if (locale_file == NULL)
|
||||
/* This means we are out of core. */
|
||||
@@ -250,7 +230,8 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
}
|
||||
|
||||
/* Determine whether the user wants transliteration or not. */
|
||||
if (modifier != NULL && __strcasecmp (modifier, "TRANSLIT") == 0)
|
||||
if ((modifier != NULL && __strcasecmp (modifier, "TRANSLIT") == 0)
|
||||
|| (special != NULL && __strcasecmp (special, "TRANSLIT") == 0))
|
||||
((struct locale_data *) locale_file->data)->use_translit = 1;
|
||||
|
||||
/* Increment the usage count. */
|
||||
@@ -265,28 +246,44 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
|
||||
/* Calling this function assumes the lock for handling global locale data
|
||||
is acquired. */
|
||||
void
|
||||
internal_function
|
||||
_nl_remove_locale (int locale, struct locale_data *data)
|
||||
{
|
||||
if (--data->usage_count == 0)
|
||||
{
|
||||
if (data->alloc != ld_archive)
|
||||
/* First search the entry in the list of loaded files. */
|
||||
struct loaded_l10nfile *ptr = _nl_locale_file_list[locale];
|
||||
|
||||
/* Search for the entry. It must be in the list. Otherwise it
|
||||
is a bug and we crash badly. */
|
||||
while ((struct locale_data *) ptr->data != data)
|
||||
ptr = ptr->next;
|
||||
|
||||
/* Mark the data as not available anymore. So when the data has
|
||||
to be used again it is reloaded. */
|
||||
ptr->decided = 0;
|
||||
ptr->data = NULL;
|
||||
|
||||
/* Free the name. */
|
||||
free ((char *) data->name);
|
||||
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
/* Really delete the data. First delete the real data. */
|
||||
if (__builtin_expect (data->mmaped, 1))
|
||||
{
|
||||
/* First search the entry in the list of loaded files. */
|
||||
struct loaded_l10nfile *ptr = _nl_locale_file_list[locale];
|
||||
|
||||
/* Search for the entry. It must be in the list. Otherwise it
|
||||
is a bug and we crash badly. */
|
||||
while ((struct locale_data *) ptr->data != data)
|
||||
ptr = ptr->next;
|
||||
|
||||
/* Mark the data as not available anymore. So when the data has
|
||||
to be used again it is reloaded. */
|
||||
ptr->decided = 0;
|
||||
ptr->data = NULL;
|
||||
/* Try to unmap the area. If this fails we mark the area as
|
||||
permanent. */
|
||||
if (__munmap ((caddr_t) data->filedata, data->filesize) != 0)
|
||||
{
|
||||
data->usage_count = UNDELETABLE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* _POSIX_MAPPED_FILES */
|
||||
/* The memory was malloced. */
|
||||
free ((void *) data->filedata);
|
||||
|
||||
/* This does the real work. */
|
||||
_nl_unload_locale (data);
|
||||
/* Now free the structure itself. */
|
||||
free (data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Free data allocated by a call to setlocale_r
|
||||
Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
/* Lock for protecting global data. */
|
||||
__libc_lock_define (extern , __libc_setlocale_lock attribute_hidden)
|
||||
__libc_lock_define (extern , __libc_setlocale_lock)
|
||||
|
||||
|
||||
void
|
||||
@@ -34,11 +34,7 @@ __freelocale (__locale_t dataset)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
/* This static object is returned for newlocale (LC_ALL_MASK, "C"). */
|
||||
if (dataset == &_nl_C_locobj)
|
||||
return;
|
||||
|
||||
/* We modify global data (the usage counts). */
|
||||
/* We modify global data. */
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
@@ -46,10 +42,9 @@ __freelocale (__locale_t dataset)
|
||||
/* We can remove the data. */
|
||||
_nl_remove_locale (cnt, dataset->__locales[cnt]);
|
||||
|
||||
/* It's done. */
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
|
||||
/* Free the locale_t handle itself. */
|
||||
free (dataset);
|
||||
|
||||
/* It's done. */
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
}
|
||||
weak_alias (__freelocale, freelocale)
|
||||
|
||||
@@ -6,33 +6,40 @@
|
||||
*
|
||||
* !!! The list has to be sorted !!!
|
||||
*/
|
||||
DEFINE_INT_CURR("ADP ") /* Andorran Peseta */
|
||||
DEFINE_INT_CURR("AED ") /* United Arab Emirates Dirham */
|
||||
DEFINE_INT_CURR("AFA ") /* Afghanistan Afgani */
|
||||
DEFINE_INT_CURR("ALL ") /* Albanian Lek */
|
||||
DEFINE_INT_CURR("AMD ") /* Armenia Dram */
|
||||
DEFINE_INT_CURR("ANG ") /* Netherlands Antilles */
|
||||
DEFINE_INT_CURR("AOA ") /* Angolan Kwanza */
|
||||
DEFINE_INT_CURR("AON ") /* Angolan New Kwanza */
|
||||
DEFINE_INT_CURR("ARS ") /* Argentine Peso */
|
||||
DEFINE_INT_CURR("ATS ") /* Austrian Schilling */
|
||||
DEFINE_INT_CURR("AUD ") /* Australian Dollar */
|
||||
DEFINE_INT_CURR("AWG ") /* Aruba Guilder */
|
||||
DEFINE_INT_CURR("AZM ") /* Azerbaijan Manat */
|
||||
DEFINE_INT_CURR("BAK ") /* Bosnian and Herzegovina Convertible Mark */
|
||||
DEFINE_INT_CURR("BBD ") /* Barbados Dollar */
|
||||
DEFINE_INT_CURR("BDT ") /* Bangladesh Taka */
|
||||
DEFINE_INT_CURR("BEF ") /* Belgian Franc */
|
||||
DEFINE_INT_CURR("BGL ") /* Bulgarian Lev */
|
||||
DEFINE_INT_CURR("BHD ") /* Bahraini Dinar */
|
||||
DEFINE_INT_CURR("BIF ") /* Burundi Franc */
|
||||
DEFINE_INT_CURR("BMD ") /* Burmudian Dollar */
|
||||
DEFINE_INT_CURR("BND ") /* Brunei Dollar */
|
||||
DEFINE_INT_CURR("BOB ") /* Bolivian Boliviano */
|
||||
DEFINE_INT_CURR("BPS ") /* Canton and Enderbury Islands */ /* ?? */
|
||||
DEFINE_INT_CURR("BRE ") /* Brazil Real */ /* obsolete */
|
||||
DEFINE_INT_CURR("BRL ") /* Brazil Cruzeiro */
|
||||
DEFINE_INT_CURR("BSD ") /* Bahamas Dollar */
|
||||
DEFINE_INT_CURR("BTN ") /* Bhutan Ngultrum */
|
||||
DEFINE_INT_CURR("BUK ") /* Burma */ /* obsolete */
|
||||
DEFINE_INT_CURR("BWP ") /* Botswana Pula */
|
||||
DEFINE_INT_CURR("BYR ") /* Belarus Ruble */
|
||||
DEFINE_INT_CURR("BYB ") /* Belarus Ruble */
|
||||
DEFINE_INT_CURR("BZD ") /* Belize Dollar */
|
||||
DEFINE_INT_CURR("CAD ") /* Canadian Dollar */
|
||||
DEFINE_INT_CURR("CDF ") /* Congo Dem.Rep. Franc */
|
||||
DEFINE_INT_CURR("CFP ") /* French Pacific Island Franc */ /* ??*/
|
||||
DEFINE_INT_CURR("CHF ") /* Swiss Franc (Liechtenstein) */
|
||||
DEFINE_INT_CURR("CLP ") /* Chilean Peso */
|
||||
DEFINE_INT_CURR("CNY ") /* China Yuan Renminbi */
|
||||
@@ -42,24 +49,33 @@ DEFINE_INT_CURR("CUP ") /* Cuban Peso */
|
||||
DEFINE_INT_CURR("CVE ") /* Cape Verde Escudo */
|
||||
DEFINE_INT_CURR("CYP ") /* Cypriot Pound */
|
||||
DEFINE_INT_CURR("CZK ") /* Czech Koruna */
|
||||
DEFINE_INT_CURR("DEM ") /* German Mark */
|
||||
DEFINE_INT_CURR("DJF ") /* Djibouti Franc */
|
||||
DEFINE_INT_CURR("DKK ") /* Danish Krone (Faroe Islands, Greenland) */
|
||||
DEFINE_INT_CURR("DOP ") /* Dominican Republic */
|
||||
DEFINE_INT_CURR("DZD ") /* Algerian Dinar */
|
||||
DEFINE_INT_CURR("ECS ") /* Ecuadoran Sucre */
|
||||
DEFINE_INT_CURR("EEK ") /* Estonian Kroon */
|
||||
DEFINE_INT_CURR("EGP ") /* Egyptian Pound */
|
||||
DEFINE_INT_CURR("ERN ") /* Eritrean Nakfa */
|
||||
DEFINE_INT_CURR("ESP ") /* Spanish Peseta */
|
||||
DEFINE_INT_CURR("ETB ") /* Ethiopian Birr */
|
||||
DEFINE_INT_CURR("EUR ") /* European Union Euro */
|
||||
DEFINE_INT_CURR("FIM ") /* Finnish Markka */
|
||||
DEFINE_INT_CURR("FJD ") /* Fiji Dollar */
|
||||
DEFINE_INT_CURR("FKP ") /* Falkland Islands Pound (Malvinas) */
|
||||
DEFINE_INT_CURR("FRF ") /* French Franc */
|
||||
DEFINE_INT_CURR("GBP ") /* British Pound */
|
||||
DEFINE_INT_CURR("GEL ") /* Georgia Lari */
|
||||
DEFINE_INT_CURR("GHC ") /* Ghana Cedi */
|
||||
DEFINE_INT_CURR("GIP ") /* Gibraltar Pound */
|
||||
DEFINE_INT_CURR("GMD ") /* Gambian Dalasi */
|
||||
DEFINE_INT_CURR("GNF ") /* Guinea Franc */
|
||||
DEFINE_INT_CURR("GNS ") /* Guinea Syli */
|
||||
DEFINE_INT_CURR("GQE ") /* Equatorial Guinea Ekwele */
|
||||
DEFINE_INT_CURR("GRD ") /* Greek Drachma */
|
||||
DEFINE_INT_CURR("GTQ ") /* Guatemala Quetzal */
|
||||
DEFINE_INT_CURR("GWP ") /* Guinea-Bissau Peso */
|
||||
DEFINE_INT_CURR("GYD ") /* Guyana Dollar */
|
||||
DEFINE_INT_CURR("HKD ") /* Hong Kong Dollar */
|
||||
DEFINE_INT_CURR("HNL ") /* Honduras Lempira */
|
||||
@@ -67,12 +83,13 @@ DEFINE_INT_CURR("HRK ") /* Croatia Kuna */
|
||||
DEFINE_INT_CURR("HTG ") /* Haiti Gourde */
|
||||
DEFINE_INT_CURR("HUF ") /* Hungarian Forint */
|
||||
DEFINE_INT_CURR("IDR ") /* Indonesia Rupiah */
|
||||
DEFINE_INT_CURR("IEP ") /* Irish Pound */
|
||||
DEFINE_INT_CURR("ILS ") /* Israeli Shekel */
|
||||
DEFINE_INT_CURR("IMP ") /* Isle of Man Pounds */
|
||||
DEFINE_INT_CURR("INR ") /* Indian Rupee (Bhutan) */
|
||||
DEFINE_INT_CURR("IQD ") /* Iraqi Dinar */
|
||||
DEFINE_INT_CURR("IRR ") /* Iranian Rial */
|
||||
DEFINE_INT_CURR("ISK ") /* Iceland Krona */
|
||||
DEFINE_INT_CURR("ITL ") /* Italian Lira (San Marino, Vatican City) */
|
||||
DEFINE_INT_CURR("JMD ") /* Jamaican Dollar */
|
||||
DEFINE_INT_CURR("JOD ") /* Jordanian Dinar */
|
||||
DEFINE_INT_CURR("JPY ") /* Japanese Yen */
|
||||
@@ -91,12 +108,14 @@ DEFINE_INT_CURR("LKR ") /* Sri Lankan Rupee */
|
||||
DEFINE_INT_CURR("LRD ") /* Liberian Dollar */
|
||||
DEFINE_INT_CURR("LSL ") /* Lesotho Maloti */
|
||||
DEFINE_INT_CURR("LTL ") /* Lithuanian Litas */
|
||||
DEFINE_INT_CURR("LUF ") /* Luxembourg Franc */
|
||||
DEFINE_INT_CURR("LVL ") /* Latvia Lat */
|
||||
DEFINE_INT_CURR("LYD ") /* Libyan Arab Jamahiriya Dinar */
|
||||
DEFINE_INT_CURR("MAD ") /* Moroccan Dirham */
|
||||
DEFINE_INT_CURR("MDL ") /* Moldova Lei */
|
||||
DEFINE_INT_CURR("MGF ") /* Madagasy Franc */
|
||||
DEFINE_INT_CURR("MKD ") /* Macedonia Denar */
|
||||
DEFINE_INT_CURR("MLF ") /* Mali Franc */
|
||||
DEFINE_INT_CURR("MMK ") /* Myanmar Kyat */
|
||||
DEFINE_INT_CURR("MNT ") /* Mongolia Tugrik */
|
||||
DEFINE_INT_CURR("MOP ") /* Macau Pataca */
|
||||
@@ -111,6 +130,7 @@ DEFINE_INT_CURR("MZM ") /* Mozambique Metical */
|
||||
DEFINE_INT_CURR("NAD ") /* Namibia Dollar */
|
||||
DEFINE_INT_CURR("NGN ") /* Nigeria Naira */
|
||||
DEFINE_INT_CURR("NIO ") /* Nicaragua Cordoba Oro */
|
||||
DEFINE_INT_CURR("NLG ") /* Netherlands Guilder */
|
||||
DEFINE_INT_CURR("NOK ") /* Norwegian Krone */
|
||||
DEFINE_INT_CURR("NPR ") /* Nepalese Rupee */
|
||||
DEFINE_INT_CURR("NZD ") /* New Zealand Dollar */
|
||||
@@ -120,7 +140,8 @@ DEFINE_INT_CURR("PEN ") /* Peruvian New Sol */
|
||||
DEFINE_INT_CURR("PGK ") /* Papau New Guinea Kina */
|
||||
DEFINE_INT_CURR("PHP ") /* Philippines Peso */
|
||||
DEFINE_INT_CURR("PKR ") /* Pakistan Rupee */
|
||||
DEFINE_INT_CURR("PLN ") /* Polish Zloty */
|
||||
DEFINE_INT_CURR("PLZ ") /* Polish Zloty */
|
||||
DEFINE_INT_CURR("PTE ") /* Portugese Escudo */
|
||||
DEFINE_INT_CURR("PYG ") /* Paraguay Guarani */
|
||||
DEFINE_INT_CURR("QAR ") /* Qatar Rial */
|
||||
DEFINE_INT_CURR("ROL ") /* Romanian Leu */
|
||||
@@ -129,7 +150,7 @@ DEFINE_INT_CURR("RWF ") /* Rwanda Franc */
|
||||
DEFINE_INT_CURR("SAR ") /* Saudi Arabia Riyal */
|
||||
DEFINE_INT_CURR("SBD ") /* Solomon Islands Dollar */
|
||||
DEFINE_INT_CURR("SCR ") /* Seychelles Rupee */
|
||||
DEFINE_INT_CURR("SDD ") /* Sudanese Dinars */
|
||||
DEFINE_INT_CURR("SDP ") /* Sudanese Pound */
|
||||
DEFINE_INT_CURR("SEK ") /* Swedish Krona */
|
||||
DEFINE_INT_CURR("SGD ") /* Singapore Dollar */
|
||||
DEFINE_INT_CURR("SHP ") /* St. Helena Pound */
|
||||
@@ -137,9 +158,9 @@ DEFINE_INT_CURR("SIT ") /* Slovenian Tolar */
|
||||
DEFINE_INT_CURR("SKK ") /* Slovakian Koruna */
|
||||
DEFINE_INT_CURR("SLL ") /* Sierra Leone Leone */
|
||||
DEFINE_INT_CURR("SOS ") /* Somalia Schilling */
|
||||
DEFINE_INT_CURR("SPL ") /* Seborga Luigini */
|
||||
DEFINE_INT_CURR("SRG ") /* Suriname Guilder */
|
||||
DEFINE_INT_CURR("STD ") /* Sao Tome and Principe Dobra */
|
||||
DEFINE_INT_CURR("SUR ") /* Soviet Union Rubel (Ukrainian, Byelorussion) */ /* ??*/
|
||||
DEFINE_INT_CURR("SVC ") /* El Salvador Colon */
|
||||
DEFINE_INT_CURR("SYP ") /* Syrian Arab Republic Pound */
|
||||
DEFINE_INT_CURR("SZL ") /* Swaziland Lilangeni */
|
||||
@@ -148,14 +169,17 @@ DEFINE_INT_CURR("TJR ") /* Tajikistani Ruble */
|
||||
DEFINE_INT_CURR("TMM ") /* Turkmenistan Manet */
|
||||
DEFINE_INT_CURR("TND ") /* Tunisian Dinar */
|
||||
DEFINE_INT_CURR("TOP ") /* Tonga Pa'Anga */
|
||||
DEFINE_INT_CURR("TPE ") /* East Timor Escudo */ /* ??? */
|
||||
DEFINE_INT_CURR("TRL ") /* Turkish Lira */
|
||||
DEFINE_INT_CURR("TTD ") /* Trinidad and Tobago */
|
||||
DEFINE_INT_CURR("TVD ") /* Tuvalu Dollars */
|
||||
DEFINE_INT_CURR("TWD ") /* Taiwan, Province of China Dollar */
|
||||
DEFINE_INT_CURR("TZS ") /* United Republic of Tanzania Shilling */
|
||||
DEFINE_INT_CURR("UAH ") /* Ukraine Hryvna */
|
||||
DEFINE_INT_CURR("UGS ") /* Ugandan Shilling */ /* obsolete */
|
||||
DEFINE_INT_CURR("UGX ") /* Ugandan Shilling */
|
||||
DEFINE_INT_CURR("USD ") /* United States Dollar */
|
||||
DEFINE_INT_CURR("UYN ") /* Uruguay New Peso */ /* obsolete */
|
||||
DEFINE_INT_CURR("UYP ") /* Uruguay Peso */ /* obsolete */
|
||||
DEFINE_INT_CURR("UYU ") /* Uruguay Peso Uruguayo */
|
||||
DEFINE_INT_CURR("UZS ") /* Uzbekistan Sum */
|
||||
DEFINE_INT_CURR("VEB ") /* Venezuelan Bolivar */
|
||||
@@ -165,10 +189,13 @@ DEFINE_INT_CURR("WST ") /* Samoa Tala */
|
||||
DEFINE_INT_CURR("XAF ") /* Central African Franc (United Republic of Cameroon, Central African Republic, Chad, Congo, Gabon) */
|
||||
DEFINE_INT_CURR("XCD ") /* East Caribbean Dollar (Antiqua, Dominica, Grenada, Montserrat, St. Kitts-Nevis-Anguilla, Saint Lucia, Saint Vincent and the Grenadines) */
|
||||
DEFINE_INT_CURR("XDR ") /* International Monetary Fund */
|
||||
DEFINE_INT_CURR("XDS ") /* St. Christopher Dollar */ /* ?? */
|
||||
DEFINE_INT_CURR("XOF ") /* West African Franc (Benin, Ivory Coast, Niger, Senegal, Togo, Upper Volta) */
|
||||
DEFINE_INT_CURR("XPF ") /* French polynesia, New Caledonia, Wallis and Futuna Islands */
|
||||
DEFINE_INT_CURR("YDD ") /* Yemini Dinar (Democratic Yemen) */ /* obsolete */
|
||||
DEFINE_INT_CURR("YER ") /* Yemeni Rial */
|
||||
DEFINE_INT_CURR("YUM ") /* Yugoslavian New Dinar */
|
||||
DEFINE_INT_CURR("YUN ") /* Yugoslavian New Dinar */
|
||||
DEFINE_INT_CURR("ZAR ") /* South Africa Rand (Lesotho, Namibia) */
|
||||
DEFINE_INT_CURR("ZMK ") /* Zambian Kwacha */
|
||||
DEFINE_INT_CURR("ZRN ") /* Zaire New Zaire */ /* obsolete */
|
||||
DEFINE_INT_CURR("ZWD ") /* Zimbabwe Dollar */
|
||||
|
||||
@@ -52,7 +52,6 @@ DEFINE_LANGUAGE_CODE ("German", de, deu, ger)
|
||||
DEFINE_LANGUAGE_CODE ("Gaelic (Scots)", gd, gla, gla)
|
||||
DEFINE_LANGUAGE_CODE ("Irish", ga, gle, gle)
|
||||
DEFINE_LANGUAGE_CODE ("Gallegan", gl, glg, glg)
|
||||
DEFINE_LANGUAGE_CODE3 ("Ganda", lug, lug)
|
||||
DEFINE_LANGUAGE_CODE ("Manx", gv, glv, glv)
|
||||
DEFINE_LANGUAGE_CODE ("Greek, Modern ()", el, gre, ell)
|
||||
DEFINE_LANGUAGE_CODE ("Guarani", gn, grn, grn)
|
||||
@@ -136,7 +135,6 @@ DEFINE_LANGUAGE_CODE ("Samoan", sm, smo, smo)
|
||||
DEFINE_LANGUAGE_CODE ("Shona", sn, sna, sna)
|
||||
DEFINE_LANGUAGE_CODE ("Sindhi", sd, snd, snd)
|
||||
DEFINE_LANGUAGE_CODE ("Somali", so, som, som)
|
||||
DEFINE_LANGUAGE_CODE3 ("Sotho, Northern", nso, nso)
|
||||
DEFINE_LANGUAGE_CODE ("Sotho, Southern", st, sot, sot)
|
||||
DEFINE_LANGUAGE_CODE ("Spanish", es, spa, spa)
|
||||
DEFINE_LANGUAGE_CODE ("Sardinian", sc, srd, srd)
|
||||
@@ -163,10 +161,8 @@ DEFINE_LANGUAGE_CODE ("Uighur", ug, uig, uig)
|
||||
DEFINE_LANGUAGE_CODE ("Ukrainian", uk, ukr, ukr)
|
||||
DEFINE_LANGUAGE_CODE ("Urdu", ur, urd, urd)
|
||||
DEFINE_LANGUAGE_CODE ("Uzbek", uz, uzb, uzb)
|
||||
DEFINE_LANGUAGE_CODE3 ("Venda", ven, ven)
|
||||
DEFINE_LANGUAGE_CODE ("Vietnamese", vi, vie, vie)
|
||||
DEFINE_LANGUAGE_CODE ("Volapük", vo, vol, vol)
|
||||
DEFINE_LANGUAGE_CODE ("Walloon", wa, wln, wln)
|
||||
DEFINE_LANGUAGE_CODE ("Welsh", cy, cym, wel)
|
||||
DEFINE_LANGUAGE_CODE ("Wolof", wo, wol, wol)
|
||||
DEFINE_LANGUAGE_CODE ("Xhosa", xh, xho, xho)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Access to locale-dependent parameters.
|
||||
Copyright (C) 1995-99,2000,01,02 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -23,11 +23,11 @@
|
||||
/* Get the type definition. */
|
||||
#include <nl_types.h>
|
||||
|
||||
#include <misc/sys/cdefs.h>
|
||||
#include <bits/locale.h> /* Define the __LC_* category names. */
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
struct TTTE;
|
||||
|
||||
/* Construct an `nl_item' value for `nl_langinfo' from a locale category
|
||||
(LC_*) and an item index within the category. Some code may depend on
|
||||
the item values within a category increasing monotonically with the
|
||||
@@ -38,7 +38,6 @@ struct TTTE;
|
||||
#define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16)
|
||||
#define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff)
|
||||
|
||||
struct TTTE;
|
||||
|
||||
/* Enumeration of locale items that can be queried with `nl_langinfo'. */
|
||||
enum
|
||||
@@ -584,7 +583,7 @@ extern char *nl_langinfo (nl_item __item) __THROW;
|
||||
# include <xlocale.h>
|
||||
|
||||
/* Just like nl_langinfo but get the information from the locale object L. */
|
||||
extern char *nl_langinfo_l (nl_item __item, __locale_t l);
|
||||
extern char *__nl_langinfo_l (nl_item __item, __locale_t l);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Define current locale data for LC_CTYPE category.
|
||||
Copyright (C) 1995-1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -25,62 +25,29 @@
|
||||
_NL_CURRENT_DEFINE (LC_CTYPE);
|
||||
|
||||
/* We are called after loading LC_CTYPE data to load it into
|
||||
the variables used by the ctype.h macros. */
|
||||
|
||||
the variables used by the ctype.h macros.
|
||||
|
||||
There are three arrays of short ints which need to be indexable
|
||||
from -128 to 255 inclusive. Stored in the locale data file are
|
||||
a copy of each for each byte order. */
|
||||
|
||||
void
|
||||
_nl_postload_ctype (void)
|
||||
{
|
||||
#define paste(a,b) paste1(a,b)
|
||||
#define paste1(a,b) a##b
|
||||
|
||||
#define current(type,x,offset) \
|
||||
((const type *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_##x) + offset)
|
||||
|
||||
/* These are defined in ctype-info.c.
|
||||
The declarations here must match those in localeinfo.h.
|
||||
|
||||
These point into arrays of 384, so they can be indexed by any `unsigned
|
||||
char' value [0,255]; by EOF (-1); or by any `signed char' value
|
||||
[-128,-1). ISO C requires that the ctype functions work for `unsigned
|
||||
char' values and for EOF; we also support negative `signed char' values
|
||||
for broken old programs. The case conversion arrays are of `int's
|
||||
rather than `unsigned char's because tolower (EOF) must be EOF, which
|
||||
doesn't fit into an `unsigned char'. But today more important is that
|
||||
the arrays are also used for multi-byte character sets. */
|
||||
|
||||
if (_NL_CURRENT_LOCALE == &_nl_global_locale)
|
||||
{
|
||||
__libc_tsd_set (CTYPE_B, (void *) current (uint16_t, CLASS, 128));
|
||||
__libc_tsd_set (CTYPE_TOUPPER, (void *) current (int32_t, TOUPPER, 128));
|
||||
__libc_tsd_set (CTYPE_TOLOWER, (void *) current (int32_t, TOLOWER, 128));
|
||||
}
|
||||
|
||||
#include <shlib-compat.h>
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
||||
/* We must use the exported names to access these so we are sure to
|
||||
be accessing the main executable's copy if it has COPY relocs. */
|
||||
|
||||
extern __const unsigned short int *__ctype_b; /* Characteristics. */
|
||||
extern __const __int32_t *__ctype_tolower; /* Case conversions. */
|
||||
extern __const __int32_t *__ctype_toupper; /* Case conversions. */
|
||||
((const type *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) + offset)
|
||||
|
||||
extern const uint32_t *__ctype32_b;
|
||||
extern const uint32_t *__ctype32_toupper;
|
||||
extern const uint32_t *__ctype32_tolower;
|
||||
extern const char *__ctype32_wctype[12];
|
||||
extern const char *__ctype32_wctrans[2];
|
||||
extern const char *__ctype32_width;
|
||||
|
||||
/* We need the .symver declarations these macros generate so that
|
||||
our references are explicitly bound to the versioned symbol names
|
||||
rather than the unadorned names that are not exported. When the
|
||||
linker sees these bound to local symbols (as the unexported names are)
|
||||
then it doesn't generate a proper relocation to the global symbols.
|
||||
We need those relocations so that a versioned definition with a COPY
|
||||
reloc in an executable will override the libc.so definition. */
|
||||
|
||||
compat_symbol (libc, __ctype_b, __ctype_b, GLIBC_2_0);
|
||||
compat_symbol (libc, __ctype_tolower, __ctype_tolower, GLIBC_2_0);
|
||||
compat_symbol (libc, __ctype_toupper, __ctype_toupper, GLIBC_2_0);
|
||||
compat_symbol (libc, __ctype32_b, __ctype32_b, GLIBC_2_0);
|
||||
compat_symbol (libc, __ctype32_tolower, __ctype32_tolower, GLIBC_2_2);
|
||||
compat_symbol (libc, __ctype32_toupper, __ctype32_toupper, GLIBC_2_2);
|
||||
size_t offset, cnt;
|
||||
|
||||
__ctype_b = current (uint16_t, CLASS, 128);
|
||||
__ctype_toupper = current (uint32_t, TOUPPER, 128);
|
||||
@@ -88,5 +55,14 @@ compat_symbol (libc, __ctype32_toupper, __ctype32_toupper, GLIBC_2_2);
|
||||
__ctype32_b = current (uint32_t, CLASS32, 0);
|
||||
__ctype32_toupper = current (uint32_t, TOUPPER32, 0);
|
||||
__ctype32_tolower = current (uint32_t, TOLOWER32, 0);
|
||||
#endif
|
||||
|
||||
offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET);
|
||||
for (cnt = 0; cnt < 12; cnt++)
|
||||
__ctype32_wctype[cnt] = _nl_current_LC_CTYPE->values[offset + cnt].string;
|
||||
|
||||
offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET);
|
||||
for (cnt = 0; cnt < 2; cnt++)
|
||||
__ctype32_wctrans[cnt] = _nl_current_LC_CTYPE->values[offset + cnt].string;
|
||||
|
||||
__ctype32_width = current (char, WIDTH, 0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Define current locale data for LC_TIME category.
|
||||
Copyright (C) 1995-2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -17,6 +17,300 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <bits/libc-lock.h>
|
||||
#include <endian.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
#include "localeinfo.h"
|
||||
|
||||
_NL_CURRENT_DEFINE (LC_TIME);
|
||||
|
||||
/* Some of the functions here must not be used while setlocale is called. */
|
||||
__libc_lock_define (extern, __libc_setlocale_lock)
|
||||
|
||||
|
||||
static int era_initialized;
|
||||
|
||||
static struct era_entry *eras;
|
||||
static size_t num_eras;
|
||||
static int alt_digits_initialized;
|
||||
static const char **alt_digits;
|
||||
|
||||
|
||||
static int walt_digits_initialized;
|
||||
static const wchar_t **walt_digits;
|
||||
|
||||
|
||||
void
|
||||
_nl_postload_time (void)
|
||||
{
|
||||
/* Prepare lazy initialization of `era' and `alt_digits' array. */
|
||||
era_initialized = 0;
|
||||
alt_digits_initialized = 0;
|
||||
walt_digits_initialized = 0;
|
||||
}
|
||||
|
||||
#define ERA_DATE_CMP(a, b) \
|
||||
(a[0] < b[0] || (a[0] == b[0] && (a[1] < b[1] \
|
||||
|| (a[1] == b[1] && a[2] <= b[2]))))
|
||||
|
||||
static void
|
||||
_nl_init_era_entries (void)
|
||||
{
|
||||
size_t cnt;
|
||||
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
if (era_initialized == 0)
|
||||
{
|
||||
size_t new_num_eras = _NL_CURRENT_WORD (LC_TIME,
|
||||
_NL_TIME_ERA_NUM_ENTRIES);
|
||||
if (new_num_eras == 0)
|
||||
{
|
||||
free (eras);
|
||||
eras = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_eras != new_num_eras)
|
||||
eras = (struct era_entry *) realloc (eras,
|
||||
new_num_eras
|
||||
* sizeof (struct era_entry));
|
||||
if (eras == NULL)
|
||||
{
|
||||
num_eras = 0;
|
||||
eras = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *ptr = _NL_CURRENT (LC_TIME, _NL_TIME_ERA_ENTRIES);
|
||||
num_eras = new_num_eras;
|
||||
|
||||
for (cnt = 0; cnt < num_eras; ++cnt)
|
||||
{
|
||||
const char *base_ptr = ptr;
|
||||
memcpy ((void *) (eras + cnt), (const void *) ptr,
|
||||
sizeof (uint32_t) * 8);
|
||||
|
||||
if (ERA_DATE_CMP(eras[cnt].start_date,
|
||||
eras[cnt].stop_date))
|
||||
if (eras[cnt].direction == (uint32_t) '+')
|
||||
eras[cnt].absolute_direction = 1;
|
||||
else
|
||||
eras[cnt].absolute_direction = -1;
|
||||
else
|
||||
if (eras[cnt].direction == (uint32_t) '+')
|
||||
eras[cnt].absolute_direction = -1;
|
||||
else
|
||||
eras[cnt].absolute_direction = 1;
|
||||
|
||||
/* Skip numeric values. */
|
||||
ptr += sizeof (uint32_t) * 8;
|
||||
|
||||
/* Set and skip era name. */
|
||||
eras[cnt].era_name = ptr;
|
||||
ptr = strchr (ptr, '\0') + 1;
|
||||
|
||||
/* Set and skip era format. */
|
||||
eras[cnt].era_format = ptr;
|
||||
ptr = strchr (ptr, '\0') + 1;
|
||||
|
||||
ptr += 3 - (((ptr - (const char *) base_ptr) + 3) & 3);
|
||||
|
||||
/* Set and skip wide era name. */
|
||||
eras[cnt].era_wname = (wchar_t *) ptr;
|
||||
ptr = (char *) (wcschr ((wchar_t *) ptr, L'\0') + 1);
|
||||
|
||||
/* Set and skip wide era format. */
|
||||
eras[cnt].era_wformat = (wchar_t *) ptr;
|
||||
ptr = (char *) (wcschr ((wchar_t *) ptr, L'\0') + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
era_initialized = 1;
|
||||
}
|
||||
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
}
|
||||
|
||||
|
||||
struct era_entry *
|
||||
_nl_get_era_entry (const struct tm *tp)
|
||||
{
|
||||
struct era_entry *result;
|
||||
int32_t tdate[3];
|
||||
size_t cnt;
|
||||
|
||||
tdate[0] = tp->tm_year;
|
||||
tdate[1] = tp->tm_mon;
|
||||
tdate[2] = tp->tm_mday;
|
||||
|
||||
if (era_initialized == 0)
|
||||
_nl_init_era_entries ();
|
||||
|
||||
/* Now compare date with the available eras. */
|
||||
for (cnt = 0; cnt < num_eras; ++cnt)
|
||||
if ((ERA_DATE_CMP(eras[cnt].start_date, tdate)
|
||||
&& ERA_DATE_CMP(tdate, eras[cnt].stop_date))
|
||||
|| (ERA_DATE_CMP(eras[cnt].stop_date, tdate)
|
||||
&& ERA_DATE_CMP(tdate, eras[cnt].start_date)))
|
||||
break;
|
||||
|
||||
result = cnt < num_eras ? &eras[cnt] : NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
struct era_entry *
|
||||
_nl_select_era_entry (int cnt)
|
||||
{
|
||||
if (era_initialized == 0)
|
||||
_nl_init_era_entries ();
|
||||
|
||||
return &eras[cnt];
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
_nl_get_alt_digit (unsigned int number)
|
||||
{
|
||||
const char *result;
|
||||
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
if (alt_digits_initialized == 0)
|
||||
{
|
||||
alt_digits_initialized = 1;
|
||||
|
||||
if (alt_digits == NULL)
|
||||
alt_digits = malloc (100 * sizeof (const char *));
|
||||
|
||||
if (alt_digits != NULL)
|
||||
{
|
||||
const char *ptr = _NL_CURRENT (LC_TIME, ALT_DIGITS);
|
||||
size_t cnt;
|
||||
|
||||
if (alt_digits != NULL)
|
||||
for (cnt = 0; cnt < 100; ++cnt)
|
||||
{
|
||||
alt_digits[cnt] = ptr;
|
||||
|
||||
/* Skip digit format. */
|
||||
ptr = strchr (ptr, '\0') + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = alt_digits != NULL && number < 100 ? alt_digits[number] : NULL;
|
||||
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const wchar_t *
|
||||
_nl_get_walt_digit (unsigned int number)
|
||||
{
|
||||
const wchar_t *result;
|
||||
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
if (walt_digits_initialized == 0)
|
||||
{
|
||||
walt_digits_initialized = 1;
|
||||
|
||||
if (walt_digits == NULL)
|
||||
walt_digits = malloc (100 * sizeof (const uint32_t *));
|
||||
|
||||
if (walt_digits != NULL)
|
||||
{
|
||||
const wchar_t *ptr = _NL_CURRENT_WSTR (LC_TIME, _NL_WALT_DIGITS);
|
||||
size_t cnt;
|
||||
|
||||
for (cnt = 0; cnt < 100; ++cnt)
|
||||
{
|
||||
walt_digits[cnt] = ptr;
|
||||
|
||||
/* Skip digit format. */
|
||||
ptr = wcschr (ptr, L'\0') + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = walt_digits != NULL && number < 100 ? walt_digits[number] : NULL;
|
||||
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
|
||||
return (wchar_t *) result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_nl_parse_alt_digit (const char **strp)
|
||||
{
|
||||
const char *str = *strp;
|
||||
int result = -1;
|
||||
size_t cnt;
|
||||
size_t maxlen = 0;
|
||||
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
if (alt_digits_initialized == 0)
|
||||
{
|
||||
alt_digits_initialized = 1;
|
||||
|
||||
if (alt_digits == NULL)
|
||||
alt_digits = malloc (100 * sizeof (const char *));
|
||||
|
||||
if (alt_digits != NULL)
|
||||
{
|
||||
const char *ptr = _NL_CURRENT (LC_TIME, ALT_DIGITS);
|
||||
|
||||
if (alt_digits != NULL)
|
||||
for (cnt = 0; cnt < 100; ++cnt)
|
||||
{
|
||||
alt_digits[cnt] = ptr;
|
||||
|
||||
/* Skip digit format. */
|
||||
ptr = strchr (ptr, '\0') + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Matching is not unambiguos. The alternative digits could be like
|
||||
I, II, III, ... and the first one is a substring of the second
|
||||
and third. Therefore we must keep on searching until we found
|
||||
the longest possible match. Note that this is not specified in
|
||||
the standard. */
|
||||
for (cnt = 0; cnt < 100; ++cnt)
|
||||
{
|
||||
size_t len = strlen (alt_digits[cnt]);
|
||||
|
||||
if (len > maxlen && strncmp (alt_digits[cnt], str, len) == 0)
|
||||
{
|
||||
maxlen = len;
|
||||
result = (int) cnt;
|
||||
}
|
||||
}
|
||||
|
||||
__libc_lock_unlock (__libc_setlocale_lock);
|
||||
|
||||
if (result != -1)
|
||||
*strp += maxlen;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_mem (void)
|
||||
{
|
||||
free (alt_digits);
|
||||
free (walt_digits);
|
||||
}
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Functions to read locale data files.
|
||||
Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@@ -60,84 +60,21 @@ static const enum value_type *_nl_value_types[] =
|
||||
};
|
||||
|
||||
|
||||
struct locale_data *
|
||||
internal_function
|
||||
_nl_intern_locale_data (int category, const void *data, size_t datasize)
|
||||
void
|
||||
_nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
{
|
||||
const struct
|
||||
int fd;
|
||||
struct
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int nstrings;
|
||||
unsigned int strindex[0];
|
||||
} *const filedata = data;
|
||||
struct locale_data *newdata;
|
||||
size_t cnt;
|
||||
|
||||
if (__builtin_expect (datasize < sizeof *filedata, 0)
|
||||
|| __builtin_expect (filedata->magic != LIMAGIC (category), 0))
|
||||
{
|
||||
/* Bad data file. */
|
||||
__set_errno (EINVAL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (__builtin_expect (filedata->nstrings < _nl_category_num_items[category],
|
||||
0)
|
||||
|| (__builtin_expect (sizeof *filedata
|
||||
+ filedata->nstrings * sizeof (unsigned int)
|
||||
>= datasize, 0)))
|
||||
{
|
||||
/* Insufficient data. */
|
||||
__set_errno (EINVAL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newdata = malloc (sizeof *newdata
|
||||
+ filedata->nstrings * sizeof (union locale_data_value));
|
||||
if (newdata == NULL)
|
||||
return NULL;
|
||||
|
||||
newdata->filedata = (void *) filedata;
|
||||
newdata->filesize = datasize;
|
||||
newdata->private.data = NULL;
|
||||
newdata->private.cleanup = NULL;
|
||||
newdata->usage_count = 0;
|
||||
newdata->use_translit = 0;
|
||||
newdata->nstrings = filedata->nstrings;
|
||||
for (cnt = 0; cnt < newdata->nstrings; ++cnt)
|
||||
{
|
||||
size_t idx = filedata->strindex[cnt];
|
||||
if (__builtin_expect (idx > (size_t) newdata->filesize, 0))
|
||||
{
|
||||
puntdata:
|
||||
free (newdata);
|
||||
__set_errno (EINVAL);
|
||||
return NULL;
|
||||
}
|
||||
if (__builtin_expect (_nl_value_types[category][cnt] == word, 0))
|
||||
{
|
||||
if (idx % __alignof__ (u_int32_t) != 0)
|
||||
goto puntdata;
|
||||
newdata->values[cnt].word =
|
||||
*((const u_int32_t *) (newdata->filedata + idx));
|
||||
}
|
||||
else
|
||||
newdata->values[cnt].string = newdata->filedata + idx;
|
||||
}
|
||||
|
||||
return newdata;
|
||||
}
|
||||
|
||||
void
|
||||
internal_function
|
||||
_nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
{
|
||||
int fd;
|
||||
void *filedata;
|
||||
} *filedata;
|
||||
struct stat64 st;
|
||||
struct locale_data *newdata;
|
||||
int save_err;
|
||||
int alloc = ld_mapped;
|
||||
int mmaped = 1;
|
||||
size_t cnt;
|
||||
|
||||
file->decided = 1;
|
||||
file->data = NULL;
|
||||
@@ -148,11 +85,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
return;
|
||||
|
||||
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
|
||||
{
|
||||
puntfd:
|
||||
__close (fd);
|
||||
return;
|
||||
}
|
||||
goto puntfd;
|
||||
if (__builtin_expect (S_ISDIR (st.st_mode), 0))
|
||||
{
|
||||
/* LOCALE/LC_foo is a directory; open LOCALE/LC_foo/SYS_LC_foo
|
||||
@@ -189,15 +122,25 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
/* Some systems do not have this flag; it is superfluous. */
|
||||
# define MAP_FILE 0
|
||||
# endif
|
||||
filedata = __mmap ((caddr_t) 0, st.st_size,
|
||||
PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
|
||||
if (__builtin_expect (filedata == MAP_FAILED, 0))
|
||||
# ifndef MAP_INHERIT
|
||||
/* Some systems might lack this; they lose. */
|
||||
# define MAP_INHERIT 0
|
||||
# endif
|
||||
filedata = (void *) __mmap ((caddr_t) 0, st.st_size, PROT_READ,
|
||||
MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0);
|
||||
if (__builtin_expect ((void *) filedata != MAP_FAILED, 1))
|
||||
{
|
||||
if (__builtin_expect (st.st_size < sizeof (*filedata), 0))
|
||||
/* This cannot be a locale data file since it's too small. */
|
||||
goto puntfd;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__builtin_expect (errno, ENOSYS) == ENOSYS)
|
||||
{
|
||||
#endif /* _POSIX_MAPPED_FILES */
|
||||
/* No mmap; allocate a buffer and read from the file. */
|
||||
alloc = ld_malloced;
|
||||
mmaped = 0;
|
||||
filedata = malloc (st.st_size);
|
||||
if (filedata != NULL)
|
||||
{
|
||||
@@ -217,61 +160,87 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
p += nread;
|
||||
to_read -= nread;
|
||||
}
|
||||
__set_errno (save_err);
|
||||
}
|
||||
else
|
||||
goto puntfd;
|
||||
__set_errno (save_err);
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
}
|
||||
else
|
||||
goto puntfd;
|
||||
}
|
||||
#endif /* _POSIX_MAPPED_FILES */
|
||||
|
||||
/* We have mapped the data, so we no longer need the descriptor. */
|
||||
__close (fd);
|
||||
|
||||
if (__builtin_expect (filedata == NULL, 0))
|
||||
/* We failed to map or read the data. */
|
||||
return;
|
||||
|
||||
newdata = _nl_intern_locale_data (category, filedata, st.st_size);
|
||||
if (__builtin_expect (newdata == NULL, 0))
|
||||
/* Bad data. */
|
||||
if (__builtin_expect (filedata->magic != LIMAGIC (category), 0))
|
||||
/* Bad data file in either byte order. */
|
||||
{
|
||||
puntmap:
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
if (alloc == ld_mapped)
|
||||
__munmap ((caddr_t) filedata, st.st_size);
|
||||
__munmap ((caddr_t) filedata, st.st_size);
|
||||
#endif
|
||||
puntfd:
|
||||
__close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
/* _nl_intern_locale_data leaves us these fields to initialize. */
|
||||
newdata->name = NULL; /* This will be filled if necessary in findlocale.c. */
|
||||
newdata->alloc = alloc;
|
||||
if (__builtin_expect (filedata->nstrings < _nl_category_num_items[category],
|
||||
0)
|
||||
|| (__builtin_expect (sizeof *filedata
|
||||
+ filedata->nstrings * sizeof (unsigned int)
|
||||
>= (size_t) st.st_size, 0)))
|
||||
{
|
||||
/* Insufficient data. */
|
||||
__set_errno (EINVAL);
|
||||
goto puntmap;
|
||||
}
|
||||
|
||||
newdata = malloc (sizeof *newdata
|
||||
+ filedata->nstrings * sizeof (union locale_data_value));
|
||||
if (newdata == NULL)
|
||||
goto puntmap;
|
||||
|
||||
newdata->name = NULL; /* This will be filled if necessary in findlocale.c. */
|
||||
newdata->filedata = (void *) filedata;
|
||||
newdata->filesize = st.st_size;
|
||||
newdata->mmaped = mmaped;
|
||||
newdata->usage_count = 0;
|
||||
newdata->use_translit = 0;
|
||||
newdata->options = NULL;
|
||||
newdata->nstrings = filedata->nstrings;
|
||||
for (cnt = 0; cnt < newdata->nstrings; ++cnt)
|
||||
{
|
||||
off_t idx = filedata->strindex[cnt];
|
||||
if (__builtin_expect (idx > newdata->filesize, 0))
|
||||
{
|
||||
free (newdata);
|
||||
__set_errno (EINVAL);
|
||||
goto puntmap;
|
||||
}
|
||||
if (__builtin_expect (_nl_value_types[category][cnt] == word, 0))
|
||||
{
|
||||
assert (idx % __alignof__ (u_int32_t) == 0);
|
||||
newdata->values[cnt].word =
|
||||
*((u_int32_t *) (newdata->filedata + idx));
|
||||
}
|
||||
else
|
||||
newdata->values[cnt].string = newdata->filedata + idx;
|
||||
}
|
||||
|
||||
__close (fd);
|
||||
file->data = newdata;
|
||||
}
|
||||
|
||||
void
|
||||
internal_function
|
||||
_nl_unload_locale (struct locale_data *locale)
|
||||
{
|
||||
if (locale->private.cleanup)
|
||||
(*locale->private.cleanup) (locale);
|
||||
|
||||
switch (__builtin_expect (locale->alloc, ld_mapped))
|
||||
{
|
||||
case ld_malloced:
|
||||
free ((void *) locale->filedata);
|
||||
break;
|
||||
case ld_mapped:
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
__munmap ((caddr_t) locale->filedata, locale->filesize);
|
||||
break;
|
||||
if (__builtin_expect (locale->mmaped, 1))
|
||||
__munmap ((caddr_t) locale->filedata, locale->filesize);
|
||||
else
|
||||
#endif
|
||||
case ld_archive: /* Nothing to do. */
|
||||
break;
|
||||
}
|
||||
|
||||
if (__builtin_expect (locale->alloc, ld_mapped) != ld_archive)
|
||||
free ((char *) locale->name);
|
||||
free ((void *) locale->filedata);
|
||||
|
||||
free ((char *) locale->options);
|
||||
free ((char *) locale->name);
|
||||
free (locale);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991,92,95-99,2000,01,02 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,92,1995-1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -119,17 +119,12 @@ struct lconv
|
||||
};
|
||||
|
||||
|
||||
__BEGIN_NAMESPACE_STD
|
||||
|
||||
/* Set and/or return the current locale. */
|
||||
extern char *setlocale (int __category, __const char *__locale) __THROW;
|
||||
|
||||
/* Return the numeric/monetary information for the current locale. */
|
||||
extern struct lconv *localeconv (void) __THROW;
|
||||
|
||||
__END_NAMESPACE_STD
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* The concept of one static locale per category is not very well
|
||||
thought out. Many applications will need to process its data using
|
||||
@@ -145,64 +140,22 @@ __END_NAMESPACE_STD
|
||||
/* Get locale datatype definition. */
|
||||
# include <xlocale.h>
|
||||
|
||||
typedef __locale_t locale_t;
|
||||
|
||||
/* Return a reference to a data structure representing a set of locale
|
||||
datasets. Unlike for the CATEGORY parameter for `setlocale' the
|
||||
CATEGORY_MASK parameter here uses a single bit for each category,
|
||||
made by OR'ing together LC_*_MASK bits above. */
|
||||
extern __locale_t newlocale (int __category_mask, __const char *__locale,
|
||||
__locale_t __base) __THROW;
|
||||
|
||||
/* These are the bits that can be set in the CATEGORY_MASK argument to
|
||||
`newlocale'. In the GNU implementation, LC_FOO_MASK has the value
|
||||
of (1 << LC_FOO), but this is not a part of the interface that
|
||||
callers can assume will be true. */
|
||||
# define LC_CTYPE_MASK (1 << __LC_CTYPE)
|
||||
# define LC_NUMERIC_MASK (1 << __LC_NUMERIC)
|
||||
# define LC_TIME_MASK (1 << __LC_TIME)
|
||||
# define LC_COLLATE_MASK (1 << __LC_COLLATE)
|
||||
# define LC_MONETARY_MASK (1 << __LC_MONETARY)
|
||||
# define LC_MESSAGES_MASK (1 << __LC_MESSAGES)
|
||||
# define LC_PAPER_MASK (1 << __LC_PAPER)
|
||||
# define LC_NAME_MASK (1 << __LC_NAME)
|
||||
# define LC_ADDRESS_MASK (1 << __LC_ADDRESS)
|
||||
# define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE)
|
||||
# define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT)
|
||||
# define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION)
|
||||
# define LC_ALL_MASK (LC_CTYPE_MASK \
|
||||
| LC_NUMERIC_MASK \
|
||||
| LC_TIME_MASK \
|
||||
| LC_COLLATE_MASK \
|
||||
| LC_MONETARY_MASK \
|
||||
| LC_MESSAGES_MASK \
|
||||
| LC_PAPER_MASK \
|
||||
| LC_NAME_MASK \
|
||||
| LC_ADDRESS_MASK \
|
||||
| LC_TELEPHONE_MASK \
|
||||
| LC_MEASUREMENT_MASK \
|
||||
| LC_IDENTIFICATION_MASK \
|
||||
)
|
||||
CATEGORY_MASK parameter here uses a single bit for each category.
|
||||
I.e., 1 << LC_CTYPE means to load data for this category. If
|
||||
BASE is non-null the appropriate category information in the BASE
|
||||
record is replaced. */
|
||||
extern __locale_t __newlocale (int __category_mask, __const char *__locale,
|
||||
__locale_t __base) __THROW;
|
||||
|
||||
/* Return a duplicate of the set of locale in DATASET. All usage
|
||||
counters are increased if necessary. */
|
||||
extern __locale_t duplocale (__locale_t __dataset) __THROW;
|
||||
extern __locale_t __duplocale (__locale_t __dataset) __THROW;
|
||||
|
||||
/* Free the data associated with a locale dataset previously returned
|
||||
by a call to `setlocale_r'. */
|
||||
extern void freelocale (__locale_t __dataset) __THROW;
|
||||
|
||||
/* Switch the current thread's locale to DATASET.
|
||||
If DATASET is null, instead just return the current setting.
|
||||
The special value LC_GLOBAL_LOCALE is the initial setting
|
||||
for all threads and can also be installed any time, meaning
|
||||
the thread uses the global settings controlled by `setlocale'. */
|
||||
extern __locale_t uselocale (__locale_t __dataset) __THROW;
|
||||
|
||||
/* This value can be passed to `uselocale' and may be returned by it.
|
||||
Passing this value to any other function has undefined behavior. */
|
||||
# define LC_GLOBAL_LOCALE ((__locale_t) -1L)
|
||||
|
||||
extern void __freelocale (__locale_t __dataset) __THROW;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
@@ -29,7 +29,7 @@ __localeconv (void)
|
||||
result.decimal_point = (char *) _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
||||
result.thousands_sep = (char *) _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
||||
result.grouping = (char *) _NL_CURRENT (LC_NUMERIC, GROUPING);
|
||||
if (*result.grouping == CHAR_MAX || *result.grouping == (char) -1)
|
||||
if (*result.grouping == CHAR_MAX || *result.grouping == -1)
|
||||
result.grouping = (char *) "";
|
||||
|
||||
result.int_curr_symbol = (char *) _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
|
||||
@@ -39,7 +39,7 @@ __localeconv (void)
|
||||
result.mon_thousands_sep = (char *) _NL_CURRENT (LC_MONETARY,
|
||||
MON_THOUSANDS_SEP);
|
||||
result.mon_grouping = (char *) _NL_CURRENT (LC_MONETARY, MON_GROUPING);
|
||||
if (*result.mon_grouping == CHAR_MAX || *result.mon_grouping == (char) -1)
|
||||
if (*result.mon_grouping == CHAR_MAX || *result.mon_grouping == -1)
|
||||
result.mon_grouping = (char *) "";
|
||||
result.positive_sign = (char *) _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
|
||||
result.negative_sign = (char *) _NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declarations for internal libc locale interfaces
|
||||
Copyright (C) 1995-2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 96, 97, 98, 99,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -23,11 +23,13 @@
|
||||
#include <stddef.h>
|
||||
#include <langinfo.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* This has to be changed whenever a new locale is defined. */
|
||||
#define __LC_LAST 13
|
||||
|
||||
#include <intl/loadinfo.h> /* For loaded_l10nfile definition. */
|
||||
|
||||
/* Magic number at the beginning of a locale data file for CATEGORY. */
|
||||
@@ -47,38 +49,21 @@ struct locale_data
|
||||
const char *name;
|
||||
const char *filedata; /* Region mapping the file data. */
|
||||
off_t filesize; /* Size of the file (and the region). */
|
||||
enum /* Flavor of storage used for those. */
|
||||
{
|
||||
ld_malloced, /* Both are malloc'd. */
|
||||
ld_mapped, /* name is malloc'd, filedata mmap'd */
|
||||
ld_archive /* Both point into mmap'd archive regions. */
|
||||
} alloc;
|
||||
|
||||
/* This provides a slot for category-specific code to cache data computed
|
||||
about this locale. That code can set a cleanup function to deallocate
|
||||
the data. */
|
||||
struct
|
||||
{
|
||||
void (*cleanup) (struct locale_data *) internal_function;
|
||||
union
|
||||
{
|
||||
void *data;
|
||||
struct lc_time_data *time;
|
||||
const struct gconv_fcts *ctype;
|
||||
} u;
|
||||
} private;
|
||||
int mmaped; /* If nonzero the data is mmaped. */
|
||||
|
||||
unsigned int usage_count; /* Counter for users. */
|
||||
|
||||
int use_translit; /* Nonzero if the mb*towv*() and wc*tomb()
|
||||
functions should use transliteration. */
|
||||
const char *options; /* Extra options from the locale name,
|
||||
not used in the path to the locale data. */
|
||||
|
||||
unsigned int nstrings; /* Number of strings below. */
|
||||
union locale_data_value
|
||||
{
|
||||
const uint32_t *wstr;
|
||||
const char *string;
|
||||
unsigned int word; /* Note endian issues vs 64-bit pointers. */
|
||||
unsigned int word;
|
||||
}
|
||||
values __flexarr; /* Items, usually pointers into `filedata'. */
|
||||
};
|
||||
@@ -138,20 +123,6 @@ struct era_entry
|
||||
-1 indicates that year number is higher in the past. (like B.C.) */
|
||||
};
|
||||
|
||||
/* Structure caching computed data about information from LC_TIME.
|
||||
The `private.time' member of `struct locale_data' points to this. */
|
||||
struct lc_time_data
|
||||
{
|
||||
struct era_entry *eras;
|
||||
size_t num_eras;
|
||||
int era_initialized;
|
||||
|
||||
const char **alt_digits;
|
||||
const wchar_t **walt_digits;
|
||||
int alt_digits_initialized;
|
||||
int walt_digits_initialized;
|
||||
};
|
||||
|
||||
|
||||
/* LC_CTYPE specific:
|
||||
Hardwired indices for standard wide character translation mappings. */
|
||||
@@ -169,194 +140,77 @@ enum
|
||||
#define _ISCTYPE(c, desc) \
|
||||
(((((const uint32_t *) (desc)) - 8)[(c) >> 5] >> ((c) & 0x1f)) & 1)
|
||||
|
||||
extern const char *const _nl_category_names[__LC_LAST] attribute_hidden;
|
||||
extern const size_t _nl_category_name_sizes[__LC_LAST] attribute_hidden;
|
||||
|
||||
/* Name of the standard locales. */
|
||||
extern const char _nl_C_name[] attribute_hidden;
|
||||
extern const char _nl_POSIX_name[] attribute_hidden;
|
||||
|
||||
/* The standard codeset. */
|
||||
extern const char _nl_C_codeset[] attribute_hidden;
|
||||
|
||||
/* This is the internal locale_t object that holds the global locale
|
||||
controlled by calls to setlocale. A thread's TSD locale pointer
|
||||
points to this when `uselocale (LC_GLOBAL_LOCALE)' is in effect. */
|
||||
extern struct __locale_struct _nl_global_locale attribute_hidden;
|
||||
|
||||
/* This fetches the thread-local locale_t pointer, either one set with
|
||||
uselocale or &_nl_global_locale. */
|
||||
#define _NL_CURRENT_LOCALE ((__locale_t) __libc_tsd_get (LOCALE))
|
||||
#include <bits/libc-tsd.h>
|
||||
__libc_tsd_define (extern, LOCALE)
|
||||
|
||||
|
||||
/* For static linking it is desireable to avoid always linking in the code
|
||||
and data for every category when we can tell at link time that they are
|
||||
unused. We can manage this playing some tricks with weak references.
|
||||
But with thread-local locale settings, it becomes quite ungainly unless
|
||||
we can use __thread variables. So only in that case do we attempt this. */
|
||||
#if !defined SHARED && defined HAVE___THREAD && defined HAVE_WEAK_SYMBOLS
|
||||
# include <tls.h>
|
||||
# if USE_TLS
|
||||
# define NL_CURRENT_INDIRECT 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NL_CURRENT_INDIRECT
|
||||
|
||||
/* For each category declare the thread-local variable for the current
|
||||
locale data. This has an extra indirection so it points at the
|
||||
__locales[CATEGORY] element in either _nl_global_locale or the current
|
||||
locale object set by uselocale, which points at the actual data. The
|
||||
reason for having these variables is so that references to particular
|
||||
categories will link in the lc-CATEGORY.c module to define this symbol,
|
||||
and we arrange that linking that module is what brings in all the code
|
||||
associated with this category. */
|
||||
/* For each category declare the variable for the current locale data. */
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
extern __thread struct locale_data *const *_nl_current_##category \
|
||||
attribute_hidden attribute_tls_model_ie;
|
||||
extern struct locale_data *_nl_current_##category;
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
|
||||
/* Return a pointer to the current `struct locale_data' for CATEGORY. */
|
||||
#define _NL_CURRENT_DATA(category) (*_nl_current_##category)
|
||||
extern const char *const _nl_category_names[__LC_LAST];
|
||||
extern const size_t _nl_category_name_sizes[__LC_LAST];
|
||||
extern struct locale_data * *const _nl_current[__LC_LAST];
|
||||
|
||||
/* Name of the standard locales. */
|
||||
extern const char _nl_C_name[];
|
||||
extern const char _nl_POSIX_name[];
|
||||
|
||||
/* The standard codeset. */
|
||||
extern const char _nl_C_codeset[];
|
||||
|
||||
/* Extract the current CATEGORY locale's string for ITEM. */
|
||||
#define _NL_CURRENT(category, item) \
|
||||
((*_nl_current_##category)->values[_NL_ITEM_INDEX (item)].string)
|
||||
(_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
|
||||
|
||||
/* Extract the current CATEGORY locale's string for ITEM. */
|
||||
#define _NL_CURRENT_WSTR(category, item) \
|
||||
((wchar_t *) (*_nl_current_##category)->values[_NL_ITEM_INDEX (item)].wstr)
|
||||
((wchar_t *) (_nl_current_##category->values[_NL_ITEM_INDEX (item)].wstr))
|
||||
|
||||
/* Extract the current CATEGORY locale's word for ITEM. */
|
||||
#define _NL_CURRENT_WORD(category, item) \
|
||||
((uint32_t) (*_nl_current_##category)->values[_NL_ITEM_INDEX (item)].word)
|
||||
(_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
|
||||
|
||||
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
|
||||
#define _NL_CURRENT_DEFINE(category) \
|
||||
__thread struct locale_data *const *_nl_current_##category \
|
||||
attribute_hidden = &_nl_global_locale.__locales[category]; \
|
||||
asm (_NL_CURRENT_DEFINE_STRINGIFY (ASM_GLOBAL_DIRECTIVE) \
|
||||
" " __SYMBOL_PREFIX "_nl_current_" #category "_used\n" \
|
||||
_NL_CURRENT_DEFINE_ABS (_nl_current_##category##_used, 1));
|
||||
#define _NL_CURRENT_DEFINE_STRINGIFY(x) _NL_CURRENT_DEFINE_STRINGIFY_1 (x)
|
||||
#define _NL_CURRENT_DEFINE_STRINGIFY_1(x) #x
|
||||
#ifdef HAVE_ASM_SET_DIRECTIVE
|
||||
# define _NL_CURRENT_DEFINE_ABS(sym, val) ".set " #sym ", " #val
|
||||
#else
|
||||
# define _NL_CURRENT_DEFINE_ABS(sym, val) #sym " = " #val
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* All categories are always loaded in the shared library, so there is no
|
||||
point in having lots of separate symbols for linking. */
|
||||
|
||||
/* Return a pointer to the current `struct locale_data' for CATEGORY. */
|
||||
# define _NL_CURRENT_DATA(category) \
|
||||
(_NL_CURRENT_LOCALE->__locales[category])
|
||||
|
||||
/* Extract the current CATEGORY locale's string for ITEM. */
|
||||
# define _NL_CURRENT(category, item) \
|
||||
(_NL_CURRENT_DATA (category)->values[_NL_ITEM_INDEX (item)].string)
|
||||
|
||||
/* Extract the current CATEGORY locale's string for ITEM. */
|
||||
# define _NL_CURRENT_WSTR(category, item) \
|
||||
((wchar_t *) _NL_CURRENT_DATA (category)->values[_NL_ITEM_INDEX (item)].wstr)
|
||||
|
||||
/* Extract the current CATEGORY locale's word for ITEM. */
|
||||
# define _NL_CURRENT_WORD(category, item) \
|
||||
((uint32_t) _NL_CURRENT_DATA (category)->values[_NL_ITEM_INDEX (item)].word)
|
||||
|
||||
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
|
||||
# define _NL_CURRENT_DEFINE(category) \
|
||||
/* No per-category variable here. */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Default search path if no LOCPATH environment variable. */
|
||||
extern const char _nl_default_locale_path[] attribute_hidden;
|
||||
extern struct locale_data _nl_C_##category; \
|
||||
struct locale_data *_nl_current_##category = &_nl_C_##category
|
||||
|
||||
/* Load the locale data for CATEGORY from the file specified by *NAME.
|
||||
If *NAME is "", use environment variables as specified by POSIX, and
|
||||
fill in *NAME with the actual name used. If LOCALE_PATH is not null,
|
||||
those directories are searched for the locale files. If it's null,
|
||||
the locale archive is checked first and then _nl_default_locale_path
|
||||
is searched for locale files. */
|
||||
If *NAME is "", use environment variables as specified by POSIX,
|
||||
and fill in *NAME with the actual name used. The directories
|
||||
listed in LOCALE_PATH are searched for the locale files. */
|
||||
extern struct locale_data *_nl_find_locale (const char *locale_path,
|
||||
size_t locale_path_len,
|
||||
int category, const char **name)
|
||||
internal_function attribute_hidden;
|
||||
int category, const char **name);
|
||||
|
||||
/* Try to load the file described by FILE. */
|
||||
extern void _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
internal_function attribute_hidden;
|
||||
extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
|
||||
|
||||
/* Free all resource. */
|
||||
extern void _nl_unload_locale (struct locale_data *locale)
|
||||
internal_function attribute_hidden;
|
||||
extern void _nl_unload_locale (struct locale_data *locale);
|
||||
|
||||
/* Free the locale and give back all memory if the usage count is one. */
|
||||
extern void _nl_remove_locale (int locale, struct locale_data *data)
|
||||
internal_function attribute_hidden;
|
||||
|
||||
/* Find the locale *NAMEP in the locale archive, and return the
|
||||
internalized data structure for its CATEGORY data. If this locale has
|
||||
already been loaded from the archive, just returns the existing data
|
||||
structure. If successful, sets *NAMEP to point directly into the mapped
|
||||
archive string table; that way, the next call can short-circuit strcmp. */
|
||||
extern struct locale_data *_nl_load_locale_from_archive (int category,
|
||||
const char **namep)
|
||||
internal_function attribute_hidden;
|
||||
|
||||
/* Subroutine of setlocale's __libc_subfreeres hook. */
|
||||
extern void _nl_archive_subfreeres (void) attribute_hidden;
|
||||
|
||||
/* Validate the contents of a locale file and set up the in-core
|
||||
data structure to point into the data. This leaves the `alloc'
|
||||
and `name' fields uninitialized, for the caller to fill in.
|
||||
If any bogons are detected in the data, this will refuse to
|
||||
intern it, and return a null pointer instead. */
|
||||
extern struct locale_data *_nl_intern_locale_data (int category,
|
||||
const void *data,
|
||||
size_t datasize)
|
||||
internal_function attribute_hidden;
|
||||
extern void _nl_remove_locale (int locale, struct locale_data *data);
|
||||
|
||||
|
||||
/* Return `era' entry which corresponds to TP. Used in strftime. */
|
||||
extern struct era_entry *_nl_get_era_entry (const struct tm *tp,
|
||||
struct locale_data *lc_time)
|
||||
internal_function attribute_hidden;
|
||||
extern struct era_entry *_nl_get_era_entry (const struct tm *tp);
|
||||
|
||||
/* Return `era' cnt'th entry . Used in strptime. */
|
||||
extern struct era_entry *_nl_select_era_entry (int cnt,
|
||||
struct locale_data *lc_time)
|
||||
internal_function attribute_hidden;
|
||||
extern struct era_entry *_nl_select_era_entry (int cnt);
|
||||
|
||||
/* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */
|
||||
extern const char *_nl_get_alt_digit (unsigned int number,
|
||||
struct locale_data *lc_time)
|
||||
internal_function attribute_hidden;
|
||||
extern const char *_nl_get_alt_digit (unsigned int number);
|
||||
|
||||
/* Similar, but now for wide characters. */
|
||||
extern const wchar_t *_nl_get_walt_digit (unsigned int number,
|
||||
struct locale_data *lc_time)
|
||||
internal_function attribute_hidden;
|
||||
extern const wchar_t *_nl_get_walt_digit (unsigned int number);
|
||||
|
||||
/* Parse string as alternative digit and return numeric value. */
|
||||
extern int _nl_parse_alt_digit (const char **strp,
|
||||
struct locale_data *lc_time)
|
||||
internal_function attribute_hidden;
|
||||
extern int _nl_parse_alt_digit (const char **strp);
|
||||
|
||||
/* Postload processing. */
|
||||
extern void _nl_postload_ctype (void);
|
||||
|
||||
/* Functions used for the `private.cleanup' hook. */
|
||||
extern void _nl_cleanup_time (struct locale_data *)
|
||||
internal_function attribute_hidden;
|
||||
extern void _nl_postload_time (void);
|
||||
|
||||
|
||||
#endif /* localeinfo.h */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Return a reference to locale information record.
|
||||
Copyright (C) 1996,1997,1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "localeinfo.h"
|
||||
|
||||
|
||||
/* Constant data defined in setlocale.c. */
|
||||
extern struct locale_data *const _nl_C[];
|
||||
|
||||
/* Use this when we come along an error. */
|
||||
#define ERROR_RETURN \
|
||||
do { \
|
||||
@@ -46,7 +48,6 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
size_t locale_path_len;
|
||||
const char *locpath_var;
|
||||
int cnt;
|
||||
size_t names_len;
|
||||
|
||||
/* We treat LC_ALL in the same way as if all bits were set. */
|
||||
if (category_mask == 1 << LC_ALL)
|
||||
@@ -60,23 +61,16 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
if (locale == NULL)
|
||||
ERROR_RETURN;
|
||||
|
||||
if (base == &_nl_C_locobj)
|
||||
/* We're to modify BASE, returned for a previous call with "C".
|
||||
We can't really modify the read-only structure, so instead
|
||||
start over by copying it. */
|
||||
base = NULL;
|
||||
|
||||
if ((base == NULL || category_mask == (1 << __LC_LAST) - 1 - (1 << LC_ALL))
|
||||
&& (category_mask == 0 || !strcmp (locale, "C")))
|
||||
/* Asking for the "C" locale needn't allocate a new object. */
|
||||
return &_nl_C_locobj;
|
||||
|
||||
/* Allocate memory for the result. */
|
||||
if (base != NULL)
|
||||
result = *base;
|
||||
else
|
||||
/* Fill with pointers to C locale data. */
|
||||
result = _nl_C_locobj;
|
||||
{
|
||||
/* Fill with pointers to C locale data. */
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
if (cnt != LC_ALL)
|
||||
result.__locales[cnt] = _nl_C[cnt];
|
||||
}
|
||||
|
||||
/* If no category is to be set we return BASE if available or a
|
||||
dataset using the C locale data. */
|
||||
@@ -93,22 +87,19 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
/* We perhaps really have to load some data. So we determine the
|
||||
path in which to look for the data now. The environment variable
|
||||
`LOCPATH' must only be used when the binary has no SUID or SGID
|
||||
bit set. If using the default path, we tell _nl_find_locale
|
||||
by passing null and it can check the canonical locale archive. */
|
||||
bit set. */
|
||||
locale_path = NULL;
|
||||
locale_path_len = 0;
|
||||
|
||||
locpath_var = getenv ("LOCPATH");
|
||||
if (locpath_var != NULL && locpath_var[0] != '\0')
|
||||
{
|
||||
if (__argz_create_sep (locpath_var, ':',
|
||||
&locale_path, &locale_path_len) != 0)
|
||||
return NULL;
|
||||
if (__argz_create_sep (locpath_var, ':',
|
||||
&locale_path, &locale_path_len) != 0)
|
||||
return NULL;
|
||||
|
||||
if (__argz_add_sep (&locale_path, &locale_path_len,
|
||||
_nl_default_locale_path, ':') != 0)
|
||||
return NULL;
|
||||
}
|
||||
if (__argz_append (&locale_path, &locale_path_len,
|
||||
LOCALEDIR, sizeof (LOCALEDIR)) != 0)
|
||||
return NULL;
|
||||
|
||||
/* Get the names for the locales we are interested in. We either
|
||||
allow a composite name or a single name. */
|
||||
@@ -120,7 +111,6 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
/* This is a composite name. Make a copy and split it up. */
|
||||
char *np = strdupa (locale);
|
||||
char *cp;
|
||||
int specified_mask = 0;
|
||||
|
||||
while ((cp = strchr (np, '=')) != NULL)
|
||||
{
|
||||
@@ -135,7 +125,6 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
ERROR_RETURN;
|
||||
|
||||
/* Found the category this clause sets. */
|
||||
specified_mask |= 1 << cnt;
|
||||
newnames[cnt] = ++cp;
|
||||
cp = strchr (cp, ';');
|
||||
if (cp != NULL)
|
||||
@@ -149,105 +138,37 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
break;
|
||||
}
|
||||
|
||||
if (category_mask &~ specified_mask)
|
||||
/* The composite name did not specify all categories we need. */
|
||||
ERROR_RETURN;
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
if (cnt != LC_ALL
|
||||
&& (category_mask & 1 << cnt) != 0 && newnames[cnt] == locale)
|
||||
/* The composite name did not specify the category we need. */
|
||||
ERROR_RETURN;
|
||||
}
|
||||
|
||||
/* Now process all categories we are interested in. */
|
||||
names_len = 0;
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
{
|
||||
if ((category_mask & 1 << cnt) != 0)
|
||||
{
|
||||
result.__locales[cnt] = _nl_find_locale (locale_path,
|
||||
locale_path_len,
|
||||
cnt, &newnames[cnt]);
|
||||
if (result.__locales[cnt] == NULL)
|
||||
{
|
||||
free_cnt_data_and_exit:
|
||||
while (cnt-- > 0)
|
||||
if (((category_mask & 1 << cnt) != 0)
|
||||
&& result.__locales[cnt]->usage_count != UNDELETABLE)
|
||||
/* We can remove the data. */
|
||||
_nl_remove_locale (cnt, result.__locales[cnt]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (newnames[cnt] != _nl_C_name)
|
||||
names_len += strlen (newnames[cnt]) + 1;
|
||||
}
|
||||
else if (cnt != LC_ALL && result.__names[cnt] != _nl_C_name)
|
||||
/* Tally up the unchanged names from BASE as well. */
|
||||
names_len += strlen (result.__names[cnt]) + 1;
|
||||
}
|
||||
|
||||
/* We successfully loaded all required data. Allocate a new structure.
|
||||
We can't just reuse the BASE pointer, because the name strings are
|
||||
changing and we need the old name string area intact so we can copy
|
||||
out of it into the new one without overlap problems should some
|
||||
category's name be getting longer. */
|
||||
result_ptr = malloc (sizeof (struct __locale_struct) + names_len);
|
||||
if (result_ptr == NULL)
|
||||
{
|
||||
cnt = __LC_LAST;
|
||||
goto free_cnt_data_and_exit;
|
||||
}
|
||||
if (cnt != LC_ALL && (category_mask & 1 << cnt) != 0)
|
||||
{
|
||||
result.__locales[cnt] = _nl_find_locale (locale_path, locale_path_len,
|
||||
cnt, &newnames[cnt]);
|
||||
if (result.__locales[cnt] == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We successfully loaded all required data. */
|
||||
if (base == NULL)
|
||||
{
|
||||
/* Fill in this new structure from scratch. */
|
||||
/* Allocate new structure. */
|
||||
result_ptr = (__locale_t) malloc (sizeof (struct __locale_struct));
|
||||
if (result_ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
char *namep = (char *) (result_ptr + 1);
|
||||
|
||||
/* Install copied new names in the new structure's __names array.
|
||||
If resolved to "C", that is already in RESULT.__names to start. */
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
if ((category_mask & 1 << cnt) != 0 && newnames[cnt] != _nl_C_name)
|
||||
{
|
||||
result.__names[cnt] = namep;
|
||||
namep = __stpcpy (namep, newnames[cnt]) + 1;
|
||||
}
|
||||
|
||||
*result_ptr = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We modify the base structure. */
|
||||
/* We modify the base structure. */
|
||||
result_ptr = base;
|
||||
|
||||
char *namep = (char *) (result_ptr + 1);
|
||||
|
||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||
if ((category_mask & 1 << cnt) != 0)
|
||||
{
|
||||
if (base->__locales[cnt]->usage_count != UNDELETABLE)
|
||||
/* We can remove the old data. */
|
||||
_nl_remove_locale (cnt, base->__locales[cnt]);
|
||||
result_ptr->__locales[cnt] = result.__locales[cnt];
|
||||
|
||||
if (newnames[cnt] == _nl_C_name)
|
||||
result_ptr->__names[cnt] = _nl_C_name;
|
||||
else
|
||||
{
|
||||
result_ptr->__names[cnt] = namep;
|
||||
namep = __stpcpy (namep, newnames[cnt]) + 1;
|
||||
}
|
||||
}
|
||||
else if (cnt != LC_ALL)
|
||||
{
|
||||
/* The RESULT members point into the old BASE structure. */
|
||||
result_ptr->__locales[cnt] = result.__locales[cnt];
|
||||
if (result.__names[cnt] == _nl_C_name)
|
||||
result_ptr->__names[cnt] = _nl_C_name;
|
||||
else
|
||||
{
|
||||
result_ptr->__names[cnt] = namep;
|
||||
namep = __stpcpy (namep, result.__names[cnt]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
free (base);
|
||||
}
|
||||
*result_ptr = result;
|
||||
|
||||
/* Update the special members. */
|
||||
update:
|
||||
@@ -263,4 +184,3 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
||||
|
||||
return result_ptr;
|
||||
}
|
||||
weak_alias (__newlocale, newlocale)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* User interface for extracting locale-dependent parameters.
|
||||
Copyright (C) 1995,96,97,99,2000,01,02 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -47,20 +47,8 @@ nl_langinfo (item)
|
||||
|
||||
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
|
||||
data = l->__locales[category];
|
||||
#elif defined NL_CURRENT_INDIRECT
|
||||
/* Make direct reference to every _nl_current_CATEGORY symbol,
|
||||
since we know only at runtime which categories are used. */
|
||||
switch (category)
|
||||
{
|
||||
# define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
case category: data = *_nl_current_##category; break;
|
||||
# include "categories.def"
|
||||
# undef DEFINE_CATEGORY
|
||||
default: /* Should be impossible. */
|
||||
return (char *) "";
|
||||
}
|
||||
#else
|
||||
data = _NL_CURRENT_DATA (category);
|
||||
data = *_nl_current[category];
|
||||
#endif
|
||||
|
||||
if (index >= data->nstrings)
|
||||
@@ -70,8 +58,3 @@ nl_langinfo (item)
|
||||
/* Return the string for the specified item. */
|
||||
return (char *) data->values[index].string;
|
||||
}
|
||||
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
|
||||
weak_alias (__nl_langinfo_l, nl_langinfo_l)
|
||||
#else
|
||||
libc_hidden_def (nl_langinfo)
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -28,9 +28,11 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "charmap-dir.h"
|
||||
|
||||
extern void *xmalloc (size_t n);
|
||||
extern void *xrealloc (void *p, size_t n);
|
||||
|
||||
/* The data type of a charmap directory being traversed. */
|
||||
struct charmap_dir
|
||||
{
|
||||
@@ -56,8 +58,8 @@ charmap_opendir (const char *directory)
|
||||
dir = opendir (directory);
|
||||
if (dir == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (1, errno, gettext ("\
|
||||
cannot read character map directory `%s'"), directory));
|
||||
error (1, errno, gettext ("cannot read character map directory `%s'"),
|
||||
directory);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -88,13 +90,13 @@ charmap_readdir (CHARMAP_DIR *cdir)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
struct dirent64 *dirent;
|
||||
struct dirent *dirent;
|
||||
size_t len;
|
||||
size_t size;
|
||||
char *filename;
|
||||
mode_t mode;
|
||||
|
||||
dirent = readdir64 (cdir->dir);
|
||||
dirent = readdir (cdir->dir);
|
||||
if (dirent == NULL)
|
||||
return NULL;
|
||||
if (strcmp (dirent->d_name, ".") == 0)
|
||||
@@ -224,7 +226,7 @@ charmap_open (const char *directory, const char *name)
|
||||
*p++ = '/';
|
||||
p = stpcpy (p, name);
|
||||
|
||||
stream = fopen (pathname, "rm");
|
||||
stream = fopen (pathname, "r");
|
||||
if (stream != NULL)
|
||||
return stream;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
|
||||
|
||||
@@ -29,9 +29,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <error.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "error.h"
|
||||
#include "linereader.h"
|
||||
#include "charmap.h"
|
||||
#include "charmap-dir.h"
|
||||
@@ -44,6 +43,8 @@
|
||||
#include "charmap-kw.h"
|
||||
|
||||
|
||||
extern void *xmalloc (size_t __n);
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static struct charmap_t *parse_charmap (struct linereader *cmfile,
|
||||
int verbose, int be_quiet);
|
||||
@@ -116,14 +117,18 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default)
|
||||
cmfile = cmlr_open (path, filename, charmap_hash);
|
||||
|
||||
if (cmfile == NULL)
|
||||
/* Try without the "/charmaps" part. */
|
||||
cmfile = cmlr_open (next, filename, charmap_hash);
|
||||
{
|
||||
/* Try without the "/charmaps" part. */
|
||||
cmfile = cmlr_open (next, filename, charmap_hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cmfile == NULL)
|
||||
/* Try the default directory. */
|
||||
cmfile = cmlr_open (CHARMAP_PATH, filename, charmap_hash);
|
||||
{
|
||||
/* Try the default directory. */
|
||||
cmfile = cmlr_open (CHARMAP_PATH, filename, charmap_hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,8 +137,7 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default)
|
||||
result = parse_charmap (cmfile, verbose, be_quiet);
|
||||
|
||||
if (result == NULL && !be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, errno, _("\
|
||||
character map file `%s' not found"), filename));
|
||||
error (0, errno, _("character map file `%s' not found"), filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,15 +194,10 @@ character map file `%s' not found"), filename));
|
||||
result = parse_charmap (cmfile, verbose, be_quiet);
|
||||
|
||||
if (result == NULL)
|
||||
WITH_CUR_LOCALE (error (4, errno, _("\
|
||||
default character map file `%s' not found"), DEFAULT_CHARMAP));
|
||||
error (4, errno, _("default character map file `%s' not found"),
|
||||
DEFAULT_CHARMAP);
|
||||
}
|
||||
|
||||
if (result != NULL && result->code_set_name == NULL)
|
||||
/* The input file does not specify a code set name. This
|
||||
shouldn't happen but we should cope with it. */
|
||||
result->code_set_name = basename (filename);
|
||||
|
||||
/* Test of ASCII compatibility of locale encoding.
|
||||
|
||||
Verify that the encoding to be used in a locale is ASCII compatible,
|
||||
@@ -244,17 +243,17 @@ default character map file `%s' not found"), DEFAULT_CHARMAP));
|
||||
|
||||
do
|
||||
{
|
||||
struct charseq *seq = charmap_find_symbol (result, p, 1);
|
||||
struct charseq * seq = charmap_find_symbol (result, p, 1);
|
||||
|
||||
if (seq == NULL || seq->ucs4 != (uint32_t) *p)
|
||||
if (seq == NULL || seq->ucs4 != *p)
|
||||
failed = 1;
|
||||
}
|
||||
while (*p++ != '\0');
|
||||
|
||||
if (failed)
|
||||
WITH_CUR_LOCALE (fprintf (stderr, _("\
|
||||
fprintf (stderr, _("\
|
||||
character map `%s' is not ASCII compatible, locale not ISO C compliant\n"),
|
||||
result->code_set_name));
|
||||
result->code_set_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -299,7 +298,7 @@ parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
|
||||
while (1)
|
||||
{
|
||||
/* What's on? */
|
||||
struct token *now = lr_token (cmfile, NULL, NULL, NULL, verbose);
|
||||
struct token *now = lr_token (cmfile, NULL, NULL, verbose);
|
||||
enum token_t nowtok = now->tok;
|
||||
struct token *arg;
|
||||
|
||||
@@ -329,9 +328,9 @@ parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
|
||||
if (result->mb_cur_min > result->mb_cur_max)
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
|
||||
cmfile->fname));
|
||||
cmfile->fname);
|
||||
|
||||
result->mb_cur_min = result->mb_cur_max;
|
||||
}
|
||||
@@ -357,7 +356,7 @@ parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
|
||||
}
|
||||
|
||||
/* We know that we need an argument. */
|
||||
arg = lr_token (cmfile, NULL, NULL, NULL, verbose);
|
||||
arg = lr_token (cmfile, NULL, NULL, verbose);
|
||||
|
||||
switch (nowtok)
|
||||
{
|
||||
@@ -834,16 +833,14 @@ only WIDTH definitions are allowed to follow the CHARMAP definition"));
|
||||
continue;
|
||||
|
||||
default:
|
||||
WITH_CUR_LOCALE (error (5, 0, _("%s: error in state machine"),
|
||||
__FILE__));
|
||||
error (5, 0, _("%s: error in state machine"), __FILE__);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (state != 91 && !be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: premature end of file"),
|
||||
cmfile->fname));
|
||||
error (0, 0, _("%s: premature end of file"), cmfile->fname);
|
||||
|
||||
lr_close (cmfile);
|
||||
|
||||
@@ -875,16 +872,6 @@ new_width (struct linereader *cmfile, struct charmap_t *result,
|
||||
lr_error (cmfile, _("unknown character `%s'"), to);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure the number of bytes for the end points of the range
|
||||
is correct. */
|
||||
if (from_val->nbytes != to_val->nbytes)
|
||||
{
|
||||
lr_error (cmfile, _("\
|
||||
number of bytes for byte sequence of beginning and end of range not the same: %d vs %d"),
|
||||
from_val->nbytes, to_val->nbytes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (result->nwidth_rules >= result->nwidth_rules_max)
|
||||
@@ -962,7 +949,7 @@ charmap_new_char (struct linereader *lr, struct charmap_t *cm,
|
||||
errno = 0;
|
||||
newp->ucs4 = strtoul (from + 1, &endp, 16);
|
||||
if (endp - from != len1
|
||||
|| (newp->ucs4 == ~((uint32_t) 0) && errno == ERANGE)
|
||||
|| (newp->ucs4 == ULONG_MAX && errno == ERANGE)
|
||||
|| newp->ucs4 >= 0x80000000)
|
||||
/* This wasn't successful. Signal this name cannot be a
|
||||
correct UCS value. */
|
||||
@@ -1008,9 +995,9 @@ hexadecimal range format should use only capital characters"));
|
||||
|
||||
errno = 0;
|
||||
from_nr = strtoul (&from[prefix_len], &from_end, decimal_ellipsis ? 10 : 16);
|
||||
if (*from_end != '\0' || (from_nr == UINT_MAX && errno == ERANGE)
|
||||
if (*from_end != '\0' || (from_nr == ULONG_MAX && errno == ERANGE)
|
||||
|| ((to_nr = strtoul (&to[prefix_len], &to_end,
|
||||
decimal_ellipsis ? 10 : 16)) == UINT_MAX
|
||||
decimal_ellipsis ? 10 : 16)) == ULONG_MAX
|
||||
&& errno == ERANGE)
|
||||
|| *to_end != '\0')
|
||||
{
|
||||
@@ -1057,7 +1044,7 @@ hexadecimal range format should use only capital characters"));
|
||||
errno = 0;
|
||||
newp->ucs4 = strtoul (name_end + 1, &endp, 16);
|
||||
if (endp - name_end != len1
|
||||
|| (newp->ucs4 == ~((uint32_t) 0) && errno == ERANGE)
|
||||
|| (newp->ucs4 == ULONG_MAX && errno == ERANGE)
|
||||
|| newp->ucs4 >= 0x80000000)
|
||||
/* This wasn't successful. Signal this name cannot be a
|
||||
correct UCS value. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -56,8 +55,6 @@ static struct
|
||||
{
|
||||
#define DEFINE_LANGUAGE_CODE(Name, Ab, Term, Lib) \
|
||||
{ #Ab, #Term, #Lib },
|
||||
#define DEFINE_LANGUAGE_CODE3(Name, Term, Lib) \
|
||||
{ "", #Term, #Lib },
|
||||
#include "iso-639.def"
|
||||
};
|
||||
|
||||
@@ -98,7 +95,7 @@ address_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
address_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_address_t *address = locale->categories[LC_ADDRESS].address;
|
||||
size_t cnt;
|
||||
@@ -131,8 +128,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (address == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_ADDRESS"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_ADDRESS");
|
||||
address_startup (NULL, locale, 0);
|
||||
address = locale->categories[LC_ADDRESS].address;
|
||||
nothing = 1;
|
||||
@@ -142,8 +139,8 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
if (address->postal_fmt == NULL)
|
||||
{
|
||||
if (! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "postal_fmt"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "postal_fmt");
|
||||
/* Use as the default value the value of the i18n locale. */
|
||||
address->postal_fmt = "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N";
|
||||
}
|
||||
@@ -154,8 +151,8 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
const char *cp = address->postal_fmt;
|
||||
|
||||
if (*cp == '\0')
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "postal_fmt"));
|
||||
error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "postal_fmt");
|
||||
else
|
||||
while (*cp != '\0')
|
||||
{
|
||||
@@ -166,9 +163,9 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
++cp;
|
||||
if (strchr ("afdbshNtreCzTSc%", *cp) == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: invalid escape `%%%c' sequence in field `%s'"),
|
||||
"LC_ADDRESS", *cp, "postal_fmt"));
|
||||
"LC_ADDRESS", *cp, "postal_fmt");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -180,8 +177,7 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
if (address->cat == NULL) \
|
||||
{ \
|
||||
if (verbose && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_ADDRESS", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", #cat); \
|
||||
address->cat = ""; \
|
||||
}
|
||||
|
||||
@@ -198,16 +194,16 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
if (address->lang_term == NULL)
|
||||
{
|
||||
if (verbose && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "lang_term"));
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS",
|
||||
"lang_term");
|
||||
address->lang_term = "";
|
||||
cnt = sizeof (iso639) / sizeof (iso639[0]);
|
||||
}
|
||||
else if (address->lang_term[0] == '\0')
|
||||
{
|
||||
if (verbose)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "lang_term"));
|
||||
error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "lang_term");
|
||||
cnt = sizeof (iso639) / sizeof (iso639[0]);
|
||||
}
|
||||
else
|
||||
@@ -217,23 +213,22 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
if (strcmp (address->lang_term, iso639[cnt].term) == 0)
|
||||
break;
|
||||
if (cnt == sizeof (iso639) / sizeof (iso639[0]))
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: terminology language code `%s' not defined"),
|
||||
"LC_ADDRESS", address->lang_term));
|
||||
"LC_ADDRESS", address->lang_term);
|
||||
}
|
||||
|
||||
if (address->lang_ab == NULL)
|
||||
{
|
||||
if (verbose && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "lang_ab"));
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "lang_ab");
|
||||
address->lang_ab = "";
|
||||
}
|
||||
else if (address->lang_ab[0] == '\0')
|
||||
{
|
||||
if (verbose)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "lang_ab"));
|
||||
error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "lang_ab");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -244,16 +239,15 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
if (strcmp (address->lang_ab, iso639[cnt].ab) == 0)
|
||||
break;
|
||||
if (cnt == sizeof (iso639) / sizeof (iso639[0]))
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: language abbreviation `%s' not defined"),
|
||||
"LC_ADDRESS", address->lang_ab));
|
||||
"LC_ADDRESS", address->lang_ab);
|
||||
}
|
||||
else
|
||||
if (strcmp (iso639[cnt].ab, address->lang_ab) != 0
|
||||
&& iso639[cnt].ab[0] != '\0')
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
if (strcmp (iso639[cnt].ab, address->lang_ab) != 0)
|
||||
error (0, 0, _("\
|
||||
%s: `%s' value does not match `%s' value"),
|
||||
"LC_ADDRESS", "lang_ab", "lang_term"));
|
||||
"LC_ADDRESS", "lang_ab", "lang_term");
|
||||
}
|
||||
|
||||
if (address->lang_lib == NULL)
|
||||
@@ -262,8 +256,8 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
else if (address->lang_lib[0] == '\0')
|
||||
{
|
||||
if (verbose)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "lang_lib"));
|
||||
error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_ADDRESS", "lang_lib");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -273,22 +267,22 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
if (strcmp (address->lang_lib, iso639[cnt].lib) == 0)
|
||||
break;
|
||||
if (cnt == sizeof (iso639) / sizeof (iso639[0]))
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: language abbreviation `%s' not defined"),
|
||||
"LC_ADDRESS", address->lang_lib));
|
||||
"LC_ADDRESS", address->lang_lib);
|
||||
}
|
||||
else
|
||||
if (strcmp (iso639[cnt].ab, address->lang_ab) != 0)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: `%s' value does not match `%s' value"), "LC_ADDRESS", "lang_lib",
|
||||
helper == 1 ? "lang_term" : "lang_ab"));
|
||||
helper == 1 ? "lang_term" : "lang_ab");
|
||||
}
|
||||
|
||||
if (address->country_num == 0)
|
||||
{
|
||||
if (verbose && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "country_num"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "country_num");
|
||||
cnt = sizeof (iso3166) / sizeof (iso3166[0]);
|
||||
}
|
||||
else
|
||||
@@ -298,41 +292,39 @@ No definition for %s category found"), "LC_ADDRESS"));
|
||||
break;
|
||||
|
||||
if (cnt == sizeof (iso3166) / sizeof (iso3166[0]))
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: numeric country code `%d' not valid"),
|
||||
"LC_ADDRESS", address->country_num));
|
||||
"LC_ADDRESS", address->country_num);
|
||||
}
|
||||
|
||||
if (address->country_ab2 == NULL)
|
||||
{
|
||||
if (verbose && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "country_ab2"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "country_ab2");
|
||||
address->country_ab2 = " ";
|
||||
}
|
||||
else if (cnt != sizeof (iso3166) / sizeof (iso3166[0])
|
||||
&& strcmp (address->country_ab2, iso3166[cnt].ab2) != 0)
|
||||
WITH_CUR_LOCALE (error (0, 0,
|
||||
_("%s: `%s' value does not match `%s' value"),
|
||||
"LC_ADDRESS", "country_ab2", "country_num"));
|
||||
error (0, 0, _("%s: `%s' value does not match `%s' value"),
|
||||
"LC_ADDRESS", "country_ab2", "country_num");
|
||||
|
||||
if (address->country_ab3 == NULL)
|
||||
{
|
||||
if (verbose && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "country_ab3"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_ADDRESS", "country_ab3");
|
||||
address->country_ab3 = " ";
|
||||
}
|
||||
else if (cnt != sizeof (iso3166) / sizeof (iso3166[0])
|
||||
&& strcmp (address->country_ab3, iso3166[cnt].ab3) != 0)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: `%s' value does not match `%s' value"),
|
||||
"LC_ADDRESS", "country_ab3", "country_num"));
|
||||
error (0, 0, _("%s: `%s' value does not match `%s' value"),
|
||||
"LC_ADDRESS", "country_ab3", "country_num");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
address_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
address_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_address_t *address = locale->categories[LC_ADDRESS].address;
|
||||
@@ -425,7 +417,7 @@ address_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == 3 + _NL_ITEM_INDEX (_NL_NUM_LC_ADDRESS));
|
||||
|
||||
write_locale_data (output_path, LC_ADDRESS, "LC_ADDRESS",
|
||||
write_locale_data (output_path, "LC_ADDRESS",
|
||||
3 + _NL_ITEM_INDEX (_NL_NUM_LC_ADDRESS), iov);
|
||||
}
|
||||
|
||||
@@ -433,7 +425,7 @@ address_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The parser for the LC_ADDRESS section of the locale definition. */
|
||||
void
|
||||
address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct locale_address_t *address;
|
||||
@@ -447,7 +439,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -473,7 +465,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ignore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -490,7 +482,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (address->cat != NULL) \
|
||||
@@ -527,7 +519,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_string && arg->tok != tok_number) \
|
||||
goto err_label; \
|
||||
if (address->cat != NULL) \
|
||||
@@ -565,7 +557,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (address->cat != 0) \
|
||||
@@ -579,7 +571,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_ADDRESS'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -597,7 +589,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <wchar.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "charmap.h"
|
||||
#include "localeinfo.h"
|
||||
#include "linereader.h"
|
||||
#include "locfile.h"
|
||||
#include "localedef.h"
|
||||
#include "elem-hash.h"
|
||||
|
||||
/* Uncomment the following line in the production version. */
|
||||
@@ -384,9 +384,8 @@ new_symbol (struct locale_collate_t *collate, const char *name, size_t len)
|
||||
/* Test whether this name is already defined somewhere. */
|
||||
static int
|
||||
check_duplicate (struct linereader *ldfile, struct locale_collate_t *collate,
|
||||
const struct charmap_t *charmap,
|
||||
struct repertoire_t *repertoire, const char *symbol,
|
||||
size_t symbol_len)
|
||||
struct charmap_t *charmap, struct repertoire_t *repertoire,
|
||||
const char *symbol, size_t symbol_len)
|
||||
{
|
||||
void *ignore = NULL;
|
||||
|
||||
@@ -427,14 +426,13 @@ check_duplicate (struct linereader *ldfile, struct locale_collate_t *collate,
|
||||
/* Read the direction specification. */
|
||||
static void
|
||||
read_directions (struct linereader *ldfile, struct token *arg,
|
||||
const struct charmap_t *charmap,
|
||||
struct repertoire_t *repertoire, struct localedef_t *result)
|
||||
struct charmap_t *charmap, struct repertoire_t *repertoire,
|
||||
struct locale_collate_t *collate)
|
||||
{
|
||||
int cnt = 0;
|
||||
int max = nrules ?: 10;
|
||||
enum coll_sort_rule *rules = calloc (max, sizeof (*rules));
|
||||
int warned = 0;
|
||||
struct locale_collate_t *collate = result->categories[LC_COLLATE].collate;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -510,7 +508,7 @@ read_directions (struct linereader *ldfile, struct token *arg,
|
||||
}
|
||||
|
||||
if (valid)
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
|
||||
if (arg->tok == tok_eof || arg->tok == tok_eol || arg->tok == tok_comma
|
||||
|| arg->tok == tok_semicolon)
|
||||
@@ -574,7 +572,7 @@ read_directions (struct linereader *ldfile, struct token *arg,
|
||||
}
|
||||
}
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
}
|
||||
|
||||
if (nrules == 0)
|
||||
@@ -662,13 +660,11 @@ unlink_element (struct locale_collate_t *collate)
|
||||
|
||||
static void
|
||||
insert_weights (struct linereader *ldfile, struct element_t *elem,
|
||||
const struct charmap_t *charmap,
|
||||
struct repertoire_t *repertoire, struct localedef_t *result,
|
||||
enum token_t ellipsis)
|
||||
struct charmap_t *charmap, struct repertoire_t *repertoire,
|
||||
struct locale_collate_t *collate, enum token_t ellipsis)
|
||||
{
|
||||
int weight_cnt;
|
||||
struct token *arg;
|
||||
struct locale_collate_t *collate = result->categories[LC_COLLATE].collate;
|
||||
|
||||
/* Initialize all the fields. */
|
||||
elem->file = ldfile->fname;
|
||||
@@ -701,7 +697,7 @@ insert_weights (struct linereader *ldfile, struct element_t *elem,
|
||||
|
||||
weight_cnt = 0;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
do
|
||||
{
|
||||
if (arg->tok == tok_eof || arg->tok == tok_eol)
|
||||
@@ -871,11 +867,11 @@ insert_weights (struct linereader *ldfile, struct element_t *elem,
|
||||
break;
|
||||
}
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
/* This better should be the end of the line or a semicolon. */
|
||||
if (arg->tok == tok_semicolon)
|
||||
/* OK, ignore this and read the next token. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
else if (arg->tok != tok_eof && arg->tok != tok_eol)
|
||||
{
|
||||
/* It's a syntax error. */
|
||||
@@ -918,14 +914,13 @@ insert_weights (struct linereader *ldfile, struct element_t *elem,
|
||||
|
||||
static int
|
||||
insert_value (struct linereader *ldfile, const char *symstr, size_t symlen,
|
||||
const struct charmap_t *charmap, struct repertoire_t *repertoire,
|
||||
struct localedef_t *result)
|
||||
struct charmap_t *charmap, struct repertoire_t *repertoire,
|
||||
struct locale_collate_t *collate)
|
||||
{
|
||||
/* First find out what kind of symbol this is. */
|
||||
struct charseq *seq;
|
||||
uint32_t wc;
|
||||
struct element_t *elem = NULL;
|
||||
struct locale_collate_t *collate = result->categories[LC_COLLATE].collate;
|
||||
|
||||
/* Try to find the character in the charmap. */
|
||||
seq = charmap_find_value (charmap, symstr, symlen);
|
||||
@@ -1026,7 +1021,7 @@ insert_value (struct linereader *ldfile, const char *symstr, size_t symlen,
|
||||
return 1;
|
||||
}
|
||||
|
||||
insert_weights (ldfile, elem, charmap, repertoire, result, tok_none);
|
||||
insert_weights (ldfile, elem, charmap, repertoire, collate, tok_none);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1034,13 +1029,12 @@ insert_value (struct linereader *ldfile, const char *symstr, size_t symlen,
|
||||
|
||||
static void
|
||||
handle_ellipsis (struct linereader *ldfile, const char *symstr, size_t symlen,
|
||||
enum token_t ellipsis, const struct charmap_t *charmap,
|
||||
enum token_t ellipsis, struct charmap_t *charmap,
|
||||
struct repertoire_t *repertoire,
|
||||
struct localedef_t *result)
|
||||
struct locale_collate_t *collate)
|
||||
{
|
||||
struct element_t *startp;
|
||||
struct element_t *endp;
|
||||
struct locale_collate_t *collate = result->categories[LC_COLLATE].collate;
|
||||
|
||||
/* Unlink the entry added for the ellipsis. */
|
||||
unlink_element (collate);
|
||||
@@ -1048,7 +1042,7 @@ handle_ellipsis (struct linereader *ldfile, const char *symstr, size_t symlen,
|
||||
|
||||
/* Process and add the end-entry. */
|
||||
if (symstr != NULL
|
||||
&& insert_value (ldfile, symstr, symlen, charmap, repertoire, result))
|
||||
&& insert_value (ldfile, symstr, symlen, charmap, repertoire, collate))
|
||||
/* Something went wrong with inserting the to-value. This means
|
||||
we cannot process the ellipsis. */
|
||||
return;
|
||||
@@ -1475,7 +1469,7 @@ collate_startup (struct linereader *ldfile, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
collate_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
/* Now is the time when we can assign the individual collation
|
||||
values for all the symbols. We have possibly different values
|
||||
@@ -1516,8 +1510,7 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
{
|
||||
/* No data, no check. */
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("No definition for %s category found"),
|
||||
"LC_COLLATE"));
|
||||
error (0, 0, _("No definition for %s category found"), "LC_COLLATE");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1532,9 +1525,9 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
&& ((sect->rules[i] & sort_position)
|
||||
!= (collate->sections->rules[i] & sort_position)))
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: `position' must be used for a specific level in all sections or none"),
|
||||
"LC_COLLATE"));
|
||||
"LC_COLLATE");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1555,10 +1548,9 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
{
|
||||
if (runp->weights[i].w[j]->weights == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error_at_line (0, 0, runp->file,
|
||||
runp->line,
|
||||
_("symbol `%s' not defined"),
|
||||
runp->weights[i].w[j]->name));
|
||||
error_at_line (0, 0, runp->file, runp->line,
|
||||
_("symbol `%s' not defined"),
|
||||
runp->weights[i].w[j]->name);
|
||||
|
||||
need_undefined = 1;
|
||||
runp->weights[i].w[j] = &collate->undefined;
|
||||
@@ -1631,14 +1623,11 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
/* This should not happen. It means that we have
|
||||
to symbols with the same byte sequence. It is
|
||||
of course an error. */
|
||||
WITH_CUR_LOCALE (error_at_line (0, 0, (*eptr)->file,
|
||||
(*eptr)->line,
|
||||
_("\
|
||||
symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
error_at_line (0, 0, runp->file,
|
||||
runp->line,
|
||||
_("symbol `%s'"),
|
||||
runp->name));
|
||||
error_at_line (0, 0, (*eptr)->file, (*eptr)->line,
|
||||
_("symbol `%s' has the same encoding as"),
|
||||
(*eptr)->name);
|
||||
error_at_line (0, 0, runp->file, runp->line,
|
||||
_("symbol `%s'"), runp->name);
|
||||
goto dont_insert;
|
||||
}
|
||||
else if (c < 0)
|
||||
@@ -1677,9 +1666,6 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
|
||||
runp->wcseqorder = wcseqact++;
|
||||
}
|
||||
else if (runp->mbs != NULL && runp->weights != NULL)
|
||||
/* This is for collation elements. */
|
||||
runp->wcseqorder = wcseqact++;
|
||||
|
||||
/* Up to the next entry. */
|
||||
runp = runp->next;
|
||||
@@ -1714,9 +1700,8 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
struct element_t *lastp;
|
||||
|
||||
/* Insert the collation sequence value. */
|
||||
if (runp->is_character)
|
||||
collseq_table_add (&collate->wcseqorder, runp->wcs[0],
|
||||
runp->wcseqorder);
|
||||
collseq_table_add (&collate->wcseqorder, runp->wcs[0],
|
||||
runp->wcseqorder);
|
||||
|
||||
/* Find the point where to insert in the list. */
|
||||
e = wchead_table_get (&collate->wcheads, runp->wcs[0]);
|
||||
@@ -1737,14 +1722,11 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
/* This should not happen. It means that we have
|
||||
two symbols with the same byte sequence. It is
|
||||
of course an error. */
|
||||
WITH_CUR_LOCALE (error_at_line (0, 0, (*eptr)->file,
|
||||
(*eptr)->line,
|
||||
_("\
|
||||
symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
error_at_line (0, 0, runp->file,
|
||||
runp->line,
|
||||
_("symbol `%s'"),
|
||||
runp->name));
|
||||
error_at_line (0, 0, (*eptr)->file, (*eptr)->line,
|
||||
_("symbol `%s' has the same encoding as"),
|
||||
(*eptr)->name);
|
||||
error_at_line (0, 0, runp->file, runp->line,
|
||||
_("symbol `%s'"), runp->name);
|
||||
goto dont_insertwc;
|
||||
}
|
||||
else if (c < 0)
|
||||
@@ -1785,7 +1767,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
/* This seems not to be enforced by recent standards. Don't
|
||||
emit an error, simply append UNDEFINED at the end. */
|
||||
if (0)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("no definition of `UNDEFINED'")));
|
||||
error (0, 0, _("no definition of `UNDEFINED'"));
|
||||
|
||||
/* Add UNDEFINED at the end. */
|
||||
collate->undefined.mborder =
|
||||
@@ -1809,15 +1791,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
|
||||
sect = collate->sections;
|
||||
while (sect != NULL && sect->rules == NULL)
|
||||
sect = sect->next;
|
||||
|
||||
/* Bail out if we have no sections because of earlier errors. */
|
||||
if (sect == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (EXIT_FAILURE, 0,
|
||||
_("too many errors; giving up")));
|
||||
return;
|
||||
}
|
||||
|
||||
assert (sect != NULL);
|
||||
ruleidx = 0;
|
||||
do
|
||||
{
|
||||
@@ -1923,7 +1897,7 @@ output_weightwc (struct obstack *pool, struct locale_collate_t *collate,
|
||||
|
||||
|
||||
void
|
||||
collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
collate_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_collate_t *collate = locale->categories[LC_COLLATE].collate;
|
||||
@@ -1987,7 +1961,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE));
|
||||
|
||||
write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", 2 + cnt, iov);
|
||||
write_locale_data (output_path, "LC_COLLATE", 2 + cnt, iov);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2571,7 +2545,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE));
|
||||
|
||||
write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", 2 + cnt, iov);
|
||||
write_locale_data (output_path, "LC_COLLATE", 2 + cnt, iov);
|
||||
|
||||
obstack_free (&weightpool, NULL);
|
||||
obstack_free (&extrapool, NULL);
|
||||
@@ -2581,7 +2555,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
void
|
||||
collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct repertoire_t *repertoire = NULL;
|
||||
@@ -2611,7 +2585,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -2619,18 +2593,18 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (nowtok == tok_copy)
|
||||
{
|
||||
state = 2;
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_string)
|
||||
{
|
||||
SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
|
||||
|
||||
skip_category:
|
||||
do
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
while (now->tok != tok_eof && now->tok != tok_end);
|
||||
|
||||
if (now->tok != tok_eof
|
||||
|| (now = lr_token (ldfile, charmap, result, NULL, verbose),
|
||||
|| (now = lr_token (ldfile, charmap, NULL, verbose),
|
||||
now->tok == tok_eof))
|
||||
lr_error (ldfile, _("%s: premature end of file"), "LC_COLLATE");
|
||||
else if (now->tok != tok_lc_collate)
|
||||
@@ -2660,7 +2634,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
lr_ignore_rest (ldfile, 1);
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
@@ -2681,7 +2655,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -2690,7 +2664,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
{
|
||||
case tok_copy:
|
||||
/* Allow copying other locales. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_string)
|
||||
goto err_label;
|
||||
|
||||
@@ -2713,7 +2687,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (state != 0)
|
||||
goto err_label;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok != tok_number)
|
||||
goto err_label;
|
||||
if (collate->col_weight_max != -1)
|
||||
@@ -2736,7 +2710,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (state != 0)
|
||||
goto err_label;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
goto err_label;
|
||||
else if (!ignore_content)
|
||||
@@ -2783,7 +2757,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (state != 0 && state != 2)
|
||||
goto err_label;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
goto err_label;
|
||||
else
|
||||
@@ -2792,7 +2766,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
size_t symbol_len = arg->val.str.lenmb;
|
||||
|
||||
/* Next the `from' keyword. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_from)
|
||||
{
|
||||
free ((char *) symbol);
|
||||
@@ -2803,7 +2777,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
ldfile->translate_strings = 1;
|
||||
|
||||
/* Finally the string with the replacement. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
|
||||
ldfile->return_widestr = 0;
|
||||
ldfile->translate_strings = 0;
|
||||
@@ -2852,7 +2826,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (state != 0 && state != 2)
|
||||
goto err_label;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
goto err_label;
|
||||
else
|
||||
@@ -2863,13 +2837,12 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
size_t endsymbol_len = 0;
|
||||
enum token_t ellipsis = tok_none;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok == tok_ellipsis2 || arg->tok == tok_ellipsis4)
|
||||
{
|
||||
ellipsis = arg->tok;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire,
|
||||
verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
{
|
||||
free (symbol);
|
||||
@@ -3000,7 +2973,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (state != 0)
|
||||
goto err_label;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
goto err_label;
|
||||
else
|
||||
@@ -3011,7 +2984,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
size_t symname_len;
|
||||
struct symbol_t *symval;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
{
|
||||
if (newname != NULL)
|
||||
@@ -3068,7 +3041,7 @@ error while adding equivalent collating symbol"));
|
||||
|
||||
case tok_script:
|
||||
/* We get told about the scripts we know. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_bsymbol)
|
||||
goto err_label;
|
||||
else
|
||||
@@ -3120,7 +3093,7 @@ error while adding equivalent collating symbol"));
|
||||
/* The 14652 draft does not specify whether all `order_start' lines
|
||||
must contain the same number of sort-rules, but 14651 does. So
|
||||
we require this here as well. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok == tok_bsymbol)
|
||||
{
|
||||
/* This better should be a section name. */
|
||||
@@ -3179,8 +3152,7 @@ error while adding equivalent collating symbol"));
|
||||
}
|
||||
|
||||
/* Next should come the end of the line or a semicolon. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire,
|
||||
verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok == tok_eol)
|
||||
{
|
||||
uint32_t cnt;
|
||||
@@ -3203,8 +3175,7 @@ error while adding equivalent collating symbol"));
|
||||
}
|
||||
|
||||
/* Get the next token. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire,
|
||||
verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3227,7 +3198,7 @@ error while adding equivalent collating symbol"));
|
||||
}
|
||||
|
||||
/* Now read the direction names. */
|
||||
read_directions (ldfile, arg, charmap, repertoire, result);
|
||||
read_directions (ldfile, arg, charmap, repertoire, collate);
|
||||
|
||||
/* From now we need the strings untranslated. */
|
||||
ldfile->translate_strings = 0;
|
||||
@@ -3249,7 +3220,7 @@ error while adding equivalent collating symbol"));
|
||||
if (was_ellipsis != tok_none)
|
||||
{
|
||||
handle_ellipsis (ldfile, NULL, 0, was_ellipsis, charmap,
|
||||
repertoire, result);
|
||||
repertoire, collate);
|
||||
was_ellipsis = tok_none;
|
||||
}
|
||||
|
||||
@@ -3277,7 +3248,7 @@ error while adding equivalent collating symbol"));
|
||||
{
|
||||
handle_ellipsis (ldfile, arg->val.str.startmb,
|
||||
arg->val.str.lenmb, was_ellipsis, charmap,
|
||||
repertoire, result);
|
||||
repertoire, collate);
|
||||
was_ellipsis = tok_none;
|
||||
}
|
||||
}
|
||||
@@ -3285,7 +3256,7 @@ error while adding equivalent collating symbol"));
|
||||
goto err_label;
|
||||
state = 3;
|
||||
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok == tok_bsymbol || arg->tok == tok_ucs4)
|
||||
{
|
||||
/* Find this symbol in the sequence table. */
|
||||
@@ -3399,14 +3370,14 @@ error while adding equivalent collating symbol"));
|
||||
if (was_ellipsis != tok_none)
|
||||
{
|
||||
handle_ellipsis (ldfile, NULL, 0, was_ellipsis, charmap,
|
||||
repertoire, result);
|
||||
repertoire, collate);
|
||||
was_ellipsis = tok_none;
|
||||
}
|
||||
}
|
||||
else if (state == 3)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: missing `reorder-end' keyword"), "LC_COLLATE"));
|
||||
error (0, 0, _("%s: missing `reorder-end' keyword"),
|
||||
"LC_COLLATE");
|
||||
state = 4;
|
||||
}
|
||||
else if (state != 2 && state != 4)
|
||||
@@ -3414,7 +3385,7 @@ error while adding equivalent collating symbol"));
|
||||
state = 5;
|
||||
|
||||
/* Get the name of the sections we are adding after. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok == tok_bsymbol)
|
||||
{
|
||||
/* Now find a section with this name. */
|
||||
@@ -3447,7 +3418,7 @@ error while adding equivalent collating symbol"));
|
||||
{
|
||||
lr_ignore_rest (ldfile, 0);
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
while (now->tok == tok_reorder_sections_after
|
||||
|| now->tok == tok_reorder_sections_end
|
||||
@@ -3497,18 +3468,11 @@ error while adding equivalent collating symbol"));
|
||||
symstr = ucs4buf;
|
||||
symlen = 9;
|
||||
}
|
||||
else if (arg != NULL)
|
||||
else
|
||||
{
|
||||
symstr = arg->val.str.startmb;
|
||||
symlen = arg->val.str.lenmb;
|
||||
}
|
||||
else
|
||||
{
|
||||
lr_error (ldfile, _("%s: bad symbol <%.*s>"), "LC_COLLATE",
|
||||
(int) ldfile->token.val.str.lenmb,
|
||||
ldfile->token.val.str.startmb);
|
||||
break;
|
||||
}
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
@@ -3548,7 +3512,7 @@ error while adding equivalent collating symbol"));
|
||||
{
|
||||
|
||||
handle_ellipsis (ldfile, symstr, symlen, was_ellipsis,
|
||||
charmap, repertoire, result);
|
||||
charmap, repertoire, collate);
|
||||
|
||||
/* Remember that we processed the ellipsis. */
|
||||
was_ellipsis = tok_none;
|
||||
@@ -3608,7 +3572,7 @@ error while adding equivalent collating symbol"));
|
||||
seqp->section->last = seqp->last;
|
||||
|
||||
/* Now insert it in the new place. */
|
||||
insert_weights (ldfile, seqp, charmap, repertoire, result,
|
||||
insert_weights (ldfile, seqp, charmap, repertoire, collate,
|
||||
tok_none);
|
||||
break;
|
||||
}
|
||||
@@ -3653,11 +3617,10 @@ error while adding equivalent collating symbol"));
|
||||
|
||||
/* Process the rest of the line which might change
|
||||
the collation rules. */
|
||||
arg = lr_token (ldfile, charmap, result, repertoire,
|
||||
verbose);
|
||||
arg = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (arg->tok != tok_eof && arg->tok != tok_eol)
|
||||
read_directions (ldfile, arg, charmap, repertoire,
|
||||
result);
|
||||
collate);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3669,7 +3632,7 @@ error while adding equivalent collating symbol"));
|
||||
assert (state == 1);
|
||||
|
||||
handle_ellipsis (ldfile, symstr, symlen, was_ellipsis, charmap,
|
||||
repertoire, result);
|
||||
repertoire, collate);
|
||||
|
||||
/* Remember that we processed the ellipsis. */
|
||||
was_ellipsis = tok_none;
|
||||
@@ -3679,7 +3642,7 @@ error while adding equivalent collating symbol"));
|
||||
}
|
||||
|
||||
/* Now insert in the new place. */
|
||||
insert_value (ldfile, symstr, symlen, charmap, repertoire, result);
|
||||
insert_value (ldfile, symstr, symlen, charmap, repertoire, collate);
|
||||
break;
|
||||
|
||||
case tok_undefined:
|
||||
@@ -3718,7 +3681,7 @@ error while adding equivalent collating symbol"));
|
||||
else
|
||||
/* Parse the weights. */
|
||||
insert_weights (ldfile, &collate->undefined, charmap,
|
||||
repertoire, result, tok_none);
|
||||
repertoire, collate, tok_none);
|
||||
break;
|
||||
|
||||
case tok_ellipsis2: /* symbolic hexadecimal ellipsis */
|
||||
@@ -3735,7 +3698,7 @@ error while adding equivalent collating symbol"));
|
||||
was_ellipsis = nowtok;
|
||||
|
||||
insert_weights (ldfile, &collate->ellipsis_weight, charmap,
|
||||
repertoire, result, nowtok);
|
||||
repertoire, collate, nowtok);
|
||||
break;
|
||||
|
||||
case tok_end:
|
||||
@@ -3757,18 +3720,18 @@ error while adding equivalent collating symbol"));
|
||||
if (was_ellipsis != tok_none)
|
||||
{
|
||||
handle_ellipsis (ldfile, NULL, 0, was_ellipsis, charmap,
|
||||
repertoire, result);
|
||||
repertoire, collate);
|
||||
was_ellipsis = tok_none;
|
||||
}
|
||||
}
|
||||
else if (state == 3)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: missing `reorder-end' keyword"), "LC_COLLATE"));
|
||||
error (0, 0, _("%s: missing `reorder-end' keyword"),
|
||||
"LC_COLLATE");
|
||||
else if (state == 5)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: missing `reorder-sections-end' keyword"), "LC_COLLATE"));
|
||||
error (0, 0, _("%s: missing `reorder-sections-end' keyword"),
|
||||
"LC_COLLATE");
|
||||
}
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -3785,7 +3748,7 @@ error while adding equivalent collating symbol"));
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -96,8 +95,7 @@ identification_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
identification_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap)
|
||||
identification_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_identification_t *identification
|
||||
= locale->categories[LC_IDENTIFICATION].identification;
|
||||
@@ -131,8 +129,8 @@ identification_finish (struct localedef_t *locale,
|
||||
if (identification == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_IDENTIFICATION"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_IDENTIFICATION");
|
||||
identification_startup (NULL, locale, 0);
|
||||
identification
|
||||
= locale->categories[LC_IDENTIFICATION].identification;
|
||||
@@ -144,8 +142,8 @@ No definition for %s category found"), "LC_IDENTIFICATION"));
|
||||
if (identification->cat == NULL) \
|
||||
{ \
|
||||
if (verbose && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_IDENTIFICATION", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_IDENTIFICATION", #cat); \
|
||||
identification->cat = ""; \
|
||||
}
|
||||
|
||||
@@ -168,17 +166,15 @@ No definition for %s category found"), "LC_IDENTIFICATION"));
|
||||
if (num != LC_ALL && identification->category[num] == NULL)
|
||||
{
|
||||
if (verbose && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: no identification for category `%s'"),
|
||||
"LC_IDENTIFICATION", category_name[num]));
|
||||
error (0, 0, _("%s: no identification for category `%s'"),
|
||||
"LC_IDENTIFICATION", category_name[num]);
|
||||
identification->category[num] = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
identification_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
identification_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_identification_t *identification
|
||||
@@ -291,15 +287,14 @@ identification_output (struct localedef_t *locale,
|
||||
assert (cnt == (2 + _NL_ITEM_INDEX (_NL_NUM_LC_IDENTIFICATION)
|
||||
+ (__LC_LAST - 2)));
|
||||
|
||||
write_locale_data (output_path, LC_IDENTIFICATION, "LC_IDENTIFICATION", cnt,
|
||||
iov);
|
||||
write_locale_data (output_path, "LC_IDENTIFICATION", cnt, iov);
|
||||
}
|
||||
|
||||
|
||||
/* The parser for the LC_IDENTIFICATION section of the locale definition. */
|
||||
void
|
||||
identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct locale_identification_t *identification;
|
||||
@@ -314,7 +309,7 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -341,7 +336,7 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ignore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -358,7 +353,7 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (identification->cat != NULL) \
|
||||
@@ -399,15 +394,15 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* We expect two operands. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok != tok_string && arg->tok != tok_ident)
|
||||
goto err_label;
|
||||
/* Next is a semicolon. */
|
||||
cattok = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
cattok = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (cattok->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
/* Now a LC_xxx identifier. */
|
||||
cattok = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
cattok = lr_token (ldfile, charmap, NULL, verbose);
|
||||
switch (cattok->tok)
|
||||
{
|
||||
#define CATEGORY(lname, uname) \
|
||||
@@ -443,7 +438,7 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_IDENTIFICATION'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -461,7 +456,7 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -58,8 +57,7 @@ measurement_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
measurement_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap)
|
||||
measurement_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_measurement_t *measurement =
|
||||
locale->categories[LC_MEASUREMENT].measurement;
|
||||
@@ -92,8 +90,8 @@ measurement_finish (struct localedef_t *locale,
|
||||
if (measurement == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_MEASUREMENT"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_MEASUREMENT");
|
||||
measurement_startup (NULL, locale, 0);
|
||||
measurement = locale->categories[LC_MEASUREMENT].measurement;
|
||||
nothing = 1;
|
||||
@@ -103,23 +101,23 @@ No definition for %s category found"), "LC_MEASUREMENT"));
|
||||
if (measurement->measurement == 0)
|
||||
{
|
||||
if (! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_MEASUREMENT", "measurement"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_MEASUREMENT", "measurement");
|
||||
/* Use as the default value the value of the i18n locale. */
|
||||
measurement->measurement = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (measurement->measurement > 3)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: invalid value for field `%s'"),
|
||||
"LC_MEASUREMENT", "measurement"));
|
||||
error (0, 0, _("%s: invalid value for field `%s'"),
|
||||
"LC_MEASUREMENT", "measurement");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
measurement_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap, const char *output_path)
|
||||
measurement_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_measurement_t *measurement =
|
||||
locale->categories[LC_MEASUREMENT].measurement;
|
||||
@@ -143,14 +141,14 @@ measurement_output (struct localedef_t *locale,
|
||||
iov[cnt].iov_len = 1;
|
||||
++cnt;
|
||||
|
||||
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
|
||||
idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len;
|
||||
iov[cnt].iov_base = (void *) charmap->code_set_name;
|
||||
iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1;
|
||||
++cnt;
|
||||
|
||||
assert (cnt == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_MEASUREMENT));
|
||||
|
||||
write_locale_data (output_path, LC_MEASUREMENT, "LC_MEASUREMENT",
|
||||
write_locale_data (output_path, "LC_MEASUREMENT",
|
||||
2 + _NL_ITEM_INDEX (_NL_NUM_LC_MEASUREMENT), iov);
|
||||
}
|
||||
|
||||
@@ -158,7 +156,7 @@ measurement_output (struct localedef_t *locale,
|
||||
/* The parser for the LC_MEASUREMENT section of the locale definition. */
|
||||
void
|
||||
measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct locale_measurement_t *measurement;
|
||||
@@ -171,7 +169,7 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -198,7 +196,7 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -215,7 +213,7 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (measurement->cat != 0) \
|
||||
@@ -229,7 +227,7 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_MEASUREMENT'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -247,7 +245,7 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "linereader.h"
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -63,7 +63,7 @@ messages_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
messages_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_messages_t *messages
|
||||
= locale->categories[LC_MESSAGES].messages;
|
||||
@@ -95,8 +95,8 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (messages == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_MESSAGES"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_MESSAGES");
|
||||
messages_startup (NULL, locale, 0);
|
||||
messages = locale->categories[LC_MESSAGES].messages;
|
||||
nothing = 1;
|
||||
@@ -112,16 +112,15 @@ No definition for %s category found"), "LC_MESSAGES"));
|
||||
if (messages->yesexpr == NULL)
|
||||
{
|
||||
if (! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' undefined"),
|
||||
"LC_MESSAGES", "yesexpr"));
|
||||
error (0, 0, _("%s: field `%s' undefined"), "LC_MESSAGES", "yesexpr");
|
||||
messages->yesexpr = "^[yY]";
|
||||
}
|
||||
else if (messages->yesexpr[0] == '\0')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value for field `%s' must not be an empty string"),
|
||||
"LC_MESSAGES", "yesexpr"));
|
||||
"LC_MESSAGES", "yesexpr");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,9 +134,9 @@ No definition for %s category found"), "LC_MESSAGES"));
|
||||
char errbuf[BUFSIZ];
|
||||
|
||||
(void) regerror (result, &re, errbuf, BUFSIZ);
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: no correct regular expression for field `%s': %s"),
|
||||
"LC_MESSAGES", "yesexpr", errbuf));
|
||||
"LC_MESSAGES", "yesexpr", errbuf);
|
||||
}
|
||||
else if (result != 0)
|
||||
regfree (&re);
|
||||
@@ -146,16 +145,15 @@ No definition for %s category found"), "LC_MESSAGES"));
|
||||
if (messages->noexpr == NULL)
|
||||
{
|
||||
if (! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' undefined"),
|
||||
"LC_MESSAGES", "noexpr"));
|
||||
error (0, 0, _("%s: field `%s' undefined"), "LC_MESSAGES", "noexpr");
|
||||
messages->noexpr = "^[nN]";
|
||||
}
|
||||
else if (messages->noexpr[0] == '\0')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value for field `%s' must not be an empty string"),
|
||||
"LC_MESSAGES", "noexpr"));
|
||||
"LC_MESSAGES", "noexpr");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,9 +167,9 @@ No definition for %s category found"), "LC_MESSAGES"));
|
||||
char errbuf[BUFSIZ];
|
||||
|
||||
(void) regerror (result, &re, errbuf, BUFSIZ);
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: no correct regular expression for field `%s': %s"),
|
||||
"LC_MESSAGES", "noexpr", errbuf));
|
||||
"LC_MESSAGES", "noexpr", errbuf);
|
||||
}
|
||||
else if (result != 0)
|
||||
regfree (&re);
|
||||
@@ -180,7 +178,7 @@ No definition for %s category found"), "LC_MESSAGES"));
|
||||
|
||||
|
||||
void
|
||||
messages_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
messages_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_messages_t *messages
|
||||
@@ -226,7 +224,7 @@ messages_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt + 1 == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES));
|
||||
|
||||
write_locale_data (output_path, LC_MESSAGES, "LC_MESSAGES",
|
||||
write_locale_data (output_path, "LC_MESSAGES",
|
||||
2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES), iov);
|
||||
}
|
||||
|
||||
@@ -234,7 +232,7 @@ messages_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The parser for the LC_MESSAGES section of the locale definition. */
|
||||
void
|
||||
messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct repertoire_t *repertoire = NULL;
|
||||
@@ -252,7 +250,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -280,7 +278,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ignore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -304,7 +302,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
lr_ignore_rest (ldfile, 0); \
|
||||
break; \
|
||||
} \
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto syntax_error; \
|
||||
else if (!ignore_content && now->val.str.startmb == NULL) \
|
||||
@@ -324,7 +322,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_MESSAGES'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -341,7 +339,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "linereader.h"
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -159,7 +159,7 @@ monetary_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
monetary_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
monetary_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_monetary_t *monetary
|
||||
= locale->categories[LC_MONETARY].monetary;
|
||||
@@ -191,8 +191,8 @@ monetary_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (monetary == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_MONETARY"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_MONETARY");
|
||||
monetary_startup (NULL, locale, 0);
|
||||
monetary = locale->categories[LC_MONETARY].monetary;
|
||||
nothing = 1;
|
||||
@@ -203,8 +203,8 @@ No definition for %s category found"), "LC_MONETARY"));
|
||||
if (monetary->cat == NULL) \
|
||||
{ \
|
||||
if (! be_quiet && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_MONETARY", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_MONETARY", #cat); \
|
||||
monetary->cat = initval; \
|
||||
}
|
||||
|
||||
@@ -221,18 +221,18 @@ No definition for %s category found"), "LC_MONETARY"));
|
||||
if (strlen (monetary->int_curr_symbol) != 4)
|
||||
{
|
||||
if (! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value of field `int_curr_symbol' has wrong length"),
|
||||
"LC_MONETARY"));
|
||||
"LC_MONETARY");
|
||||
}
|
||||
else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
|
||||
NR_VALID_INT_CURR, sizeof (const char *),
|
||||
(comparison_fn_t) curr_strcmp) == NULL
|
||||
&& !be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value of field `int_curr_symbol' does \
|
||||
not correspond to a valid name in ISO 4217"),
|
||||
"LC_MONETARY"));
|
||||
"LC_MONETARY");
|
||||
}
|
||||
|
||||
/* The decimal point must not be empty. This is not said explicitly
|
||||
@@ -241,15 +241,15 @@ not correspond to a valid name in ISO 4217"),
|
||||
if (monetary->mon_decimal_point == NULL)
|
||||
{
|
||||
if (! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_MONETARY", "mon_decimal_point"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_MONETARY", "mon_decimal_point");
|
||||
monetary->mon_decimal_point = ".";
|
||||
}
|
||||
else if (monetary->mon_decimal_point[0] == '\0' && ! be_quiet && ! nothing)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value for field `%s' must not be the empty string"),
|
||||
"LC_MONETARY", "mon_decimal_point"));
|
||||
"LC_MONETARY", "mon_decimal_point");
|
||||
}
|
||||
if (monetary->mon_decimal_point_wc == L'\0')
|
||||
monetary->mon_decimal_point_wc = L'.';
|
||||
@@ -257,8 +257,8 @@ not correspond to a valid name in ISO 4217"),
|
||||
if (monetary->mon_grouping_len == 0)
|
||||
{
|
||||
if (! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_MONETARY", "mon_grouping"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_MONETARY", "mon_grouping");
|
||||
|
||||
monetary->mon_grouping = (char *) "\177";
|
||||
monetary->mon_grouping_len = 1;
|
||||
@@ -269,15 +269,15 @@ not correspond to a valid name in ISO 4217"),
|
||||
if (monetary->cat == -2) \
|
||||
{ \
|
||||
if (! be_quiet && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_MONETARY", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_MONETARY", #cat); \
|
||||
monetary->cat = initval; \
|
||||
} \
|
||||
else if ((monetary->cat < min || monetary->cat > max) \
|
||||
&& !be_quiet && !nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _(" \
|
||||
%s: value for field `%s' must be in range %d...%d"), \
|
||||
"LC_MONETARY", #cat, min, max))
|
||||
"LC_MONETARY", #cat, min, max)
|
||||
|
||||
TEST_ELEM (int_frac_digits, -128, 127, -1);
|
||||
TEST_ELEM (frac_digits, -128, 127, -1);
|
||||
@@ -305,9 +305,9 @@ not correspond to a valid name in ISO 4217"),
|
||||
monetary->cat = monetary->alt; \
|
||||
else if ((monetary->cat < min || monetary->cat > max) && !be_quiet \
|
||||
&& ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value for field `%s' must be in range %d...%d"), \
|
||||
"LC_MONETARY", #cat, min, max))
|
||||
"LC_MONETARY", #cat, min, max)
|
||||
|
||||
TEST_ELEM (int_p_cs_precedes, p_cs_precedes, -1, 1);
|
||||
TEST_ELEM (int_p_sep_by_space, p_sep_by_space, -1, 2);
|
||||
@@ -353,7 +353,7 @@ not correspond to a valid name in ISO 4217"),
|
||||
|
||||
|
||||
void
|
||||
monetary_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
monetary_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_monetary_t *monetary
|
||||
@@ -612,7 +612,7 @@ monetary_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == 3 + _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY));
|
||||
|
||||
write_locale_data (output_path, LC_MONETARY, "LC_MONETARY",
|
||||
write_locale_data (output_path, "LC_MONETARY",
|
||||
3 + _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY), iov);
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ curr_strcmp (const char *s1, const char **s2)
|
||||
/* The parser for the LC_MONETARY section of the locale definition. */
|
||||
void
|
||||
monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct repertoire_t *repertoire = NULL;
|
||||
@@ -644,7 +644,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -670,7 +670,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ignore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -687,7 +687,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
now = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
else if (monetary->cat != NULL) \
|
||||
@@ -722,7 +722,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
} \
|
||||
\
|
||||
ldfile->return_widestr = 1; \
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (monetary->cat != NULL) \
|
||||
@@ -763,7 +763,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
now = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (now->tok != tok_minus1 && now->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (monetary->cat != -2) \
|
||||
@@ -815,7 +815,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_minus1 && now->tok != tok_number)
|
||||
goto err_label;
|
||||
else
|
||||
@@ -863,11 +863,11 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
grouping[act++] = now->val.num;
|
||||
|
||||
/* Next must be semicolon. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
break;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
while (now->tok == tok_minus1 || now->tok == tok_number);
|
||||
|
||||
@@ -893,7 +893,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
if (now->val.num == 0)
|
||||
@@ -910,11 +910,11 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (!ignore_content)
|
||||
monetary->conversion_rate[0] = now->val.num;
|
||||
/* Next must be a semicolon. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
/* And another number. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
if (now->val.num == 0)
|
||||
@@ -927,7 +927,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_MONETARY'. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@@ -944,7 +944,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -61,7 +60,7 @@ name_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
name_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_name_t *name = locale->categories[LC_NAME].name;
|
||||
int nothing = 0;
|
||||
@@ -92,8 +91,7 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (name == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_NAME"));
|
||||
error (0, 0, _("No definition for %s category found"), "LC_NAME");
|
||||
name_startup (NULL, locale, 0);
|
||||
name = locale->categories[LC_NAME].name;
|
||||
nothing = 1;
|
||||
@@ -103,8 +101,7 @@ No definition for %s category found"), "LC_NAME"));
|
||||
if (name->name_fmt == NULL)
|
||||
{
|
||||
if (! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_NAME", "name_fmt"));
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_NAME", "name_fmt");
|
||||
/* Use as the default value the value of the i18n locale. */
|
||||
name->name_fmt = "%p%t%g%t%m%t%f";
|
||||
}
|
||||
@@ -115,8 +112,8 @@ No definition for %s category found"), "LC_NAME"));
|
||||
const char *cp = name->name_fmt;
|
||||
|
||||
if (*cp == '\0')
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_NAME", "name_fmt"));
|
||||
error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_NAME", "name_fmt");
|
||||
else
|
||||
while (*cp != '\0')
|
||||
{
|
||||
@@ -127,8 +124,9 @@ No definition for %s category found"), "LC_NAME"));
|
||||
++cp;
|
||||
if (strchr ("dfFgGlomMpsSt", *cp) == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: invalid escape sequence in field `%s'"), "LC_NAME", "name_fmt"));
|
||||
error (0, 0, _("\
|
||||
%s: invalid escape sequence in field `%s'"),
|
||||
"LC_NAME", "name_fmt");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -140,8 +138,7 @@ No definition for %s category found"), "LC_NAME"));
|
||||
if (name->cat == NULL) \
|
||||
{ \
|
||||
if (verbose && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_NAME", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_NAME", #cat); \
|
||||
name->cat = ""; \
|
||||
}
|
||||
|
||||
@@ -154,7 +151,7 @@ No definition for %s category found"), "LC_NAME"));
|
||||
|
||||
|
||||
void
|
||||
name_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
name_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_name_t *name = locale->categories[LC_NAME].name;
|
||||
@@ -210,7 +207,7 @@ name_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_NAME));
|
||||
|
||||
write_locale_data (output_path, LC_NAME, "LC_NAME",
|
||||
write_locale_data (output_path, "LC_NAME",
|
||||
2 + _NL_ITEM_INDEX (_NL_NUM_LC_NAME), iov);
|
||||
}
|
||||
|
||||
@@ -218,7 +215,7 @@ name_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The parser for the LC_NAME section of the locale definition. */
|
||||
void
|
||||
name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct locale_name_t *name;
|
||||
@@ -231,7 +228,7 @@ name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -257,7 +254,7 @@ name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ignore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -274,7 +271,7 @@ name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (name->cat != NULL) \
|
||||
@@ -299,7 +296,7 @@ name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_NAME'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -316,7 +313,7 @@ name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "linereader.h"
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -65,7 +65,7 @@ numeric_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
numeric_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
numeric_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
|
||||
int nothing = 0;
|
||||
@@ -96,8 +96,8 @@ numeric_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (numeric == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_NUMERIC"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_NUMERIC");
|
||||
numeric_startup (NULL, locale, 0);
|
||||
numeric = locale->categories[LC_NUMERIC].numeric;
|
||||
nothing = 1;
|
||||
@@ -110,27 +110,26 @@ No definition for %s category found"), "LC_NUMERIC"));
|
||||
if (numeric->decimal_point == NULL)
|
||||
{
|
||||
if (! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_NUMERIC", "decimal_point"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_NUMERIC", "decimal_point");
|
||||
numeric->decimal_point = ".";
|
||||
}
|
||||
else if (numeric->decimal_point[0] == '\0' && ! be_quiet && ! nothing)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: value for field `%s' must not be the empty string"),
|
||||
"LC_NUMERIC", "decimal_point"));
|
||||
"LC_NUMERIC", "decimal_point");
|
||||
}
|
||||
if (numeric->decimal_point_wc == L'\0')
|
||||
numeric->decimal_point_wc = L'.';
|
||||
|
||||
if (numeric->grouping_len == 0 && ! be_quiet && ! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_NUMERIC", "grouping"));
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_NUMERIC", "grouping");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
numeric_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
numeric_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
|
||||
@@ -187,7 +186,7 @@ numeric_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt + 1 == 3 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC));
|
||||
|
||||
write_locale_data (output_path, LC_NUMERIC, "LC_NUMERIC",
|
||||
write_locale_data (output_path, "LC_NUMERIC",
|
||||
3 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC), iov);
|
||||
}
|
||||
|
||||
@@ -195,7 +194,7 @@ numeric_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The parser for the LC_NUMERIC section of the locale definition. */
|
||||
void
|
||||
numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct repertoire_t *repertoire = NULL;
|
||||
@@ -213,7 +212,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -239,7 +238,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -257,7 +256,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
} \
|
||||
\
|
||||
ldfile->return_widestr = 1; \
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (numeric->cat != NULL) \
|
||||
@@ -297,7 +296,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_minus1 && now->tok != tok_number)
|
||||
goto err_label;
|
||||
else
|
||||
@@ -344,11 +343,11 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
grouping[act++] = now->val.num;
|
||||
|
||||
/* Next must be semicolon. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
break;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
while (now->tok == tok_minus1 || now->tok == tok_number);
|
||||
|
||||
@@ -367,7 +366,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_NUMERIC'. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@@ -384,7 +383,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -58,7 +57,7 @@ paper_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
paper_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
paper_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_paper_t *paper = locale->categories[LC_PAPER].paper;
|
||||
int nothing = 0;
|
||||
@@ -89,8 +88,7 @@ paper_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (paper == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_PAPER"));
|
||||
error (0, 0, _("No definition for %s category found"), "LC_PAPER");
|
||||
paper_startup (NULL, locale, 0);
|
||||
paper = locale->categories[LC_PAPER].paper;
|
||||
nothing = 1;
|
||||
@@ -100,8 +98,7 @@ No definition for %s category found"), "LC_PAPER"));
|
||||
if (paper->height == 0)
|
||||
{
|
||||
if (! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_PAPER", "height"));
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_PAPER", "height");
|
||||
/* Use as default values the values from the i18n locale. */
|
||||
paper->height = 297;
|
||||
}
|
||||
@@ -109,8 +106,7 @@ No definition for %s category found"), "LC_PAPER"));
|
||||
if (paper->width == 0)
|
||||
{
|
||||
if (! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_PAPER", "width"));
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_PAPER", "width");
|
||||
/* Use as default values the values from the i18n locale. */
|
||||
paper->width = 210;
|
||||
}
|
||||
@@ -118,7 +114,7 @@ No definition for %s category found"), "LC_PAPER"));
|
||||
|
||||
|
||||
void
|
||||
paper_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
paper_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_paper_t *paper = locale->categories[LC_PAPER].paper;
|
||||
@@ -154,7 +150,7 @@ paper_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_PAPER));
|
||||
|
||||
write_locale_data (output_path, LC_PAPER, "LC_PAPER",
|
||||
write_locale_data (output_path, "LC_PAPER",
|
||||
2 + _NL_ITEM_INDEX (_NL_NUM_LC_PAPER), iov);
|
||||
}
|
||||
|
||||
@@ -162,7 +158,7 @@ paper_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The parser for the LC_PAPER section of the locale definition. */
|
||||
void
|
||||
paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct locale_paper_t *paper;
|
||||
@@ -175,7 +171,7 @@ paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -201,7 +197,7 @@ paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -218,7 +214,7 @@ paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (paper->cat != 0) \
|
||||
@@ -233,7 +229,7 @@ paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_PAPER'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -250,7 +246,7 @@ paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -60,7 +59,7 @@ telephone_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
telephone_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_telephone_t *telephone =
|
||||
locale->categories[LC_TELEPHONE].telephone;
|
||||
@@ -92,8 +91,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (telephone == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_TELEPHONE"));
|
||||
error (0, 0, _("No definition for %s category found"),
|
||||
"LC_TELEPHONE");
|
||||
telephone_startup (NULL, locale, 0);
|
||||
telephone = locale->categories[LC_TELEPHONE].telephone;
|
||||
nothing = 1;
|
||||
@@ -103,8 +102,8 @@ No definition for %s category found"), "LC_TELEPHONE"));
|
||||
if (telephone->tel_int_fmt == NULL)
|
||||
{
|
||||
if (! nothing)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_TELEPHONE", "tel_int_fmt"));
|
||||
error (0, 0, _("%s: field `%s' not defined"),
|
||||
"LC_TELEPHONE", "tel_int_fmt");
|
||||
/* Use as the default value the value of the i18n locale. */
|
||||
telephone->tel_int_fmt = "+%c %a %l";
|
||||
}
|
||||
@@ -115,8 +114,8 @@ No definition for %s category found"), "LC_TELEPHONE"));
|
||||
const char *cp = telephone->tel_int_fmt;
|
||||
|
||||
if (*cp == '\0')
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_TELEPHONE", "tel_int_fmt"));
|
||||
error (0, 0, _("%s: field `%s' must not be empty"),
|
||||
"LC_TELEPHONE", "tel_int_fmt");
|
||||
else
|
||||
while (*cp != '\0')
|
||||
{
|
||||
@@ -124,8 +123,9 @@ No definition for %s category found"), "LC_TELEPHONE"));
|
||||
{
|
||||
if (strchr ("aAlc", *++cp) == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_int_fmt"));
|
||||
error (0, 0, _("\
|
||||
%s: invalid escape sequence in field `%s'"),
|
||||
"LC_TELEPHONE", "tel_int_fmt");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -147,8 +147,8 @@ No definition for %s category found"), "LC_TELEPHONE"));
|
||||
{
|
||||
if (strchr ("aAlc", *++cp) == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_dom_fmt"));
|
||||
error (0, 0, _("%s: invalid escape sequence in field `%s'"),
|
||||
"LC_TELEPHONE", "tel_dom_fmt");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -160,8 +160,7 @@ No definition for %s category found"), "LC_TELEPHONE"));
|
||||
if (telephone->cat == NULL) \
|
||||
{ \
|
||||
if (verbose && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_TELEPHONE", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_TELEPHONE", #cat); \
|
||||
telephone->cat = ""; \
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ No definition for %s category found"), "LC_TELEPHONE"));
|
||||
|
||||
|
||||
void
|
||||
telephone_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
telephone_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_telephone_t *telephone =
|
||||
@@ -218,7 +217,7 @@ telephone_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
|
||||
assert (cnt == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE));
|
||||
|
||||
write_locale_data (output_path, LC_TELEPHONE, "LC_TELEPHONE",
|
||||
write_locale_data (output_path, "LC_TELEPHONE",
|
||||
2 + _NL_ITEM_INDEX (_NL_NUM_LC_TELEPHONE), iov);
|
||||
}
|
||||
|
||||
@@ -226,7 +225,7 @@ telephone_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The parser for the LC_TELEPHONE section of the locale definition. */
|
||||
void
|
||||
telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct locale_telephone_t *telephone;
|
||||
@@ -239,7 +238,7 @@ telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -265,7 +264,7 @@ telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -282,7 +281,7 @@ telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose); \
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (arg->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (telephone->cat != NULL) \
|
||||
@@ -305,7 +304,7 @@ telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_TELEPHONE'. */
|
||||
arg = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@@ -322,7 +321,7 @@ telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "linereader.h"
|
||||
#include "localedef.h"
|
||||
#include "localeinfo.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -126,7 +126,7 @@ time_startup (struct linereader *lr, struct localedef_t *locale,
|
||||
|
||||
|
||||
void
|
||||
time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
time_finish (struct localedef_t *locale, struct charmap_t *charmap)
|
||||
{
|
||||
struct locale_time_t *time = locale->categories[LC_TIME].time;
|
||||
int nothing = 0;
|
||||
@@ -157,8 +157,7 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
if (time == NULL)
|
||||
{
|
||||
if (! be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
No definition for %s category found"), "LC_TIME"));
|
||||
error (0, 0, _("No definition for %s category found"), "LC_TIME");
|
||||
time_startup (NULL, locale, 0);
|
||||
time = locale->categories[LC_TIME].time;
|
||||
nothing = 1;
|
||||
@@ -173,8 +172,7 @@ No definition for %s category found"), "LC_TIME"));
|
||||
int i; \
|
||||
\
|
||||
if (! be_quiet && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_TIME", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_TIME", #cat); \
|
||||
\
|
||||
for (i = 0; i < sizeof (initval) / sizeof (initval[0]); ++i) \
|
||||
time->cat[i] = initval[i]; \
|
||||
@@ -194,8 +192,7 @@ No definition for %s category found"), "LC_TIME"));
|
||||
if (time->cat == NULL) \
|
||||
{ \
|
||||
if (! be_quiet && ! nothing) \
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
|
||||
"LC_TIME", #cat)); \
|
||||
error (0, 0, _("%s: field `%s' not defined"), "LC_TIME", #cat); \
|
||||
\
|
||||
time->cat = initval; \
|
||||
}
|
||||
@@ -245,9 +242,10 @@ No definition for %s category found"), "LC_TIME"));
|
||||
if (*str != '+' && *str != '-')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: direction flag in string %Zd in `era' field is not '+' nor '-'"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0,
|
||||
_("%s: direction flag in string %Zd in `era' field"
|
||||
" is not '+' nor '-'"),
|
||||
"LC_TIME", idx + 1);
|
||||
/* Default arbitrarily to '+'. */
|
||||
time->era_entries[idx].direction = '+';
|
||||
}
|
||||
@@ -256,9 +254,10 @@ No definition for %s category found"), "LC_TIME"));
|
||||
if (*++str != ':')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: direction flag in string %Zd in `era' field is not a single character"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0,
|
||||
_("%s: direction flag in string %Zd in `era' field"
|
||||
" is not a single character"),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else
|
||||
@@ -269,17 +268,17 @@ No definition for %s category found"), "LC_TIME"));
|
||||
if (endp == str)
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: invalid number for offset in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: invalid number for offset in string %Zd in"
|
||||
" `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: garbage at end of offset value in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: garbage at end of offset value in"
|
||||
" string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else
|
||||
@@ -328,18 +327,18 @@ No definition for %s category found"), "LC_TIME"));
|
||||
{
|
||||
invalid_start_date:
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: invalid starting date in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: invalid starting date in string %Zd in"
|
||||
" `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
{
|
||||
garbage_start_date:
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: garbage at end of starting date in string %Zd in `era' field "),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: garbage at end of starting date "
|
||||
"in string %Zd in `era' field "),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else
|
||||
@@ -356,9 +355,9 @@ No definition for %s category found"), "LC_TIME"));
|
||||
&& time->era_entries[idx].start_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].start_date[0])))
|
||||
&& !be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: starting date is invalid in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: starting date is invalid in"
|
||||
" string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,18 +404,18 @@ No definition for %s category found"), "LC_TIME"));
|
||||
{
|
||||
invalid_stop_date:
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: invalid stopping date in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: invalid stopping date in string %Zd in"
|
||||
" `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
{
|
||||
garbage_stop_date:
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: garbage at end of stopping date in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: garbage at end of stopping date "
|
||||
"in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else
|
||||
@@ -433,17 +432,17 @@ No definition for %s category found"), "LC_TIME"));
|
||||
&& time->era_entries[idx].stop_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].stop_date[0])))
|
||||
&& !be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: stopping date is invalid in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: stopping date is invalid in"
|
||||
" string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (str == NULL || *str == '\0')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: missing era name in string %Zd in `era' field"), "LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: missing era name in string %Zd in `era'"
|
||||
" field"), "LC_TIME", idx + 1);
|
||||
time->era_entries[idx].name =
|
||||
time->era_entries[idx].format = "";
|
||||
}
|
||||
@@ -454,9 +453,9 @@ No definition for %s category found"), "LC_TIME"));
|
||||
if (str == NULL || *str == '\0')
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
%s: missing era format in string %Zd in `era' field"),
|
||||
"LC_TIME", idx + 1));
|
||||
error (0, 0, _("%s: missing era format in string %Zd"
|
||||
" in `era' field"),
|
||||
"LC_TIME", idx + 1);
|
||||
time->era_entries[idx].name =
|
||||
time->era_entries[idx].format = "";
|
||||
}
|
||||
@@ -483,33 +482,33 @@ No definition for %s category found"), "LC_TIME"));
|
||||
time->week_1stday = 19971130;
|
||||
|
||||
if (time->week_1stweek > time->week_ndays)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: third operand for value of field `%s' must not be larger than %d"),
|
||||
"LC_TIME", "week", 7));
|
||||
"LC_TIME", "week", 7);
|
||||
|
||||
if (time->first_weekday == '\0')
|
||||
/* The definition does not specify this so the default is used. */
|
||||
time->first_weekday = 1;
|
||||
else if (time->first_weekday > time->week_ndays)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: values of field `%s' must not be larger than %d"),
|
||||
"LC_TIME", "first_weekday", 7));
|
||||
"LC_TIME", "first_weekday", 7);
|
||||
|
||||
if (time->first_workday == '\0')
|
||||
/* The definition does not specify this so the default is used. */
|
||||
time->first_workday = 1;
|
||||
else if (time->first_workday > time->week_ndays)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: values of field `%s' must not be larger than %d"),
|
||||
"LC_TIME", "first_workday", 7));
|
||||
"LC_TIME", "first_workday", 7);
|
||||
|
||||
if (time->cal_direction == '\0')
|
||||
/* The definition does not specify this so the default is used. */
|
||||
time->cal_direction = 1;
|
||||
else if (time->cal_direction > 3)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("\
|
||||
error (0, 0, _("\
|
||||
%s: values for field `%s' must not be larger than %d"),
|
||||
"LC_TIME", "cal_direction", 3));
|
||||
"LC_TIME", "cal_direction", 3);
|
||||
|
||||
/* XXX We don't perform any tests on the timezone value since this is
|
||||
simply useless, stupid $&$!@... */
|
||||
@@ -524,7 +523,7 @@ No definition for %s category found"), "LC_TIME"));
|
||||
|
||||
|
||||
void
|
||||
time_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
time_output (struct localedef_t *locale, struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
struct locale_time_t *time = locale->categories[LC_TIME].time;
|
||||
@@ -906,14 +905,14 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
+ 2 + time->num_era * 10 - 1));
|
||||
assert (last_idx == _NL_ITEM_INDEX (_NL_NUM_LC_TIME));
|
||||
|
||||
write_locale_data (output_path, LC_TIME, "LC_TIME", 2 + cnt, iov);
|
||||
write_locale_data (output_path, "LC_TIME", 2 + cnt, iov);
|
||||
}
|
||||
|
||||
|
||||
/* The parser for the LC_TIME section of the locale definition. */
|
||||
void
|
||||
time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
const struct charmap_t *charmap, const char *repertoire_name,
|
||||
struct charmap_t *charmap, const char *repertoire_name,
|
||||
int ignore_content)
|
||||
{
|
||||
struct repertoire_t *repertoire = NULL;
|
||||
@@ -932,7 +931,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@@ -958,7 +957,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@@ -977,7 +976,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
\
|
||||
for (cnt = 0; cnt < max; ++cnt) \
|
||||
{ \
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok == tok_eol) \
|
||||
{ \
|
||||
if (cnt < min) \
|
||||
@@ -1009,7 +1008,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
} \
|
||||
\
|
||||
/* Match the semicolon. */ \
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_semicolon && now->tok != tok_eol) \
|
||||
break; \
|
||||
} \
|
||||
@@ -1023,8 +1022,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
\
|
||||
if (now->tok == tok_semicolon) \
|
||||
{ \
|
||||
now = lr_token (ldfile, charmap, result, repertoire, \
|
||||
verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok == tok_eol) \
|
||||
lr_error (ldfile, _("extra trailing semicolon")); \
|
||||
else if (now->tok == tok_string) \
|
||||
@@ -1060,7 +1058,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_string)
|
||||
goto err_label;
|
||||
if (!ignore_content && (now->val.str.startmb == NULL
|
||||
@@ -1082,7 +1080,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
* sizeof (char *));
|
||||
time->wera[time->num_era++] = now->val.str.startwc;
|
||||
}
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_eol && now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
}
|
||||
@@ -1099,7 +1097,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
else if (time->cat != NULL) \
|
||||
@@ -1141,7 +1139,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (time->cat != 0) \
|
||||
@@ -1164,25 +1162,25 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
time->week_ndays = now->val.num;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
time->week_1stday = now->val.num;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
time->week_1stweek = now->val.num;
|
||||
@@ -1192,7 +1190,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_TIME'. */
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@@ -1209,7 +1207,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, result, repertoire, verbose);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
@@ -29,11 +28,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "charmap.h"
|
||||
#include "error.h"
|
||||
#include "linereader.h"
|
||||
#include "locfile.h"
|
||||
|
||||
/* Prototypes for a few program-wide used functions. */
|
||||
extern void *xmalloc (size_t __n);
|
||||
extern void *xrealloc (void *__p, size_t __n);
|
||||
extern char *xstrdup (const char *__str);
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static struct token *get_toplvl_escape (struct linereader *lr);
|
||||
@@ -41,7 +44,6 @@ static struct token *get_symname (struct linereader *lr);
|
||||
static struct token *get_ident (struct linereader *lr);
|
||||
static struct token *get_string (struct linereader *lr,
|
||||
const struct charmap_t *charmap,
|
||||
struct localedef_t *locale,
|
||||
const struct repertoire_t *repertoire,
|
||||
int verbose);
|
||||
|
||||
@@ -56,7 +58,7 @@ lr_open (const char *fname, kw_hash_fct_t hf)
|
||||
return lr_create (stdin, "<stdin>", hf);
|
||||
else
|
||||
{
|
||||
fp = fopen (fname, "rm");
|
||||
fp = fopen (fname, "r");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
return lr_create (fp, fname, hf);
|
||||
@@ -161,8 +163,7 @@ extern char *program_name;
|
||||
|
||||
struct token *
|
||||
lr_token (struct linereader *lr, const struct charmap_t *charmap,
|
||||
struct localedef_t *locale, const struct repertoire_t *repertoire,
|
||||
int verbose)
|
||||
const struct repertoire_t *repertoire, int verbose)
|
||||
{
|
||||
int ch;
|
||||
|
||||
@@ -294,7 +295,7 @@ lr_token (struct linereader *lr, const struct charmap_t *charmap,
|
||||
return &lr->token;
|
||||
|
||||
case '"':
|
||||
return get_string (lr, charmap, locale, repertoire, verbose);
|
||||
return get_string (lr, charmap, repertoire, verbose);
|
||||
|
||||
case '-':
|
||||
ch = lr_getc (lr);
|
||||
@@ -381,7 +382,7 @@ get_toplvl_escape (struct linereader *lr)
|
||||
bytes[nbytes++] = byte;
|
||||
}
|
||||
while (ch == lr->escape_char
|
||||
&& nbytes < (int) sizeof (lr->token.val.charcode.bytes));
|
||||
&& nbytes < sizeof (lr->token.val.charcode.bytes));
|
||||
|
||||
if (!isspace (ch))
|
||||
lr_error (lr, _("garbage at end of character code specification"));
|
||||
@@ -567,8 +568,7 @@ get_ident (struct linereader *lr)
|
||||
|
||||
static struct token *
|
||||
get_string (struct linereader *lr, const struct charmap_t *charmap,
|
||||
struct localedef_t *locale, const struct repertoire_t *repertoire,
|
||||
int verbose)
|
||||
const struct repertoire_t *repertoire, int verbose)
|
||||
{
|
||||
int return_widestr = lr->return_widestr;
|
||||
char *buf;
|
||||
@@ -690,6 +690,7 @@ non-symbolic character value should not be used"));
|
||||
if (cp == &buf[bufact])
|
||||
{
|
||||
char utmp[10];
|
||||
const char *symbol = NULL;
|
||||
|
||||
/* Yes, it is. */
|
||||
ADDC ('\0');
|
||||
@@ -711,65 +712,21 @@ non-symbolic character value should not be used"));
|
||||
the repertoire the name of the character and
|
||||
find it in the charmap. */
|
||||
if (repertoire != NULL)
|
||||
symbol = repertoire_find_symbol (repertoire, wch);
|
||||
|
||||
if (symbol == NULL)
|
||||
/* We cannot generate a string since we
|
||||
cannot map from the Unicode number to the
|
||||
character symbol. */
|
||||
illegal_string = 1;
|
||||
else
|
||||
{
|
||||
const char *symbol;
|
||||
seq = charmap_find_value (charmap, symbol,
|
||||
strlen (symbol));
|
||||
|
||||
symbol = repertoire_find_symbol (repertoire, wch);
|
||||
|
||||
if (symbol != NULL)
|
||||
seq = charmap_find_value (charmap, symbol,
|
||||
strlen (symbol));
|
||||
}
|
||||
|
||||
if (seq == NULL)
|
||||
{
|
||||
#ifndef NO_TRANSLITERATION
|
||||
/* Transliterate if possible. */
|
||||
if (locale != NULL)
|
||||
{
|
||||
uint32_t *translit;
|
||||
|
||||
if ((locale->avail & CTYPE_LOCALE) == 0)
|
||||
{
|
||||
/* Load the CTYPE data now. */
|
||||
int old_needed = locale->needed;
|
||||
|
||||
locale->needed = 0;
|
||||
locale = load_locale (LC_CTYPE,
|
||||
locale->name,
|
||||
locale->repertoire_name,
|
||||
charmap, locale);
|
||||
locale->needed = old_needed;
|
||||
}
|
||||
|
||||
if ((locale->avail & CTYPE_LOCALE) != 0
|
||||
&& ((translit = find_translit (locale,
|
||||
charmap, wch))
|
||||
!= NULL))
|
||||
/* The CTYPE data contains a matching
|
||||
transliteration. */
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; translit[i] != 0; ++i)
|
||||
{
|
||||
char utmp[10];
|
||||
|
||||
snprintf (utmp, sizeof (utmp), "U%08X",
|
||||
translit[i]);
|
||||
seq = charmap_find_value (charmap, utmp,
|
||||
9);
|
||||
assert (seq != NULL);
|
||||
ADDS (seq->bytes, seq->nbytes);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* NO_TRANSLITERATION */
|
||||
|
||||
/* Not a known name. */
|
||||
illegal_string = 1;
|
||||
if (seq == NULL)
|
||||
/* Not a known name. */
|
||||
illegal_string = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.org>.
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
typedef const struct keyword_t *(*kw_hash_fct_t) (const char *, unsigned int);
|
||||
struct charset_t;
|
||||
struct localedef_t;
|
||||
|
||||
|
||||
struct token
|
||||
{
|
||||
@@ -85,20 +85,18 @@ struct linereader
|
||||
|
||||
/* Functions defined in linereader.c. */
|
||||
extern struct linereader *lr_open (const char *fname, kw_hash_fct_t hf);
|
||||
extern struct linereader *lr_create (FILE *fp, const char *fname,
|
||||
kw_hash_fct_t hf);
|
||||
extern struct linereader *lr_create (FILE *fp, const char *fname, kw_hash_fct_t hf);
|
||||
extern int lr_eof (struct linereader *lr);
|
||||
extern void lr_close (struct linereader *lr);
|
||||
extern int lr_next (struct linereader *lr);
|
||||
extern struct token *lr_token (struct linereader *lr,
|
||||
const struct charmap_t *charmap,
|
||||
struct localedef_t *locale,
|
||||
const struct repertoire_t *repertoire,
|
||||
int verbose);
|
||||
|
||||
|
||||
#define lr_error(lr, fmt, args...) \
|
||||
WITH_CUR_LOCALE (error_at_line (0, 0, lr->fname, lr->lineno, fmt, ## args))
|
||||
error_at_line (0, 0, lr->fname, lr->lineno, fmt, ## args)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Implementation of the locale program according to POSIX 9945-2.
|
||||
Copyright (C) 1995-1997, 1999-2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
@@ -43,12 +43,10 @@
|
||||
|
||||
#include "localeinfo.h"
|
||||
#include "charmap-dir.h"
|
||||
#include "../locarchive.h"
|
||||
|
||||
extern void *xmalloc (size_t __n);
|
||||
extern char *xstrdup (const char *__str);
|
||||
|
||||
#define ARCHIVE_NAME LOCALEDIR "/locale-archive"
|
||||
|
||||
/* If set print the name of the category. */
|
||||
static int show_category_name;
|
||||
@@ -170,11 +168,7 @@ extern void locale_special (const char *name, int show_category_name,
|
||||
int show_keyword_name);
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static void print_LC_IDENTIFICATION (void *mapped, size_t size);
|
||||
static void print_LC_CTYPE (void *mapped, size_t size);
|
||||
static void write_locales (void);
|
||||
static int nameentcmp (const void *a, const void *b);
|
||||
static int write_archive_locales (void **all_datap, char *linebuf);
|
||||
static void write_charmaps (void);
|
||||
static void show_locale_vars (void);
|
||||
static void show_info (const char *name);
|
||||
@@ -288,7 +282,7 @@ print_version (FILE *stream, struct argp_state *state)
|
||||
Copyright (C) %s Free Software Foundation, Inc.\n\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
"), "2003");
|
||||
"), "2002");
|
||||
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
|
||||
}
|
||||
|
||||
@@ -333,74 +327,6 @@ select_dirs (const struct dirent *dirent)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_LC_IDENTIFICATION (void *mapped, size_t size)
|
||||
{
|
||||
/* Read the information from the file. */
|
||||
struct
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int nstrings;
|
||||
unsigned int strindex[0];
|
||||
} *filedata = mapped;
|
||||
|
||||
if (filedata->magic == LIMAGIC (LC_IDENTIFICATION)
|
||||
&& (sizeof *filedata
|
||||
+ (filedata->nstrings
|
||||
* sizeof (unsigned int))
|
||||
<= size))
|
||||
{
|
||||
const char *str;
|
||||
|
||||
#define HANDLE(idx, name) \
|
||||
str = ((char *) mapped \
|
||||
+ filedata->strindex[_NL_ITEM_INDEX (_NL_IDENTIFICATION_##idx)]); \
|
||||
if (*str != '\0') \
|
||||
printf ("%9s | %s\n", name, str)
|
||||
HANDLE (TITLE, "title");
|
||||
HANDLE (SOURCE, "source");
|
||||
HANDLE (ADDRESS, "address");
|
||||
HANDLE (CONTACT, "contact");
|
||||
HANDLE (EMAIL, "email");
|
||||
HANDLE (TEL, "telephone");
|
||||
HANDLE (FAX, "fax");
|
||||
HANDLE (LANGUAGE, "language");
|
||||
HANDLE (TERRITORY, "territory");
|
||||
HANDLE (AUDIENCE, "audience");
|
||||
HANDLE (APPLICATION, "application");
|
||||
HANDLE (ABBREVIATION, "abbreviation");
|
||||
HANDLE (REVISION, "revision");
|
||||
HANDLE (DATE, "date");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_LC_CTYPE (void *mapped, size_t size)
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int nstrings;
|
||||
unsigned int strindex[0];
|
||||
} *filedata = mapped;
|
||||
|
||||
if (filedata->magic == LIMAGIC (LC_CTYPE)
|
||||
&& (sizeof *filedata
|
||||
+ (filedata->nstrings
|
||||
* sizeof (unsigned int))
|
||||
<= size))
|
||||
{
|
||||
const char *str;
|
||||
|
||||
str = ((char *) mapped
|
||||
+ filedata->strindex[_NL_ITEM_INDEX (_NL_CTYPE_CODESET_NAME)]);
|
||||
if (*str != '\0')
|
||||
printf (" codeset | %s\n", str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Write the names of all available locales to stdout. We have some
|
||||
sources of the information: the contents of the locale directory
|
||||
and the locale.alias file. To avoid duplicates and print the
|
||||
@@ -421,91 +347,6 @@ write_locales (void)
|
||||
|
||||
#define PUT(name) tsearch (name, &all_data, \
|
||||
(int (*) (const void *, const void *)) strcoll)
|
||||
#define GET(name) tfind (name, &all_data, \
|
||||
(int (*) (const void *, const void *)) strcoll)
|
||||
|
||||
/* `POSIX' locale is always available (POSIX.2 4.34.3). */
|
||||
PUT ("POSIX");
|
||||
/* And so is the "C" locale. */
|
||||
PUT ("C");
|
||||
|
||||
memset (linebuf, '-', sizeof (linebuf) - 1);
|
||||
linebuf[sizeof (linebuf) - 1] = '\0';
|
||||
|
||||
/* First scan the locale archive. */
|
||||
if (write_archive_locales (&all_data, linebuf))
|
||||
first_locale = 0;
|
||||
|
||||
/* Now we can look for all files in the directory. */
|
||||
ndirents = scandir (LOCALEDIR, &dirents, select_dirs, alphasort);
|
||||
for (cnt = 0; cnt < ndirents; ++cnt)
|
||||
{
|
||||
/* Test whether at least the LC_CTYPE data is there. Some
|
||||
directories only contain translations. */
|
||||
char buf[sizeof (LOCALEDIR) + strlen (dirents[cnt]->d_name)
|
||||
+ sizeof "/LC_IDENTIFICATION"];
|
||||
char *enddir;
|
||||
struct stat64 st;
|
||||
|
||||
stpcpy (enddir = stpcpy (stpcpy (stpcpy (buf, LOCALEDIR), "/"),
|
||||
dirents[cnt]->d_name),
|
||||
"/LC_IDENTIFICATION");
|
||||
|
||||
if (stat64 (buf, &st) == 0 && S_ISREG (st.st_mode))
|
||||
{
|
||||
if (verbose && GET (dirents[cnt]->d_name) == NULL)
|
||||
{
|
||||
/* Provide some nice output of all kinds of
|
||||
information. */
|
||||
int fd;
|
||||
|
||||
if (! first_locale)
|
||||
putchar_unlocked ('\n');
|
||||
first_locale = 0;
|
||||
|
||||
printf ("locale: %-15.15s directory: %.*s\n%s\n",
|
||||
dirents[cnt]->d_name, (int) (enddir - buf), buf,
|
||||
linebuf);
|
||||
|
||||
fd = open64 (buf, O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
void *mapped = mmap64 (NULL, st.st_size, PROT_READ,
|
||||
MAP_SHARED, fd, 0);
|
||||
if (mapped != MAP_FAILED)
|
||||
{
|
||||
print_LC_IDENTIFICATION (mapped, st.st_size);
|
||||
|
||||
munmap (mapped, st.st_size);
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
/* Now try to get the charset information. */
|
||||
strcpy (enddir, "/LC_CTYPE");
|
||||
fd = open64 (buf, O_RDONLY);
|
||||
if (fd != -1 && fstat64 (fd, &st) >= 0
|
||||
&& ((mapped = mmap64 (NULL, st.st_size, PROT_READ,
|
||||
MAP_SHARED, fd, 0))
|
||||
!= MAP_FAILED))
|
||||
{
|
||||
print_LC_CTYPE (mapped, st.st_size);
|
||||
|
||||
munmap (mapped, st.st_size);
|
||||
}
|
||||
|
||||
if (fd != -1)
|
||||
close (fd);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the verbose format is not selected we simply
|
||||
collect the names. */
|
||||
PUT (xstrdup (dirents[cnt]->d_name));
|
||||
}
|
||||
}
|
||||
if (ndirents > 0)
|
||||
free (dirents);
|
||||
|
||||
/* Now read the locale.alias files. */
|
||||
if (argz_create_sep (LOCALE_ALIAS_PATH, ':', &alias_path, &alias_path_len))
|
||||
@@ -519,7 +360,7 @@ write_locales (void)
|
||||
char full_name[strlen (entry) + sizeof aliasfile];
|
||||
|
||||
stpcpy (stpcpy (full_name, entry), aliasfile);
|
||||
fp = fopen (full_name, "rm");
|
||||
fp = fopen (full_name, "r");
|
||||
if (fp == NULL)
|
||||
/* Ignore non-existing files. */
|
||||
continue;
|
||||
@@ -581,7 +422,7 @@ write_locales (void)
|
||||
*cp++ = '\0';
|
||||
|
||||
/* Add the alias. */
|
||||
if (! verbose && GET (value) != NULL)
|
||||
if (! verbose)
|
||||
PUT (xstrdup (alias));
|
||||
}
|
||||
}
|
||||
@@ -601,120 +442,146 @@ write_locales (void)
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
memset (linebuf, '-', sizeof (linebuf) - 1);
|
||||
linebuf[sizeof (linebuf) - 1] = '\0';
|
||||
|
||||
/* Now we can look for all files in the directory. */
|
||||
ndirents = scandir (LOCALEDIR, &dirents, select_dirs, alphasort);
|
||||
for (cnt = 0; cnt < ndirents; ++cnt)
|
||||
{
|
||||
/* Test whether at least the LC_CTYPE data is there. Some
|
||||
directories only contain translations. */
|
||||
char buf[sizeof (LOCALEDIR) + strlen (dirents[cnt]->d_name)
|
||||
+ sizeof "/LC_IDENTIFICATION"];
|
||||
char *enddir;
|
||||
struct stat64 st;
|
||||
|
||||
stpcpy (enddir = stpcpy (stpcpy (stpcpy (buf, LOCALEDIR), "/"),
|
||||
dirents[cnt]->d_name),
|
||||
"/LC_IDENTIFICATION");
|
||||
|
||||
if (stat64 (buf, &st) == 0 && S_ISREG (st.st_mode))
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
/* Provide some nice output of all kinds of
|
||||
information. */
|
||||
int fd;
|
||||
|
||||
if (! first_locale)
|
||||
putchar_unlocked ('\n');
|
||||
first_locale = 0;
|
||||
|
||||
printf ("locale: %-15.15s directory: %.*s\n%s\n",
|
||||
dirents[cnt]->d_name, (int) (enddir - buf), buf,
|
||||
linebuf);
|
||||
|
||||
fd = open64 (buf, O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
void *mapped = mmap64 (NULL, st.st_size, PROT_READ,
|
||||
MAP_SHARED, fd, 0);
|
||||
if (mapped != MAP_FAILED)
|
||||
{
|
||||
/* Read the information from the file. */
|
||||
struct
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int nstrings;
|
||||
unsigned int strindex[0];
|
||||
} *filedata = mapped;
|
||||
|
||||
if (filedata->magic == LIMAGIC (LC_IDENTIFICATION)
|
||||
&& (sizeof *filedata
|
||||
+ (filedata->nstrings
|
||||
* sizeof (unsigned int))
|
||||
<= (size_t) st.st_size))
|
||||
{
|
||||
const char *str;
|
||||
|
||||
#define HANDLE(idx, name) \
|
||||
str = ((char *) mapped \
|
||||
+ filedata->strindex[_NL_ITEM_INDEX (_NL_IDENTIFICATION_##idx)]); \
|
||||
if (*str != '\0') \
|
||||
printf ("%9s | %s\n", name, str)
|
||||
HANDLE (TITLE, "title");
|
||||
HANDLE (SOURCE, "source");
|
||||
HANDLE (ADDRESS, "address");
|
||||
HANDLE (CONTACT, "contact");
|
||||
HANDLE (EMAIL, "email");
|
||||
HANDLE (TEL, "telephone");
|
||||
HANDLE (FAX, "fax");
|
||||
HANDLE (LANGUAGE, "language");
|
||||
HANDLE (TERRITORY, "territory");
|
||||
HANDLE (AUDIENCE, "audience");
|
||||
HANDLE (APPLICATION, "application");
|
||||
HANDLE (ABBREVIATION, "abbreviation");
|
||||
HANDLE (REVISION, "revision");
|
||||
HANDLE (DATE, "date");
|
||||
}
|
||||
|
||||
munmap (mapped, st.st_size);
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
/* Now try to get the charset information. */
|
||||
strcpy (enddir, "/LC_CTYPE");
|
||||
fd = open64 (buf, O_RDONLY);
|
||||
if (fd != -1 && fstat64 (fd, &st) >= 0
|
||||
&& ((mapped = mmap64 (NULL, st.st_size, PROT_READ,
|
||||
MAP_SHARED, fd, 0))
|
||||
!= MAP_FAILED))
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int nstrings;
|
||||
unsigned int strindex[0];
|
||||
} *filedata = mapped;
|
||||
|
||||
if (filedata->magic == LIMAGIC (LC_CTYPE)
|
||||
&& (sizeof *filedata
|
||||
+ (filedata->nstrings
|
||||
* sizeof (unsigned int))
|
||||
<= (size_t) st.st_size))
|
||||
{
|
||||
const char *str;
|
||||
|
||||
str = ((char *) mapped
|
||||
+ filedata->strindex[_NL_ITEM_INDEX (_NL_CTYPE_CODESET_NAME)]);
|
||||
if (*str != '\0')
|
||||
printf (" codeset | %s\n", str);
|
||||
}
|
||||
|
||||
munmap (mapped, st.st_size);
|
||||
}
|
||||
|
||||
if (fd != -1)
|
||||
close (fd);
|
||||
}
|
||||
}
|
||||
else
|
||||
/* If the verbose format is not selected we simply
|
||||
collect the names. */
|
||||
PUT (xstrdup (dirents[cnt]->d_name));
|
||||
}
|
||||
}
|
||||
if (ndirents > 0)
|
||||
free (dirents);
|
||||
|
||||
if (! verbose)
|
||||
{
|
||||
/* `POSIX' locale is always available (POSIX.2 4.34.3). */
|
||||
PUT ("POSIX");
|
||||
/* And so is the "C" locale. */
|
||||
PUT ("C");
|
||||
|
||||
twalk (all_data, print_names);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct nameent
|
||||
{
|
||||
char *name;
|
||||
uint32_t locrec_offset;
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
nameentcmp (const void *a, const void *b)
|
||||
{
|
||||
return strcoll (((const struct nameent *) a)->name,
|
||||
((const struct nameent *) b)->name);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
write_archive_locales (void **all_datap, char *linebuf)
|
||||
{
|
||||
struct stat64 st;
|
||||
void *all_data = *all_datap;
|
||||
size_t len = 0;
|
||||
struct locarhead *head;
|
||||
struct namehashent *namehashtab;
|
||||
char *addr = MAP_FAILED;
|
||||
int fd, ret = 0;
|
||||
uint32_t cnt;
|
||||
|
||||
fd = open64 (ARCHIVE_NAME, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return 0;
|
||||
|
||||
if (fstat64 (fd, &st) < 0 || st.st_size < sizeof (*head))
|
||||
goto error_out;
|
||||
|
||||
len = st.st_size;
|
||||
addr = mmap64 (NULL, len, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (addr == MAP_FAILED)
|
||||
goto error_out;
|
||||
|
||||
head = (struct locarhead *) addr;
|
||||
if (head->namehash_offset + head->namehash_size > len
|
||||
|| head->string_offset + head->string_size > len
|
||||
|| head->locrectab_offset + head->locrectab_size > len
|
||||
|| head->sumhash_offset + head->sumhash_size > len)
|
||||
goto error_out;
|
||||
|
||||
namehashtab = (struct namehashent *) (addr + head->namehash_offset);
|
||||
if (! verbose)
|
||||
{
|
||||
for (cnt = 0; cnt < head->namehash_size; ++cnt)
|
||||
if (namehashtab[cnt].locrec_offset != 0)
|
||||
{
|
||||
PUT (xstrdup (addr + namehashtab[cnt].name_offset));
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
struct nameent *names;
|
||||
uint32_t used;
|
||||
|
||||
names = (struct nameent *) xmalloc (head->namehash_used
|
||||
* sizeof (struct nameent));
|
||||
for (cnt = used = 0; cnt < head->namehash_size; ++cnt)
|
||||
if (namehashtab[cnt].locrec_offset != 0)
|
||||
{
|
||||
names[used].name = addr + namehashtab[cnt].name_offset;
|
||||
names[used++].locrec_offset = namehashtab[cnt].locrec_offset;
|
||||
}
|
||||
|
||||
/* Sort the names. */
|
||||
qsort (names, used, sizeof (struct nameent), nameentcmp);
|
||||
|
||||
for (cnt = 0; cnt < used; ++cnt)
|
||||
{
|
||||
struct locrecent *locrec;
|
||||
|
||||
PUT (xstrdup (names[cnt].name));
|
||||
|
||||
if (cnt)
|
||||
putchar_unlocked ('\n');
|
||||
|
||||
printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n",
|
||||
names[cnt].name, linebuf);
|
||||
|
||||
locrec = (struct locrecent *) (addr + names[cnt].locrec_offset);
|
||||
|
||||
print_LC_IDENTIFICATION (addr
|
||||
+ locrec->record[LC_IDENTIFICATION].offset,
|
||||
locrec->record[LC_IDENTIFICATION].len);
|
||||
|
||||
print_LC_CTYPE (addr + locrec->record[LC_CTYPE].offset,
|
||||
locrec->record[LC_CTYPE].len);
|
||||
}
|
||||
|
||||
ret = used;
|
||||
}
|
||||
|
||||
error_out:
|
||||
if (addr != MAP_FAILED)
|
||||
munmap (addr, len);
|
||||
close (fd);
|
||||
*all_datap = all_data;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Write the names of all available character maps to stdout. */
|
||||
static void
|
||||
write_charmaps (void)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
@@ -27,16 +27,14 @@
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
#include <mcheck.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <error.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "error.h"
|
||||
#include "charmap.h"
|
||||
#include "locfile.h"
|
||||
|
||||
@@ -57,8 +55,7 @@ int verbose;
|
||||
/* If not zero suppress warnings and information messages. */
|
||||
int be_quiet;
|
||||
|
||||
/* If not zero, produce old-style hash table instead of 3-level access
|
||||
tables. */
|
||||
/* If not zero, produce old-style hash table instead of 3-level access tables. */
|
||||
int oldstyle_tables;
|
||||
|
||||
/* If not zero force output even if warning were issued. */
|
||||
@@ -76,44 +73,18 @@ static const char *input_file;
|
||||
/* Name of the repertoire map file. */
|
||||
const char *repertoire_global;
|
||||
|
||||
/* Name of the locale.alias file. */
|
||||
const char *alias_file;
|
||||
|
||||
/* List of all locales. */
|
||||
static struct localedef_t *locales;
|
||||
|
||||
/* If true don't add locale data to archive. */
|
||||
bool no_archive;
|
||||
|
||||
/* If true add named locales to archive. */
|
||||
static bool add_to_archive;
|
||||
|
||||
/* If true delete named locales from archive. */
|
||||
static bool delete_from_archive;
|
||||
|
||||
/* If true replace archive content when adding. */
|
||||
static bool replace_archive;
|
||||
|
||||
/* If true list archive content. */
|
||||
static bool list_archive;
|
||||
|
||||
/* Maximum number of retries when opening the locale archive. */
|
||||
int max_locarchive_open_retry = 10;
|
||||
|
||||
|
||||
/* Name and version of program. */
|
||||
static void print_version (FILE *stream, struct argp_state *state);
|
||||
void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
|
||||
|
||||
#define OPT_POSIX 301
|
||||
#define OPT_QUIET 302
|
||||
#define OPT_OLDSTYLE 303
|
||||
#define OPT_PREFIX 304
|
||||
#define OPT_NO_ARCHIVE 305
|
||||
#define OPT_ADD_TO_ARCHIVE 306
|
||||
#define OPT_REPLACE 307
|
||||
#define OPT_DELETE_FROM_ARCHIVE 308
|
||||
#define OPT_LIST_ARCHIVE 309
|
||||
#define OPT_POSIX 1
|
||||
#define OPT_QUIET 2
|
||||
#define OPT_OLDSTYLE 3
|
||||
#define OPT_PREFIX 4
|
||||
|
||||
/* Definitions of arguments for argp functions. */
|
||||
static const struct argp_option options[] =
|
||||
@@ -134,17 +105,6 @@ static const struct argp_option options[] =
|
||||
{ "quiet", OPT_QUIET, NULL, 0,
|
||||
N_("Suppress warnings and information messages") },
|
||||
{ "verbose", 'v', NULL, 0, N_("Print more messages") },
|
||||
{ NULL, 0, NULL, 0, N_("Archive control:") },
|
||||
{ "no-archive", OPT_NO_ARCHIVE, NULL, 0,
|
||||
N_("Don't add new data to archive") },
|
||||
{ "add-to-archive", OPT_ADD_TO_ARCHIVE, NULL, 0,
|
||||
N_("Add locales named by parameters to archive") },
|
||||
{ "replace", OPT_REPLACE, NULL, 0, N_("Replace existing archive content") },
|
||||
{ "delete-from-archive", OPT_DELETE_FROM_ARCHIVE, NULL, 0,
|
||||
N_("Remove locales named by parameters from archive") },
|
||||
{ "list-archive", OPT_LIST_ARCHIVE, NULL, 0, N_("List content of archive") },
|
||||
{ "alias-file", 'A', "FILE", 0,
|
||||
N_("locale.alias file to consult when making archive")},
|
||||
{ NULL, 0, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
@@ -152,10 +112,7 @@ static const struct argp_option options[] =
|
||||
static const char doc[] = N_("Compile locale specification");
|
||||
|
||||
/* Strings for arguments in help texts. */
|
||||
static const char args_doc[] = N_("\
|
||||
NAME\n\
|
||||
[--add-to-archive|--delete-from-archive] FILE...\n\
|
||||
--list-archive [FILE]");
|
||||
static const char args_doc[] = N_("NAME");
|
||||
|
||||
/* Prototype for option handler. */
|
||||
static error_t parse_opt (int key, char *arg, struct argp_state *state);
|
||||
@@ -205,15 +162,6 @@ main (int argc, char *argv[])
|
||||
argp_err_exit_status = 4;
|
||||
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
|
||||
|
||||
/* Handle a few special cases. */
|
||||
if (list_archive)
|
||||
show_archive_content (verbose);
|
||||
if (add_to_archive)
|
||||
return add_locales_to_archive (argc - remaining, &argv[remaining],
|
||||
replace_archive);
|
||||
if (delete_from_archive)
|
||||
return delete_locales_from_archive (argc - remaining, &argv[remaining]);
|
||||
|
||||
/* POSIX.2 requires to be verbose about missing characters in the
|
||||
character map. */
|
||||
verbose |= posix_conformance;
|
||||
@@ -229,8 +177,6 @@ main (int argc, char *argv[])
|
||||
/* The parameter describes the output path of the constructed files.
|
||||
If the described files cannot be written return a NULL pointer. */
|
||||
output_path = construct_output_path (argv[remaining]);
|
||||
if (output_path == NULL && ! no_archive)
|
||||
error (4, errno, _("cannot create directory for output files"));
|
||||
cannot_write_why = errno;
|
||||
|
||||
/* Now that the parameters are processed we have to reset the local
|
||||
@@ -241,8 +187,7 @@ main (int argc, char *argv[])
|
||||
defines error code 3 for this situation so I think it must be
|
||||
a fatal error (see P1003.2 4.35.8). */
|
||||
if (sysconf (_SC_2_LOCALEDEF) < 0)
|
||||
WITH_CUR_LOCALE (error (3, 0, _("\
|
||||
FATAL: system does not define `_POSIX2_LOCALEDEF'")));
|
||||
error (3, 0, _("FATAL: system does not define `_POSIX2_LOCALEDEF'"));
|
||||
|
||||
/* Process charmap file. */
|
||||
charmap = charmap_read (charmap_file, verbose, be_quiet, 1);
|
||||
@@ -255,8 +200,7 @@ FATAL: system does not define `_POSIX2_LOCALEDEF'")));
|
||||
|
||||
/* Now read the locale file. */
|
||||
if (locfile_read (&global, charmap) != 0)
|
||||
WITH_CUR_LOCALE (error (4, errno, _("\
|
||||
cannot open locale definition file `%s'"), input_file));
|
||||
error (4, errno, _("cannot open locale definition file `%s'"), input_file);
|
||||
|
||||
/* Perhaps we saw some `copy' instructions. */
|
||||
while (1)
|
||||
@@ -271,8 +215,8 @@ cannot open locale definition file `%s'"), input_file));
|
||||
break;
|
||||
|
||||
if (locfile_read (runp, charmap) != 0)
|
||||
WITH_CUR_LOCALE (error (4, errno, _("\
|
||||
cannot open locale definition file `%s'"), runp->name));
|
||||
error (4, errno, _("cannot open locale definition file `%s'"),
|
||||
runp->name);
|
||||
}
|
||||
|
||||
/* Check the categories we processed in source form. */
|
||||
@@ -283,14 +227,13 @@ cannot open locale definition file `%s'"), runp->name));
|
||||
if (error_message_count == 0 || force_output != 0)
|
||||
{
|
||||
if (cannot_write_why != 0)
|
||||
WITH_CUR_LOCALE (error (4, cannot_write_why, _("\
|
||||
cannot write output files to `%s'"), output_path));
|
||||
error (4, cannot_write_why, _("cannot write output files to `%s'"),
|
||||
output_path);
|
||||
else
|
||||
write_all_categories (locales, charmap, argv[remaining], output_path);
|
||||
write_all_categories (locales, charmap, output_path);
|
||||
}
|
||||
else
|
||||
WITH_CUR_LOCALE (error (4, 0, _("\
|
||||
no output file produced because warning were issued")));
|
||||
error (4, 0, _("no output file produced because warning were issued"));
|
||||
|
||||
/* This exit status is prescribed by POSIX.2 4.35.7. */
|
||||
exit (error_message_count != 0);
|
||||
@@ -315,30 +258,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
case OPT_PREFIX:
|
||||
output_prefix = arg;
|
||||
break;
|
||||
case OPT_NO_ARCHIVE:
|
||||
no_archive = true;
|
||||
break;
|
||||
case OPT_ADD_TO_ARCHIVE:
|
||||
add_to_archive = true;
|
||||
break;
|
||||
case OPT_REPLACE:
|
||||
replace_archive = true;
|
||||
break;
|
||||
case OPT_DELETE_FROM_ARCHIVE:
|
||||
delete_from_archive = true;
|
||||
break;
|
||||
case OPT_LIST_ARCHIVE:
|
||||
list_archive = true;
|
||||
break;
|
||||
case 'c':
|
||||
force_output = 1;
|
||||
break;
|
||||
case 'f':
|
||||
charmap_file = arg;
|
||||
break;
|
||||
case 'A':
|
||||
alias_file = arg;
|
||||
break;
|
||||
case 'i':
|
||||
input_file = arg;
|
||||
break;
|
||||
@@ -387,7 +312,7 @@ print_version (FILE *stream, struct argp_state *state)
|
||||
Copyright (C) %s Free Software Foundation, Inc.\n\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
"), "2003");
|
||||
"), "2002");
|
||||
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
|
||||
}
|
||||
|
||||
@@ -449,9 +374,6 @@ construct_output_path (char *path)
|
||||
output_prefix ?: "", LOCALEDIR,
|
||||
(int) (startp - path), path, normal, endp, '\0');
|
||||
|
||||
if (n < 0)
|
||||
return NULL;
|
||||
|
||||
endp = result + n - 1;
|
||||
}
|
||||
else
|
||||
@@ -461,21 +383,16 @@ construct_output_path (char *path)
|
||||
size_t len = strlen (path) + 1;
|
||||
result = xmalloc (len + 1);
|
||||
endp = mempcpy (result, path, len) - 1;
|
||||
|
||||
/* If the user specified an output path we cannot add the output
|
||||
to the archive. */
|
||||
no_archive = true;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
|
||||
if (no_archive && euidaccess (result, W_OK) == -1)
|
||||
if (euidaccess (result, W_OK) == -1)
|
||||
/* Perhaps the directory does not exist now. Try to create it. */
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
errno = 0;
|
||||
if (mkdir (result, 0777) < 0)
|
||||
return NULL;
|
||||
mkdir (result, 0777);
|
||||
}
|
||||
|
||||
*endp++ = '/';
|
||||
@@ -561,17 +478,14 @@ add_to_readlist (int locale, const char *name, const char *repertoire_name,
|
||||
}
|
||||
}
|
||||
|
||||
if (generate
|
||||
&& (runp->needed & (1 << locale)) != 0
|
||||
&& (runp->avail & (1 << locale)) == 0)
|
||||
WITH_CUR_LOCALE (error (5, 0, _("\
|
||||
circular dependencies between locale definitions")));
|
||||
if (generate && (runp->needed & (1 << locale)) != 0)
|
||||
error (5, 0, _("circular dependencies between locale definitions"));
|
||||
|
||||
if (copy_locale != NULL)
|
||||
{
|
||||
if (runp->categories[locale].generic != NULL)
|
||||
WITH_CUR_LOCALE (error (5, 0, _("\
|
||||
cannot add already read locale `%s' a second time"), name));
|
||||
error (5, 0, _("cannot add already read locale `%s' a second time"),
|
||||
name);
|
||||
else
|
||||
runp->categories[locale].generic =
|
||||
copy_locale->categories[locale].generic;
|
||||
@@ -585,7 +499,7 @@ cannot add already read locale `%s' a second time"), name));
|
||||
|
||||
struct localedef_t *
|
||||
find_locale (int locale, const char *name, const char *repertoire_name,
|
||||
const struct charmap_t *charmap)
|
||||
struct charmap_t *charmap)
|
||||
{
|
||||
struct localedef_t *result;
|
||||
|
||||
@@ -596,8 +510,8 @@ find_locale (int locale, const char *name, const char *repertoire_name,
|
||||
|
||||
if ((result->avail & (1 << locale)) == 0
|
||||
&& locfile_read (result, charmap) != 0)
|
||||
WITH_CUR_LOCALE (error (4, errno, _("\
|
||||
cannot open locale definition file `%s'"), result->name));
|
||||
error (4, errno, _("cannot open locale definition file `%s'"),
|
||||
result->name);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -605,7 +519,7 @@ cannot open locale definition file `%s'"), result->name));
|
||||
|
||||
struct localedef_t *
|
||||
load_locale (int locale, const char *name, const char *repertoire_name,
|
||||
const struct charmap_t *charmap, struct localedef_t *copy_locale)
|
||||
struct charmap_t *charmap, struct localedef_t *copy_locale)
|
||||
{
|
||||
struct localedef_t *result;
|
||||
|
||||
@@ -616,8 +530,8 @@ load_locale (int locale, const char *name, const char *repertoire_name,
|
||||
|
||||
if ((result->avail & (1 << locale)) == 0
|
||||
&& locfile_read (result, charmap) != 0)
|
||||
WITH_CUR_LOCALE (error (4, errno, _("\
|
||||
cannot open locale definition file `%s'"), result->name));
|
||||
error (4, errno, _("cannot open locale definition file `%s'"),
|
||||
result->name);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* General definitions for localedef(1).
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002 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.
|
||||
|
||||
@@ -22,13 +22,10 @@
|
||||
#define _LOCALEDEF_H 1
|
||||
|
||||
/* Get the basic locale definitions. */
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "repertoire.h"
|
||||
#include "../locarchive.h"
|
||||
|
||||
|
||||
/* We need a bitmask for the locales. */
|
||||
@@ -116,9 +113,6 @@ extern int verbose;
|
||||
extern int be_quiet;
|
||||
extern int oldstyle_tables;
|
||||
extern const char *repertoire_global;
|
||||
extern int max_locarchive_open_retry;
|
||||
extern bool no_archive;
|
||||
extern const char *alias_file;
|
||||
|
||||
|
||||
/* Prototypes for a few program-wide used functions. */
|
||||
@@ -128,19 +122,6 @@ extern void *xrealloc (void *__p, size_t __n);
|
||||
extern char *xstrdup (const char *__str);
|
||||
|
||||
|
||||
/* Wrapper to switch LC_CTYPE back to the locale specified in the
|
||||
environment for output. */
|
||||
#define WITH_CUR_LOCALE(stmt) \
|
||||
do { \
|
||||
int saved_errno = errno; \
|
||||
const char *cur_locale_ = setlocale (LC_CTYPE, NULL); \
|
||||
setlocale (LC_CTYPE, ""); \
|
||||
errno = saved_errno; \
|
||||
stmt; \
|
||||
setlocale (LC_CTYPE, cur_locale_); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Mark given locale as to be read. */
|
||||
extern struct localedef_t *add_to_readlist (int locale, const char *name,
|
||||
const char *repertoire_name,
|
||||
@@ -150,32 +131,12 @@ extern struct localedef_t *add_to_readlist (int locale, const char *name,
|
||||
/* Find the information for the locale NAME. */
|
||||
extern struct localedef_t *find_locale (int locale, const char *name,
|
||||
const char *repertoire_name,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
|
||||
/* Load (if necessary) the information for the locale NAME. */
|
||||
extern struct localedef_t *load_locale (int locale, const char *name,
|
||||
const char *repertoire_name,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
struct localedef_t *copy_locale);
|
||||
|
||||
|
||||
/* Open the locale archive. */
|
||||
extern void open_archive (struct locarhandle *ah, bool readonly);
|
||||
|
||||
/* Close the locale archive. */
|
||||
extern void close_archive (struct locarhandle *ah);
|
||||
|
||||
/* Add given locale data to the archive. */
|
||||
extern int add_locale_to_archive (struct locarhandle *ah, const char *name,
|
||||
locale_data_t data, bool replace);
|
||||
|
||||
/* Add content of named directories to locale archive. */
|
||||
extern int add_locales_to_archive (size_t nlist, char *list[], bool replace);
|
||||
|
||||
/* Removed named locales from archive. */
|
||||
extern int delete_locales_from_archive (size_t nlist, char *list[]);
|
||||
|
||||
/* List content of locale archive. */
|
||||
extern void show_archive_content (int verbose);
|
||||
|
||||
#endif /* localedef.h */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
|
||||
|
||||
@@ -30,24 +30,18 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../../crypt/md5.h"
|
||||
#include "localedef.h"
|
||||
#include "locfile.h"
|
||||
#include "simple-hash.h"
|
||||
|
||||
#include "locfile-kw.h"
|
||||
|
||||
|
||||
/* Temporary storage of the locale data before writing it to the archive. */
|
||||
static locale_data_t to_archive;
|
||||
|
||||
|
||||
int
|
||||
locfile_read (struct localedef_t *result, const struct charmap_t *charmap)
|
||||
locfile_read (struct localedef_t *result, struct charmap_t *charmap)
|
||||
{
|
||||
const char *filename = result->name;
|
||||
const char *repertoire_name = result->repertoire_name;
|
||||
int locale_mask = result->needed & ~result->avail;
|
||||
int locale_mask = result->needed ^ result->avail;
|
||||
struct linereader *ldfile;
|
||||
int not_here = ALL_LOCALES;
|
||||
|
||||
@@ -103,7 +97,7 @@ locfile_read (struct localedef_t *result, const struct charmap_t *charmap)
|
||||
/* Parse locale definition file and store result in RESULT. */
|
||||
while (1)
|
||||
{
|
||||
struct token *now = lr_token (ldfile, charmap, NULL, NULL, verbose);
|
||||
struct token *now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
enum token_t nowtok = now->tok;
|
||||
struct token *arg;
|
||||
|
||||
@@ -119,7 +113,7 @@ locfile_read (struct localedef_t *result, const struct charmap_t *charmap)
|
||||
case tok_escape_char:
|
||||
case tok_comment_char:
|
||||
/* We need an argument. */
|
||||
arg = lr_token (ldfile, charmap, NULL, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
if (arg->tok != tok_ident)
|
||||
{
|
||||
@@ -146,7 +140,7 @@ argument to `%s' must be a single character"),
|
||||
|
||||
case tok_repertoiremap:
|
||||
/* We need an argument. */
|
||||
arg = lr_token (ldfile, charmap, NULL, NULL, verbose);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
if (arg->tok != tok_ident)
|
||||
{
|
||||
@@ -271,7 +265,7 @@ syntax error: not inside a locale definition section"));
|
||||
/* Semantic checking of locale specifications. */
|
||||
|
||||
static void (*const check_funcs[]) (struct localedef_t *,
|
||||
const struct charmap_t *) =
|
||||
struct charmap_t *) =
|
||||
{
|
||||
[LC_CTYPE] = ctype_finish,
|
||||
[LC_COLLATE] = collate_finish,
|
||||
@@ -289,7 +283,7 @@ static void (*const check_funcs[]) (struct localedef_t *,
|
||||
|
||||
void
|
||||
check_all_categories (struct localedef_t *definitions,
|
||||
const struct charmap_t *charmap)
|
||||
struct charmap_t *charmap)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
@@ -301,8 +295,8 @@ check_all_categories (struct localedef_t *definitions,
|
||||
|
||||
/* Writing the locale data files. All files use the same output_path. */
|
||||
|
||||
static void (*const write_funcs[]) (struct localedef_t *,
|
||||
const struct charmap_t *, const char *) =
|
||||
static void (*const write_funcs[]) (struct localedef_t *, struct charmap_t *,
|
||||
const char *) =
|
||||
{
|
||||
[LC_CTYPE] = ctype_output,
|
||||
[LC_COLLATE] = collate_output,
|
||||
@@ -318,10 +312,9 @@ static void (*const write_funcs[]) (struct localedef_t *,
|
||||
[LC_IDENTIFICATION] = identification_output
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
write_all_categories (struct localedef_t *definitions,
|
||||
const struct charmap_t *charmap, const char *locname,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
{
|
||||
int cnt;
|
||||
@@ -329,25 +322,8 @@ write_all_categories (struct localedef_t *definitions,
|
||||
for (cnt = 0; cnt < sizeof (write_funcs) / sizeof (write_funcs[0]); ++cnt)
|
||||
if (write_funcs[cnt] != NULL)
|
||||
write_funcs[cnt] (definitions, charmap, output_path);
|
||||
|
||||
if (! no_archive)
|
||||
{
|
||||
/* The data has to be added to the archive. Do this now. */
|
||||
struct locarhandle ah;
|
||||
|
||||
/* Open the archive. This call never returns if we cannot
|
||||
successfully open the archive. */
|
||||
open_archive (&ah, false);
|
||||
|
||||
if (add_locale_to_archive (&ah, locname, to_archive, true) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot add to locale archive"));
|
||||
|
||||
/* We are done. */
|
||||
close_archive (&ah);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Return a NULL terminated list of the directories next to output_path
|
||||
that have the same owner, group, permissions and device as output_path. */
|
||||
static const char **
|
||||
@@ -389,12 +365,12 @@ siblings_uncached (const char *output_path)
|
||||
elems = NULL;
|
||||
for (;;)
|
||||
{
|
||||
struct dirent64 *other_dentry;
|
||||
struct dirent *other_dentry;
|
||||
const char *other_name;
|
||||
char *other_path;
|
||||
struct stat other_stat;
|
||||
|
||||
other_dentry = readdir64 (dirp);
|
||||
other_dentry = readdir (dirp);
|
||||
if (other_dentry == NULL)
|
||||
break;
|
||||
|
||||
@@ -432,7 +408,6 @@ siblings_uncached (const char *output_path)
|
||||
return elems;
|
||||
}
|
||||
|
||||
|
||||
/* Return a NULL terminated list of the directories next to output_path
|
||||
that have the same owner, group, permissions and device as output_path.
|
||||
Cache the result for future calls. */
|
||||
@@ -459,7 +434,6 @@ siblings (const char *output_path)
|
||||
return last_result;
|
||||
}
|
||||
|
||||
|
||||
/* Read as many bytes from a file descriptor as possible. */
|
||||
static ssize_t
|
||||
full_read (int fd, void *bufarea, size_t nbyte)
|
||||
@@ -483,7 +457,6 @@ full_read (int fd, void *bufarea, size_t nbyte)
|
||||
return buf - (char *) bufarea;
|
||||
}
|
||||
|
||||
|
||||
/* Compare the contents of two regular files of the same size. Return 0
|
||||
if they are equal, 1 if they are different, or -1 if an error occurs. */
|
||||
static int
|
||||
@@ -533,10 +506,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Write a locale file, with contents given by N_ELEM and VEC. */
|
||||
void
|
||||
write_locale_data (const char *output_path, int catidx, const char *category,
|
||||
write_locale_data (const char *output_path, const char *category,
|
||||
size_t n_elem, struct iovec *vec)
|
||||
{
|
||||
size_t cnt, step, maxiov;
|
||||
@@ -544,32 +516,6 @@ write_locale_data (const char *output_path, int catidx, const char *category,
|
||||
char *fname;
|
||||
const char **other_paths;
|
||||
|
||||
if (! no_archive)
|
||||
{
|
||||
/* The data will be added to the archive. For now we simply
|
||||
generate the image which will be written. First determine
|
||||
the size. */
|
||||
int cnt;
|
||||
void *endp;
|
||||
|
||||
to_archive[catidx].size = 0;
|
||||
for (cnt = 0; cnt < n_elem; ++cnt)
|
||||
to_archive[catidx].size += vec[cnt].iov_len;
|
||||
|
||||
/* Allocate the memory for it. */
|
||||
to_archive[catidx].addr = xmalloc (to_archive[catidx].size);
|
||||
|
||||
/* Fill it in. */
|
||||
for (cnt = 0, endp = to_archive[catidx].addr; cnt < n_elem; ++cnt)
|
||||
endp = mempcpy (endp, vec[cnt].iov_base, vec[cnt].iov_len);
|
||||
|
||||
/* Compute the MD5 sum for the data. */
|
||||
__md5_buffer (to_archive[catidx].addr, to_archive[catidx].size,
|
||||
to_archive[catidx].sum);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fname = xmalloc (strlen (output_path) + 2 * strlen (category) + 7);
|
||||
|
||||
/* Normally we write to the directory pointed to by the OUTPUT_PATH.
|
||||
@@ -622,8 +568,9 @@ write_locale_data (const char *output_path, int catidx, const char *category,
|
||||
if (fd == -1)
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, save_err, _("\
|
||||
cannot open output file `%s' for category `%s'"), fname, category));
|
||||
error (0, save_err, _("\
|
||||
cannot open output file `%s' for category `%s'"),
|
||||
fname, category);
|
||||
free (fname);
|
||||
return;
|
||||
}
|
||||
@@ -646,8 +593,8 @@ cannot open output file `%s' for category `%s'"), fname, category));
|
||||
if (writev (fd, &vec[cnt], step) < 0)
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, errno, _("\
|
||||
failure while writing data for category `%s'"), category));
|
||||
error (0, errno, _("failure while writing data for category `%s'"),
|
||||
category);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -734,7 +681,8 @@ failure while writing data for category `%s'"), category));
|
||||
char * tmp_fname =
|
||||
(char *) xmalloc (strlen (fname) + 4 + 1);
|
||||
|
||||
strcpy (stpcpy (tmp_fname, fname), ".tmp");
|
||||
strcpy (tmp_fname, fname);
|
||||
strcat (tmp_fname, ".tmp");
|
||||
|
||||
if (link (other_fname, tmp_fname) >= 0)
|
||||
{
|
||||
@@ -742,8 +690,9 @@ failure while writing data for category `%s'"), category));
|
||||
if (rename (tmp_fname, fname) < 0)
|
||||
{
|
||||
if (!be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, errno, _("\
|
||||
cannot create output file `%s' for category `%s'"), fname, category));
|
||||
error (0, errno, _("\
|
||||
cannot create output file `%s' for category `%s'"),
|
||||
fname, category);
|
||||
}
|
||||
free (tmp_fname);
|
||||
free (other_fname);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
|
||||
|
||||
@@ -46,7 +46,7 @@ struct locale_file
|
||||
|
||||
/* General handling of `copy'. */
|
||||
static inline void
|
||||
handle_copy (struct linereader *ldfile, const struct charmap_t *charmap,
|
||||
handle_copy (struct linereader *ldfile, struct charmap_t *charmap,
|
||||
const char *repertoire_name, struct localedef_t *result,
|
||||
enum token_t token, int locale, const char *locale_name,
|
||||
int ignore_content)
|
||||
@@ -54,7 +54,7 @@ handle_copy (struct linereader *ldfile, const struct charmap_t *charmap,
|
||||
struct token *now;
|
||||
int warned = 0;
|
||||
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_string)
|
||||
lr_error (ldfile, _("expect string argument for `copy'"));
|
||||
else if (!ignore_content)
|
||||
@@ -74,8 +74,8 @@ locale name should consist only of portable characters"));
|
||||
|
||||
/* The rest of the line must be empty and the next keyword must be
|
||||
`END xxx'. */
|
||||
while ((now = lr_token (ldfile, charmap, result, NULL, verbose))->tok
|
||||
!= tok_end && now->tok != tok_eof)
|
||||
while ((now = lr_token (ldfile, charmap, NULL, verbose))->tok != tok_end
|
||||
&& now->tok != tok_eof)
|
||||
{
|
||||
if (warned == 0)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ no other keyword shall be specified when `copy' is used"));
|
||||
if (now->tok != tok_eof)
|
||||
{
|
||||
/* Handle `END xxx'. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
if (now->tok != token)
|
||||
lr_error (ldfile, _("\
|
||||
@@ -106,22 +106,20 @@ no other keyword shall be specified when `copy' is used"));
|
||||
|
||||
/* Found in locfile.c. */
|
||||
extern int locfile_read (struct localedef_t *result,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
|
||||
/* Check validity of all the locale data. */
|
||||
extern void check_all_categories (struct localedef_t *definitions,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
|
||||
/* Write out all locale categories. */
|
||||
extern void write_all_categories (struct localedef_t *definitions,
|
||||
const struct charmap_t *charmap,
|
||||
const char *locname,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Write out the data. */
|
||||
extern void write_locale_data (const char *output_path, int catidx,
|
||||
const char *category, size_t n_elem,
|
||||
struct iovec *vec);
|
||||
extern void write_locale_data (const char *output_path, const char *category,
|
||||
size_t n_elem, struct iovec *vec);
|
||||
|
||||
|
||||
/* Entrypoints for the parsers of the individual categories. */
|
||||
@@ -129,147 +127,145 @@ extern void write_locale_data (const char *output_path, int catidx,
|
||||
/* Handle LC_CTYPE category. */
|
||||
extern void ctype_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void ctype_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void ctype_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
extern uint32_t *find_translit (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap, uint32_t wch);
|
||||
|
||||
/* Handle LC_COLLATE category. */
|
||||
extern void collate_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void collate_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void collate_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_MONETARY category. */
|
||||
extern void monetary_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void monetary_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void monetary_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_NUMERIC category. */
|
||||
extern void numeric_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void numeric_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void numeric_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_MESSAGES category. */
|
||||
extern void messages_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void messages_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void messages_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_TIME category. */
|
||||
extern void time_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void time_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void time_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_PAPER category. */
|
||||
extern void paper_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void paper_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void paper_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_NAME category. */
|
||||
extern void name_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void name_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void name_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_ADDRESS category. */
|
||||
extern void address_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void address_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void address_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_TELEPHONE category. */
|
||||
extern void telephone_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void telephone_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void telephone_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_MEASUREMENT category. */
|
||||
extern void measurement_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void measurement_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void measurement_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
/* Handle LC_IDENTIFICATION category. */
|
||||
extern void identification_read (struct linereader *ldfile,
|
||||
struct localedef_t *result,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *repertoire_name,
|
||||
int ignore_content);
|
||||
extern void identification_finish (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap);
|
||||
struct charmap_t *charmap);
|
||||
extern void identification_output (struct localedef_t *locale,
|
||||
const struct charmap_t *charmap,
|
||||
struct charmap_t *charmap,
|
||||
const char *output_path);
|
||||
|
||||
#endif /* locfile.h */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "linereader.h"
|
||||
#include "charmap.h"
|
||||
#include "repertoire.h"
|
||||
#include "simple-hash.h"
|
||||
#include "localedef.h"
|
||||
|
||||
|
||||
/* Simple keyword hashing for the repertoiremap. */
|
||||
@@ -149,7 +149,7 @@ repertoire_read (const char *filename)
|
||||
while (1)
|
||||
{
|
||||
/* What's on? */
|
||||
struct token *now = lr_token (repfile, NULL, NULL, NULL, verbose);
|
||||
struct token *now = lr_token (repfile, NULL, NULL, verbose);
|
||||
enum token_t nowtok = now->tok;
|
||||
struct token *arg;
|
||||
|
||||
@@ -168,7 +168,7 @@ repertoire_read (const char *filename)
|
||||
if (nowtok == tok_escape_char || nowtok == tok_comment_char)
|
||||
{
|
||||
/* We know that we need an argument. */
|
||||
arg = lr_token (repfile, NULL, NULL, NULL, verbose);
|
||||
arg = lr_token (repfile, NULL, NULL, verbose);
|
||||
|
||||
if (arg->tok != tok_ident)
|
||||
{
|
||||
@@ -322,14 +322,13 @@ argument to <%s> must be a single character"),
|
||||
}
|
||||
|
||||
if (state != 2 && state != 90 && !be_quiet)
|
||||
WITH_CUR_LOCALE (error (0, 0, _("%s: premature end of file"),
|
||||
repfile->fname));
|
||||
error (0, 0, _("%s: premature end of file"), repfile->fname);
|
||||
|
||||
lr_close (repfile);
|
||||
|
||||
if (tsearch (result, &known, &repertoire_compare) == NULL)
|
||||
/* Something went wrong. */
|
||||
WITH_CUR_LOCALE (error (0, errno, _("cannot safe new repertoire map")));
|
||||
error (0, errno, _("cannot safe new repertoire map"));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -340,8 +339,7 @@ repertoire_complain (const char *name)
|
||||
{
|
||||
if (tfind (name, &unavailable, (__compar_fn_t) strcmp) == NULL)
|
||||
{
|
||||
WITH_CUR_LOCALE (error (0, errno, _("\
|
||||
repertoire map file `%s' not found"), name));
|
||||
error (0, errno, _("repertoire map file `%s' not found"), name);
|
||||
|
||||
/* Remember that we reported this map. */
|
||||
tsearch (name, &unavailable, (__compar_fn_t) strcmp);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Implement simple hashing table with string based keys.
|
||||
Copyright (C) 1994-1997, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
|
||||
|
||||
@@ -46,12 +46,14 @@
|
||||
# define BITSPERBYTE 8
|
||||
#endif
|
||||
|
||||
#ifndef LONGBITS
|
||||
# define LONGBITS (sizeof (long) * BITSPERBYTE)
|
||||
#endif
|
||||
|
||||
#ifndef bcopy
|
||||
# define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
#include "hashval.h"
|
||||
|
||||
extern void *xmalloc (size_t __n);
|
||||
extern void *xcalloc (size_t __n, size_t __m);
|
||||
|
||||
@@ -68,8 +70,11 @@ hash_entry;
|
||||
/* Prototypes for local functions. */
|
||||
static void insert_entry_2 (hash_table *htab, const void *key, size_t keylen,
|
||||
unsigned long hval, size_t idx, void *data);
|
||||
static size_t lookup (const hash_table *htab, const void *key, size_t keylen,
|
||||
static size_t lookup (hash_table *htab, const void *key, size_t keylen,
|
||||
unsigned long int hval);
|
||||
static size_t lookup_2 (hash_table *htab, const void *key, size_t keylen,
|
||||
unsigned long int hval);
|
||||
static unsigned long compute_hashval (const void *key, size_t keylen);
|
||||
static int is_prime (unsigned long int candidate);
|
||||
|
||||
|
||||
@@ -158,11 +163,9 @@ insert_entry_2 (htab, key, keylen, hval, idx, data)
|
||||
}
|
||||
|
||||
++htab->filled;
|
||||
if (100 * htab->filled > 75 * htab->size)
|
||||
if (100 * htab->filled > 90 * htab->size)
|
||||
{
|
||||
/* Table is filled more than 75%. Resize the table.
|
||||
Experiments have shown that for best performance, this threshold
|
||||
must lie between 40% and 85%. */
|
||||
/* Table is filled more than 90%. Resize the table. */
|
||||
unsigned long int old_size = htab->size;
|
||||
|
||||
htab->size = next_prime (htab->size * 2);
|
||||
@@ -174,8 +177,8 @@ insert_entry_2 (htab, key, keylen, hval, idx, data)
|
||||
if (table[idx].used)
|
||||
insert_entry_2 (htab, table[idx].key, table[idx].keylen,
|
||||
table[idx].used,
|
||||
lookup (htab, table[idx].key, table[idx].keylen,
|
||||
table[idx].used),
|
||||
lookup_2 (htab, table[idx].key, table[idx].keylen,
|
||||
table[idx].used),
|
||||
table[idx].data);
|
||||
|
||||
free (table);
|
||||
@@ -185,7 +188,7 @@ insert_entry_2 (htab, key, keylen, hval, idx, data)
|
||||
|
||||
int
|
||||
find_entry (htab, key, keylen, result)
|
||||
const hash_table *htab;
|
||||
hash_table *htab;
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
void **result;
|
||||
@@ -221,7 +224,7 @@ set_entry (htab, key, keylen, newval)
|
||||
|
||||
int
|
||||
iterate_table (htab, ptr, key, keylen, data)
|
||||
const hash_table *htab;
|
||||
hash_table *htab;
|
||||
void **ptr;
|
||||
const void **key;
|
||||
size_t *keylen;
|
||||
@@ -247,13 +250,56 @@ iterate_table (htab, ptr, key, keylen, data)
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
lookup (htab, key, keylen, hval)
|
||||
hash_table *htab;
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
unsigned long hval;
|
||||
{
|
||||
unsigned long hash;
|
||||
size_t idx;
|
||||
hash_entry *table = (hash_entry *) htab->table;
|
||||
|
||||
/* First hash function: simply take the modul but prevent zero. */
|
||||
hash = 1 + hval % htab->size;
|
||||
|
||||
idx = hash;
|
||||
|
||||
if (table[idx].used)
|
||||
{
|
||||
if (table[idx].used == hval && table[idx].keylen == keylen
|
||||
&& memcmp (key, table[idx].key, keylen) == 0)
|
||||
return idx;
|
||||
|
||||
/* Second hash function as suggested in [Knuth]. */
|
||||
hash = 1 + hval % (htab->size - 2);
|
||||
|
||||
do
|
||||
{
|
||||
if (idx <= hash)
|
||||
idx = htab->size + idx - hash;
|
||||
else
|
||||
idx -= hash;
|
||||
|
||||
/* If entry is found use it. */
|
||||
if (table[idx].used == hval && table[idx].keylen == keylen
|
||||
&& memcmp (key, table[idx].key, keylen) == 0)
|
||||
return idx;
|
||||
}
|
||||
while (table[idx].used);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
/* References:
|
||||
[Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
|
||||
[Knuth] The Art of Computer Programming, part3 (6.4) */
|
||||
|
||||
static size_t
|
||||
lookup (htab, key, keylen, hval)
|
||||
const hash_table *htab;
|
||||
lookup_2 (htab, key, keylen, hval)
|
||||
hash_table *htab;
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
unsigned long int hval;
|
||||
@@ -294,7 +340,34 @@ lookup (htab, key, keylen, hval)
|
||||
}
|
||||
|
||||
|
||||
unsigned long int
|
||||
static unsigned long
|
||||
compute_hashval (key, keylen)
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
{
|
||||
size_t cnt;
|
||||
unsigned long int hval, g;
|
||||
|
||||
/* Compute the hash value for the given string. The algorithm
|
||||
is taken from [Aho,Sethi,Ullman]. */
|
||||
cnt = 0;
|
||||
hval = keylen;
|
||||
while (cnt < keylen)
|
||||
{
|
||||
hval <<= 4;
|
||||
hval += (unsigned long int) *(((char *) key) + cnt++);
|
||||
g = hval & ((unsigned long) 0xf << (LONGBITS - 4));
|
||||
if (g != 0)
|
||||
{
|
||||
hval ^= g >> (LONGBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
}
|
||||
return hval != 0 ? hval : ~((unsigned long) 0);
|
||||
}
|
||||
|
||||
|
||||
unsigned long
|
||||
next_prime (seed)
|
||||
unsigned long int seed;
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995-1999, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -37,17 +37,15 @@ extern int init_hash (hash_table *htab, unsigned long int init_size) __THROW;
|
||||
extern int delete_hash (hash_table *htab) __THROW;
|
||||
extern int insert_entry (hash_table *htab, const void *key, size_t keylen,
|
||||
void *data) __THROW;
|
||||
extern int find_entry (const hash_table *htab, const void *key, size_t keylen,
|
||||
extern int find_entry (hash_table *htab, const void *key, size_t keylen,
|
||||
void **result) __THROW;
|
||||
extern int set_entry (hash_table *htab, const void *key, size_t keylen,
|
||||
void *newval) __THROW;
|
||||
|
||||
extern int iterate_table (const hash_table *htab, void **ptr,
|
||||
extern int iterate_table (hash_table *htab, void **ptr,
|
||||
const void **key, size_t *keylen, void **data)
|
||||
__THROW;
|
||||
|
||||
extern unsigned long int compute_hashval (const void *key, size_t keylen)
|
||||
__THROW;
|
||||
extern unsigned long int next_prime (unsigned long int seed) __THROW;
|
||||
|
||||
#endif /* simple-hash.h */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 95-99, 2000, 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 95-99, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -27,42 +27,41 @@
|
||||
|
||||
#include "localeinfo.h"
|
||||
|
||||
#ifdef NL_CURRENT_INDIRECT
|
||||
/* For each category declare two external variables (with weak references):
|
||||
extern const struct locale_data *_nl_current_CATEGORY;
|
||||
This points to the current locale's in-core data for CATEGORY.
|
||||
extern const struct locale_data _nl_C_CATEGORY;
|
||||
This contains the built-in "C"/"POSIX" locale's data for CATEGORY.
|
||||
Both are weak references; if &_nl_current_CATEGORY is zero,
|
||||
then nothing is using the locale data. */
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
extern struct locale_data *_nl_current_##category; \
|
||||
extern struct locale_data _nl_C_##category;
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
|
||||
/* For each category declare a special external symbol
|
||||
_nl_current_CATEGORY_used with a weak reference.
|
||||
This symbol will is defined in lc-CATEGORY.c and will be linked in
|
||||
if anything uses _nl_current_CATEGORY (also defined in that module).
|
||||
Also use a weak reference for the _nl_current_CATEGORY thread variable. */
|
||||
|
||||
# define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
extern char _nl_current_##category##_used; \
|
||||
weak_extern (_nl_current_##category##_used) \
|
||||
weak_extern (_nl_current_##category)
|
||||
# include "categories.def"
|
||||
# undef DEFINE_CATEGORY
|
||||
|
||||
/* Now define a table of flags based on those special weak symbols' values.
|
||||
_nl_current_used[CATEGORY] will be zero if _nl_current_CATEGORY is not
|
||||
linked in. */
|
||||
static char *const _nl_current_used[] =
|
||||
/* Array indexed by category of pointers to _nl_current_CATEGORY slots.
|
||||
Elements are zero for categories whose data is never used. */
|
||||
struct locale_data * *const _nl_current[] =
|
||||
{
|
||||
# define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = &_nl_current_##category##_used,
|
||||
# include "categories.def"
|
||||
# undef DEFINE_CATEGORY
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = &_nl_current_##category,
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
/* We need this additional element to simplify the code. It must
|
||||
simply be != NULL. */
|
||||
[LC_ALL] = (struct locale_data **) ~0ul
|
||||
};
|
||||
|
||||
# define CATEGORY_USED(category) (_nl_current_used[category] != 0)
|
||||
|
||||
#else
|
||||
|
||||
/* The shared library always loads all the categories,
|
||||
and the current global settings are kept in _nl_global_locale. */
|
||||
|
||||
# define CATEGORY_USED(category) (1)
|
||||
|
||||
#endif
|
||||
/* Array indexed by category of pointers to _nl_C_CATEGORY slots.
|
||||
Elements are zero for categories whose data is never used. */
|
||||
struct locale_data *const _nl_C[] =
|
||||
{
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = &_nl_C_##category,
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
};
|
||||
|
||||
|
||||
/* Define an array of category names (also the environment variable names),
|
||||
@@ -86,17 +85,11 @@ const size_t _nl_category_name_sizes[] =
|
||||
};
|
||||
|
||||
|
||||
#ifdef NL_CURRENT_INDIRECT
|
||||
# define WEAK_POSTLOAD(postload) weak_extern (postload)
|
||||
#else
|
||||
# define WEAK_POSTLOAD(postload) /* Need strong refs in static linking. */
|
||||
#endif
|
||||
|
||||
/* Declare the postload functions used below. */
|
||||
#undef NO_POSTLOAD
|
||||
#define NO_POSTLOAD _nl_postload_ctype /* Harmless thing known to exist. */
|
||||
#define DEFINE_CATEGORY(category, category_name, items, postload) \
|
||||
extern void postload (void); WEAK_POSTLOAD (postload)
|
||||
extern void postload (void);
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
#undef NO_POSTLOAD
|
||||
@@ -112,8 +105,20 @@ static void (*const _nl_category_postload[]) (void) =
|
||||
};
|
||||
|
||||
|
||||
/* Name of current locale for each individual category.
|
||||
Each is malloc'd unless it is nl_C_name. */
|
||||
static const char *_nl_current_names[] =
|
||||
{
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = _nl_C_name,
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
[LC_ALL] = _nl_C_name /* For LC_ALL. */
|
||||
};
|
||||
|
||||
|
||||
/* Lock for protecting global data. */
|
||||
__libc_lock_define_initialized (, __libc_setlocale_lock attribute_hidden)
|
||||
__libc_lock_define_initialized (, __libc_setlocale_lock)
|
||||
|
||||
/* Defined in loadmsgcat.c. */
|
||||
extern int _nl_msg_cat_cntr;
|
||||
@@ -142,7 +147,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
|
||||
{
|
||||
const char *name = (category == LC_ALL ? newnames[i] :
|
||||
category == i ? newnames[0] :
|
||||
_nl_global_locale.__names[i]);
|
||||
_nl_current_names[i]);
|
||||
last_len = strlen (name);
|
||||
cumlen += _nl_category_name_sizes[i] + 1 + last_len + 1;
|
||||
if (i > 0 && same && strcmp (name, newnames[0]) != 0)
|
||||
@@ -171,7 +176,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
|
||||
/* Add "CATEGORY=NAME;" to the string. */
|
||||
const char *name = (category == LC_ALL ? newnames[i] :
|
||||
category == i ? newnames[0] :
|
||||
_nl_global_locale.__names[i]);
|
||||
_nl_current_names[i]);
|
||||
p = __stpcpy (p, _nl_category_names[i]);
|
||||
*p++ = '=';
|
||||
p = __stpcpy (p, name);
|
||||
@@ -182,31 +187,33 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
|
||||
}
|
||||
|
||||
|
||||
/* Put NAME in _nl_global_locale.__names. */
|
||||
/* Put NAME in _nl_current_names. */
|
||||
static inline void
|
||||
setname (int category, const char *name)
|
||||
{
|
||||
if (_nl_global_locale.__names[category] == name)
|
||||
if (_nl_current_names[category] == name)
|
||||
return;
|
||||
|
||||
if (_nl_global_locale.__names[category] != _nl_C_name)
|
||||
free ((char *) _nl_global_locale.__names[category]);
|
||||
if (_nl_current_names[category] != _nl_C_name)
|
||||
free ((char *) _nl_current_names[category]);
|
||||
|
||||
_nl_global_locale.__names[category] = name;
|
||||
_nl_current_names[category] = name;
|
||||
}
|
||||
|
||||
|
||||
/* Put DATA in *_nl_current[CATEGORY]. */
|
||||
static inline void
|
||||
setdata (int category, struct locale_data *data)
|
||||
{
|
||||
if (CATEGORY_USED (category))
|
||||
if (_nl_current[category] != NULL)
|
||||
{
|
||||
_nl_global_locale.__locales[category] = data;
|
||||
*_nl_current[category] = data;
|
||||
if (_nl_category_postload[category])
|
||||
(*_nl_category_postload[category]) ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
setlocale (int category, const char *locale)
|
||||
{
|
||||
@@ -222,31 +229,27 @@ setlocale (int category, const char *locale)
|
||||
|
||||
/* Does user want name of current locale? */
|
||||
if (locale == NULL)
|
||||
return (char *) _nl_global_locale.__names[category];
|
||||
return (char *) _nl_current_names[category];
|
||||
|
||||
if (strcmp (locale, _nl_global_locale.__names[category]) == 0)
|
||||
if (strcmp (locale, _nl_current_names[category]) == 0)
|
||||
/* Changing to the same thing. */
|
||||
return (char *) _nl_global_locale.__names[category];
|
||||
return (char *) _nl_current_names[category];
|
||||
|
||||
/* We perhaps really have to load some data. So we determine the
|
||||
path in which to look for the data now. The environment variable
|
||||
`LOCPATH' must only be used when the binary has no SUID or SGID
|
||||
bit set. If using the default path, we tell _nl_find_locale
|
||||
by passing null and it can check the canonical locale archive. */
|
||||
bit set. */
|
||||
locale_path = NULL;
|
||||
locale_path_len = 0;
|
||||
|
||||
locpath_var = getenv ("LOCPATH");
|
||||
if (locpath_var != NULL && locpath_var[0] != '\0')
|
||||
{
|
||||
if (__argz_create_sep (locpath_var, ':',
|
||||
&locale_path, &locale_path_len) != 0)
|
||||
return NULL;
|
||||
if (__argz_create_sep (locpath_var, ':',
|
||||
&locale_path, &locale_path_len) != 0)
|
||||
return NULL;
|
||||
|
||||
if (__argz_add_sep (&locale_path, &locale_path_len,
|
||||
_nl_default_locale_path, ':') != 0)
|
||||
return NULL;
|
||||
}
|
||||
if (__argz_add_sep (&locale_path, &locale_path_len, LOCALEDIR, ':') != 0)
|
||||
return NULL;
|
||||
|
||||
if (category == LC_ALL)
|
||||
{
|
||||
@@ -313,14 +316,7 @@ setlocale (int category, const char *locale)
|
||||
&newnames[category]);
|
||||
|
||||
if (newdata[category] == NULL)
|
||||
{
|
||||
#ifdef NL_CURRENT_INDIRECT
|
||||
if (newnames[category] == _nl_C_name)
|
||||
/* Null because it's the weak value of _nl_C_LC_FOO. */
|
||||
continue;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
/* We must not simply free a global locale since we have no
|
||||
control over the usage. So we mark it as un-deletable. */
|
||||
@@ -330,7 +326,7 @@ setlocale (int category, const char *locale)
|
||||
/* Make a copy of locale name. */
|
||||
if (newnames[category] != _nl_C_name)
|
||||
{
|
||||
newnames[category] = __strdup (newnames[category]);
|
||||
newnames[category] = strdup (newnames[category]);
|
||||
if (newnames[category] == NULL)
|
||||
break;
|
||||
}
|
||||
@@ -375,7 +371,7 @@ setlocale (int category, const char *locale)
|
||||
/* Protect global data. */
|
||||
__libc_lock_lock (__libc_setlocale_lock);
|
||||
|
||||
if (CATEGORY_USED (category))
|
||||
if (_nl_current[category] != NULL)
|
||||
{
|
||||
/* Only actually load the data if anything will use it. */
|
||||
newdata = _nl_find_locale (locale_path, locale_path_len, category,
|
||||
@@ -395,7 +391,7 @@ setlocale (int category, const char *locale)
|
||||
/* Make a copy of locale name. */
|
||||
if (newname[0] != _nl_C_name)
|
||||
{
|
||||
newname[0] = __strdup (newname[0]);
|
||||
newname[0] = strdup (newname[0]);
|
||||
if (newname[0] == NULL)
|
||||
goto abort_single;
|
||||
}
|
||||
@@ -413,7 +409,7 @@ setlocale (int category, const char *locale)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CATEGORY_USED (category))
|
||||
if (_nl_current[category] != NULL)
|
||||
setdata (category, newdata);
|
||||
|
||||
setname (category, newname[0]);
|
||||
@@ -433,63 +429,44 @@ setlocale (int category, const char *locale)
|
||||
return (char *) newname[0];
|
||||
}
|
||||
}
|
||||
libc_hidden_def (setlocale)
|
||||
|
||||
static void
|
||||
free_category (int category,
|
||||
struct locale_data *here, struct locale_data *c_data)
|
||||
extern struct loaded_l10nfile *_nl_locale_file_list[];
|
||||
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
struct loaded_l10nfile *runp = _nl_locale_file_list[category];
|
||||
|
||||
/* If this category is already "C" don't do anything. */
|
||||
if (here != c_data)
|
||||
{
|
||||
/* We have to be prepared that sometime later we still
|
||||
might need the locale information. */
|
||||
setdata (category, c_data);
|
||||
setname (category, _nl_C_name);
|
||||
}
|
||||
|
||||
while (runp != NULL)
|
||||
{
|
||||
struct loaded_l10nfile *curr = runp;
|
||||
struct locale_data *data = (struct locale_data *) runp->data;
|
||||
|
||||
if (data != NULL && data != c_data)
|
||||
_nl_unload_locale (data);
|
||||
runp = runp->next;
|
||||
free ((char *) curr->filename);
|
||||
free (curr);
|
||||
}
|
||||
}
|
||||
|
||||
libc_freeres_fn (free_mem)
|
||||
{
|
||||
#ifdef NL_CURRENT_INDIRECT
|
||||
/* We don't use the loop because we want to have individual weak
|
||||
symbol references here. */
|
||||
# define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
if (CATEGORY_USED (category)) \
|
||||
{ \
|
||||
extern struct locale_data _nl_C_##category; \
|
||||
weak_extern (_nl_C_##category) \
|
||||
free_category (category, *_nl_current_##category, &_nl_C_##category); \
|
||||
}
|
||||
# include "categories.def"
|
||||
# undef DEFINE_CATEGORY
|
||||
#else
|
||||
int category;
|
||||
|
||||
for (category = 0; category < __LC_LAST; ++category)
|
||||
if (category != LC_ALL)
|
||||
free_category (category, _NL_CURRENT_DATA (category),
|
||||
_nl_C_locobj.__locales[category]);
|
||||
#endif
|
||||
{
|
||||
struct locale_data *here = *_nl_current[category];
|
||||
struct loaded_l10nfile *runp = _nl_locale_file_list[category];
|
||||
|
||||
/* If this category is already "C" don't do anything. */
|
||||
if (here != _nl_C[category])
|
||||
{
|
||||
/* We have to be prepared that sometime later me still
|
||||
might need the locale information. */
|
||||
setdata (category, _nl_C[category]);
|
||||
setname (category, _nl_C_name);
|
||||
|
||||
_nl_unload_locale (here);
|
||||
}
|
||||
|
||||
while (runp != NULL)
|
||||
{
|
||||
struct loaded_l10nfile *curr = runp;
|
||||
struct locale_data *data = (struct locale_data *) runp->data;
|
||||
|
||||
if (data != NULL && data != here && data != _nl_C[category])
|
||||
_nl_unload_locale (data);
|
||||
runp = runp->next;
|
||||
free ((char *) curr->filename);
|
||||
free (curr);
|
||||
}
|
||||
}
|
||||
|
||||
setname (LC_ALL, _nl_C_name);
|
||||
|
||||
/* This frees the data structures associated with the locale archive.
|
||||
The locales from the archive are not in the file list, so we have
|
||||
not called _nl_unload_locale on them above. */
|
||||
_nl_archive_subfreeres ();
|
||||
}
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* C locale object.
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
|
||||
|
||||
@@ -27,27 +27,27 @@ extern struct locale_data _nl_C_##category;
|
||||
#undef DEFINE_CATEGORY
|
||||
|
||||
/* Defined in locale/C-ctype.c. */
|
||||
extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
|
||||
extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
|
||||
extern const char _nl_C_LC_CTYPE_tolower[] attribute_hidden;
|
||||
extern const char _nl_C_LC_CTYPE_class[];
|
||||
extern const char _nl_C_LC_CTYPE_toupper[];
|
||||
extern const char _nl_C_LC_CTYPE_tolower[];
|
||||
|
||||
|
||||
struct __locale_struct _nl_C_locobj attribute_hidden =
|
||||
struct __locale_struct _nl_C_locobj =
|
||||
{
|
||||
.__locales =
|
||||
{
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = &_nl_C_##category,
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
},
|
||||
.__names =
|
||||
{
|
||||
[LC_ALL] = _nl_C_name,
|
||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
||||
[category] = _nl_C_name,
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
[LC_CTYPE] = &_nl_C_LC_CTYPE,
|
||||
[LC_NUMERIC] = &_nl_C_LC_NUMERIC,
|
||||
[LC_TIME] = &_nl_C_LC_TIME,
|
||||
[LC_COLLATE] = &_nl_C_LC_COLLATE,
|
||||
[LC_MONETARY] = &_nl_C_LC_MONETARY,
|
||||
[LC_MESSAGES] = &_nl_C_LC_MESSAGES,
|
||||
[LC_PAPER] = &_nl_C_LC_PAPER,
|
||||
[LC_NAME] = &_nl_C_LC_NAME,
|
||||
[LC_ADDRESS] = &_nl_C_LC_ADDRESS,
|
||||
[LC_TELEPHONE] = &_nl_C_LC_TELEPHONE,
|
||||
[LC_MEASUREMENT] = &_nl_C_LC_MEASUREMENT,
|
||||
[LC_IDENTIFICATION] = &_nl_C_LC_IDENTIFICATION
|
||||
},
|
||||
.__ctype_b = (const unsigned short int *) _nl_C_LC_CTYPE_class + 128,
|
||||
.__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Definition of locale datatype.
|
||||
Copyright (C) 1997,2000,02 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@@ -34,9 +34,6 @@ typedef struct __locale_struct
|
||||
const unsigned short int *__ctype_b;
|
||||
const int *__ctype_tolower;
|
||||
const int *__ctype_toupper;
|
||||
|
||||
/* Note: LC_ALL is not a valid index into this array. */
|
||||
const char *__names[13];
|
||||
} *__locale_t;
|
||||
|
||||
#endif /* xlocale.h */
|
||||
|
||||
Reference in New Issue
Block a user