X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fwctype.in.h;h=b8ecca4d2514c640b1d4374b6ae32cc5cad36b3a;hb=46f5f314f34a08c9305758482d7d2fdb0e999d09;hp=99d8635b0a25266f861b20f12021cfa73c30b4f2;hpb=52c4f309aad0bce5307f2cca26b59b76ed7574ab;p=gnulib.git diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 99d8635b0..b8ecca4d2 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 , for platforms that lack it. - Copyright (C) 2006-2011 Free Software Foundation, Inc. + Copyright (C) 2006-2014 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 . */ /* 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 #endif +/* mingw has declarations of towupper and towlower in as + well . Include in advance to avoid rpl_ prefix + being added to the declarations. */ +#ifdef __MINGW32__ +# include +#endif + /* Include the original if it exists. BeOS 5 has the functions but no . */ /* 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 includes which includes 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 . + 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 +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 @@ -448,6 +491,24 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " # endif #endif +/* Perform a given case conversion on a wide character. + The argument WC must be either a wchar_t value or WEOF. + The argument DESC must have been returned by the wctrans() function. */ +#if @GNULIB_TOWCTRANS@ +# if !@HAVE_WCTRANS_T@ +_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +# endif +_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +_GL_CXXALIASWARN (towctrans); +#elif defined GNULIB_POSIXCHECK +# undef towctrans +# if HAVE_RAW_DECL_TOWCTRANS +_GL_WARN_ON_USE (towctrans, "towctrans is unportable - " + "use gnulib module towctrans for portability"); +# endif +#endif + +_GL_INLINE_HEADER_END -#endif /* _GL_WCTYPE_H */ -#endif /* _GL_WCTYPE_H */ +#endif /* _@GUARD_PREFIX@_WCTYPE_H */ +#endif /* _@GUARD_PREFIX@_WCTYPE_H */