Print this page
4477 DTrace should speak JSON
Reviewed by: Bryan Cantrill <bmc@joyent.com>


  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 
  43 #if     defined(_KERNEL) && !defined(_BOOT)
  44 
  45 #define isalnum(ch)     (isalpha(ch) || isdigit(ch))
  46 #define isalpha(ch)     (isupper(ch) || islower(ch))
  47 #define isdigit(ch)     ((ch) >= '0' && (ch) <= '9')
  48 #define islower(ch)     ((ch) >= 'a' && (ch) <= 'z')
  49 #define isspace(ch)     (((ch) == ' ') || ((ch) == '\r') || ((ch) == '\n') || \
  50                         ((ch) == '\t') || ((ch) == '\f'))
  51 #define isupper(ch)     ((ch) >= 'A' && (ch) <= 'Z')
  52 #define isxdigit(ch)    (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \
  53                         ((ch) >= 'A' && (ch) <= 'F'))
  54 
  55 #endif  /* _KERNEL && !_BOOT */
  56 
  57 #define DIGIT(x)        \
  58         (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
  59 
  60 #define MBASE   ('z' - 'a' + 1 + 10)


  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(_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) >= '0' && (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) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
  63 
  64 #define MBASE   ('z' - 'a' + 1 + 10)