_ctype.h revision eda71b4a8fb1d0b34d0f08c47b43af49428d24c3
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore/*
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Copyright (c) 1989, 1993
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * The Regents of the University of California. All rights reserved.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * (c) UNIX System Laboratories, Inc.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * All or some portions of this file are derived from material licensed
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * to the University of California by American Telephone and Telegraph
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Co. or Unix System Laboratories, Inc. and are reproduced herein with
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * the permission of UNIX System Laboratories, Inc.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore *
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * This code is derived from software contributed to Berkeley by
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Paul Borman at Krystal Technologies.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore *
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Redistribution and use in source and binary forms, with or without
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * modification, are permitted provided that the following conditions
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * are met:
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * 1. Redistributions of source code must retain the above copyright
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * notice, this list of conditions and the following disclaimer.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * 2. Redistributions in binary form must reproduce the above copyright
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * notice, this list of conditions and the following disclaimer in the
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * documentation and/or other materials provided with the distribution.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * 3. Neither the name of the University nor the names of its contributors
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * may be used to endorse or promote products derived from this software
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * without specific prior written permission.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore *
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * SUCH DAMAGE.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore/*
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Use is subject to license terms.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#ifndef __CTYPE_H_
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define __CTYPE_H_
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore/*
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Please take careful note. It turns out that the _ISxxx macros
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * occupy the lower order byte, except for _ISGRAPH, _ISALPHA, and _ISPRINT.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Those occupt 0x2000, 0x4000, and 0x8000. Now, noting *very* carefully,
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * it turns out that this leaves some gaps in the extended bits, which
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * are occupied by _E1 = phonogram, _E2 = ideogram, and _E3 = English.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * The *other* _Ex bits are reserved. We don't think these higher order
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * bits are baked into applications (because they haven't been used before),
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * so we believe it is safe to reuse them how we see fit.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore *
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * This makes it possible to define a single space which overlaps both the
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * wctype types, and the ctype types.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_A _ISALPHA /* Alpha */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_C _ISCNTRL /* Control */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_D _ISDIGIT /* Digit */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_G _ISGRAPH /* Graph */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_L _ISLOWER /* Lower */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_P _ISPUNCT /* Punct */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_S _ISSPACE /* Space */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_U _ISUPPER /* Upper */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_X _ISXDIGIT /* X digit */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_B _ISBLANK /* Blank */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_R _ISPRINT /* Print */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_Q _E1 /* Phonogram */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_I _E2 /* Ideogram */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_E _E3 /* English (Solaris) */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_N _E4 /* Number */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_T _E5 /* Special */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore/* These high order bits were never used for anything at all. */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_SW0 0x20000000U /* 0 width character */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_SW1 0x40000000U /* 1 width character */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_SW2 0x80000000U /* 2 width character */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_SW3 0xc0000000U /* 3 width character */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_SWM 0xe0000000U /* Mask for screen width data */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#define _CTYPE_SWS 30 /* Bits to shift to get width */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amoreunsigned int ___runetype(int);
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore#endif /* !__CTYPE_H_ */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore