Add handling of R_386_TLS_TPOFF32.
[dragonfly.git] / include / ctype.h
CommitLineData
32a7b49a 1/* $NetBSD: src/include/ctype.h,v 1.25 2003/10/22 15:51:18 kleink Exp $ */
9a5fe7cc 2/* $DragonFly: src/include/ctype.h,v 1.8 2005/05/06 14:25:17 y0netan1 Exp $ */
32a7b49a 3
984263bc 4/*
32a7b49a
JS
5 * Copyright (c) 1989 The Regents of the University of California.
6 * All rights reserved.
984263bc
MD
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 *
984263bc
MD
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.
32a7b49a 21 * 3. Neither the name of the University nor the names of its contributors
984263bc
MD
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 *
32a7b49a 37 * @(#)ctype.h 5.3 (Berkeley) 4/3/91
984263bc
MD
38 */
39
40#ifndef _CTYPE_H_
32a7b49a 41#define _CTYPE_H_
984263bc 42
32a7b49a
JS
43#include <sys/cdefs.h>
44#include <machine/stdint.h>
e2565a42 45
32a7b49a
JS
46#define _U 0x01
47#define _L 0x02
48#define _N 0x04
49#define _S 0x08
50#define _P 0x10
51#define _C 0x20
52#define _X 0x40
53#define _B 0x80
54
55extern const __uint16_t *__libc_ctype_;
56extern const __int16_t *__libc_tolower_tab_;
57extern const __int16_t *__libc_toupper_tab_;
984263bc
MD
58
59__BEGIN_DECLS
32a7b49a
JS
60int isalnum(int);
61int isalpha(int);
62int iscntrl(int);
63int isdigit(int);
64int isgraph(int);
65int islower(int);
66int isprint(int);
67int ispunct(int);
68int isspace(int);
69int isupper(int);
70int isxdigit(int);
71int tolower(int);
72int toupper(int);
73
74#if defined(__XSI_VISIBLE)
75int isascii(int);
76int toascii(int);
77int _tolower(int);
78int _toupper(int);
984263bc 79#endif
984263bc 80
32a7b49a
JS
81#if _ISO_C_VISIBLE >= 1999 || _POSIX_VISIBLE >= 200112L || \
82 __XSI_VISIBLE >= 600
83int isblank(int);
984263bc 84#endif
984263bc
MD
85__END_DECLS
86
32a7b49a
JS
87#define isdigit(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _N))
88#define islower(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _L))
89#define isspace(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _S))
90#define ispunct(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _P))
91#define isupper(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _U))
92#define isalpha(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & (_U|_L)))
93#define isxdigit(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & (_N|_X)))
94#define isalnum(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & (_U|_L|_N)))
9a5fe7cc 95#define isprint(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & (_P|_U|_L|_N|_B)))
32a7b49a
JS
96#define isgraph(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & (_P|_U|_L|_N)))
97#define iscntrl(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _C))
98#define tolower(c) ((int)((__libc_tolower_tab_ + 1)[(int)(c)]))
99#define toupper(c) ((int)((__libc_toupper_tab_ + 1)[(int)(c)]))
100
101#if defined(__XSI_VISIBLE)
102#define isascii(c) ((unsigned)(c) <= 0177)
103#define toascii(c) ((c) & 0177)
104#define _tolower(c) ((c) - 'A' + 'a')
105#define _toupper(c) ((c) - 'a' + 'A')
984263bc
MD
106#endif
107
32a7b49a
JS
108#if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 200112L || \
109 __XSI_VISIBLE >= 600
110#define isblank(c) ((int)((__libc_ctype_ + 1)[(int)(c)] & _B))
111#endif
984263bc 112
32a7b49a
JS
113#ifdef _CTYPE_PRIVATE
114#include <machine/limits.h> /* for CHAR_BIT */
115
116#define _CTYPE_NUM_CHARS (1 << CHAR_BIT)
117
118#define _CTYPE_ID "DFCTYPE"
119#define _CTYPE_REV 3
120
121extern const __uint16_t __libc_C_ctype_[];
122extern const __int16_t __libc_C_toupper_[];
123extern const __int16_t __libc_C_tolower_[];
124#endif
984263bc
MD
125
126#endif /* !_CTYPE_H_ */