Merge from vendor branch LUKEMFTP:
[dragonfly.git] / lib / libc / gen / ctype.c
1 /*      $NetBSD: src/lib/libc/gen/ctype_.c,v 1.16 2003/08/07 16:42:46 agc Exp $ */
2 /*      $DragonFly: src/lib/libc/gen/ctype.c,v 1.5 2005/09/17 14:39:44 joerg Exp $ */
3
4 /*
5  * Copyright (c) 1989 The Regents of the University of California.
6  * All rights reserved.
7  * (c) UNIX System Laboratories, Inc.
8  * All or some portions of this file are derived from material licensed
9  * to the University of California by American Telephone and Telegraph
10  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11  * the permission of UNIX System Laboratories, Inc.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  */
37
38 #define _CTYPE_PRIVATE
39
40 #include <sys/types.h>
41 #include <ctype.h>
42 #include <limits.h>
43
44 #define _U      _CTYPEMASK_U
45 #define _L      _CTYPEMASK_L
46 #define _D      _CTYPEMASK_D
47 #define _S      _CTYPEMASK_S
48 #define _P      _CTYPEMASK_P
49 #define _C      _CTYPEMASK_C
50 #define _X      _CTYPEMASK_X
51 #define _B      _CTYPEMASK_B
52 #define _A      _CTYPEMASK_A
53 #define _G      _CTYPEMASK_G
54 #define _R      _CTYPEMASK_R
55
56 const uint16_t __libc_C_ctype_[1 + _CTYPE_NUM_CHARS] = {
57         0,
58 /*00*/  _C,             _C,             _C,             _C,
59         _C,             _C,             _C,             _C,
60         _C,             _C|_S|_B,       _C|_S,          _C|_S,
61         _C|_S,          _C|_S,          _C,             _C,
62 /*10*/  _C,             _C,             _C,             _C,
63         _C,             _C,             _C,             _C,
64         _C,             _C,             _C,             _C,
65         _C,             _C,             _C,             _C,
66 /*20*/  _S|_B|_R,       _P|_R|_G,       _P|_R|_G,       _P|_R|_G,
67         _P|_R|_G,       _P|_R|_G,       _P|_R|_G,       _P|_R|_G,
68         _P|_R|_G,       _P|_R|_G,       _P|_R|_G,       _P|_R|_G,
69         _P|_R|_G,       _P|_R|_G,       _P|_R|_G,       _P|_R|_G,
70 /*30*/  _D|_R|_G|_X,    _D|_R|_G|_X,    _D|_R|_G|_X,    _D|_R|_G|_X,
71         _D|_R|_G|_X,    _D|_R|_G|_X,    _D|_R|_G|_X,    _D|_R|_G|_X,
72         _D|_R|_G|_X,    _D|_R|_G|_X,    _P|_R|_G,       _P|_R|_G,
73         _P|_R|_G,       _P|_R|_G,       _P|_R|_G,       _P|_R|_G,
74 /*40*/  _P|_R|_G,       _U|_X|_R|_G|_A, _U|_X|_R|_G|_A, _U|_X|_R|_G|_A,
75         _U|_X|_R|_G|_A, _U|_X|_R|_G|_A, _U|_X|_R|_G|_A, _U|_R|_G|_A,
76         _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,
77         _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,
78 /*50*/  _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,
79         _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,
80         _U|_R|_G|_A,    _U|_R|_G|_A,    _U|_R|_G|_A,    _P|_R|_G,
81         _P|_R|_G,       _P|_R|_G,       _P|_R|_G,       _P|_R|_G,
82 /*60*/  _P|_R|_G,       _L|_X|_R|_G|_A, _L|_X|_R|_G|_A, _L|_X|_R|_G|_A,
83         _L|_X|_R|_G|_A, _L|_X|_R|_G|_A, _L|_X|_R|_G|_A, _L|_R|_G|_A,
84         _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,
85         _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,
86 /*70*/  _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,
87         _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,
88         _L|_R|_G|_A,    _L|_R|_G|_A,    _L|_R|_G|_A,    _P|_R|_G,
89         _P|_R|_G,       _P|_R|_G,       _P|_R|_G,       _C
90 };
91
92 const uint16_t *__libc_ctype_ = __libc_C_ctype_;