summaryrefslogtreecommitdiff
path: root/lib/wctype.in.h
diff options
context:
space:
mode:
authorLi Jinjing <jinjingx.li@intel.com>2014-10-26 22:28:15 +0800
committerLi Jinjing <jinjingx.li@intel.com>2014-10-26 22:28:15 +0800
commit931b01b091932a1f796c23379ea32abb68bd5895 (patch)
tree3aa9e1125da84f7e3bd764bbff577c42a766508b /lib/wctype.in.h
parent7be93f2d05131d061bd4790ae33c8d50f50010d7 (diff)
downloadm4-931b01b091932a1f796c23379ea32abb68bd5895.tar.gz
m4-931b01b091932a1f796c23379ea32abb68bd5895.tar.bz2
m4-931b01b091932a1f796c23379ea32abb68bd5895.zip
Imported Upstream version 1.4.17upstream/1.4.17sandbox/jinjingx/upstream
Diffstat (limited to 'lib/wctype.in.h')
-rw-r--r--lib/wctype.in.h98
1 files changed, 71 insertions, 27 deletions
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 65879aa..10b5c33 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
- Copyright (C) 2006-2011 Free Software Foundation, Inc.
+ Copyright (C) 2006-2013 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible and Paul Eggert. */
@@ -26,7 +25,7 @@
* wctrans_t, and wctype_t are not yet implemented.
*/
-#ifndef _GL_WCTYPE_H
+#ifndef _@GUARD_PREFIX@_WCTYPE_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -45,6 +44,13 @@
# include <wchar.h>
#endif
+/* mingw has declarations of towupper and towlower in <ctype.h> as
+ well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix
+ being added to the declarations. */
+#ifdef __MINGW32__
+# include <ctype.h>
+#endif
+
/* Include the original <wctype.h> if it exists.
BeOS 5 has the functions but no <wctype.h>. */
/* The include_next requires a split double-inclusion guard. */
@@ -52,13 +58,34 @@
# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
#endif
-#ifndef _GL_WCTYPE_H
-#define _GL_WCTYPE_H
+#ifndef _@GUARD_PREFIX@_WCTYPE_H
+#define _@GUARD_PREFIX@_WCTYPE_H
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_WCTYPE_INLINE
+# define _GL_WCTYPE_INLINE _GL_INLINE
+#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
+/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
+ #defines a number of identifiers in the application namespace. Revert
+ these #defines. */
+#ifdef __sun
+# undef multibyte
+# undef eucw1
+# undef eucw2
+# undef eucw3
+# undef scrw1
+# undef scrw2
+# undef scrw3
+#endif
+
/* Define wint_t and WEOF. (Also done in wchar.in.h.) */
#if !@HAVE_WINT_T@ && !defined wint_t
# define wint_t int
@@ -66,6 +93,18 @@
# define WEOF -1
# endif
#else
+/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
+ This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
+ "unchanged by default argument promotions". Override it. */
+# if defined _MSC_VER
+# if !GNULIB_defined_wint_t
+# include <crtdefs.h>
+typedef unsigned int rpl_wint_t;
+# undef wint_t
+# define wint_t rpl_wint_t
+# define GNULIB_defined_wint_t 1
+# endif
+# endif
# ifndef WEOF
# define WEOF ((wint_t) -1)
# endif
@@ -115,12 +154,16 @@
# define iswspace rpl_iswspace
# define iswupper rpl_iswupper
# define iswxdigit rpl_iswxdigit
+# endif
+# endif
+# if @REPLACE_TOWLOWER@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define towlower rpl_towlower
# define towupper rpl_towupper
# endif
# endif
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswalnum
# else
@@ -132,7 +175,7 @@ iswalnum
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswalpha
# else
@@ -143,7 +186,7 @@ iswalpha
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswblank
# else
@@ -154,7 +197,7 @@ iswblank
return wc == ' ' || wc == '\t';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswcntrl
# else
@@ -165,7 +208,7 @@ iswcntrl
return (wc & ~0x1f) == 0 || wc == 0x7f;
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswdigit
# else
@@ -176,7 +219,7 @@ iswdigit
return wc >= '0' && wc <= '9';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswgraph
# else
@@ -187,7 +230,7 @@ iswgraph
return wc >= '!' && wc <= '~';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswlower
# else
@@ -198,7 +241,7 @@ iswlower
return wc >= 'a' && wc <= 'z';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswprint
# else
@@ -209,7 +252,7 @@ iswprint
return wc >= ' ' && wc <= '~';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswpunct
# else
@@ -222,7 +265,7 @@ iswpunct
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswspace
# else
@@ -234,7 +277,7 @@ iswspace
|| wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswupper
# else
@@ -245,7 +288,7 @@ iswupper
return wc >= 'A' && wc <= 'Z';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswxdigit
# else
@@ -257,8 +300,8 @@ iswxdigit
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
}
-static inline wint_t
-# if @REPLACE_ISWCNTRL@
+_GL_WCTYPE_INLINE wint_t
+# if @REPLACE_TOWLOWER@
rpl_towlower
# else
towlower
@@ -268,8 +311,8 @@ towlower
return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
}
-static inline wint_t
-# if @REPLACE_ISWCNTRL@
+_GL_WCTYPE_INLINE wint_t
+# if @REPLACE_TOWLOWER@
rpl_towupper
# else
towupper
@@ -308,7 +351,7 @@ _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
result register. We need to fix this by adding a zero-extend from
wchar_t to wint_t after the call. */
-static inline wint_t
+_GL_WCTYPE_INLINE wint_t
rpl_towlower (wint_t wc)
{
return (wint_t) (wchar_t) towlower (wc);
@@ -317,7 +360,7 @@ rpl_towlower (wint_t wc)
# define towlower rpl_towlower
# endif
-static inline wint_t
+_GL_WCTYPE_INLINE wint_t
rpl_towupper (wint_t wc)
{
return (wint_t) (wchar_t) towupper (wc);
@@ -416,7 +459,7 @@ _GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
# endif
#endif
-#if @REPLACE_ISWCNTRL@ || defined __MINGW32__
+#if @REPLACE_TOWLOWER@ || defined __MINGW32__
_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
#else
@@ -465,6 +508,7 @@ _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
# endif
#endif
+_GL_INLINE_HEADER_END
-#endif /* _GL_WCTYPE_H */
-#endif /* _GL_WCTYPE_H */
+#endif /* _@GUARD_PREFIX@_WCTYPE_H */
+#endif /* _@GUARD_PREFIX@_WCTYPE_H */