don't typedef rune_t if _ANSI_SOURCE defined
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 29 May 1993 03:53:13 +0000 (19:53 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 29 May 1993 03:53:13 +0000 (19:53 -0800)
delete macro versions, they're not reentrant; this simplifies lots o' stuff

SCCS-vsn: include/ctype.h 5.10

usr/src/include/ctype.h

index d47ab0a..53d4907 100644 (file)
@@ -7,13 +7,15 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ctype.h     5.9 (Berkeley) %G%
+ *     @(#)ctype.h     5.10 (Berkeley) %G%
  */
 
 #ifndef        _CTYPE_H_
 #define _CTYPE_H_
 
  */
 
 #ifndef        _CTYPE_H_
 #define _CTYPE_H_
 
+#ifndef _ANSI_SOURCE
 #include <runetype.h>
 #include <runetype.h>
+#endif
 
 #define        _A      0x00000100L             /* Alpha */
 #define        _C      0x00000200L             /* Control */
 
 #define        _A      0x00000100L             /* Alpha */
 #define        _C      0x00000200L             /* Control */
 #define        _Q      0x00200000L             /* Phonogram */
 
 #define isalnum(c)      __istype((c), (_A|_D))
 #define        _Q      0x00200000L             /* Phonogram */
 
 #define isalnum(c)      __istype((c), (_A|_D))
-#define isalpha(c)      __istype((c), _A)
-#define iscntrl(c)      __istype((c), _C)
-#define isdigit(c)      __isctype((c), _D)     /* ANSI -- locale independent */
-#define isgraph(c)      __istype((c), _G)
-#define islower(c)      __istype((c), _L)
-#define isprint(c)      __istype((c), _R)
-#define ispunct(c)      __istype((c), _P)
-#define isspace(c)      __istype((c), _S)
-#define isupper(c)      __istype((c), _U)
-#define isxdigit(c)     __isctype((c), _X)     /* ANSI -- locale independent */
+#define isalpha(c)      __istype((c),     _A)
+#define iscntrl(c)      __istype((c),     _C)
+#define isdigit(c)      __isctype((c),    _D)  /* ANSI -- locale independent */
+#define isgraph(c)      __istype((c),     _G)
+#define islower(c)      __istype((c),     _L)
+#define isprint(c)      __istype((c),     _R)
+#define ispunct(c)      __istype((c),     _P)
+#define isspace(c)      __istype((c),     _S)
+#define isupper(c)      __istype((c),     _U)
+#define isxdigit(c)     __isctype((c),    _X)  /* ANSI -- locale independent */
 
 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
 #define        isascii(c)      ((c & ~0x7F) == 0)
 
 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
 #define        isascii(c)      ((c & ~0x7F) == 0)
@@ -55,6 +57,7 @@
 #define        ishexnumber(c)  __istype((c), _X)
 #endif
 
 #define        ishexnumber(c)  __istype((c), _X)
 #endif
 
+/* See comments in <machine/ansi.h> about _BSD_RUNE_T_. */
 __BEGIN_DECLS
 extern unsigned long   ___runetype __P((_BSD_RUNE_T_));
 extern _BSD_RUNE_T_    ___tolower __P((_BSD_RUNE_T_));
 __BEGIN_DECLS
 extern unsigned long   ___runetype __P((_BSD_RUNE_T_));
 extern _BSD_RUNE_T_    ___tolower __P((_BSD_RUNE_T_));
@@ -62,13 +65,13 @@ extern _BSD_RUNE_T_ ___toupper __P((_BSD_RUNE_T_));
 __END_DECLS
 
 /*
 __END_DECLS
 
 /*
- * See comments in <machine/ansi.h> about _BSD_RUNE_T_.
- *
- * If your compiler supports inline functions, #define _USE_CTYPE_INLINE_.
- * Otherwise, if you want inline macros, #define _USE_CTYPE_MACROS_, else
- * #define _USE_CTYPE_CLIBRARY_ to call C library functions.
+ * If your compiler supports prototypes and inline functions,
+ * #define _USE_CTYPE_INLINE_.  Otherwise, use the C library
+ * functions.
  */
  */
-#define        _USE_CTYPE_INLINE_                      /* 4.4BSD */
+#if !defined(_USE_CTYPE_CLIBRARY_) && defined(__GNUC__) || defined(__cplusplus)
+#define        _USE_CTYPE_INLINE_      1
+#endif
 
 #if defined(_USE_CTYPE_INLINE_)
 static inline int
 
 #if defined(_USE_CTYPE_INLINE_)
 static inline int
@@ -85,7 +88,8 @@ __isctype(_BSD_RUNE_T_ c, unsigned long f)
            _DefaultRuneLocale.runetype[c]) & f) ? 1 : 0);
 }
 
            _DefaultRuneLocale.runetype[c]) & f) ? 1 : 0);
 }
 
