1/* Copyright (C) 2002, 2003 Manuel Novoa III 2 * 3 * This library is free software; you can redistribute it and/or 4 * modify it under the terms of the GNU Lesser General Public 5 * License as published by the Free Software Foundation; either 6 * version 2.1 of the License, or (at your option) any later version. 7 * 8 * The GNU C Library is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public 14 * License along with the GNU C Library; if not, write to the Free 15 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 16 * 02111-1307 USA. 17 */ 18 19/* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! 20 * 21 * Besides uClibc, I'm using this code in my libc for elks, which is 22 * a 16-bit environment with a fairly limited compiler. It would make 23 * things much easier for me if this file isn't modified unnecessarily. 24 * In particular, please put any new or replacement functions somewhere 25 * else, and modify the makefile to use your version instead. 26 * Thanks. Manuel 27 * 28 * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ 29 30#ifndef _UCLIBC_LOCALE_H 31#define _UCLIBC_LOCALE_H 32 33/**********************************************************************/ 34/* uClibc compatibilty stuff */ 35 36#ifdef __UCLIBC_HAS_LOCALE__ 37 38# undef __LOCALE_C_ONLY 39 40#else 41 42# define __LOCALE_C_ONLY 43 44 45#endif 46 47/**********************************************************************/ 48 49#define __NL_ITEM_CATEGORY_SHIFT 8 50#define __NL_ITEM_INDEX_MASK 0xff 51 52/* TODO: Make sure these agree with the locale mmap file gererator! */ 53 54#define __LC_CTYPE 0 55#define __LC_NUMERIC 1 56#define __LC_MONETARY 2 57#define __LC_TIME 3 58#define __LC_COLLATE 4 59#define __LC_MESSAGES 5 60#define __LC_ALL 6 61 62/**********************************************************************/ 63#ifndef __LOCALE_C_ONLY 64 65enum { 66 __ctype_encoding_7_bit, /* C/POSIX */ 67 __ctype_encoding_utf8, /* UTF-8 */ 68 __ctype_encoding_8_bit /* for 8-bit codeset locales */ 69}; 70 71#define LOCALE_STRING_SIZE (2 * __LC_ALL + 2) 72 73 /* 74 * '#' + 2_per_category + '\0' 75 * {locale row # : 0 = C|POSIX} + 0x8001 76 * encoded in two chars as (((N+1) >> 8) | 0x80) and ((N+1) & 0xff) 77 * so decode is ((((uint16_t)(*s & 0x7f)) << 8) + s[1]) - 1 78 * 79 * Note: 0s are not used as they are nul-terminators for strings. 80 * Note: 0xff, 0xff is the encoding for a non-selected locale. 81 * (see setlocale() below). 82 * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul. 83 */ 84 85struct __uclibc_locale_struct; 86typedef struct __uclibc_locale_struct *__locale_t; 87 88 89#endif /* !defined(__LOCALE_C_ONLY) */ 90 91#endif /* _UCLIBC_LOCALE_H */ 92