changeset 12183:2bdca798f96c

New module 'ctype'.
author Bruno Haible <bruno@clisp.org>
date Sun, 18 Oct 2009 21:12:31 +0200
parents 8ba00f285749
children d36f385f1f13
files ChangeLog doc/posix-headers/ctype.texi lib/ctype.in.h m4/ctype.m4 modules/ctype
diffstat 5 files changed, 129 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-10-18  Bruno Haible  <bruno@clisp.org>
+
+	New module 'ctype'.
+	* lib/ctype.in.h: New file.
+	* m4/ctype.m4: New file.
+	* modules/ctype: New file.
+	* doc/posix-headers/ctype.texi: Mention the new module.
+
 2009-10-18  Jim Meyering  <meyering@redhat.com>
 
 	m4: stylistic-only: hoist AC_SUBST to be adjacent to initialization
--- a/doc/posix-headers/ctype.texi
+++ b/doc/posix-headers/ctype.texi
@@ -3,7 +3,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/susv3xbd/ctype.h.html}
 
-Gnulib module: ---
+Gnulib module: ctype
 
 Portability problems fixed by Gnulib:
 @itemize
new file mode 100644
--- /dev/null
+++ b/lib/ctype.in.h
@@ -0,0 +1,53 @@
+/* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
+
+   Copyright (C) 2009 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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program 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 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.  */
+
+/* Written by Bruno Haible.  */
+
+/*
+ * ISO C 99 <ctype.h> for platforms on which it is incomplete.
+ * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
+ */
+
+#ifndef _GL_CTYPE_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
+/* Include the original <ctype.h>.  */
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_CTYPE_H@
+
+#ifndef _GL_CTYPE_H
+#define _GL_CTYPE_H
+
+/* Return non-zero if c is a blank, i.e. a space or tab character.  */
+#if @GNULIB_ISBLANK@
+# if !@HAVE_ISBLANK@
+extern int isblank (int c);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef isblank
+# define isblank(c) \
+    (GL_LINK_WARNING ("isblank is unportable - " \
+                      "use gnulib module isblank for portability"), \
+     isblank (c))
+#endif
+
+#endif /* _GL_CTYPE_H */
+#endif /* _GL_CTYPE_H */
new file mode 100644
--- /dev/null
+++ b/m4/ctype.m4
@@ -0,0 +1,28 @@
+# ctype_h.m4 serial 1
+dnl Copyright (C) 2009 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.
+
+AC_DEFUN([gl_CTYPE_H],
+[
+  AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+  dnl Execute this unconditionally, because CTYPE_H may be set by other
+  dnl modules, after this code is executed.
+  gl_CHECK_NEXT_HEADERS([ctype.h])
+])
+
+AC_DEFUN([gl_CTYPE_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_CTYPE_H_DEFAULTS],
+[
+  GNULIB_ISBLANK=0; AC_SUBST([GNULIB_ISBLANK])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ISBLANK=1;   AC_SUBST([HAVE_ISBLANK])
+  CTYPE_H='';       AC_SUBST([CTYPE_H])
+])
new file mode 100644
--- /dev/null
+++ b/modules/ctype
@@ -0,0 +1,39 @@
+Description:
+A <ctype.h> that conforms to C99.
+
+Files:
+lib/ctype.in.h
+m4/ctype.m4
+
+Depends-on:
+include_next
+
+configure.ac:
+gl_CTYPE_H
+
+Makefile.am:
+BUILT_SOURCES += $(CTYPE_H)
+
+# We need the following in order to create <ctype.h> when the system
+# doesn't have one that works with the given compiler.
+ctype.h: ctype.in.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+	      -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
+	      -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
+	      -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
+	      < $(srcdir)/ctype.in.h; \
+	} > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += ctype.h ctype.h-t
+
+Include:
+<ctype.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible