* lib/ctype.in.h: (isblank_l): New declaration.
* lib/isblank_l.c: New file.
* m4/isblank_l.m4: New file.
* m4/ctype_h.m4 (gl_CTYPE_H): Test for isblank_l.
(gl_CTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_ISBLANK_L.
(gl_CTYPE_H_DEFAULTS): Initialize HAVE_ISBLANK_L.
* modules/ctype-h (Makefile.am): Substitute GNULIB_ISBLANK_L,
HAVE_ISBLANK_L.
* modules/isblank_l: New file.
* tests/test-ctype-h-c++.cc: Check declaration of isblank_l.
* doc/posix-functions/isblank_l.texi: Mention the new module.
+2025-02-15 Bruno Haible <bruno@clisp.org>
+
+ isblank_l: New module.
+ * lib/ctype.in.h: (isblank_l): New declaration.
+ * lib/isblank_l.c: New file.
+ * m4/isblank_l.m4: New file.
+ * m4/ctype_h.m4 (gl_CTYPE_H): Test for isblank_l.
+ (gl_CTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_ISBLANK_L.
+ (gl_CTYPE_H_DEFAULTS): Initialize HAVE_ISBLANK_L.
+ * modules/ctype-h (Makefile.am): Substitute GNULIB_ISBLANK_L,
+ HAVE_ISBLANK_L.
+ * modules/isblank_l: New file.
+ * tests/test-ctype-h-c++.cc: Check declaration of isblank_l.
+ * doc/posix-functions/isblank_l.texi: Mention the new module.
+
2025-02-15 Bruno Haible <bruno@clisp.org>
isalpha_l: Add tests.
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/isblank_l.html}
-Gnulib module: ---
+Gnulib module: isblank_l
+@mindex isblank_l
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on many platforms:
+FreeBSD 9.0, NetBSD 6.1, OpenBSD 6.1, Minix 3.1.8, AIX 6.1, HP-UX 11, Solaris 11.3, Cygwin 2.5.x, mingw, MSVC 14, Android 4.4.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This function is missing on many platforms:
-FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.0, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 11.3, Cygwin 1.7.x, mingw, MSVC 14, Android 4.4.
@end itemize
#error "Please include config.h first."
#endif
-#if @GNULIB_ISALNUM_L@ || @GNULIB_ISALPHA_L@
+#if @GNULIB_ISALNUM_L@ || @GNULIB_ISALPHA_L@ || @GNULIB_ISBLANK_L@
/* Get locale_t. */
# include <locale.h>
#endif
# endif
#endif
+/* Return non-zero if c is a blank, i.e. a space or tab character. */
+#if @GNULIB_ISBLANK_L@
+# if !@HAVE_ISBLANK_L@
+_GL_FUNCDECL_SYS (isblank_l, int, (int c, locale_t locale),
+ _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (isblank_l, int, (int c, locale_t locale));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (isblank_l);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef isblank_l
+# if HAVE_RAW_DECL_ISBLANK_L
+_GL_WARN_ON_USE (isblank_l, "isblank_l is unportable - "
+ "use gnulib module isblank_l for portability");
+# endif
+#endif
+
#endif /* _@GUARD_PREFIX@_CTYPE_H */
#endif
#endif /* _@GUARD_PREFIX@_CTYPE_H */
--- /dev/null
+/* Test whether a single-byte character is blank.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2025. */
+
+#include <config.h>
+
+/* Specification. */
+#include <ctype.h>
+
+#define FUNC isblank_l
+#define GLOBAL_FUNC isblank
+#define C_FUNC(c) \
+ (c == ' ' || c == '\t')
+/* Documentation:
+ <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/isblank-iswblank-isblank-l-iswblank-l> */
+#if defined __MINGW32__
+/* mingw lacks _isblank_l. */
+# define WINDOWS_FUNC(c,l) C_FUNC(c)
+#else
+# define WINDOWS_FUNC _isblank_l
+#endif
+#include "is_l-impl.h"
# ctype_h.m4
-# serial 11
+# serial 12
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <ctype.h>
- ]], [isalnum_l isalpha_l isblank])
+ ]], [isalnum_l isalpha_l isblank isblank_l])
])
# gl_CTYPE_MODULE_INDICATOR([modulename])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISALNUM_L])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISALPHA_L])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISBLANK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISBLANK_L])
])
m4_require(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS])
AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
HAVE_ISALNUM_L=1; AC_SUBST([HAVE_ISALNUM_L])
HAVE_ISALPHA_L=1; AC_SUBST([HAVE_ISALPHA_L])
HAVE_ISBLANK=1; AC_SUBST([HAVE_ISBLANK])
+ HAVE_ISBLANK_L=1; AC_SUBST([HAVE_ISBLANK_L])
])
--- /dev/null
+# isblank_l.m4
+# serial 1
+dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl This file is offered as-is, without any warranty.
+
+AC_DEFUN([gl_FUNC_ISBLANK_L],
+[
+ AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+
+ dnl Persuade glibc <ctype.h> to declare isblank_l().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_FUNCS_ONCE([isblank_l])
+ if test $ac_cv_func_isblank_l = no; then
+ HAVE_ISBLANK_L=0
+ fi
+
+ dnl Prerequisites of lib/isblank_l.c.
+ AC_REQUIRE([gt_FUNC_USELOCALE])
+])
-e 's/@''GNULIB_ISALNUM_L''@/$(GNULIB_ISALNUM_L)/g' \
-e 's/@''GNULIB_ISALPHA_L''@/$(GNULIB_ISALPHA_L)/g' \
-e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
+ -e 's/@''GNULIB_ISBLANK_L''@/$(GNULIB_ISBLANK_L)/g' \
-e 's/@''HAVE_ISALNUM_L''@/$(HAVE_ISALNUM_L)/g' \
-e 's/@''HAVE_ISALPHA_L''@/$(HAVE_ISALPHA_L)/g' \
-e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
+ -e 's/@''HAVE_ISBLANK_L''@/$(HAVE_ISBLANK_L)/g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
$(srcdir)/ctype.in.h > $@-t
--- /dev/null
+Description:
+isblank_l() function: test whether a single-byte character is blank.
+
+Files:
+lib/isblank_l.c
+lib/is_l-impl.h
+m4/isblank_l.m4
+m4/intl-thread-locale.m4
+
+Depends-on:
+ctype-h
+locale-h
+extensions
+
+configure.ac:
+gl_FUNC_ISBLANK_L
+gl_CONDITIONAL([GL_COND_OBJ_ISBLANK_L], [test $HAVE_ISBLANK_L = 0])
+gl_MODULE_INDICATOR([isblank_l])
+gl_CTYPE_MODULE_INDICATOR([isblank_l])
+
+Makefile.am:
+if GL_COND_OBJ_ISBLANK_L
+lib_SOURCES += isblank_l.c
+endif
+
+Include:
+<ctype.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
SIGNATURE_CHECK (GNULIB_NAMESPACE::isblank, int, (int));
#endif
+#if GNULIB_TEST_ISBLANK_L
+SIGNATURE_CHECK (GNULIB_NAMESPACE::isblank_l, int, (int, locale_t));
+#endif
+
int
main ()