The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/cddl/contrib/opensolaris/common/util/strtolctype.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * CDDL HEADER START
    3  *
    4  * The contents of this file are subject to the terms of the
    5  * Common Development and Distribution License (the "License").
    6  * You may not use this file except in compliance with the License.
    7  *
    8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    9  * or http://www.opensolaris.org/os/licensing.
   10  * See the License for the specific language governing permissions
   11  * and limitations under the License.
   12  *
   13  * When distributing Covered Code, include this CDDL HEADER in each
   14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
   15  * If applicable, add the following below this CDDL HEADER, with the
   16  * fields enclosed by brackets "[]" replaced with your own identifying
   17  * information: Portions Copyright [yyyy] [name of copyright owner]
   18  *
   19  * CDDL HEADER END
   20  */
   21 
   22 /*
   23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   24  * Use is subject to license terms.
   25  */
   26 
   27 /*      Copyright (c) 1988 AT&T */
   28 /*        All Rights Reserved   */
   29 
   30 #ifndef _COMMON_UTIL_CTYPE_H
   31 #define _COMMON_UTIL_CTYPE_H
   32 
   33 #ifdef  __cplusplus
   34 extern "C" {
   35 #endif
   36 
   37 /*
   38  * This header file contains a collection of macros that the strtou?ll?
   39  * functions in common/util use to test characters.  What we need is a kernel
   40  * version of ctype.h.
   41  *
   42  * NOTE: These macros are used within several DTrace probe context functions.
   43  * They must not be altered to make function calls or perform actions not
   44  * safe in probe context.
   45  */
   46 
   47 #if defined(illumos) && (defined(_KERNEL) || defined(_BOOT))
   48 
   49 #define isalnum(ch)     (isalpha(ch) || isdigit(ch))
   50 #define isalpha(ch)     (isupper(ch) || islower(ch))
   51 #define isdigit(ch)     ((ch) >= '' && (ch) <= '9')
   52 #define islower(ch)     ((ch) >= 'a' && (ch) <= 'z')
   53 #define isspace(ch)     (((ch) == ' ') || ((ch) == '\r') || ((ch) == '\n') || \
   54                         ((ch) == '\t') || ((ch) == '\f'))
   55 #define isupper(ch)     ((ch) >= 'A' && (ch) <= 'Z')
   56 #define isxdigit(ch)    (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \
   57                         ((ch) >= 'A' && (ch) <= 'F'))
   58 
   59 #endif  /* _KERNEL || _BOOT */
   60 
   61 #define DIGIT(x)        \
   62         (isdigit(x) ? (x) - '' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
   63 
   64 #define MBASE   ('z' - 'a' + 1 + 10)
   65 
   66 /*
   67  * The following macro is a version of isalnum() that limits alphabetic
   68  * characters to the ranges a-z and A-Z; locale dependent characters will not
   69  * return 1.  The members of a-z and A-Z are assumed to be in ascending order
   70  * and contiguous.
   71  */
   72 #define lisalnum(x)     \
   73         (isdigit(x) || ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z'))
   74 
   75 #ifdef  __cplusplus
   76 }
   77 #endif
   78 
   79 #endif  /* _COMMON_UTIL_CTYPE_H */

Cache object: 6a7f979293e9d9b6bd5b46579f02cf57


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.