1 /* $NetBSD: runetype_local.h,v 1.14 2013/08/18 20:03:48 joerg Exp $ */
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Paul Borman at Krystal Technologies.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * @(#)rune.h 8.1 (Berkeley) 6/27/93
35 * @(#)runetype.h 8.1 (Berkeley) 6/2/93
38 #ifndef _RUNETYPE_LOCAL_H_
39 #define _RUNETYPE_LOCAL_H_
41 #include <sys/cdefs.h>
42 #include <sys/types.h>
45 #include "ctype_local.h"
46 #include "runetype_file.h"
48 #define _RUNE_ISCACHED(c) ((c)>=0 && (c)<_CTYPE_CACHE_SIZE)
52 * expanded rune locale declaration. local to the host. host endian.
55 __nbrune_t re_min
; /* First rune of the range */
56 __nbrune_t re_max
; /* Last rune (inclusive) of the range */
57 __nbrune_t re_map
; /* What first maps to in maps */
58 _RuneType
*re_rune_types
; /* Array of types in range */
63 uint32_t rr_nranges
; /* Number of ranges stored */
64 _RuneEntry
*rr_rune_ranges
;
71 typedef struct _WCTransEntry
{
73 __nbrune_t
*te_cached
;
74 _RuneRange
*te_extmap
;
76 #define _WCTRANS_INDEX_LOWER 0
77 #define _WCTRANS_INDEX_UPPER 1
78 #define _WCTRANS_NINDEXES 2
83 typedef struct _WCTypeEntry
{
87 #define _WCTYPE_INDEX_ALNUM 0
88 #define _WCTYPE_INDEX_ALPHA 1
89 #define _WCTYPE_INDEX_BLANK 2
90 #define _WCTYPE_INDEX_CNTRL 3
91 #define _WCTYPE_INDEX_DIGIT 4
92 #define _WCTYPE_INDEX_GRAPH 5
93 #define _WCTYPE_INDEX_LOWER 6
94 #define _WCTYPE_INDEX_PRINT 7
95 #define _WCTYPE_INDEX_PUNCT 8
96 #define _WCTYPE_INDEX_SPACE 9
97 #define _WCTYPE_INDEX_UPPER 10
98 #define _WCTYPE_INDEX_XDIGIT 11
99 #define _WCTYPE_NINDEXES 12
105 typedef struct _RuneLocale
{
107 * copied from _FileRuneLocale
109 _RuneType rl_runetype
[_CTYPE_CACHE_SIZE
];
110 __nbrune_t rl_maplower
[_CTYPE_CACHE_SIZE
];
111 __nbrune_t rl_mapupper
[_CTYPE_CACHE_SIZE
];
112 _RuneRange rl_runetype_ext
;
113 _RuneRange rl_maplower_ext
;
114 _RuneRange rl_mapupper_ext
;
117 size_t rl_variable_len
;
120 * the following portion is generated on the fly
122 const char *rl_codeset
;
123 struct _citrus_ctype_rec
*rl_citrus_ctype
;
124 _WCTransEntry rl_wctrans
[_WCTRANS_NINDEXES
];
125 _WCTypeEntry rl_wctype
[_WCTYPE_NINDEXES
];
127 const unsigned short *rl_ctype_tab
;
128 const short *rl_tolower_tab
;
129 const short *rl_toupper_tab
;
131 #ifdef __BUILD_LEGACY
132 const unsigned char *rl_compat_bsdctype
;
139 extern __dso_hidden
const _RuneLocale _DefaultRuneLocale
;
142 int _rune_load(const char * __restrict
, size_t, _RuneLocale
** __restrict
);
145 #endif /* !_RUNETYPE_LOCAL_H_ */