You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/07/30 17:29:00 UTC
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1487: libc: Avoid ctype function to evaluate the argument more than once
xiaoxiang781216 commented on a change in pull request #1487:
URL: https://github.com/apache/incubator-nuttx/pull/1487#discussion_r463157048
##########
File path: include/ctype.h
##########
@@ -37,21 +37,50 @@
#ifndef __INCLUDE_CTYPE_H
#define __INCLUDE_CTYPE_H
-/* There is no consistent ctype implementation, just a smattering of
- * functions. Individually, they are okay, but a more standard, data lookup
- * approach would make more sense if used extensively.
- */
-
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/compiler.h>
+#include <nuttx/arch.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+/* The classification flags */
+
+#define _U 0x01 /* upper */
+#define _L 0x02 /* lower */
+#define _N 0x04 /* digit */
+#define _S 0x08 /* space */
+#define _P 0x10 /* punct */
+#define _C 0x20 /* cntrl */
+#define _X 0x40 /* a-f|A-F */
+#define _B 0x80 /* blank */
+
+#define __ctype_lookup(c) up_romgetc(__ctype_ + (c))
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+extern const IPTR char _ctype_[];
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org