>From 610da39dbe01509af66bde383cac228d03b736c6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 31 Dec 2019 19:35:48 +0100 Subject: [PATCH 1/3] uchar: New module. * lib/uchar.in.h: New file. * m4/uchar.m4: New file. * modules/uchar: New file. * doc/posix-headers/uchar.texi: Mention the new module. --- ChangeLog | 8 +++++++ doc/posix-headers/uchar.texi | 8 +++---- lib/uchar.in.h | 54 ++++++++++++++++++++++++++++++++++++++++++++ m4/uchar.m4 | 19 ++++++++++++++++ modules/uchar | 40 ++++++++++++++++++++++++++++++++ 5 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 lib/uchar.in.h create mode 100644 m4/uchar.m4 create mode 100644 modules/uchar diff --git a/ChangeLog b/ChangeLog index 6f6e619..7d4c550 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-12-31 Bruno Haible + + uchar: New module. + * lib/uchar.in.h: New file. + * m4/uchar.m4: New file. + * modules/uchar: New file. + * doc/posix-headers/uchar.texi: Mention the new module. + 2019-12-30 Jim Meyering localeinfo: ->simple would be wrong for LC_ALL=C diff --git a/doc/posix-headers/uchar.texi b/doc/posix-headers/uchar.texi index 7662a79..3907732 100644 --- a/doc/posix-headers/uchar.texi +++ b/doc/posix-headers/uchar.texi @@ -5,15 +5,15 @@ Defines the types @code{char16_t}, @code{char32_t} and declares the functions @code{mbrtoc16}, @code{c16rtomb}, @code{mbrtoc32}, @code{c32rtomb}. -Gnulib module: --- +Gnulib module: uchar Portability problems fixed by Gnulib: @itemize +@item +This header file is missing on many non-glibc platforms: +glibc 2.15, Mac OS X 10.5, FreeBSD 6.4, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin, mingw, MSVC 9. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This header file is missing on many non-glibc platforms: -glibc 2.15, Mac OS X 10.5, FreeBSD 6.4, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin, mingw, MSVC 9. @end itemize diff --git a/lib/uchar.in.h b/lib/uchar.in.h new file mode 100644 index 0000000..2870bae --- /dev/null +++ b/lib/uchar.in.h @@ -0,0 +1,54 @@ +/* substitute - 16-bit and 32-bit wide character types. + Copyright (C) 2019 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 3 of the License, 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, see . */ + +/* Written by Bruno Haible , 2019. */ + +/* + * ISO C 11 for platforms that lack it. + */ + +#ifndef _@GUARD_PREFIX@_UCHAR_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if @HAVE_UCHAR_H@ +# @INCLUDE_NEXT@ @NEXT_UCHAR_H@ +#endif + +/* Get uint_least16_t, uint_least32_t. */ +#include + +/* Get mbstate_t, size_t. */ +#include + +#if !@HAVE_UCHAR_H@ + +/* A 16-bit variant of wchar_t. + Note: This type does *NOT* denote UTF-16 units. (Only on platforms + on which __STDC_UTF_16__ is defined.) */ +typedef uint_least16_t char16_t; + +/* A 32-bit variant of wchar_t. + Note: This type does *NOT* denote UTF-32 code points. (Only on platforms + on which __STDC_UTF_32__ is defined.) */ +typedef uint_least32_t char32_t; + +#endif + +#endif /* _@GUARD_PREFIX@_UCHAR_H */ diff --git a/m4/uchar.m4 b/m4/uchar.m4 new file mode 100644 index 0000000..ca6a21f --- /dev/null +++ b/m4/uchar.m4 @@ -0,0 +1,19 @@ +# uchar.m4 serial 1 +dnl Copyright (C) 2019 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 From Bruno Haible. +dnl Prepare the overridden . + +AC_DEFUN_ONCE([gl_UCHAR_H], +[ + gl_CHECK_NEXT_HEADERS([uchar.h]) + if test $ac_cv_header_uchar_h = yes; then + HAVE_UCHAR_H=1 + else + HAVE_UCHAR_H=0 + fi + AC_SUBST([HAVE_UCHAR_H]) +]) diff --git a/modules/uchar b/modules/uchar new file mode 100644 index 0000000..48ed448 --- /dev/null +++ b/modules/uchar @@ -0,0 +1,40 @@ +Description: +A GNU-like . + +Files: +lib/uchar.in.h +m4/uchar.m4 + +Depends-on: +include_next +stdint +wchar + +configure.ac: +gl_UCHAR_H + +Makefile.am: +BUILT_SOURCES += uchar.h + +uchar.h: uchar.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ + -e 's/@''HAVE_UCHAR_H''@/$(HAVE_UCHAR_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_UCHAR_H''@|$(NEXT_UCHAR_H)|g' \ + < $(srcdir)/uchar.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += uchar.h uchar.h-t + +Include: + + +License: +LGPLv2+ + +Maintainer: +all -- 2.7.4