-#if !defined(_ANSI_LIBRARY)    /* _ANSI_LIBRARY: for lib/libc/gen/isctype.c. */
+/* _ANSI_LIBRARY is defined by lib/libc/gen/isctype.c. */
+#if !defined(_ANSI_LIBRARY)
 static inline _BSD_RUNE_T_
 toupper(_BSD_RUNE_T_ c)
 {
 static inline _BSD_RUNE_T_
 toupper(_BSD_RUNE_T_ c)
 {
@@ -100,37 +104,15 @@ tolower(_BSD_RUNE_T_ c)
            ___tolower(c) : _CurrentRuneLocale->maplower[c]);
 }
 #endif /* !_ANSI_LIBRARY */
            ___tolower(c) : _CurrentRuneLocale->maplower[c]);
 }
 #endif /* !_ANSI_LIBRARY */
-#endif /* _USE_CTYPE_INLINE_ */
 
 
-#if defined(_USE_CTYPE_MACROS_)
-static int ___ctype_junk;
-#define __istype(c, f)                                                 \
-       (((((___ctype_junk = (c)) & _CRMASK) ?                          \
-           ___runetype(___ctype_junk) :                                \
-           _CurrentRuneLocale->runetype[___ctype_junk]) & f) ? 1 : 0)
+#else /* !_USE_CTYPE_INLINE_ */
 
 
-#define __isctype(c, f)                                                        \
-       (((((___ctype_junk = (c)) & _CRMASK) ? 0 :                      \
-           _DefaultRuneLocale.runetype[___ctype_junk]) & f) ? 1 : 0)
-
-#define        toupper(c)                                                      \
-       (((___ctype_junk = (c)) & _CRMASK) ?                            \
-           ___toupper(___ctype_junk) :                                 \
-           _CurrentRuneLocale->mapupper[___ctype_junk])
-
-#define        tolower(c)                                                      \
-       (((___ctype_junk = (c)) & _CRMASK) ?                            \
-           ___tolower(___ctype_junk) :                                 \
-           _CurrentRuneLocale->maplower[___ctype_junk])
-#endif /* _USE_CTYPE_MACROS_*/
-
-#if defined(_USE_CTYPE_CLIBRARY_)
 __BEGIN_DECLS
 extern int             __istype __P((_BSD_RUNE_T_, unsigned long));
 extern int             __isctype __P((_BSD_RUNE_T_, unsigned long));
 extern _BSD_RUNE_T_    toupper __P((_BSD_RUNE_T_));
 extern _BSD_RUNE_T_    tolower __P((_BSD_RUNE_T_));
 __END_DECLS
 __BEGIN_DECLS
 extern int             __istype __P((_BSD_RUNE_T_, unsigned long));
 extern int             __isctype __P((_BSD_RUNE_T_, unsigned long));
 extern _BSD_RUNE_T_    toupper __P((_BSD_RUNE_T_));
 extern _BSD_RUNE_T_    tolower __P((_BSD_RUNE_T_));
 __END_DECLS
-#endif /* _USE_CTYPE_CLIBRARY_ */
+#endif /* _USE_CTYPE_INLINE_ */
 
 #endif /* !_CTYPE_H_ */
 
 #endif /* !_CTYPE_H_ */