Changeset 1454 for trunk/src/emx/include/sys/locale.h
- Timestamp:
- Sep 4, 2004, 8:22:38 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/sys/locale.h
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1453 r1454 1 /* 2 Locale support implementation through OS/2 Unicode API. 3 Copyright (c) 2003 InnoTek Systemberatung GmbH 4 5 For conditions of distribution and use, see the file COPYING. 6 7 Private header file for locale support. 8 */ 9 10 #ifndef __SYS_LOCALE_H__ 11 #define __SYS_LOCALE_H__ 12 13 /* To avoid conflicts with unidef.h we should use same values as there. */ 14 #define LC_ALL (-1) 15 #define LC_COLLATE 0 16 #define LC_CTYPE 1 17 #define LC_NUMERIC 2 18 #define LC_MONETARY 3 19 #define LC_TIME 4 20 #define LC_MESSAGES 5 21 #define __LC_COUNT 6 22 23 /* Bit masks for __locale_global.ctype - 24 !NOTE! - these have identical values to the CT_* to speed up setlocale(). */ 25 #define __UPPER 0x0001 /* Upper case alphabetic character. */ 26 #define __LOWER 0x0002 /* Lower case alphabetic character. */ 27 #define __DIGIT 0x0004 /* Digits 0-9. */ 28 #define __SPACE 0x0008 /* White space and line ends. */ 29 #define __PUNCT 0x0010 /* Punctuation marks. */ 30 #define __CNTRL 0x0020 /* Control and format characters. */ 31 #define __BLANK 0x0040 /* Space and tab. */ 32 #define __XDIGIT 0x0080 /* Hex digits. */ 33 #define __ALPHA 0x0100 /* Letters and linguistic marks. */ 34 #define __ALNUM 0x0200 /* Alphanumeric. */ 35 #define __GRAPH 0x0400 /* All except controls and space. */ 36 #define __PRINT 0x0800 /* Everything except controls. */ 37 #define __NUMBER 0x1000 /* Integral number. */ 38 #define __SYMBOL 0x2000 /* Symbol. */ 39 #define __ASCII 0x8000 /* In standard ASCII set. */ 40 41 /* Locale information structure. */ 42 struct lconv 43 { 44 char *decimal_point; /* non-monetary decimal point */ 45 char *thousands_sep; /* non-monetary thousands separator */ 46 char *grouping; /* non-monetary size of grouping */ 47 char *int_curr_symbol; /* international currency symbol and separator */ 48 char *currency_symbol; /* local currency symbol */ 49 char *mon_decimal_point; /* monetary decimal point */ 50 char *mon_thousands_sep; /* monetary thousands separator */ 51 char *mon_grouping; /* monetary size of grouping */ 52 char *positive_sign; /* non-negative values sign */ 53 char *negative_sign; /* negative values sign */ 54 char int_frac_digits; /* number of fractional digits - int currency */ 55 char frac_digits; /* number of fractional digits - local currency */ 56 char p_cs_precedes; /* (non-neg curr sym) 1-precedes, 0-succeeds */ 57 char p_sep_by_space; /* (non-neg curr sym) 1-space, 0-no space */ 58 char n_cs_precedes; /* (neg curr sym) 1-precedes, 0-succeeds */ 59 char n_sep_by_space; /* (neg curr sym) 1-space, 0-no space */ 60 char p_sign_posn; /* positioning of non-negative monetary sign */ 61 char n_sign_posn; /* positioning of negative monetary sign */ 62 /** @todo C99 63 char int_n_cs_precedes 64 char int_n_sep_by_space 65 char int_n_sign_posn 66 char int_p_cs_precedes 67 char int_p_sep_by_space 68 char int_p_sign_posn 69 */ 70 }; 71 72 73 #ifdef __INTERNAL_DEFS 74 75 #include <uconv.h> 76 77 /* This structure keeps the time formatting rules. */ 78 struct __locale_time 79 { 80 char *smonths [12]; /* Short month names */ 81 char *lmonths [12]; /* Long month names */ 82 char *swdays [7]; /* Short weekday names */ 83 char *lwdays [7]; /* Long weekday names */ 84 char *date_time_fmt; /* Date and time format */ 85 char *date_fmt; /* Date format */ 86 char *time_fmt; /* Time format */ 87 char *am, *pm; /* AM and PM strings */ 88 }; 89 90 /* There is one global object of this type that contains integral 91 information about last selected (with setlocale()) locale. 92 The locale information itself is split into parts to avoid linking 93 unused data into programs that use just the "C" locale and just 94 a few functions that use locale data (such as strdate()). */ 95 struct __locale_global 96 { 97 /* Lock for multi-threaded operations. */ 98 signed char /* _smutex */ lock; /* Avoid including builtin.h & smutex.h */ 99 /* Category names. */ 100 char *name [__LC_COUNT + 1]; 101 }; 102 103 /* This structure contains the uppercase/lowercase tables. */ 104 struct __locale_ctype 105 { 106 /* Bit flags for every character (for isXXX() function series) */ 107 unsigned short cflags [256]; 108 /* All uppercased characters */ 109 unsigned char upcase [256]; 110 /* All lowercased characters */ 111 unsigned char locase [256]; 112 /* MBCS prefixes. Two bits per character. */ 113 unsigned char mbcsprefix [256/4]; 114 /* The converter object to convert to and from selected codepage 115 (used with MBCS codepages only) */ 116 UconvObject uconv; 117 /* The locale object. */ 118 LocaleObject locale; 119 /* Non-zero if there are any MBCS prefix characters in codepage */ 120 char mbcs; 121 }; 122 123 struct __locale_collate 124 { 125 /* Character weight for SBCS codepages */ 126 unsigned char weight [256]; 127 /* MBCS prefixes. Two bits per character. */ 128 unsigned char mbcsprefix [256/4]; 129 /* The converter object to convert to and from selected codepage 130 (used with MBCS codepages only) */ 131 UconvObject uconv; 132 /* The locale object. */ 133 LocaleObject locale; 134 /* Non-zero if there are any MBCS prefix characters in codepage */ 135 char mbcs; 136 }; 137 138 /* Handy macros for working with (__locale_ctype|__locale_collate).mbcsprefix */ 139 #define SET_MBCS_PREFIX(s,c,v) \ 140 s [((unsigned char)c) >> 2] |= (v) << (2 * ((c) & 3)) 141 #define LEN_MBCS_PREFIX(s,c) \ 142 ((s [((unsigned char)c) >> 2] >> (2 * ((c & 3) ^ 3))) & 3) 143 #define IS_MBCS_PREFIX(s,c) \ 144 (LEN_MBCS_PREFIX(s.mbcsprefix,c) != 1) 145 #define CHK_MBCS_PREFIX(s,c,v) \ 146 ((v = LEN_MBCS_PREFIX(s.mbcsprefix,c)) > 1) 147 148 /* A static constant string denoting the "C" locale. */ 149 extern const char __locale_C[2]; 150 151 /* Global locale information. */ 152 extern struct __locale_global __locale; 153 /* String collation information. */ 154 extern struct __locale_collate __locale_collate; 155 /* Character case conversion tables. */ 156 extern struct __locale_ctype __locale_ctype; 157 /* Locale information structure. */ 158 extern struct lconv __locale_lconv; 159 /* Date / time formatting rules. */ 160 extern struct __locale_time __locale_time; 161 162 /* Convert a string to Unicode, apply some transform and convert back. */ 163 extern void __do_Unicode (UconvObject *uconv, char *s, void *arg, 164 int (*xform) (UniChar *, void *)); 165 /* Convert a MBCS character to Unicode; returns number of bytes in MBCS char. */ 166 extern int __to_ucs (UconvObject, const unsigned char *, size_t, UniChar *); 167 /* Convert a Unicode character to MBCS */ 168 extern int __from_ucs (UconvObject, UniChar, unsigned char *, size_t); 169 170 #else 171 172 /* Simplified extern definitions for inline functions usage */ 173 174 /* Character case conversion tables. */ 175 extern struct 176 { 177 unsigned short cflags [256]; 178 unsigned char upcase [256]; 179 unsigned char locase [256]; 180 } __locale_ctype; 181 182 #endif /* __INTERNAL_DEFS */ 183 184 #endif /* __SYS_LOCALE_H__ */ 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.