29#ifndef _RWSTD_LOC_LOCALEDEF_H_INCLUDED
30#define _RWSTD_LOC_LOCALEDEF_H_INCLUDED
36#if 6 <= _RWSTD_HP_aCC_MAJOR
40# pragma diag_suppress 4298, 4299
68#define _RWSTD_CHAR_ARRAY(off) \
69 (_RWSTD_REINTERPRET_CAST (const char*, this + 1) + (off))
73#define _RWSTD_WCHAR_T_ARRAY(off) \
74 _RWSTD_REINTERPRET_CAST (const wchar_t*, _RWSTD_CHAR_ARRAY (off))
76#define _RWSTD_UINT_ARRAY(off) \
77 _RWSTD_REINTERPRET_CAST (const _RWSTD_UINT32_T*, _RWSTD_CHAR_ARRAY (off))
81#define _RWSTD_ARRAY_ELM(T, off, i) \
82 _RWSTD_REINTERPRET_CAST (const T*, \
83 ( _RWSTD_REINTERPRET_CAST (const char*, this + 1) \
84 + (off) + (i) * sizeof (T)))
90 _RWSTD_UINT32_T codeset_off;
91 _RWSTD_UINT32_T charmap_off;
92 _RWSTD_UINT32_T n_to_w_tab_off;
93 _RWSTD_UINT32_T w_to_n_tab_off;
94 _RWSTD_UINT32_T utf8_to_ext_tab_off;
95 _RWSTD_UINT32_T wchar_off;
96 _RWSTD_UINT32_T xliteration_off;
97 _RWSTD_UINT32_T codecvt_ext_off;
100 _RWSTD_UINT8_T mb_cur_max;
103 const char* codeset_name ()
const {
108 const char* charmap_name ()
const {
113 const _RWSTD_UINT32_T* w_to_n_tab ()
const {
118 const _RWSTD_UINT32_T* n_to_w_tab ()
const {
123 const _RWSTD_UINT32_T* utf8_to_ext_tab ()
const {
129 wchar_t get_internal_at_offset (_RWSTD_UINT32_T
off)
const {
135 wchar_t get_ucs4_at_offset (_RWSTD_UINT32_T
off)
const {
139 const void* get_ext ()
const {
143 const _RWSTD_UINT32_T* get_xliteration_tab ()
const {
152 _RWSTD_UINT32_T codeset_off;
153 _RWSTD_UINT32_T charmap_off;
154 _RWSTD_UINT32_T wmask_s;
155 _RWSTD_UINT32_T wtoupper_off;
156 _RWSTD_UINT32_T wtolower_off;
157 _RWSTD_UINT32_T wmask_off;
160 _RWSTD_UINT32_T ctype_ext_off;
162 _RWSTD_UINT8_T toupper_tab[256];
163 _RWSTD_UINT8_T tolower_tab[256];
164 _RWSTD_UINT32_T mask_tab[256];
165 _RWSTD_UINT8_T mb_cur_max;
167 _RWSTD_SIZE_T wtoupper_s ()
const {
168 return (wtolower_off - wtoupper_off) /
sizeof (__rw_upper_elm);
171 _RWSTD_SIZE_T wtolower_s ()
const {
172 return (wmask_off - wtolower_off) /
sizeof (__rw_lower_elm);
175 _RWSTD_SIZE_T codeset_s ()
const {
176 return charmap_off - codeset_off;
179 _RWSTD_SIZE_T charmap_s ()
const {
180 return wtoupper_off - charmap_off;
183 const char* codeset_name ()
const {
187 const char* charmap_name ()
const {
191 __rw_upper_elm wtoupper_tab (_RWSTD_SIZE_T idx)
const {
195 __rw_lower_elm wtolower_tab (_RWSTD_SIZE_T idx)
const {
199 __rw_mask_elm wmask_tab (_RWSTD_SIZE_T idx)
const {
203 const void* get_ext ()
const {
213 _RWSTD_UINT32_T codeset_off;
214 _RWSTD_UINT32_T charmap_off;
216 _RWSTD_UINT32_T n_ce_tab_off;
217 _RWSTD_UINT32_T w_ce_tab_off;
219 _RWSTD_UINT32_T weight_tab_off;
221 _RWSTD_UINT32_T n_char_tab_off;
222 _RWSTD_UINT32_T n_char_off_tab_off;
223 _RWSTD_UINT32_T n_char_first_char_off;
225 _RWSTD_UINT32_T w_char_tab_off;
226 _RWSTD_UINT32_T w_char_off_tab_off;
227 _RWSTD_UINT32_T w_char_first_char_off;
229 _RWSTD_UINT32_T n_ce_off_tab_off;
230 _RWSTD_UINT32_T w_ce_off_tab_off;
231 _RWSTD_UINT32_T n_ce_first_char_off;
232 _RWSTD_UINT32_T w_ce_first_char_off;
233 _RWSTD_UINT32_T n_ce_last_char_off;
234 _RWSTD_UINT32_T w_ce_last_char_off;
236 _RWSTD_UINT32_T undefined_weight_idx;
238 _RWSTD_UINT32_T elm_size;
239 _RWSTD_UINT32_T num_elms;
241 _RWSTD_UINT32_T num_wchars;
244 _RWSTD_UINT32_T collate_ext_off;
246 _RWSTD_UINT32_T undefined_optimization;
248 _RWSTD_UINT8_T longest_weight;
249 _RWSTD_UINT8_T num_weights;
250 _RWSTD_UINT8_T largest_ce;
252 _RWSTD_UINT8_T weight_type[256];
255 _RWSTD_UINT32_T get_n_tab_off (_RWSTD_UINT32_T tabno)
const {
256 return (_RWSTD_UINT32_T)
257 (
sizeof (_RWSTD_UINT32_T) * (*(
const _RWSTD_UINT32_T*)(
258 (_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
260 + (tabno *
sizeof (_RWSTD_UINT32_T))))));
262 _RWSTD_UINT32_T get_n_ce_tab_off (_RWSTD_UINT32_T tabno)
const {
263 return (_RWSTD_UINT32_T)
264 (
sizeof (_RWSTD_UINT32_T) * (*(
const _RWSTD_UINT32_T*)(
265 (_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
267 + (tabno *
sizeof (_RWSTD_UINT32_T))))));
270 _RWSTD_UINT32_T get_w_ce_tab_off (_RWSTD_UINT32_T tabno)
const {
271 return (_RWSTD_UINT32_T)
272 (
sizeof (_RWSTD_UINT32_T) * (*(
const _RWSTD_UINT32_T*)(
273 (_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
275 + (tabno *
sizeof (_RWSTD_UINT32_T))))));
278 _RWSTD_UINT8_T get_first_char_in_n_tab (_RWSTD_UINT32_T tabno)
const {
279 return *((
const _RWSTD_UINT8_T*)
this +
sizeof *
this
280 + n_char_first_char_off + tabno);
284 _RWSTD_UINT8_T get_first_char_in_n_ce_tab (_RWSTD_UINT32_T tabno)
const {
285 return *((
const _RWSTD_UINT8_T*)
this +
sizeof *
this
286 + n_ce_first_char_off + tabno);
289 _RWSTD_UINT8_T get_first_char_in_w_ce_tab (_RWSTD_UINT32_T tabno)
const {
290 return *((
const _RWSTD_UINT8_T*)
this +
sizeof *
this
291 + w_ce_first_char_off + tabno);
294 _RWSTD_UINT8_T get_last_char_in_n_ce_tab (_RWSTD_UINT32_T tabno)
const {
295 return *((
const _RWSTD_UINT8_T*)
this +
sizeof *
this
296 + n_ce_last_char_off + tabno);
299 _RWSTD_UINT8_T get_last_char_in_w_ce_tab (_RWSTD_UINT32_T tabno)
const {
300 return *((
const _RWSTD_UINT8_T*)
this +
sizeof *
this
301 + w_ce_last_char_off + tabno);
304 const _RWSTD_UINT32_T* get_n_tab (_RWSTD_UINT32_T tabno)
const {
305 return (
const _RWSTD_UINT32_T*)
306 ((_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
307 + n_char_tab_off + get_n_tab_off (tabno)));
310 const _RWSTD_UINT32_T* get_n_ce_tab (_RWSTD_UINT32_T tabno)
const {
311 return (
const _RWSTD_UINT32_T*)
312 ((_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
313 + n_ce_tab_off + get_n_ce_tab_off (tabno)));
316 const _RWSTD_UINT32_T* get_w_ce_tab (_RWSTD_UINT32_T tabno)
const {
317 return (
const _RWSTD_UINT32_T*)
318 ((_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
319 + w_ce_tab_off + get_w_ce_tab_off (tabno)));
322 _RWSTD_UINT32_T get_w_tab_off (_RWSTD_UINT32_T tabno)
const {
323 return (_RWSTD_UINT32_T)
324 (
sizeof (_RWSTD_UINT32_T) * (*(
const _RWSTD_UINT32_T*)(
325 (_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
327 + (tabno *
sizeof (_RWSTD_UINT32_T))))));
330 _RWSTD_UINT8_T get_first_char_in_w_tab (_RWSTD_UINT32_T tabno)
const {
331 return *((
const _RWSTD_UINT8_T*)
this +
sizeof *
this
332 + w_char_first_char_off + tabno);
336 const _RWSTD_UINT32_T* get_w_tab (_RWSTD_UINT32_T tabno)
const {
337 return (
const _RWSTD_UINT32_T*)
338 ((_RWSTD_SIZE_T)((
const char*)
this +
sizeof *
this
339 + w_char_tab_off + get_w_tab_off (tabno)));
343 const _RWSTD_UINT32_T* coll ()
const {
347 const char* codeset_name ()
const {
351 const char* charmap_name ()
const {
355 const _RWSTD_UINT32_T* get_weight (_RWSTD_UINT32_T idx)
const {
356 return (
const _RWSTD_UINT32_T*)((_RWSTD_SIZE_T)((
const char*)coll ()
360 const void* get_ext ()
const {
369 _RWSTD_UINT32_T decimal_point_off [2];
370 _RWSTD_UINT32_T thousands_sep_off [2];
371 _RWSTD_UINT32_T grouping_off;
372 _RWSTD_UINT32_T punct_ext_off;
375 const void* decimal_point (
bool wide)
const {
380 const void* thousands_sep (
bool wide)
const {
384 const void* grouping ()
const {
388 const void* get_ext ()
const {
397 _RWSTD_UINT32_T codeset_off;
398 _RWSTD_UINT32_T charmap_off;
400 _RWSTD_UINT32_T curr_symbol_off [2][2];
401 _RWSTD_UINT32_T positive_sign_off [2];
402 _RWSTD_UINT32_T negative_sign_off [2];
405 _RWSTD_UINT32_T monetary_ext_off;
408 char pos_format[2][4];
411 char neg_format[2][4];
418 char p_cs_precedes[2];
427 char p_sep_by_space[2];
431 char n_cs_precedes[2];
436 char n_sep_by_space[2];
452 const void* curr_symbol (
bool intl,
bool wide)
const {
456 const void* positive_sign (
bool wide)
const {
460 const void* negative_sign (
bool wide)
const {
464 const char* codeset_name ()
const {
468 const char* charmap_name ()
const {
472 const void* get_ext ()
const {
481 _RWSTD_UINT32_T codeset_off;
482 _RWSTD_UINT32_T charmap_off;
484 _RWSTD_UINT32_T truename_off [2];
485 _RWSTD_UINT32_T falsename_off [2];
487 _RWSTD_UINT32_T numeric_ext_off;
489 const void* truename (
bool wide)
const {
493 const void* falsename (
bool wide)
const {
497 const char* codeset_name ()
const {
501 const char* charmap_name ()
const {
505 const void* get_ext ()
const {
512struct __rw_messages_t
514 _RWSTD_UINT32_T codeset_off;
515 _RWSTD_UINT32_T charmap_off;
517 _RWSTD_UINT32_T yesexpr_off[2];
518 _RWSTD_UINT32_T noexpr_off[2];
520 _RWSTD_UINT32_T messages_ext_off;
522 const void* yesexpr (
bool wide)
const {
526 const void* noexpr (
bool wide)
const {
530 const char* codeset_name ()
const {
534 const char* charmap_name ()
const {
538 const void* get_ext ()
const {
548 _RWSTD_UINT32_T codeset_off;
549 _RWSTD_UINT32_T charmap_off;
550 _RWSTD_UINT32_T num_eras;
551 _RWSTD_UINT32_T num_alt_digits;
553 _RWSTD_UINT32_T era_off;
554 _RWSTD_UINT32_T alt_digits_off;
555 _RWSTD_UINT32_T abday_off[2][7];
556 _RWSTD_UINT32_T day_off[2][7];
557 _RWSTD_UINT32_T abmon_off[2][12];
558 _RWSTD_UINT32_T mon_off[2][12];
559 _RWSTD_UINT32_T am_pm_off[2][2];
560 _RWSTD_UINT32_T d_t_fmt_off[2];
561 _RWSTD_UINT32_T d_fmt_off[2];
562 _RWSTD_UINT32_T t_fmt_off[2];
563 _RWSTD_UINT32_T t_fmt_ampm_off[2];
564 _RWSTD_UINT32_T era_d_t_fmt_off[2];
565 _RWSTD_UINT32_T era_d_fmt_off[2];
566 _RWSTD_UINT32_T era_t_fmt_off[2];
569 _RWSTD_UINT32_T time_ext_off;
572 const void* abday (_RWSTD_SIZE_T idx,
bool wide)
const {
577 const void* day (_RWSTD_SIZE_T idx,
bool wide)
const {
582 const void* abmon (_RWSTD_SIZE_T idx,
bool wide)
const {
587 const void* mon (_RWSTD_SIZE_T idx,
bool wide)
const {
593 const void* am_pm (_RWSTD_SIZE_T idx,
bool wide)
const {
598 const void* d_t_fmt (
bool wide)
const {
603 const void* d_fmt (
bool wide)
const {
608 const void* t_fmt (
bool wide)
const {
612 const void* t_fmt_ampm (
bool wide)
const {
617 _RWSTD_UINT32_T name_off [2];
618 _RWSTD_UINT32_T fmt_off [2];
627 _RWSTD_INT32_T year [2];
633 const era_t* era (_RWSTD_SIZE_T idx)
const {
638 _RWSTD_SIZE_T era_count ()
const {
642 const void* era_name (_RWSTD_SIZE_T idx,
bool wide)
const {
646 const void* era_fmt (_RWSTD_SIZE_T idx,
bool wide)
const {
651 const void* era_d_t_fmt (
bool wide)
const {
656 const void* era_d_fmt (
bool wide)
const {
661 const void* era_t_fmt (
bool wide)
const {
666 const void* alt_digits (_RWSTD_SIZE_T idx,
bool wide)
const {
668 (_RWSTD_UINT32_T, alt_digits_off,
673 _RWSTD_UINT32_T alt_digits_count ()
const {
674 return num_alt_digits;
677 const char* codeset_name ()
const {
681 const char* charmap_name ()
const {
685 const void* get_ext ()
const {
691#if 6 <= _RWSTD_aCC_MAJOR
693# pragma diag_default 4298, 4299
697static inline _RWSTD_SIZE_T
698__rw_itoutf8 (_RWSTD_UINT32_T wchar,
char *to)
700 typedef _RWSTD_UINT8_T _UChar;
703 to [0] = _UChar (wchar);
706 if (wchar < 0x800U) {
707 to [0] = _UChar (0xc0U | (wchar >> 6));
708 to [1] = _UChar (0x80U | (wchar & 0x3fU));
711 if (wchar < 0x10000U) {
712 to [0] = _UChar (0xe0U | (wchar >> 12));
713 to [1] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
714 to [2] = _UChar (0x80U | (wchar & 0x3fU));
717 if (wchar < 0x200000U) {
718 to [0] = _UChar (0xf0U | (wchar >> 18));
719 to [1] = _UChar (0x80U | (wchar >> 12 & 0x3fU));
720 to [2] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
721 to [3] = _UChar (0x80U | (wchar & 0x3fU));
724 if (wchar < 0x4000000U) {
725 to [0] = _UChar (0xf8U | (wchar >> 24));
726 to [1] = _UChar (0x80U | (wchar >> 18 & 0x3fU));
727 to [2] = _UChar (0x80U | (wchar >> 12 & 0x3fU));
728 to [3] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
729 to [4] = _UChar (0x80U | (wchar & 0x3fU));
732 to [0] = _UChar (0xfcU | (wchar >> 30));
733 to [1] = _UChar (0x80U | (wchar >> 24 & 0x3fU));
734 to [2] = _UChar (0x80U | (wchar >> 18 & 0x3fU));
735 to [3] = _UChar (0x80U | (wchar >> 12 & 0x3fU));
736 to [4] = _UChar (0x80U | (wchar >> 6 & 0x3fU));
737 to [5] = _UChar (0x80U | (wchar & 0x3fU));
748static inline const char*
749__rw_utf8toucs4 (_RWSTD_INT32_T *ret,
const char *from,
const char *from_end)
755 typedef _RWSTD_INT32_T _Int32;
757 const _RWSTD_UINT8_T*
const byte =
760 if (
byte [0] < 0x80U) {
761 *ret = _Int32 (
byte [0]);
765 if (
byte [0] < 0xc2U) {
771 const _RWSTD_PTRDIFF_T
len = from_end - from;
773 if (
byte [0] < 0xe0U) {
777 *ret = _Int32 ((
byte [0] & 0x1fU) << 6 |
byte [1] & 0x3fU);
781 if (
byte [0] < 0xf0U) {
785 *ret = _Int32 ( (
byte [0] & 0x0fU) << 12
786 | (
byte [1] & 0x3fU) << 6
787 | (
byte [2] & 0x3fU));
791 if (
byte [0] < 0xf8U) {
795 *ret = _Int32 ( (
byte [0] & 0x07U) << 18
796 | (
byte [1] & 0x3fU) << 12
797 | (
byte [2] & 0x3fU) << 6
798 | (
byte [3] & 0x3fU));
802 if (
byte [0] < 0xfcU) {
806 *ret = _Int32 ( (
byte [0] & 0x03U) << 24
807 | (
byte [1] & 0x3fU) << 18
808 | (
byte [2] & 0x3fU) << 12
809 | (
byte [3] & 0x3fU) << 6
810 | (
byte [4] & 0x3fU));
814 if (
byte [0] < 0xfeU) {
818 *ret = _Int32 ( (
byte [0] & 0x01U) << 30
819 | (
byte [1] & 0x3fU) << 24
820 | (
byte [2] & 0x3fU) << 18
821 | (
byte [3] & 0x3fU) << 12
822 | (
byte [4] & 0x3fU) << 6
823 | (
byte [5] & 0x3fU));
837unsigned __rw_mbtowco (
const unsigned *cvtbl,
839 const char *from_end)
841 typedef _RWSTD_UINT8_T _UChar;
844 const unsigned bit31 = 0x80000000U;
846 const char *next = from;
850 for (
const unsigned *ptbl = cvtbl; (wc = ptbl [_UChar (*next)]) & bit31; ) {
856 if (wc == _RWSTD_UINT_MAX || ++next == from_end)
860 ptbl = cvtbl + 256 * (wc & ~bit31);
#define _RWSTD_REINTERPRET_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_ASSERT(ignore)
#define _RWSTD_UINT_ARRAY(off)
#define _RWSTD_ARRAY_ELM(T, off, i)
#define _RWSTD_CHAR_ARRAY(off)