This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Properly display unavailable elements in LC_MONETARY category
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 18 Nov 2013 12:38:14 +0100
- Subject: Re: [PATCH] Properly display unavailable elements in LC_MONETARY category
- Authentication-results: sourceware.org; auth=none
- References: <mvmd2m5ri7o dot fsf at hawking dot suse dot de> <20131113095851 dot GA1920 at domone dot podge> <mvmiovvm3zz dot fsf at hawking dot suse dot de>
On Thu, Nov 14, 2013 at 03:50:40PM +0100, Andreas Schwab wrote:
> LC_MONETARY mon_grouping and LC_NUMERIC grouping use both \177 and \377
> as special markers, where \177 is used for -1, and \377 is used instead
> of 0 (even though 0 for grouping has no meaning). __guess_grouping in
> printf_fp.c interpretes both as the end of grouping.
>
> For integer-valued elements localedef always emits "\377" for
> unavailable values (locale file contents should not depend on the
> signedness of char). This means that C-monetary should use "\377" even
> on signed architectures, and localeconv needs to convert to the
> POSIX-mandated CHAR_MAX. Further fixes are needed for strfmon to be
> independent of signedness.
>
> Andreas.
>
> * locale/programs/locale.c (show_info) [case byte]: Check for
> '\377' instead of '\177'.
> * locale/C-monetary.c (not_available): Always use "\377".
> * stdlib/strfmon_l.c (__vstrfmon_l): Use -2 as marker for
> unspecified p_sign_posn and n_sign_posn. Check for '\377' to
> detect unavailable sign_posn locale elements.
> * locale/localeconv.c (__localeconv): For grouping and
> mon_grouping handle "\177" and "\377" like no grouping.
> (INT_ELEM): New macro. Use it to set all numeric members.
> * locale/programs/ld-monetary.c (monetary_read)
> <tok_mon_grouping>: Normalize single -1 to the empty string.
> * locale/programs/ld-numeric.c (numeric_read) <tok_grouping>:
> Likewise.
>
looks ok.