a_l_e_x_1991

bits/uClibc_locale.h

Sep 29th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  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; see the file COPYING.LIB. If
  15. * not, see <http://www.gnu.org/licenses/>.
  16. */
  17.  
  18. /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION!
  19. *
  20. * Besides uClibc, I'm using this code in my libc for elks, which is
  21. * a 16-bit environment with a fairly limited compiler. It would make
  22. * things much easier for me if this file isn't modified unnecessarily.
  23. * In particular, please put any new or replacement functions somewhere
  24. * else, and modify the makefile to use your version instead.
  25. * Thanks. Manuel
  26. *
  27. * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
  28.  
  29. #ifndef _UCLIBC_LOCALE_H
  30. #define _UCLIBC_LOCALE_H
  31.  
  32. /**********************************************************************/
  33. /* uClibc compatibilty stuff */
  34.  
  35. # undef __LOCALE_C_ONLY
  36.  
  37. /**********************************************************************/
  38.  
  39. #define __NL_ITEM_CATEGORY_SHIFT 8
  40. #define __NL_ITEM_INDEX_MASK 0xff
  41.  
  42. /* TODO: Make sure these agree with the locale mmap file gererator! */
  43.  
  44. #define __LC_CTYPE 0
  45. #define __LC_NUMERIC 1
  46. #define __LC_MONETARY 2
  47. #define __LC_TIME 3
  48. #define __LC_COLLATE 4
  49. #define __LC_MESSAGES 5
  50. #define __LC_ALL 6
  51.  
  52. /**********************************************************************/
  53. #ifndef __LOCALE_C_ONLY
  54.  
  55. enum {
  56. __ctype_encoding_7_bit, /* C/POSIX */
  57. __ctype_encoding_utf8, /* UTF-8 */
  58. __ctype_encoding_8_bit /* for 8-bit codeset locales */
  59. };
  60.  
  61. #define LOCALE_STRING_SIZE (2 * __LC_ALL + 2)
  62.  
  63. /*
  64. * '#' + 2_per_category + '\0'
  65. * {locale row # : 0 = C|POSIX} + 0x8001
  66. * encoded in two chars as (((N+1) >> 8) | 0x80) and ((N+1) & 0xff)
  67. * so decode is ((((uint16_t)(*s & 0x7f)) << 8) + s[1]) - 1
  68. *
  69. * Note: 0s are not used as they are nul-terminators for strings.
  70. * Note: 0xff, 0xff is the encoding for a non-selected locale.
  71. * (see setlocale() below).
  72. * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul.
  73. */
  74.  
  75. struct __uclibc_locale_struct;
  76. typedef struct __uclibc_locale_struct *__locale_t;
  77.  
  78. #endif /* !defined(__LOCALE_C_ONLY) */
  79.  
  80. #endif /* _UCLIBC_LOCALE_H */
Advertisement
Add Comment
Please, Sign In to add comment