1 /* $NetBSD: runetype_local.h,v 1.12 2010/06/20 02:23:15 tnozaki 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 "runetype_misc.h"
47 #define _RUNE_ISCACHED(c) ((c)>=0 && (c)<_CTYPE_CACHE_SIZE)
51 * expanded rune locale declaration. local to the host. host endian.
54 __nbrune_t re_min
; /* First rune of the range */
55 __nbrune_t re_max
; /* Last rune (inclusive) of the range */
56 __nbrune_t re_map
; /* What first maps to in maps */
57 _RuneType
*re_rune_types
; /* Array of types in range */
62 uint32_t rr_nranges
; /* Number of ranges stored */
63 _RuneEntry
*rr_rune_ranges
;
70 typedef struct _WCTransEntry
{
72 __nbrune_t
*te_cached
;
73 _RuneRange
*te_extmap
;
75 #define _WCTRANS_INDEX_LOWER 0
76 #define _WCTRANS_INDEX_UPPER 1
77 #define _WCTRANS_NINDEXES 2
82 typedef struct _WCTypeEntry
{
86 #define _WCTYPE_INDEX_ALNUM 0
87 #define _WCTYPE_INDEX_ALPHA 1
88 #define _WCTYPE_INDEX_BLANK 2
89 #define _WCTYPE_INDEX_CNTRL 3
90 #define _WCTYPE_INDEX_DIGIT 4
91 #define _WCTYPE_INDEX_GRAPH 5
92 #define _WCTYPE_INDEX_LOWER 6
93 #define _WCTYPE_INDEX_PRINT 7
94 #define _WCTYPE_INDEX_PUNCT 8
95 #define _WCTYPE_INDEX_SPACE 9
96 #define _WCTYPE_INDEX_UPPER 10
97 #define _WCTYPE_INDEX_XDIGIT 11
98 #define _WCTYPE_NINDEXES 12
104 typedef struct _RuneLocale
{
106 * copied from _FileRuneLocale
108 _RuneType rl_runetype
[_CTYPE_CACHE_SIZE
];
109 __nbrune_t rl_maplower
[_CTYPE_CACHE_SIZE
];
110 __nbrune_t rl_mapupper
[_CTYPE_CACHE_SIZE
];
111 _RuneRange rl_runetype_ext
;
112 _RuneRange rl_maplower_ext
;
113 _RuneRange rl_mapupper_ext
;
116 size_t rl_variable_len
;
119 * the following portion is generated on the fly
121 const char *rl_codeset
;
122 struct _citrus_ctype_rec
*rl_citrus_ctype
;
123 _WCTransEntry rl_wctrans
[_WCTRANS_NINDEXES
];
124 _WCTypeEntry rl_wctype
[_WCTYPE_NINDEXES
];
126 const unsigned char *rl_ctype_tab
;
127 const short *rl_tolower_tab
;
128 const short *rl_toupper_tab
;
134 extern const _RuneLocale _DefaultRuneLocale
;
135 extern const _RuneLocale
*_CurrentRuneLocale
;
138 int _rune_load(const char * __restrict
, size_t, _RuneLocale
** __restrict
);
141 #endif /* !_RUNETYPE_LOCAL_H_ */