-/* iswctype( wint_t, wctype_t )\r
-\r
- This file is part of the Public Domain C Library (PDCLib).\r
- Permission is granted to use, modify, and / or redistribute at will.\r
-*/\r
-\r
-#include <wctype.h>\r
-#ifndef REGTEST\r
-#include <_PDCLIB_locale.h>\r
-\r
-int _PDCLIB_iswctype_l( wint_t wc, wctype_t desc, locale_t l )\r
-{\r
- wc = _PDCLIB_unpackwint( wc );\r
-\r
- _PDCLIB_wcinfo_t *info = _PDCLIB_wcgetinfo( l, wc );\r
-\r
- if(!info) return 0;\r
-\r
- return info->flags & desc;\r
-}\r
-\r
-int iswctype( wint_t wc, wctype_t desc )\r
-{\r
- return _PDCLIB_iswctype_l( wc, desc, _PDCLIB_threadlocale() );\r
-}\r
-\r
-#endif\r
-\r
-#ifdef TEST\r
-#include <_PDCLIB_test.h>\r
-\r
-int main( void )\r
-{\r
- TESTCASE( iswctype(L'a', wctype("alpha")));\r
- TESTCASE( iswctype(L'z', wctype("alpha")));\r
- TESTCASE( iswctype(L'E', wctype("alpha")));\r
- TESTCASE(!iswctype(L'3', wctype("alpha")));\r
- TESTCASE(!iswctype(L';', wctype("alpha")));\r
-\r
- TESTCASE( iswctype(L'a', wctype("alnum")));\r
- TESTCASE( iswctype(L'3', wctype("alnum")));\r
- TESTCASE(!iswctype(L';', wctype("alnum")));\r
-\r
- TESTCASE( iswctype(L' ', wctype("blank")));\r
- TESTCASE( iswctype(L'\t', wctype("blank")));\r
- TESTCASE(!iswctype(L'\n', wctype("blank")));\r
- TESTCASE(!iswctype(L';', wctype("blank")));\r
-\r
- TESTCASE( iswctype(L'\0', wctype("cntrl")));\r
- TESTCASE( iswctype(L'\n', wctype("cntrl")));\r
- TESTCASE( iswctype(L'\v', wctype("cntrl")));\r
- TESTCASE(!iswctype(L'\t', wctype("cntrl")));\r
- TESTCASE(!iswctype(L'a', wctype("cntrl")));\r
-\r
- TESTCASE( iswctype(L'0', wctype("digit")));\r
- TESTCASE( iswctype(L'1', wctype("digit")));\r
- TESTCASE( iswctype(L'2', wctype("digit")));\r
- TESTCASE( iswctype(L'3', wctype("digit")));\r
- TESTCASE( iswctype(L'4', wctype("digit")));\r
- TESTCASE( iswctype(L'5', wctype("digit")));\r
- TESTCASE( iswctype(L'6', wctype("digit")));\r
- TESTCASE( iswctype(L'7', wctype("digit")));\r
- TESTCASE( iswctype(L'8', wctype("digit")));\r
- TESTCASE( iswctype(L'9', wctype("digit")));\r
- TESTCASE(!iswctype(L'X', wctype("digit")));\r
- TESTCASE(!iswctype(L'?', wctype("digit")));\r
-\r
- TESTCASE( iswctype(L'a', wctype("graph")));\r
- TESTCASE( iswctype(L'z', wctype("graph")));\r
- TESTCASE( iswctype(L'E', wctype("graph")));\r
- TESTCASE( iswctype(L'E', wctype("graph")));\r
- TESTCASE(!iswctype(L' ', wctype("graph")));\r
- TESTCASE(!iswctype(L'\t', wctype("graph")));\r
- TESTCASE(!iswctype(L'\n', wctype("graph")));\r
-\r
- TESTCASE( iswctype(L'a', wctype("lower")));\r
- TESTCASE( iswctype(L'e', wctype("lower")));\r
- TESTCASE( iswctype(L'z', wctype("lower")));\r
- TESTCASE(!iswctype(L'A', wctype("lower")));\r
- TESTCASE(!iswctype(L'E', wctype("lower")));\r
- TESTCASE(!iswctype(L'Z', wctype("lower")));\r
-\r
- TESTCASE(!iswctype(L'a', wctype("upper")));\r
- TESTCASE(!iswctype(L'e', wctype("upper")));\r
- TESTCASE(!iswctype(L'z', wctype("upper")));\r
- TESTCASE( iswctype(L'A', wctype("upper")));\r
- TESTCASE( iswctype(L'E', wctype("upper")));\r
- TESTCASE( iswctype(L'Z', wctype("upper")));\r
-\r
- TESTCASE( iswctype(L'Z', wctype("print")));\r
- TESTCASE( iswctype(L'a', wctype("print")));\r
- TESTCASE( iswctype(L';', wctype("print")));\r
- TESTCASE( iswctype(L'\t', wctype("print")));\r
- TESTCASE(!iswctype(L'\0', wctype("print")));\r
-\r
- TESTCASE( iswctype(L';', wctype("punct")));\r
- TESTCASE( iswctype(L'.', wctype("punct")));\r
- TESTCASE( iswctype(L'?', wctype("punct")));\r
- TESTCASE(!iswctype(L' ', wctype("punct")));\r
- TESTCASE(!iswctype(L'Z', wctype("punct")));\r
-\r
- TESTCASE( iswctype(L' ', wctype("space")));\r
- TESTCASE( iswctype(L'\t', wctype("space")));\r
-\r
- TESTCASE( iswctype(L'0', wctype("xdigit")));\r
- TESTCASE( iswctype(L'1', wctype("xdigit")));\r
- TESTCASE( iswctype(L'2', wctype("xdigit")));\r
- TESTCASE( iswctype(L'3', wctype("xdigit")));\r
- TESTCASE( iswctype(L'4', wctype("xdigit")));\r
- TESTCASE( iswctype(L'5', wctype("xdigit")));\r
- TESTCASE( iswctype(L'6', wctype("xdigit")));\r
- TESTCASE( iswctype(L'7', wctype("xdigit")));\r
- TESTCASE( iswctype(L'8', wctype("xdigit")));\r
- TESTCASE( iswctype(L'9', wctype("xdigit")));\r
- TESTCASE( iswctype(L'a', wctype("xdigit")));\r
- TESTCASE( iswctype(L'b', wctype("xdigit")));\r
- TESTCASE( iswctype(L'c', wctype("xdigit")));\r
- TESTCASE( iswctype(L'd', wctype("xdigit")));\r
- TESTCASE( iswctype(L'e', wctype("xdigit")));\r
- TESTCASE( iswctype(L'f', wctype("xdigit")));\r
- TESTCASE( iswctype(L'A', wctype("xdigit")));\r
- TESTCASE( iswctype(L'B', wctype("xdigit")));\r
- TESTCASE( iswctype(L'C', wctype("xdigit")));\r
- TESTCASE( iswctype(L'D', wctype("xdigit")));\r
- TESTCASE( iswctype(L'E', wctype("xdigit")));\r
- TESTCASE( iswctype(L'F', wctype("xdigit")));\r
- TESTCASE(!iswctype(L'g', wctype("xdigit")));\r
- TESTCASE(!iswctype(L'G', wctype("xdigit")));\r
- TESTCASE(!iswctype(L'x', wctype("xdigit")));\r
- TESTCASE(!iswctype(L'X', wctype("xdigit")));\r
- TESTCASE(!iswctype(L' ', wctype("xdigit")));\r
-\r
- return TEST_RESULTS;\r
-}\r
-#endif\r
+/* iswctype( wint_t, wctype_t )
+
+ This file is part of the Public Domain C Library (PDCLib).
+ Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <wctype.h>
+#ifndef REGTEST
+#include "_PDCLIB_locale.h"
+
+int _PDCLIB_iswctype_l( wint_t wc, wctype_t desc, locale_t l )
+{
+ wc = _PDCLIB_unpackwint( wc );
+
+ _PDCLIB_wcinfo_t *info = _PDCLIB_wcgetinfo( l, wc );
+
+ if(!info) return 0;
+
+ return info->flags & desc;
+}
+
+int iswctype( wint_t wc, wctype_t desc )
+{
+ return _PDCLIB_iswctype_l( wc, desc, _PDCLIB_threadlocale() );
+}
+
+#endif
+
+#ifdef TEST
+#include "_PDCLIB_test.h"
+
+int main( void )
+{
+ TESTCASE( iswctype(L'a', wctype("alpha")));
+ TESTCASE( iswctype(L'z', wctype("alpha")));
+ TESTCASE( iswctype(L'E', wctype("alpha")));
+ TESTCASE(!iswctype(L'3', wctype("alpha")));
+ TESTCASE(!iswctype(L';', wctype("alpha")));
+
+ TESTCASE( iswctype(L'a', wctype("alnum")));
+ TESTCASE( iswctype(L'3', wctype("alnum")));
+ TESTCASE(!iswctype(L';', wctype("alnum")));
+
+ TESTCASE( iswctype(L' ', wctype("blank")));
+ TESTCASE( iswctype(L'\t', wctype("blank")));
+ TESTCASE(!iswctype(L'\n', wctype("blank")));
+ TESTCASE(!iswctype(L';', wctype("blank")));
+
+ TESTCASE( iswctype(L'\0', wctype("cntrl")));
+ TESTCASE( iswctype(L'\n', wctype("cntrl")));
+ TESTCASE( iswctype(L'\v', wctype("cntrl")));
+ TESTCASE(!iswctype(L'\t', wctype("cntrl")));
+ TESTCASE(!iswctype(L'a', wctype("cntrl")));
+
+ TESTCASE( iswctype(L'0', wctype("digit")));
+ TESTCASE( iswctype(L'1', wctype("digit")));
+ TESTCASE( iswctype(L'2', wctype("digit")));
+ TESTCASE( iswctype(L'3', wctype("digit")));
+ TESTCASE( iswctype(L'4', wctype("digit")));
+ TESTCASE( iswctype(L'5', wctype("digit")));
+ TESTCASE( iswctype(L'6', wctype("digit")));
+ TESTCASE( iswctype(L'7', wctype("digit")));
+ TESTCASE( iswctype(L'8', wctype("digit")));
+ TESTCASE( iswctype(L'9', wctype("digit")));
+ TESTCASE(!iswctype(L'X', wctype("digit")));
+ TESTCASE(!iswctype(L'?', wctype("digit")));
+
+ TESTCASE( iswctype(L'a', wctype("graph")));
+ TESTCASE( iswctype(L'z', wctype("graph")));
+ TESTCASE( iswctype(L'E', wctype("graph")));
+ TESTCASE( iswctype(L'E', wctype("graph")));
+ TESTCASE(!iswctype(L' ', wctype("graph")));
+ TESTCASE(!iswctype(L'\t', wctype("graph")));
+ TESTCASE(!iswctype(L'\n', wctype("graph")));
+
+ TESTCASE( iswctype(L'a', wctype("lower")));
+ TESTCASE( iswctype(L'e', wctype("lower")));
+ TESTCASE( iswctype(L'z', wctype("lower")));
+ TESTCASE(!iswctype(L'A', wctype("lower")));
+ TESTCASE(!iswctype(L'E', wctype("lower")));
+ TESTCASE(!iswctype(L'Z', wctype("lower")));
+
+ TESTCASE(!iswctype(L'a', wctype("upper")));
+ TESTCASE(!iswctype(L'e', wctype("upper")));
+ TESTCASE(!iswctype(L'z', wctype("upper")));
+ TESTCASE( iswctype(L'A', wctype("upper")));
+ TESTCASE( iswctype(L'E', wctype("upper")));
+ TESTCASE( iswctype(L'Z', wctype("upper")));
+
+ TESTCASE( iswctype(L'Z', wctype("print")));
+ TESTCASE( iswctype(L'a', wctype("print")));
+ TESTCASE( iswctype(L';', wctype("print")));
+ TESTCASE( iswctype(L'\t', wctype("print")));
+ TESTCASE(!iswctype(L'\0', wctype("print")));
+
+ TESTCASE( iswctype(L';', wctype("punct")));
+ TESTCASE( iswctype(L'.', wctype("punct")));
+ TESTCASE( iswctype(L'?', wctype("punct")));
+ TESTCASE(!iswctype(L' ', wctype("punct")));
+ TESTCASE(!iswctype(L'Z', wctype("punct")));
+
+ TESTCASE( iswctype(L' ', wctype("space")));
+ TESTCASE( iswctype(L'\t', wctype("space")));
+
+ TESTCASE( iswctype(L'0', wctype("xdigit")));
+ TESTCASE( iswctype(L'1', wctype("xdigit")));
+ TESTCASE( iswctype(L'2', wctype("xdigit")));
+ TESTCASE( iswctype(L'3', wctype("xdigit")));
+ TESTCASE( iswctype(L'4', wctype("xdigit")));
+ TESTCASE( iswctype(L'5', wctype("xdigit")));
+ TESTCASE( iswctype(L'6', wctype("xdigit")));
+ TESTCASE( iswctype(L'7', wctype("xdigit")));
+ TESTCASE( iswctype(L'8', wctype("xdigit")));
+ TESTCASE( iswctype(L'9', wctype("xdigit")));
+ TESTCASE( iswctype(L'a', wctype("xdigit")));
+ TESTCASE( iswctype(L'b', wctype("xdigit")));
+ TESTCASE( iswctype(L'c', wctype("xdigit")));
+ TESTCASE( iswctype(L'd', wctype("xdigit")));
+ TESTCASE( iswctype(L'e', wctype("xdigit")));
+ TESTCASE( iswctype(L'f', wctype("xdigit")));
+ TESTCASE( iswctype(L'A', wctype("xdigit")));
+ TESTCASE( iswctype(L'B', wctype("xdigit")));
+ TESTCASE( iswctype(L'C', wctype("xdigit")));
+ TESTCASE( iswctype(L'D', wctype("xdigit")));
+ TESTCASE( iswctype(L'E', wctype("xdigit")));
+ TESTCASE( iswctype(L'F', wctype("xdigit")));
+ TESTCASE(!iswctype(L'g', wctype("xdigit")));
+ TESTCASE(!iswctype(L'G', wctype("xdigit")));
+ TESTCASE(!iswctype(L'x', wctype("xdigit")));
+ TESTCASE(!iswctype(L'X', wctype("xdigit")));
+ TESTCASE(!iswctype(L' ', wctype("xdigit")));
+
+ return TEST_RESULTS;
+}
+#endif