summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/mingw/ChangeLog11
-rw-r--r--winsup/mingw/include/ctype.h31
-rw-r--r--winsup/mingw/include/wctype.h13
-rw-r--r--winsup/mingw/mingwex/Makefile.in6
-rwxr-xr-xwinsup/mingw/mingwex/isblank.c5
-rwxr-xr-xwinsup/mingw/mingwex/iswblank.c5
6 files changed, 64 insertions, 7 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index d0e8439dc..672262552 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,3 +1,13 @@
+2006-08-03 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * include/ctype.h (_BLANK): Expand comment.
+ (isblank): Add prototype and inline definition.
+ (iswblank): Add prototype and inline definition.
+ * include/wctype.h (iswblank): Add prototype and inline definition.
+ * mingwex/isblank.c: New file.
+ * mingwex/iswblank.c: New file.
+ * mingwex/Makefile.in: Add isblank, iswblank to libmingwex.a
+
2006-07-06 Danny Smith <dannysmith@users.sourceforge.net>
* include/math.h (__INFF,__INFL): Remove '#'.
@@ -30,7 +40,6 @@
* mingwex/feupdateenv.c: Likewise.
* mingwex/fegetround.c: Add comment.
-
2006-06-25 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* Include/_mingw.h: Increment version to 3.10.
diff --git a/winsup/mingw/include/ctype.h b/winsup/mingw/include/ctype.h
index f4020afdf..55e78431e 100644
--- a/winsup/mingw/include/ctype.h
+++ b/winsup/mingw/include/ctype.h
@@ -31,7 +31,9 @@
#define _SPACE 0x0008 /* HT LF VT FF CR SP */
#define _PUNCT 0x0010
#define _CONTROL 0x0020
-#define _BLANK 0x0040 /* this is SP only, not SP and HT as in C99 */
+/* _BLANK is set for SP and non-ASCII horizontal space chars (eg,
+ "no-break space", 0xA0, in CP1250) but not for HT. */
+#define _BLANK 0x0040
#define _HEX 0x0080
#define _LEADBYTE 0x8000
@@ -55,6 +57,11 @@ _CRTIMP int __cdecl isspace(int);
_CRTIMP int __cdecl isupper(int);
_CRTIMP int __cdecl isxdigit(int);
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+ || !defined __STRICT_ANSI__
+int __cdecl isblank (int);
+#endif
+
#ifndef __STRICT_ANSI__
_CRTIMP int __cdecl _isctype (int, int);
#endif
@@ -135,9 +142,9 @@ extern unsigned short** _imp___ctype;
* optimise away the constant condition.
*/
-
#if ! (defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES) \
- || defined (__STRICT_ANSI__ ))
+ || defined (__STRICT_ANSI__))
+)
/* use simple lookup if SB locale, else _isctype() */
#define __ISCTYPE(c, mask) (MB_CUR_MAX == 1 ? (_pctype[c] & mask) : _isctype(c, mask))
__CRT_INLINE int __cdecl isalnum(int c) {return __ISCTYPE(c, (_ALPHA|_DIGIT));}
@@ -152,6 +159,12 @@ __CRT_INLINE int __cdecl isspace(int c) {return __ISCTYPE(c, _SPACE);}
__CRT_INLINE int __cdecl isupper(int c) {return __ISCTYPE(c, _UPPER);}
__CRT_INLINE int __cdecl isxdigit(int c) {return __ISCTYPE(c, _HEX);}
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+ || !defined __STRICT_ANSI__
+__CRT_INLINE int __cdecl isblank (int c)
+ {return (__ISCTYPE(c, _BLANK) || c == '\t');}
+#endif
+
/* these reproduce behaviour of lib underscored versions */
__CRT_INLINE int __cdecl _tolower(int c) {return ( c -'A'+'a');}
__CRT_INLINE int __cdecl _toupper(int c) {return ( c -'a'+'A');}
@@ -187,6 +200,12 @@ _CRTIMP int __cdecl iswspace(wint_t);
_CRTIMP int __cdecl iswupper(wint_t);
_CRTIMP int __cdecl iswxdigit(wint_t);
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+ || !defined __STRICT_ANSI__
+int __cdecl iswblank (wint_t);
+#endif
+
+
/* Older MS docs uses wchar_t for arg and return type, while newer
online MS docs say arg is wint_t and return is int.
ISO C uses wint_t for both. */
@@ -212,6 +231,12 @@ __CRT_INLINE int __cdecl iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
__CRT_INLINE int __cdecl iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
__CRT_INLINE int __cdecl iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
__CRT_INLINE int __cdecl isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+ || !defined __STRICT_ANSI__
+__CRT_INLINE int __cdecl iswblank (wint_t wc)
+ {return (iswctype(wc,_BLANK) || wc == L'\t');}
+#endif
+
#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
#ifndef __STRICT_ANSI__
diff --git a/winsup/mingw/include/wctype.h b/winsup/mingw/include/wctype.h
index ed8f05f77..630b994ef 100644
--- a/winsup/mingw/include/wctype.h
+++ b/winsup/mingw/include/wctype.h
@@ -79,6 +79,11 @@ _CRTIMP int __cdecl iswspace(wint_t);
_CRTIMP int __cdecl iswupper(wint_t);
_CRTIMP int __cdecl iswxdigit(wint_t);
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+ || !defined __STRICT_ANSI__
+int __cdecl iswblank (wint_t);
+#endif
+
/* Older MS docs uses wchar_t for arg and return type, while newer
online MS docs say arg is wint_t and return is int.
ISO C uses wint_t for both. */
@@ -127,8 +132,14 @@ __CRT_INLINE int __cdecl iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
__CRT_INLINE int __cdecl iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
__CRT_INLINE int __cdecl iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
__CRT_INLINE int __cdecl isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
-#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+ || !defined __STRICT_ANSI__
+__CRT_INLINE int __cdecl iswblank (wint_t wc)
+ {return (iswctype(wc, _BLANK) || wc == L'\t');}
+#endif
+
+#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
typedef wchar_t wctrans_t;
diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in
index 1b7609910..89ea204e7 100644
--- a/winsup/mingw/mingwex/Makefile.in
+++ b/winsup/mingw/mingwex/Makefile.in
@@ -36,7 +36,7 @@ DISTFILES = Makefile.in configure configure.in \
wcstoimax.c wcstold.c wcstoumax.c wctrans.c wctype.c \
wdirent.c wmemchr.c wmemcmp.c wmemcpy.c wmemmove.c wmemset.c wtoll.c \
wcrtomb.c wctob.c mbrtowc.c btowc.c mb_wc_common.h \
- gettimeofday.c
+ gettimeofday.c isblank.c iswblank.c
MATH_DISTFILES = \
acosf.c acosl.c asinf.c asinl.c atan2f.c atan2l.c \
atanf.c atanl.c cbrt.c cbrtf.c cbrtl.c ceilf.S ceill.S \
@@ -118,6 +118,8 @@ Q8_OBJS = \
strtoimax.o strtoumax.o wcstoimax.o wcstoumax.o \
wmemchr.o wmemcmp.o wmemcpy.o wmemmove.o wmemset.o \
wctrans.o wctype.o wcrtomb.o wctob.o mbrtowc.o btowc.o
+CTYPE_OBJS = \
+ isblank.o iswblank.o
STDLIB_OBJS = \
strtold.o wcstold.o
STDLIB_STUB_OBJS = \
@@ -178,7 +180,7 @@ COMPLEX_OBJS = \
csinl.o csinh.o csinhf.o csinhl.o csqrt.o csqrtf.o csqrtl.o \
ctan.o ctanf.o ctanl.o ctanh.o ctanhf.o ctanhl.o
-LIB_OBJS = $(Q8_OBJS) $(STDLIB_OBJS) $(STDLIB_STUB_OBJS) \
+LIB_OBJS = $(Q8_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDLIB_STUB_OBJS) \
$(STDIO_OBJS) $(MATH_OBJS) $(FENV_OBJS) \
$(POSIX_OBJS) $(REPLACE_OBJS) $(COMPLEX_OBJS)
diff --git a/winsup/mingw/mingwex/isblank.c b/winsup/mingw/mingwex/isblank.c
new file mode 100755
index 000000000..d3ba74d39
--- /dev/null
+++ b/winsup/mingw/mingwex/isblank.c
@@ -0,0 +1,5 @@
+#define __NO_CTYPE_LINES
+#include <ctype.h>
+
+int _cdecl isblank (int c)
+{return (_isctype(c, _BLANK) || c == '\t');}
diff --git a/winsup/mingw/mingwex/iswblank.c b/winsup/mingw/mingwex/iswblank.c
new file mode 100755
index 000000000..316168940
--- /dev/null
+++ b/winsup/mingw/mingwex/iswblank.c
@@ -0,0 +1,5 @@
+#define __NO_CTYPE_LINES
+#include <wctype.h>
+
+int __cdecl iswblank (wint_t wc)
+ {return (iswctype(wc, _BLANK) || wc == L'\t');}