summaryrefslogtreecommitdiff
path: root/nuttx/include/ctype.h
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/include/ctype.h')
-rw-r--r--nuttx/include/ctype.h50
1 files changed, 34 insertions, 16 deletions
diff --git a/nuttx/include/ctype.h b/nuttx/include/ctype.h
index 9b62034ff..fb30746de 100644
--- a/nuttx/include/ctype.h
+++ b/nuttx/include/ctype.h
@@ -64,31 +64,49 @@
************************************************************/
#define isspace(c) \
- (c == ' ' || c == '\t' || c == '\n' || \
- c == '\r' || c == '\f' || c== '\v')
+ ((c) == ' ' || (c) == '\t' || (c) == '\n' || \
+ (c) == '\r' || (c) == '\f' || c== '\v')
/************************************************************
- * Function: isdigit
+ * Function: isascii
*
* Description:
- * ANSI standard isdigit implementation.
+ * Checks whether c is a 7-bit unsigned char value that
+ * fits into the ASCII character set.
*
************************************************************/
-#define isdigit(c) \
- (c >= '0' && c <= '9')
+#define isascii(c) ((c) >= 0 && (c) <= 0x7f);
/************************************************************
- * Function: isascii
+ * Function: isprint
*
* Description:
- * Checks whether c is a 7-bit unsigned char value that
- * fits into the ASCII character set.
+ * Checks for a printable character (including space)
+ *
+ ************************************************************/
+
+#define isprint(c) ((c) >= 0x20 && (c) < 0x7f)
+
+/************************************************************
+ * Function: iscntrl
+ *
+ * Description:
+ * Checks for control character.
+ *
+ ************************************************************/
+
+#define iscontrol(c) (!isprint(c))
+
+/************************************************************
+ * Function: isdigit
+ *
+ * Description:
+ * ANSI standard isdigit implementation.
*
************************************************************/
-#define isascii(c) \
- (c >= 0 && c <= 0177);
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
/************************************************************
* Function: isxdigit
@@ -100,9 +118,9 @@
************************************************************/
#define isxdigit(c) \
- ((c >= '0' && c <= '9') || \
- (c >= 'a' && c <= 'f') || \
- (c >= 'A' && c <= 'F'))
+ (((c) >= '0' && (c) <= '9') || \
+ ((c) >= 'a' && (c) <= 'f') || \
+ ((c) >= 'A' && (c) <= 'F'))
/************************************************************
* Function: toupper
@@ -113,7 +131,7 @@
************************************************************/
#define toupper(c) \
- ((c >= 'a' && c <= 'z') ? ((c) - 'a' + 'A') : (c))
+ (((c) >= 'a' && (c) <= 'z') ? ((c) - 'a' + 'A') : (c))
/************************************************************
* Function: tolower
@@ -124,7 +142,7 @@
************************************************************/
#define tolower(c) \
- ((c >= 'A' && c <= 'Z') ? ((c) - 'A' + 'a') : (c))
+ (((c) >= 'A' && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c))
/************************************************************
* Public Type Definitions