199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1989, 1993
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The Regents of the University of California. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (c) UNIX System Laboratories, Inc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All or some portions of this file are derived from material licensed
199767f8919635c4928607450d9e0abb932109ceToomas Soome * to the University of California by American Telephone and Telegraph
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Co. or Unix System Laboratories, Inc. and are reproduced herein with
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the permission of UNIX System Laboratories, Inc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This code is derived from software contributed to Berkeley by
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Paul Borman at Krystal Technologies.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 3. Neither the name of the University nor the names of its contributors
199767f8919635c4928607450d9e0abb932109ceToomas Soome * may be used to endorse or promote products derived from this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @(#)ctype.h 8.4 (Berkeley) 1/21/94
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _CTYPE_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _CTYPE_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/cdefs.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/_types.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <_ctype.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome__BEGIN_DECLS
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isalnum(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isalpha(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint iscntrl(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isdigit(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isgraph(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint islower(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isprint(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint ispunct(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isspace(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isupper(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isxdigit(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint tolower(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint toupper(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __XSI_VISIBLE
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isascii(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint toascii(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __ISO_C_VISIBLE >= 1999
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isblank(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __BSD_VISIBLE
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint digittoint(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint ishexnumber(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isideogram(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isnumber(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isphonogram(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isrune(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint isspecial(int);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <xlocale/_ctype.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome__END_DECLS
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef __cplusplus
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D|_CTYPE_N)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isalpha(c) __sbistype((c), _CTYPE_A)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define iscntrl(c) __sbistype((c), _CTYPE_C)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isdigit(c) __sbistype((c), _CTYPE_D)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isgraph(c) __sbistype((c), _CTYPE_G)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define islower(c) __sbistype((c), _CTYPE_L)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isprint(c) __sbistype((c), _CTYPE_R)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ispunct(c) __sbistype((c), _CTYPE_P)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isspace(c) __sbistype((c), _CTYPE_S)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isupper(c) __sbistype((c), _CTYPE_U)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isxdigit(c) __sbistype((c), _CTYPE_X)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define tolower(c) __sbtolower(c)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define toupper(c) __sbtoupper(c)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !__cplusplus */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __XSI_VISIBLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * tolower() and toupper() respectively, minus extra checking to ensure that
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the argument is a lower or uppercase letter respectively. We've chosen to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * implement these macros with the same error checking as tolower() and
199767f8919635c4928607450d9e0abb932109ceToomas Soome * toupper() since this doesn't violate the specification itself, only its
199767f8919635c4928607450d9e0abb932109ceToomas Soome * intent. We purposely leave _tolower() and _toupper() undocumented to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * discourage their use.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX isascii() and toascii() should similarly be undocumented.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _tolower(c) __sbtolower(c)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _toupper(c) __sbtoupper(c)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isascii(c) (((c) & ~0x7F) == 0)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define toascii(c) ((c) & 0x7F)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isblank(c) __sbistype((c), _CTYPE_B)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __BSD_VISIBLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define digittoint(c) __sbmaskrune((c), 0xFF)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ishexnumber(c) __sbistype((c), _CTYPE_X)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isideogram(c) __sbistype((c), _CTYPE_I)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isnumber(c) __sbistype((c), _CTYPE_D|_CTYPE_N)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isphonogram(c) __sbistype((c), _CTYPE_Q)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isrune(c) __sbistype((c), 0xFFFFFF00L)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define isspecial(c) __sbistype((c), _CTYPE_T)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_CTYPE_H_ */