From d07fdf8b9ece2c4339b325921add50792077bf97 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Mon, 6 May 2002 07:37:32 +0000 Subject: New locale support (in development). Supports LC_CTYPE, LC_NUMERIC, LC_TIME, LC_MONETARY, and LC_MESSAGES for the SUSv3 items. Also, nl_langinfo() when real locale support is enabled. New implementation of ctype.h. New implementation of wctype.h. New implementation of most of the string functions (smaller). New implementation of the wcs/wmem functions. These are untested, but they're also just preprocessor-modified versions ot the corresponding str/mem functions. Tweaked qsort and new bsearch. Stuff still pending: stdlib.h and wchar.h mb<->wc functions. I actually have working versions of the stdlib ones, but the reentrant versions from wchar.h require some reworking. Basic replacement and translit support for wc->mb conversions. (groundwork laid). Simple-minded collate support such as was provided by the previous locale implementation. (mostly done -- 8-bit codesets only) Shared mmaping of the locale data and strerror message text. --- extra/locale/README | 86 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 22 deletions(-) (limited to 'extra/locale/README') diff --git a/extra/locale/README b/extra/locale/README index 6ac487c9a..63723f97f 100644 --- a/extra/locale/README +++ b/extra/locale/README @@ -1,29 +1,71 @@ +Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! +Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! -The programs gen_ctype_from_glibc.c and gen_collate_from_glibc.c -will generate data files which can be -used by uClibc ctype, strcoll and setlocale functions to support locales. -From the comments: +The programs in this directory are strictly cut-and-paste hack jobs to +extract the data I needed from glibc's locale database. I'm ashamed to +even let them into the light of day, and I consider them complete garbage. -/* - * Generator locale ctype tables - * You must have already setuped locale for worked libc (libc5 or glibc) - * - * This programm scan /usr/share/locale directories and write - * ./LOCALE/LC_CTYPE files for system with uclibc - * - * Written by Vladimir Oleynik 2001 - */ +However, they are currently necessary to build the data needed for the +locale support I've implemented, so I'm forced to include them here. +NOTE: While its possible to use this stuff for native != target arch, +you'll have to either write a converter to account for endianess and +struct padding issues, or run the mmap file generator on your target +arch. But all these programs will be rewritten at some point. -Sample usage to dump all the data files in a tmp directory: +All that being said, LC_CTYPE support has been added and supports the +ctype.h and wctype.h function. Also, LC_TIME, LC_MONETARY, LC_NUMERIC, +and LC_MESSAGES are supported wrt SUSv3. localeconv() works in both +real and stub locale modes. nl_langinfo() currently only works with +real locales enabled. That will be fixed though. wc->mb unsupported +char replacement and basic translit support is on the way as well. +Finally, some basic 8-bit codeset LC_COLLATE support should be in place +in the next week or two (similar to what was in the previous locale +implementation). -gcc gen_ctype_from_glibc.c -o gen_ctype_from_glibc -gcc gen_collate_from_glibc.c -o gen_ctype_from_glibc +Also, as one can probably guess, I'm working towards having the locale +data accessed via a shared mmap. That will allow non-mmu platforms +to use this without the current bloat. -mkdir tmp -cd tmp -../gen_ctype_from_glibc -d /usr/share/locale -c -../gen_collate_from_glibc +Currently, the output of size for my locale_data.o file is + text data bss dec hex filename + 59072 4 0 59076 e6c4 extra/locale/locale_data.o +which is for the C locale (automatic of course) + all codesets in +charmaps/ and all 268 locales in LOCALES. I estimate that the +translit support for those 8-bit codesets will add another 7-10k. -Then just move the directory or directories you need (not the .c files) -to the uClibc locale file directory you set in Config. +One difference of note is that the special case upper/lower mappings +in the turkish locale are currently not implemented. That will be +fixed. + +Manuel + +Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! +Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! + + +1) In the toplevel dir, 'make headers uClibc_config' . + +2) Create a codesets.txt file in this dir listing the codesets you want + to support. The easiest way to do this is to edit the output of + 'find ./charmaps -name "*.pairs" > codesets.txt'. + NOTE: UTF-8 support is always included if you build with wide chars enabled. + NOTE: The files in charmaps/ were created from glibc's charmap files + with the awk script at the end of this file. You can add others + but only single byte codesets are supported. + +3) Create a locales.txt file to select the locales you want to support. + You can copy and edit the LOCALES file for example. Other locales could + added provided you've included the appropriate codesets in step 2. + NOTE: You have to have the approprite locales available for glibc! + +4) Run make here. + +5) Continue building uClibc from the toplevel dir. + + + + +Script used to generate the charmaps/*.pairs files: + +cat $1 | awk 'BEGIN { i = 0 } ; { if ($1 == "CHARMAP") i=1 ; else if ($1 == "END") i=0 ; else if (i==1) { sub("/","0",$2) ; sub("","",$1) ; print "{", $2, ",", $1, "}," } }' -- cgit v1.2.3