[BACK]Return to ctype.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/ctype.h, Revision 1.3

1.3     ! deraadt     1: /*     $OpenBSD: ctype.h,v 1.2 1997/09/21 10:45:28 niklas Exp $        */
1.1       deraadt     2: /*     $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd 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. All advertising materials mentioning features or use of this software
                     22:  *    must display the following acknowledgement:
                     23:  *     This product includes software developed by the University of
                     24:  *     California, Berkeley and its contributors.
                     25:  * 4. Neither the name of the University nor the names of its contributors
                     26:  *    may be used to endorse or promote products derived from this software
                     27:  *    without specific prior written permission.
                     28:  *
                     29:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     30:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     31:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     32:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     33:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     34:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     35:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     36:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     37:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     38:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     39:  * SUCH DAMAGE.
                     40:  *
                     41:  *     @(#)ctype.h     5.3 (Berkeley) 4/3/91
                     42:  */
                     43:
                     44: #ifndef _CTYPE_H_
                     45: #define _CTYPE_H_
                     46: #include <sys/cdefs.h>
                     47:
                     48: #define        _U      0x01
                     49: #define        _L      0x02
                     50: #define        _N      0x04
                     51: #define        _S      0x08
                     52: #define        _P      0x10
                     53: #define        _C      0x20
                     54: #define        _X      0x40
                     55: #define        _B      0x80
                     56:
                     57: extern const char      *_ctype_;
                     58: extern const short     *_tolower_tab_;
                     59: extern const short     *_toupper_tab_;
                     60:
                     61: __BEGIN_DECLS
                     62: extern int     isalnum __P ((int));
                     63: extern int     isalpha __P ((int));
                     64: extern int     iscntrl __P ((int));
                     65: extern int     isdigit __P ((int));
                     66: extern int     isgraph __P ((int));
                     67: extern int     islower __P ((int));
                     68: extern int     isprint __P ((int));
                     69: extern int     ispunct __P ((int));
                     70: extern int     isspace __P ((int));
                     71: extern int     isupper __P ((int));
                     72: extern int     isxdigit __P ((int));
                     73: extern int     tolower __P ((int));
                     74: extern int     toupper __P ((int));
                     75:
                     76: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
                     77: extern int     isblank __P ((int));
                     78: extern int     isascii __P ((int));
                     79: extern int     toascii __P ((int));
                     80: extern int     _tolower __P ((int));
                     81: extern int     _toupper __P ((int));
                     82: #endif
                     83: __END_DECLS
                     84:
1.3     ! deraadt    85: #define        isdigit(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _N)
        !            86: #define        islower(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _L)
        !            87: #define        isspace(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _S)
        !            88: #define        ispunct(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _P)
        !            89: #define        isupper(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _U)
        !            90: #define        isalpha(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_U|_L))
        !            91: #define        isxdigit(c)     ((_ctype_ + 1)[(unsigned char)(c)] & (_N|_X))
        !            92: #define        isalnum(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_U|_L|_N))
        !            93: #define        isprint(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_P|_U|_L|_N|_B))
        !            94: #define        isgraph(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_P|_U|_L|_N))
        !            95: #define        iscntrl(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _C)
        !            96: #define tolower(c)     ((_tolower_tab_ + 1)[(unsigned char)(c)])
        !            97: #define toupper(c)     ((_toupper_tab_ + 1)[(unsigned char)(c)])
1.1       deraadt    98:
                     99: #if !defined(_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
                    100: #if notyet
1.3     ! deraadt   101: #define isblank(c)     ((_ctype_ + 1)[(unsigned char)(c)] & _B)
1.1       deraadt   102: #endif
1.3     ! deraadt   103: #define        isascii(c)      ((unsigned char)(c) <= 0177)
1.1       deraadt   104: #define        toascii(c)      ((c) & 0177)
                    105: #define _tolower(c)    ((c) - 'A' + 'a')
                    106: #define _toupper(c)    ((c) - 'a' + 'A')
                    107: #endif
                    108:
                    109: #endif /* !_CTYPE_H_ */