diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2010-05-27 18:23:15 +0200 |
---|---|---|
committer | Andreas Rottmann <a.rottmann@gmx.at> | 2010-05-27 18:23:15 +0200 |
commit | 3e0814cd9862b89c7a39672672937477bd87ddfb (patch) | |
tree | 159134a624e51509f40ed8823249f09a70d1dda3 | |
parent | 3bebb94360f1c2333feb8d504a9fa4f96984d8b7 (diff) |
Imported Upstream version 0.9.3upstream/0.9.3
1174 files changed, 60851 insertions, 27062 deletions
@@ -1,3 +1,96 @@ +2010-05-02 Bruno Haible <bruno@clisp.org> + + * Version 0.9.3 released. + +2010-05-02 Bruno Haible <bruno@clisp.org> + + * version.sh: Bump version number and date. + * README: Update version. + * lib/Makefile.am (LTV_*): Update to 1:2:1. + +2010-05-02 Bruno Haible <bruno@clisp.org> + + * gnulib-m4/gnulib-cache.m4: Updated by gnulib-tool. + +2010-03-30 Bruno Haible <bruno@clisp.org> + + * README.woe32: Update for Cygwin 1.7.x. + +2010-03-29 Bruno Haible <bruno@clisp.org> + + Undo last change, not needed any more. + * configure.ac: Remove LT_LANG([C++]) invocation. + +2010-03-12 Bruno Haible <bruno@clisp.org> + + Fix libtool failure with gnulib C++ tests. + * configure.ac: Add LT_LANG([C++]) invocation. + Reported by Ludovic Courtès <ludo@gnu.org>. + +2010-01-10 Bruno Haible <bruno@clisp.org> + + * doc/unistr.texi (Elementary string functions on NUL terminated + strings): Change description of u*_stpncpy return value to be + consistent with stpncpy in glibc. + +2010-01-01 Bruno Haible <bruno@clisp.org> + + * Version 0.9.2.1 released. + +2010-01-01 Bruno Haible <bruno@clisp.org> + + * version.sh: Bump version number and date. + * README: Update version. + * doc/libunistring.texi: Update copyright year. + * lib/libunistring.rc: Likewise. + +2009-12-26 Bruno Haible <bruno@clisp.org> + + * Version 0.9.2 released. + +2009-12-26 Bruno Haible <bruno@clisp.org> + + * version.sh: Bump version number and date. + * README: Update version. + * lib/Makefile.am (LTV_*): Update to 1:1:1. + * NEWS: Mention what changed. + +2009-12-26 Bruno Haible <bruno@clisp.org> + + * lib/libunistring.rc: Update. + +2009-12-26 Bruno Haible <bruno@clisp.org> + + * lib/Makefile.am (EXTRA_DIST): Add unistring/cdefs.in.h. + +2009-12-24 Bruno Haible <bruno@clisp.org> + + Update after gnulib added module 'unused-parameter'. + * gnulib-local/lib/unistr.h.diff: Replace the #include of + "unused-parameter.h". + * lib/unistring/cdefs.in.h: Renamed from lib/unistring/cdefs.h. Replace + the _UNUSED_PARAMETER_ with a placeholder for _GL_UNUSED_PARAMETER. + * lib/Makefile.am (unistring/cdefs.h): New rule. + (BUILT_SOURCES, MOSTLYCLEANFILES, CLEANFILES): Augment. + +2009-12-12 Bruno Haible <bruno@clisp.org> + + * lib/libunistring.rc: Untabify. + * woe32dll/export.h: Likewise. + +2009-12-09 Bruno Haible <bruno@clisp.org> + + Ensure _UNUSED_PARAMETER_ is defined in the public header files. + * lib/unistring/cdefs.h: New file, based on gnulib/m4/gnulib-common.m4. + * lib/Makefile.am (nobase_nodist_include_HEADERS): Add it. + * gnulib-local/lib/unistr.h.diff: Include unistring/cdefs.h. + Reported by Mike Gran <spk121@yahoo.com>. + +2009-09-01 Bruno Haible <bruno@clisp.org> + + * README.woe32: Put the -mno-cygwin option into CC and CXX. + Recommended by Paolo Bonzini and Eric Blake. + 2009-08-17 Bruno Haible <bruno@clisp.org> * Version 0.9.1.1 released. diff --git a/Makefile.in b/Makefile.in index c2582cb..4a83e54 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -48,17 +48,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/alloca.m4 \ $(top_srcdir)/gnulib-m4/codeset.m4 \ - $(top_srcdir)/gnulib-m4/dup2.m4 \ $(top_srcdir)/gnulib-m4/eealloc.m4 \ $(top_srcdir)/gnulib-m4/environ.m4 \ $(top_srcdir)/gnulib-m4/errno_h.m4 \ $(top_srcdir)/gnulib-m4/error.m4 \ - $(top_srcdir)/gnulib-m4/exitfail.m4 \ $(top_srcdir)/gnulib-m4/exponentd.m4 \ $(top_srcdir)/gnulib-m4/exponentf.m4 \ $(top_srcdir)/gnulib-m4/exponentl.m4 \ $(top_srcdir)/gnulib-m4/extensions.m4 \ - $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ $(top_srcdir)/gnulib-m4/float_h.m4 \ $(top_srcdir)/gnulib-m4/fpieee.m4 \ $(top_srcdir)/gnulib-m4/frexp.m4 \ @@ -90,6 +88,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/locale-zh.m4 \ $(top_srcdir)/gnulib-m4/locale_h.m4 \ $(top_srcdir)/gnulib-m4/localename.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ $(top_srcdir)/gnulib-m4/longlong.m4 \ $(top_srcdir)/gnulib-m4/malloc.m4 \ $(top_srcdir)/gnulib-m4/malloca.m4 \ @@ -102,13 +101,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/memchr.m4 \ $(top_srcdir)/gnulib-m4/minmax.m4 \ $(top_srcdir)/gnulib-m4/mmap-anon.m4 \ - $(top_srcdir)/gnulib-m4/mode_t.m4 \ $(top_srcdir)/gnulib-m4/multiarch.m4 \ $(top_srcdir)/gnulib-m4/nocrash.m4 \ - $(top_srcdir)/gnulib-m4/open.m4 \ $(top_srcdir)/gnulib-m4/printf-frexp.m4 \ $(top_srcdir)/gnulib-m4/printf-frexpl.m4 \ $(top_srcdir)/gnulib-m4/printf.m4 \ + $(top_srcdir)/gnulib-m4/putenv.m4 \ $(top_srcdir)/gnulib-m4/relocatable-lib.m4 \ $(top_srcdir)/gnulib-m4/setenv.m4 \ $(top_srcdir)/gnulib-m4/signbit.m4 \ @@ -120,16 +118,21 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/stdlib_h.m4 \ $(top_srcdir)/gnulib-m4/strerror.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/thread.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ $(top_srcdir)/gnulib-m4/unistd_h.m4 \ $(top_srcdir)/gnulib-m4/vasnprintf.m4 \ - $(top_srcdir)/gnulib-m4/wchar.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_h.m4 \ $(top_srcdir)/gnulib-m4/wchar_t.m4 \ $(top_srcdir)/gnulib-m4/wctob.m4 \ - $(top_srcdir)/gnulib-m4/wctype.m4 \ + $(top_srcdir)/gnulib-m4/wctype_h.m4 \ $(top_srcdir)/gnulib-m4/wcwidth.m4 \ $(top_srcdir)/gnulib-m4/wint_t.m4 \ $(top_srcdir)/gnulib-m4/xalloc.m4 \ - $(top_srcdir)/gnulib-m4/xsize.m4 $(top_srcdir)/m4/exported.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/yield.m4 $(top_srcdir)/m4/exported.m4 \ $(top_srcdir)/m4/init-package-version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ @@ -246,22 +249,31 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GLIBC21 = @GLIBC21@ GLOBAL_SYMBOL_PIPE = @GLOBAL_SYMBOL_PIPE@ +GNULIB_ACOSL = @GNULIB_ACOSL@ +GNULIB_ASINL = @GNULIB_ASINL@ +GNULIB_ATANL = @GNULIB_ATANL@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_BTOWC = @GNULIB_BTOWC@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ GNULIB_CEILF = @GNULIB_CEILF@ GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_COSL = @GNULIB_COSL@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_DUP3 = @GNULIB_DUP3@ +GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FLOORF = @GNULIB_FLOORF@ GNULIB_FLOORL = @GNULIB_FLOORL@ GNULIB_FREXP = @GNULIB_FREXP@ @@ -271,12 +283,15 @@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_ISINF = @GNULIB_ISINF@ GNULIB_ISNAN = @GNULIB_ISNAN@ @@ -286,9 +301,11 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ +GNULIB_LINKAT = @GNULIB_LINKAT@ +GNULIB_LOGB = @GNULIB_LOGB@ +GNULIB_LOGL = @GNULIB_LOGL@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MBRLEN = @GNULIB_MBRLEN@ GNULIB_MBRTOWC = @GNULIB_MBRTOWC@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ @@ -313,26 +330,37 @@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ +GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ +GNULIB_PIPE2 = @GNULIB_PIPE2@ +GNULIB_PREAD = @GNULIB_PREAD@ +GNULIB_PTSNAME = @GNULIB_PTSNAME@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_REALPATH = @GNULIB_REALPATH@ +GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_ROUND = @GNULIB_ROUND@ GNULIB_ROUNDF = @GNULIB_ROUNDF@ GNULIB_ROUNDL = @GNULIB_ROUNDL@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SINL = @GNULIB_SINL@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SQRTL = @GNULIB_SQRTL@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ @@ -344,12 +372,20 @@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_SYMLINK = @GNULIB_SYMLINK@ +GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ +GNULIB_TANL = @GNULIB_TANL@ GNULIB_TRUNC = @GNULIB_TRUNC@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNLINK = @GNULIB_UNLINK@ +GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ +GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ @@ -357,26 +393,41 @@ GNULIB_WCTOB = @GNULIB_WCTOB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ +HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ASINL = @HAVE_ASINL@ +HAVE_ATANL = @HAVE_ATANL@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COSL = @HAVE_COSL@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILF = @HAVE_DECL_CEILF@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORF = @HAVE_DECL_FLOORF@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGB = @HAVE_DECL_LOGB@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_ROUND = @HAVE_DECL_ROUND@ +HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ +HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -384,52 +435,77 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPL = @HAVE_EXPL@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ HAVE_GLOBAL_SYMBOL_PIPE = @HAVE_GLOBAL_SYMBOL_PIPE@ +HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ HAVE_ISNANL = @HAVE_ISNANL@ +HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LOGL = @HAVE_LOGL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ +HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ +HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ +HAVE_MKSTEMP = @HAVE_MKSTEMP@ +HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SINL = @HAVE_SINL@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ @@ -437,14 +513,21 @@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TANL = @HAVE_TANL@ +HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ @@ -452,6 +535,7 @@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HEXVERSION = @HEXVERSION@ ICONV_H = @ICONV_H@ @@ -467,27 +551,32 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ LIBS = @LIBS@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LIBTHREAD = @LIBTHREAD@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ -LOCALE_H = @LOCALE_H@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NAMESPACING = @NAMESPACING@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -500,7 +589,6 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -533,17 +621,21 @@ RANLIB = @RANLIB@ RC = @RC@ RELOCATABLE = @RELOCATABLE@ REPLACE_BTOWC = @REPLACE_BTOWC@ +REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CEILF = @REPLACE_CEILF@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FLOORF = @REPLACE_FLOORF@ REPLACE_FLOORL = @REPLACE_FLOORL@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_ICONV = @REPLACE_ICONV@ @@ -555,6 +647,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ @@ -567,20 +661,36 @@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_NAN = @REPLACE_NAN@ REPLACE_NULL = @REPLACE_NULL@ -REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_REALPATH = @REPLACE_REALPATH@ +REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ +REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_UNSETENV = @REPLACE_UNSETENV@ +REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ @@ -597,14 +707,13 @@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ TEXI2DVI = @TEXI2DVI@ +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ -VOID_UNSETENV = @VOID_UNSETENV@ -WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +YIELD_LIB = @YIELD_LIB@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -632,6 +741,7 @@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -750,7 +860,7 @@ distclean-libtool: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -775,7 +885,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -939,7 +1049,8 @@ distdir: $(DISTFILES) fi; \ done -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ @@ -983,17 +1094,17 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -1,3 +1,21 @@ +New in 0.9.3: +* Bug fixes in unistr.h functions: + - The functions u16_to_u32, u16_to_u8, u8_to_u32, u8_to_u16 now fail when + the argument is not valid. Previously, they returned a converted string + where invalid parts were each replaced with U+FFFD. + - The function u8_mbsnlen now counts an incomplete character at the end + of the argument string as 1 character. Previously, it could count as 2 + or 3 characters. + - The return value of the u8_stpncpy, u16_stpncpy, u32_stpncpy functions + was incorrect. + - The u8_strcoll, u16_strcoll, u32_strcoll now try harder to give a non-zero + return value. +* Portability to MacOS X 10.6 and Cygwin 1.7. + +New in 0.9.2: +* The function uc_locale_language now uses the locale of the current thread, + if a thread-specific locale has been set. + New in 0.9.1: * In the include file unicase.h, functions for case mapping of substrings have been added. @@ -53,7 +53,7 @@ The documentation is under another license; see in the documentation. Download -------- - http://ftp.gnu.org/gnu/libunistring/libunistring-0.9.1.1.tar.gz + http://ftp.gnu.org/gnu/libunistring/libunistring-0.9.3.tar.gz Homepage -------- diff --git a/README.woe32 b/README.woe32 index 07c7260..28430ae 100644 --- a/README.woe32 +++ b/README.woe32 @@ -1,4 +1,4 @@ -Installation on Woe32 (WinNT/2000/XP/Vista, Win95/98/ME): +Installation on Woe32 (WinNT/2000/XP/Vista/7, Win95/98/ME): This file explains how to create binaries for the mingw execution environment. For how to create binaries for the cygwin environment, please see the normal @@ -23,10 +23,10 @@ and configure commands: PATH=/usr/local/mingw/bin:$PATH export PATH ./configure --host=i586-pc-mingw32 --prefix=/usr/local/mingw \ - CPPFLAGS="-mno-cygwin -Wall -I/usr/local/mingw/include" \ - CFLAGS="-mno-cygwin -O2 -g" \ - CXXFLAGS="-mno-cygwin -O2 -g" \ - LDFLAGS="-mno-cygwin -L/usr/local/mingw/lib" + CC="gcc-3 -mno-cygwin" \ + CXX="g++-3 -mno-cygwin" \ + CPPFLAGS="-Wall -I/usr/local/mingw/include" \ + LDFLAGS="-L/usr/local/mingw/lib" The -mno-cygwin tells the cygwin compiler and linker to build for mingw. The -I and -L option are so that packages previously built for the @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11 -*- Autoconf -*- +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. @@ -14,6 +14,6642 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 52 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +_LT_REQUIRED_DARWIN_CHECKS + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# -------------------------- +# Check for some things on darwin +AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[0123]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac +]) + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +[$]* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# ------------------ +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# --------------------------------------------------------------------- +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ---------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +m4_if($1,[],[ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec], +[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"]) +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec], +[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"]) +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 DLLs +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +# set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognize shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognize a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +])# AC_PROG_LD + + +# AC_PROG_LD_GNU +# -------------- +AC_DEFUN([AC_PROG_LD_GNU], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AC_PROG_LD_GNU + + +# AC_PROG_LD_RELOAD_FLAG +# ---------------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac +])# AC_PROG_LD_RELOAD_FLAG + + +# AC_DEPLIBS_CHECK_METHOD +# ----------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# ------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF + +# Report which library types will actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext <<EOF +int a; +void foo (void) { a = 0; } +EOF +],[$1],[CXX],[cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +EOF +],[$1],[F77],[cat > conftest.$ac_ext <<EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +EOF +],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +EOF +]) +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then + _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then + _LT_AC_TAGVAR(predep_objects, $1)="$p" + else + _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then + _LT_AC_TAGVAR(postdep_objects, $1)="$p" + else + _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$rm -f confest.$objext + +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + +# PORTME: override above test on systems where it is broken +ifelse([$1],[CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_AC_TAGVAR(predep_objects,$1)= + _LT_AC_TAGVAR(postdep_objects,$1)= + _LT_AC_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac +])# AC_LIBTOOL_POSTDEP_PREDEP + +# AC_LIBTOOL_LANG_F77_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) +AC_DEFUN([_LT_AC_LANG_F77_CONFIG], +[AC_REQUIRE([AC_PROG_F77]) +AC_LANG_PUSH(Fortran 77) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +_LT_AC_TAGVAR(GCC, $1)="$G77" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# ------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(fix_srcfile_path, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([LT_AC_PROG_SED]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + + +# Cheap backport of AS_EXECUTABLE_P and required macros +# from Autoconf 2.59; we should not use $as_executable_p directly. + +# _AS_TEST_PREPARE +# ---------------- +m4_ifndef([_AS_TEST_PREPARE], +[m4_defun([_AS_TEST_PREPARE], +[if test -x / >/dev/null 2>&1; then + as_executable_p='test -x' +else + as_executable_p='test -f' +fi +])])# _AS_TEST_PREPARE + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_ifndef([AS_EXECUTABLE_P], +[m4_defun([AS_EXECUTABLE_P], +[AS_REQUIRE([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])])# AS_EXECUTABLE_P + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +]) + # po.m4 serial 17 (gettext-0.18) dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -479,7 +7115,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11], [], +m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -495,7 +7131,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11])dnl +[AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) @@ -1471,17 +8107,15 @@ AC_SUBST([am__untar]) m4_include([gnulib-m4/00gnulib.m4]) m4_include([gnulib-m4/alloca.m4]) m4_include([gnulib-m4/codeset.m4]) -m4_include([gnulib-m4/dup2.m4]) m4_include([gnulib-m4/eealloc.m4]) m4_include([gnulib-m4/environ.m4]) m4_include([gnulib-m4/errno_h.m4]) m4_include([gnulib-m4/error.m4]) -m4_include([gnulib-m4/exitfail.m4]) m4_include([gnulib-m4/exponentd.m4]) m4_include([gnulib-m4/exponentf.m4]) m4_include([gnulib-m4/exponentl.m4]) m4_include([gnulib-m4/extensions.m4]) -m4_include([gnulib-m4/fcntl_h.m4]) +m4_include([gnulib-m4/fcntl-o.m4]) m4_include([gnulib-m4/float_h.m4]) m4_include([gnulib-m4/fpieee.m4]) m4_include([gnulib-m4/frexp.m4]) @@ -1513,6 +8147,7 @@ m4_include([gnulib-m4/locale-tr.m4]) m4_include([gnulib-m4/locale-zh.m4]) m4_include([gnulib-m4/locale_h.m4]) m4_include([gnulib-m4/localename.m4]) +m4_include([gnulib-m4/lock.m4]) m4_include([gnulib-m4/longlong.m4]) m4_include([gnulib-m4/malloc.m4]) m4_include([gnulib-m4/malloca.m4]) @@ -1525,13 +8160,12 @@ m4_include([gnulib-m4/mbstate_t.m4]) m4_include([gnulib-m4/memchr.m4]) m4_include([gnulib-m4/minmax.m4]) m4_include([gnulib-m4/mmap-anon.m4]) -m4_include([gnulib-m4/mode_t.m4]) m4_include([gnulib-m4/multiarch.m4]) m4_include([gnulib-m4/nocrash.m4]) -m4_include([gnulib-m4/open.m4]) m4_include([gnulib-m4/printf-frexp.m4]) m4_include([gnulib-m4/printf-frexpl.m4]) m4_include([gnulib-m4/printf.m4]) +m4_include([gnulib-m4/putenv.m4]) m4_include([gnulib-m4/relocatable-lib.m4]) m4_include([gnulib-m4/setenv.m4]) m4_include([gnulib-m4/signbit.m4]) @@ -1543,16 +8177,21 @@ m4_include([gnulib-m4/stdint_h.m4]) m4_include([gnulib-m4/stdlib_h.m4]) m4_include([gnulib-m4/strerror.m4]) m4_include([gnulib-m4/string_h.m4]) +m4_include([gnulib-m4/strncat.m4]) +m4_include([gnulib-m4/thread.m4]) +m4_include([gnulib-m4/threadlib.m4]) m4_include([gnulib-m4/unistd_h.m4]) m4_include([gnulib-m4/vasnprintf.m4]) -m4_include([gnulib-m4/wchar.m4]) +m4_include([gnulib-m4/warn-on-use.m4]) +m4_include([gnulib-m4/wchar_h.m4]) m4_include([gnulib-m4/wchar_t.m4]) m4_include([gnulib-m4/wctob.m4]) -m4_include([gnulib-m4/wctype.m4]) +m4_include([gnulib-m4/wctype_h.m4]) m4_include([gnulib-m4/wcwidth.m4]) m4_include([gnulib-m4/wint_t.m4]) m4_include([gnulib-m4/xalloc.m4]) m4_include([gnulib-m4/xsize.m4]) +m4_include([gnulib-m4/yield.m4]) m4_include([m4/exported.m4]) m4_include([m4/init-package-version.m4]) m4_include([m4/libtool.m4]) diff --git a/build-aux/arg-nonnull.h b/build-aux/arg-nonnull.h new file mode 100644 index 0000000..7e3e2db --- /dev/null +++ b/build-aux/arg-nonnull.h @@ -0,0 +1,26 @@ +/* A C macro for declaring that specific arguments must not be NULL. + Copyright (C) 2009, 2010 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 + Lesser 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 <http://www.gnu.org/licenses/>. */ + +/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools + that the values passed as arguments n, ..., m must be non-NULL pointers. + n = 1 stands for the first argument, n = 2 for the second argument etc. */ +#ifndef _GL_ARG_NONNULL +# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 +# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) +# else +# define _GL_ARG_NONNULL(params) +# endif +#endif diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h new file mode 100644 index 0000000..7d71089 --- /dev/null +++ b/build-aux/c++defs.h @@ -0,0 +1,251 @@ +/* C++ compatible function declaration macros. + Copyright (C) 2010 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 + Lesser 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 <http://www.gnu.org/licenses/>. */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype rpl_func parameters_and_attributes + +/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype func parameters_and_attributes + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + rettype (*const func) parameters = ::rpl_func; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + rettype (*const func) parameters = \ + reinterpret_cast<rettype(*)parameters>(::rpl_func); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* If we were to write + rettype (*const func) parameters = ::func; + like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls + better (remove an indirection through a 'static' pointer variable), + but then the _GL_CXXALIASWARN macro below would cause a warning not only + for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static rettype (*func) parameters = ::func; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static rettype (*func) parameters = \ + reinterpret_cast<rettype(*)parameters>(::func); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static rettype (*func) parameters = \ + reinterpret_cast<rettype(*)parameters>( \ + (rettype2(*)parameters2)(::func)); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ diff --git a/build-aux/config.guess b/build-aux/config.guess index e3a2116..115f944 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. -timestamp='2009-06-10' +timestamp='2010-04-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,16 +27,16 @@ timestamp='2009-06-10' # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Originally written by Per Bothner. Please send patches (context +# diff format) to <config-patches@gnu.org> and include a ChangeLog +# entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,8 +56,9 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -91,7 +92,7 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 +trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -105,7 +106,7 @@ trap 'exit 1' 1 2 15 set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || @@ -333,6 +334,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -807,12 +811,12 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:[3456]*) + *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd | genuineintel) + authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -854,6 +858,20 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -876,6 +894,17 @@ EOF frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; @@ -901,39 +930,18 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -942,8 +950,11 @@ EOF *) echo hppa-unknown-linux-gnu ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux @@ -966,58 +977,6 @@ EOF xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1247,6 +1206,16 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} diff --git a/build-aux/config.rpath b/build-aux/config.rpath index 85c2f20..17298f2 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2008 Free Software Foundation, Inc. +# Copyright 1996-2010 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # diff --git a/build-aux/config.sub b/build-aux/config.sub index eb0389a..ae35431 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. -timestamp='2009-06-11' +timestamp='2010-03-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -32,13 +32,16 @@ timestamp='2009-06-11' # Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -72,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -149,7 +153,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; @@ -284,20 +288,31 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ + | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none @@ -328,7 +343,7 @@ case $basic_machine in | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ @@ -340,7 +355,7 @@ case $basic_machine in | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -368,15 +383,17 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* \ + | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile-* | tilegx-* \ | tron-* \ + | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ @@ -474,6 +491,15 @@ case $basic_machine in basic_machine=powerpc-ibm os=-cnk ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos @@ -726,6 +752,9 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze) + basic_machine=microblaze-xilinx + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1064,17 +1093,10 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff + # This must be matched before tile*. + tilegx*) + basic_machine=tilegx-unknown + os=-linux-gnu ;; tile*) basic_machine=tile-unknown @@ -1247,6 +1269,9 @@ case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1268,8 +1293,8 @@ case $os in # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ @@ -1290,7 +1315,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1423,6 +1448,8 @@ case $os in -dicos*) os=-dicos ;; + -nacl*) + ;; -none) ;; *) @@ -1463,6 +1490,15 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h deleted file mode 100644 index fda0194..0000000 --- a/build-aux/link-warning.h +++ /dev/null @@ -1,28 +0,0 @@ -/* GL_LINK_WARNING("literal string") arranges to emit the literal string as - a linker warning on most glibc systems. - We use a linker warning rather than a preprocessor warning, because - #warning cannot be used inside macros. */ -#ifndef GL_LINK_WARNING - /* This works on platforms with GNU ld and ELF object format. - Testing __GLIBC__ is sufficient for asserting that GNU ld is in use. - Testing __ELF__ guarantees the ELF object format. - Testing __GNUC__ is necessary for the compound expression syntax. */ -# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__ -# define GL_LINK_WARNING(message) \ - GL_LINK_WARNING1 (__FILE__, __LINE__, message) -# define GL_LINK_WARNING1(file, line, message) \ - GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */ -# define GL_LINK_WARNING2(file, line, message) \ - GL_LINK_WARNING3 (file ":" #line ": warning: " message) -# define GL_LINK_WARNING3(message) \ - ({ static const char warning[sizeof (message)] \ - __attribute__ ((__unused__, \ - __section__ (".gnu.warning"), \ - __aligned__ (1))) \ - = message "\n"; \ - (void)0; \ - }) -# else -# define GL_LINK_WARNING(message) ((void) 0) -# endif -#endif diff --git a/build-aux/unused-parameter.h b/build-aux/unused-parameter.h new file mode 100644 index 0000000..b6fa325 --- /dev/null +++ b/build-aux/unused-parameter.h @@ -0,0 +1,36 @@ +/* A C macro for declaring that specific function parameters are not used. + Copyright (C) 2008-2010 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 + Lesser 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 <http://www.gnu.org/licenses/>. */ + +/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter + declarations for parameters that are not used. This helps to reduce + warnings, such as from GCC -Wunused-parameter. The syntax is as follows: + type param _GL_UNUSED_PARAMETER + or more generally + param_decl _GL_UNUSED_PARAMETER + For example: + int param _GL_UNUSED_PARAMETER + int *(*param)(void) _GL_UNUSED_PARAMETER + Other possible, but obscure and discouraged syntaxes: + int _GL_UNUSED_PARAMETER *(*param)(void) + _GL_UNUSED_PARAMETER int *(*param)(void) + */ +#ifndef _GL_UNUSED_PARAMETER +# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__)) +# else +# define _GL_UNUSED_PARAMETER +# endif +#endif diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h new file mode 100644 index 0000000..171e599 --- /dev/null +++ b/build-aux/warn-on-use.h @@ -0,0 +1,109 @@ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010 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 + Lesser 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 <http://www.gnu.org/licenses/>. */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + This macro is useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. However, one of the reasons that a function is a + portability trap is if it has the wrong signature. Declaring + FUNCTION with a different signature in C is a compilation error, so + this macro must use the same type as any existing declaration so + that programs that avoid the problematic FUNCTION do not fail to + compile merely because they included a header that poisoned the + function. But this implies that _GL_WARN_ON_USE is only safe to + use if FUNCTION is known to already have a declaration. Use of + this macro implies that there must not be any other macro hiding + the declaration of FUNCTION; but undefining FUNCTION first is part + of the poisoning process anyway (although for symbols that are + provided only via a macro, the result is a compilation error rather + than a warning containing "literal string"). Also note that in + C++, it is only safe to use if FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system <stdio.h>: + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static inline char ***rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function __attribute__ ((__warning__ (message))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") + is like _GL_WARN_ON_USE (function, "string"), except that the function is + declared with the given prototype, consisting of return type, parameters, + and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif diff --git a/config.h.in b/config.h.in index 115612b..4bf512d 100644 --- a/config.h.in +++ b/config.h.in @@ -47,7 +47,7 @@ /* Define as the word index where to find the sign of 'double'. */ #undef DBL_SIGNBIT_WORD -/* Define to 1 if the package shall run at any location in the filesystem. */ +/* Define to 1 if the package shall run at any location in the file system. */ #undef ENABLE_RELOCATABLE /* Define as the bit index in the word where to find bit 0 of the exponent of @@ -63,52 +63,117 @@ /* Define as the word index where to find the sign of 'float'. */ #undef FLT_SIGNBIT_WORD -/* Define to 1 when using the gnulib module open. */ -#undef GNULIB_OPEN +/* Define to 1 when the gnulib module environ should be tested. */ +#undef GNULIB_TEST_ENVIRON -/* Define to 1 when using the gnulib module uninorm/u16-normalize. */ -#undef GNULIB_UNINORM_U16_NORMALIZE +/* Define to 1 when the gnulib module frexpl should be tested. */ +#undef GNULIB_TEST_FREXPL -/* Define to 1 when using the gnulib module uninorm/u32-normalize. */ -#undef GNULIB_UNINORM_U32_NORMALIZE +/* Define to 1 when the gnulib module getpagesize should be tested. */ +#undef GNULIB_TEST_GETPAGESIZE -/* Define to 1 when using the gnulib module uninorm/u8-normalize. */ -#undef GNULIB_UNINORM_U8_NORMALIZE +/* Define to 1 when the gnulib module malloc-posix should be tested. */ +#undef GNULIB_TEST_MALLOC_POSIX -/* Define to 1 when using the gnulib module unistr/u16-mbtouc. */ +/* Define to 1 when the gnulib module mbrtowc should be tested. */ +#undef GNULIB_TEST_MBRTOWC + +/* Define to 1 when the gnulib module mbsinit should be tested. */ +#undef GNULIB_TEST_MBSINIT + +/* Define to 1 when the gnulib module mbsnlen should be tested. */ +#undef GNULIB_TEST_MBSNLEN + +/* Define to 1 when the gnulib module memchr should be tested. */ +#undef GNULIB_TEST_MEMCHR + +/* Define to 1 when the gnulib module putenv should be tested. */ +#undef GNULIB_TEST_PUTENV + +/* Define to 1 when the gnulib module setenv should be tested. */ +#undef GNULIB_TEST_SETENV + +/* Define to 1 when the gnulib module signbit should be tested. */ +#undef GNULIB_TEST_SIGNBIT + +/* Define to 1 when the gnulib module strerror should be tested. */ +#undef GNULIB_TEST_STRERROR + +/* Define to 1 when the gnulib module strncat should be tested. */ +#undef GNULIB_TEST_STRNCAT + +/* Define to 1 when the gnulib module uninorm/u16-normalize should be tested. + */ +#undef GNULIB_TEST_UNINORM_U16_NORMALIZE + +/* Define to 1 when the gnulib module uninorm/u32-normalize should be tested. + */ +#undef GNULIB_TEST_UNINORM_U32_NORMALIZE + +/* Define to 1 when the gnulib module uninorm/u8-normalize should be tested. + */ +#undef GNULIB_TEST_UNINORM_U8_NORMALIZE + +/* Define to 1 when the gnulib module unsetenv should be tested. */ +#undef GNULIB_TEST_UNSETENV + +/* Define to 1 when the gnulib module wctob should be tested. */ +#undef GNULIB_TEST_WCTOB + +/* Define to 1 when the gnulib module wcwidth should be tested. */ +#undef GNULIB_TEST_WCWIDTH + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u16-mbtouc shall be considered present. */ #undef GNULIB_UNISTR_U16_MBTOUC -/* Define to 1 when using the gnulib module unistr/u16-mbtoucr. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u16-mbtoucr shall be considered present. + */ #undef GNULIB_UNISTR_U16_MBTOUCR -/* Define to 1 when using the gnulib module unistr/u16-mbtouc-unsafe. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u16-mbtouc-unsafe shall be considered + present. */ #undef GNULIB_UNISTR_U16_MBTOUC_UNSAFE -/* Define to 1 when using the gnulib module unistr/u16-uctomb. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u16-uctomb shall be considered present. */ #undef GNULIB_UNISTR_U16_UCTOMB -/* Define to 1 when using the gnulib module unistr/u32-mbtouc. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u32-mbtouc shall be considered present. */ #undef GNULIB_UNISTR_U32_MBTOUC -/* Define to 1 when using the gnulib module unistr/u32-mbtoucr. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u32-mbtoucr shall be considered present. + */ #undef GNULIB_UNISTR_U32_MBTOUCR -/* Define to 1 when using the gnulib module unistr/u32-mbtouc-unsafe. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u32-mbtouc-unsafe shall be considered + present. */ #undef GNULIB_UNISTR_U32_MBTOUC_UNSAFE -/* Define to 1 when using the gnulib module unistr/u32-uctomb. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u32-uctomb shall be considered present. */ #undef GNULIB_UNISTR_U32_UCTOMB -/* Define to 1 when using the gnulib module unistr/u8-mbtouc. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-mbtouc shall be considered present. */ #undef GNULIB_UNISTR_U8_MBTOUC -/* Define to 1 when using the gnulib module unistr/u8-mbtoucr. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-mbtoucr shall be considered present. */ #undef GNULIB_UNISTR_U8_MBTOUCR -/* Define to 1 when using the gnulib module unistr/u8-mbtouc-unsafe. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-mbtouc-unsafe shall be considered + present. */ #undef GNULIB_UNISTR_U8_MBTOUC_UNSAFE -/* Define to 1 when using the gnulib module unistr/u8-uctomb. */ +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-uctomb shall be considered present. */ #undef GNULIB_UNISTR_U8_UCTOMB /* Define to 1 if you have 'alloca' after including <alloca.h>, a header that @@ -162,6 +227,14 @@ don't. */ #undef HAVE_DECL_GETC_UNLOCKED +/* Define to 1 if you have the declaration of `program_invocation_name', and + to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_NAME + +/* Define to 1 if you have the declaration of `program_invocation_short_name', + and to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + /* Define to 1 if you have the declaration of `strerror', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR @@ -185,18 +258,12 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H -/* Define to 1 if you have the `dup2' function. */ -#undef HAVE_DUP2 - /* Define if you have the declaration of environ. */ #undef HAVE_ENVIRON_DECL /* Define to 1 if you have the <errno.h> header file. */ #undef HAVE_ERRNO_H -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - /* Define to 1 if you have the <float.h> header file. */ #undef HAVE_FLOAT_H @@ -239,6 +306,9 @@ /* Define if the isnan(long double) function is available in libc. */ #undef HAVE_ISNANL_IN_LIBC +/* Define to 1 if you have the `iswblank' function. */ +#undef HAVE_ISWBLANK + /* Define to 1 if you have the `iswcntrl' function. */ #undef HAVE_ISWCNTRL @@ -294,15 +364,361 @@ /* Define to 1 if you have the `mprotect' function. */ #undef HAVE_MPROTECT +/* Define to 1 if you have the `newlocale' function. */ +#undef HAVE_NEWLOCALE + /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define to 1 if you have the <OS.h> header file. */ #undef HAVE_OS_H +/* Define to 1 if you have the `pthread_atfork' function. */ +#undef HAVE_PTHREAD_ATFORK + +/* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */ +#undef HAVE_PTHREAD_MUTEX_RECURSIVE + +/* Define if the POSIX multithreading library has read/write locks. */ +#undef HAVE_PTHREAD_RWLOCK + /* Define to 1 if you have the <random.h> header file. */ #undef HAVE_RANDOM_H +/* Define to 1 if acosl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ACOSL + +/* Define to 1 if asinl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ASINL + +/* Define to 1 if atanl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ATANL + +/* Define to 1 if atoll is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ATOLL + +/* Define to 1 if btowc is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_BTOWC + +/* Define to 1 if canonicalize_file_name is declared even after undefining + macros. */ +#undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME + +/* Define to 1 if ceilf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_CEILF + +/* Define to 1 if ceill is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_CEILL + +/* Define to 1 if chown is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_CHOWN + +/* Define to 1 if cosl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_COSL + +/* Define to 1 if dup2 is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_DUP2 + +/* Define to 1 if dup3 is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_DUP3 + +/* Define to 1 if duplocale is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_DUPLOCALE + +/* Define to 1 if endusershell is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ENDUSERSHELL + +/* Define to 1 if environ is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ENVIRON + +/* Define to 1 if euidaccess is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_EUIDACCESS + +/* Define to 1 if expl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_EXPL + +/* Define to 1 if faccessat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FACCESSAT + +/* Define to 1 if fchdir is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FCHDIR + +/* Define to 1 if fchownat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FCHOWNAT + +/* Define to 1 if floorf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FLOORF + +/* Define to 1 if floorl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FLOORL + +/* Define to 1 if frexpl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FREXPL + +/* Define to 1 if fsync is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FSYNC + +/* Define to 1 if ftruncate is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FTRUNCATE + +/* Define to 1 if getcwd is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETCWD + +/* Define to 1 if getdomainname is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETDOMAINNAME + +/* Define to 1 if getdtablesize is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETDTABLESIZE + +/* Define to 1 if getgroups is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETGROUPS + +/* Define to 1 if gethostname is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETHOSTNAME + +/* Define to 1 if getloadavg is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLOADAVG + +/* Define to 1 if getlogin is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLOGIN + +/* Define to 1 if getlogin_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLOGIN_R + +/* Define to 1 if getpagesize is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETPAGESIZE + +/* Define to 1 if getsubopt is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETSUBOPT + +/* Define to 1 if getusershell is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETUSERSHELL + +/* Define to 1 if grantpt is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GRANTPT + +/* Define to 1 if initstat_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_INITSTAT_R + +/* Define to 1 if lchown is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LCHOWN + +/* Define to 1 if ldexpl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LDEXPL + +/* Define to 1 if link is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LINK + +/* Define to 1 if linkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LINKAT + +/* Define to 1 if logb is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LOGB + +/* Define to 1 if logl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LOGL + +/* Define to 1 if lseek is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LSEEK + +/* Define to 1 if mbrlen is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MBRLEN + +/* Define to 1 if mbrtowc is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MBRTOWC + +/* Define to 1 if mbsinit is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MBSINIT + +/* Define to 1 if mbsnrtowcs is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MBSNRTOWCS + +/* Define to 1 if mbsrtowcs is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MBSRTOWCS + +/* Define to 1 if memmem is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MEMMEM + +/* Define to 1 if mempcpy is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MEMPCPY + +/* Define to 1 if memrchr is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MEMRCHR + +/* Define to 1 if mkdtemp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKDTEMP + +/* Define to 1 if mkostemp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKOSTEMP + +/* Define to 1 if mkostemps is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKOSTEMPS + +/* Define to 1 if mkstemp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKSTEMP + +/* Define to 1 if mkstemps is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKSTEMPS + +/* Define to 1 if pipe2 is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PIPE2 + +/* Define to 1 if pread is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PREAD + +/* Define to 1 if ptsname is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PTSNAME + +/* Define to 1 if random_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RANDOM_R + +/* Define to 1 if rawmemchr is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RAWMEMCHR + +/* Define to 1 if readlink is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_READLINK + +/* Define to 1 if readlinkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_READLINKAT + +/* Define to 1 if realpath is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_REALPATH + +/* Define to 1 if rmdir is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RMDIR + +/* Define to 1 if round is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ROUND + +/* Define to 1 if roundf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ROUNDF + +/* Define to 1 if roundl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ROUNDL + +/* Define to 1 if rpmatch is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RPMATCH + +/* Define to 1 if setenv is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SETENV + +/* Define to 1 if setstate_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SETSTATE_R + +/* Define to 1 if setusershell is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SETUSERSHELL + +/* Define to 1 if sinl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SINL + +/* Define to 1 if sleep is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SLEEP + +/* Define to 1 if sqrtl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SQRTL + +/* Define to 1 if srandom_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SRANDOM_R + +/* Define to 1 if stpcpy is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STPCPY + +/* Define to 1 if stpncpy is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STPNCPY + +/* Define to 1 if strcasestr is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRCASESTR + +/* Define to 1 if strchrnul is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRCHRNUL + +/* Define to 1 if strdup is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRDUP + +/* Define to 1 if strncat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRNCAT + +/* Define to 1 if strndup is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRNDUP + +/* Define to 1 if strnlen is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRNLEN + +/* Define to 1 if strpbrk is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRPBRK + +/* Define to 1 if strsep is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRSEP + +/* Define to 1 if strsignal is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRSIGNAL + +/* Define to 1 if strtod is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOD + +/* Define to 1 if strtok_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOK_R + +/* Define to 1 if strtoll is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOLL + +/* Define to 1 if strtoull is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOULL + +/* Define to 1 if strverscmp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRVERSCMP + +/* Define to 1 if symlink is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SYMLINK + +/* Define to 1 if symlinkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SYMLINKAT + +/* Define to 1 if tanl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TANL + +/* Define to 1 if trunc is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TRUNC + +/* Define to 1 if truncf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TRUNCF + +/* Define to 1 if truncl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TRUNCL + +/* Define to 1 if ttyname_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TTYNAME_R + +/* Define to 1 if unlink is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNLINK + +/* Define to 1 if unlinkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNLINKAT + +/* Define to 1 if unlockpt is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNLOCKPT + +/* Define to 1 if unsetenv is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNSETENV + +/* Define to 1 if usleep is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_USLEEP + +/* Define to 1 if wcrtomb is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_WCRTOMB + +/* Define to 1 if wcsnrtombs is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_WCSNRTOMBS + +/* Define to 1 if wcsrtombs is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_WCSRTOMBS + +/* Define to 1 if wctob is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_WCTOB + +/* Define to 1 if wcwidth is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_WCWIDTH + /* Define to 1 if you have the <search.h> header file. */ #undef HAVE_SEARCH_H @@ -324,6 +740,11 @@ /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF +/* Define if the return value of the snprintf function is the number of of + bytes (excluding the terminating NUL) that would have been produced if the + buffer had been large enough. */ +#undef HAVE_SNPRINTF_RETVAL_C99 + /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H @@ -394,6 +815,9 @@ /* Define to 1 if the system has the type `unsigned long long int'. */ #undef HAVE_UNSIGNED_LONG_LONG_INT +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + /* Define to 1 if you have the <wchar.h> header file. */ #undef HAVE_WCHAR_H @@ -430,6 +854,9 @@ /* Define to 1 if O_NOFOLLOW works. */ #undef HAVE_WORKING_O_NOFOLLOW +/* Define to 1 if you have the <xlocale.h> header file. */ +#undef HAVE_XLOCALE_H + /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL @@ -527,9 +954,6 @@ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O -/* Define to 1 if open() fails to recognize a trailing slash. */ -#undef OPEN_TRAILING_SLASH_BUG - /* Name of package */ #undef PACKAGE @@ -551,17 +975,13 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to the type that is the result of default argument promotions of - type mode_t. */ -#undef PROMOTED_MODE_T +/* Define if the pthread_in_use() detection is hard. */ +#undef PTHREAD_IN_USE_DETECTION_HARD /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX -/* Define to 1 if dup2 returns 0 instead of the target fd. */ -#undef REPLACE_DUP2 - /* Define this to 1 if strerror is broken. */ #undef REPLACE_STRERROR @@ -593,9 +1013,36 @@ /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P +/* Define if the POSIX multithreading library can be used. */ +#undef USE_POSIX_THREADS + +/* Define if references to the POSIX multithreading library should be made + weak. */ +#undef USE_POSIX_THREADS_WEAK + +/* Define if the GNU Pth multithreading library can be used. */ +#undef USE_PTH_THREADS + +/* Define if references to the GNU Pth multithreading library should be made + weak. */ +#undef USE_PTH_THREADS_WEAK + +/* Define if the old Solaris multithreading library can be used. */ +#undef USE_SOLARIS_THREADS + +/* Define if references to the old Solaris multithreading library should be + made weak. */ +#undef USE_SOLARIS_THREADS_WEAK + +/* Define if the Win32 multithreading API can be used. */ +#undef USE_WIN32_THREADS + /* Version number of package */ #undef VERSION +/* Define to 1 if unsetenv returns void instead of int. */ +#undef VOID_UNSETENV + /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wchar_t'. */ #undef WCHAR_T_SUFFIX @@ -676,9 +1123,6 @@ /* Define to a type if <wchar.h> does not define. */ #undef mbstate_t -/* Define to `int' if <sys/types.h> does not define. */ -#undef mode_t - /* Define as the type of the result of subtracting two pointers, if the system doesn't define it. */ #undef ptrdiff_t @@ -687,24 +1131,28 @@ nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict, even - though the corresponding Sun C compiler does, which causes - "#define restrict _Restrict" in the previous line. Perhaps some future - version of Sun C++ will work with _Restrict; if so, it'll probably - define __RESTRICT, just as Sun C does. */ +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict +# define __restrict__ #endif /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t -/* Define as a marker that can be attached to function parameter declarations - for parameters that are not used. This helps to reduce warnings, such as - from GCC -Wunused-parameter. */ +/* Define as a marker that can be attached to declarations that might not + be used. This helps to reduce warnings, such as from + GCC -Wunused-parameter. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) +# define _GL_UNUSED __attribute__ ((__unused__)) #else -# define _UNUSED_PARAMETER_ +# define _GL_UNUSED #endif +/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name + is a misnomer outside of parameter lists. */ +#define _UNUSED_PARAMETER_ _GL_UNUSED @@ -1,10 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64. +# Generated by GNU Autoconf 2.65. +# # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software -# Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. @@ -673,7 +675,8 @@ fi -exec 7<&0 </dev/null 6>&1 +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, @@ -737,8 +740,9 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_func_list= +gl_use_threads_default= ac_header_list= +ac_func_list= ac_subst_vars='gltests_LTLIBOBJS gltests_LIBOBJS gl_LTLIBOBJS @@ -758,31 +762,128 @@ DLL_VARIABLE WOE32DLL_FALSE WOE32DLL_TRUE LIBTESTS_LIBDEPS -LOCALE_H +YIELD_LIB NEXT_AS_FIRST_DIRECTIVE_LOCALE_H NEXT_LOCALE_H +HAVE_XLOCALE_H +REPLACE_DUPLOCALE +HAVE_DUPLOCALE +GNULIB_DUPLOCALE LTLIBINTL LIBINTL -FCNTL_H -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H -NEXT_FCNTL_H -REPLACE_OPEN -GNULIB_OPEN LOCALE_TR_UTF8 LOCALE_FR +gltests_WITNESS REPLACE_ISWCNTRL -WCTYPE_H HAVE_WCTYPE_H NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H NEXT_WCTYPE_H +HAVE_ISWBLANK HAVE_ISWCNTRL +HAVE_WINT_T +HAVE_WCHAR_H NEXT_AS_FIRST_DIRECTIVE_WCHAR_H NEXT_WCHAR_H -HAVE_WCHAR_H -HAVE_WINT_T HAVE_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_UNISTD_H NEXT_UNISTD_H +UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS +UNISTD_H_HAVE_WINSOCK2_H +REPLACE_WRITE +REPLACE_USLEEP +REPLACE_UNLINKAT +REPLACE_UNLINK +REPLACE_TTYNAME_R +REPLACE_SYMLINK +REPLACE_SLEEP +REPLACE_RMDIR +REPLACE_READLINK +REPLACE_PREAD +REPLACE_LSEEK +REPLACE_LINKAT +REPLACE_LINK +REPLACE_LCHOWN +REPLACE_GETPAGESIZE +REPLACE_GETGROUPS +REPLACE_GETCWD +REPLACE_FCHOWNAT +REPLACE_DUP2 +REPLACE_DUP +REPLACE_CLOSE +REPLACE_CHOWN +HAVE_SYS_PARAM_H +HAVE_OS_H +HAVE_DECL_GETUSERSHELL +HAVE_DECL_GETPAGESIZE +HAVE_DECL_GETLOGIN_R +HAVE_DECL_ENVIRON +HAVE_USLEEP +HAVE_UNLINKAT +HAVE_TTYNAME_R +HAVE_SYMLINKAT +HAVE_SYMLINK +HAVE_SLEEP +HAVE_READLINKAT +HAVE_READLINK +HAVE_PREAD +HAVE_PIPE2 +HAVE_LINKAT +HAVE_LINK +HAVE_LCHOWN +HAVE_GETPAGESIZE +HAVE_GETLOGIN +HAVE_GETHOSTNAME +HAVE_GETGROUPS +HAVE_GETDTABLESIZE +HAVE_GETDOMAINNAME +HAVE_FTRUNCATE +HAVE_FSYNC +HAVE_FCHOWNAT +HAVE_FCHDIR +HAVE_FACCESSAT +HAVE_EUIDACCESS +HAVE_DUP3 +HAVE_DUP2 +HAVE_CHOWN +GNULIB_WRITE +GNULIB_USLEEP +GNULIB_UNLINKAT +GNULIB_UNLINK +GNULIB_UNISTD_H_SIGPIPE +GNULIB_UNISTD_H_GETOPT +GNULIB_TTYNAME_R +GNULIB_SYMLINKAT +GNULIB_SYMLINK +GNULIB_SLEEP +GNULIB_RMDIR +GNULIB_READLINKAT +GNULIB_READLINK +GNULIB_PREAD +GNULIB_PIPE2 +GNULIB_LSEEK +GNULIB_LINKAT +GNULIB_LINK +GNULIB_LCHOWN +GNULIB_GETUSERSHELL +GNULIB_GETPAGESIZE +GNULIB_GETLOGIN_R +GNULIB_GETLOGIN +GNULIB_GETHOSTNAME +GNULIB_GETGROUPS +GNULIB_GETDTABLESIZE +GNULIB_GETDOMAINNAME +GNULIB_GETCWD +GNULIB_FTRUNCATE +GNULIB_FSYNC +GNULIB_FCHOWNAT +GNULIB_FCHDIR +GNULIB_FACCESSAT +GNULIB_EUIDACCESS +GNULIB_ENVIRON +GNULIB_DUP3 +GNULIB_DUP2 +GNULIB_CLOSE +GNULIB_CHOWN NEXT_AS_FIRST_DIRECTIVE_STRING_H NEXT_STRING_H HAVE_RANDOM_H @@ -820,23 +921,27 @@ HAVE__BOOL STDBOOL_H RELOCATABLE APPLE_UNIVERSAL_BUILD +UNDEFINE_STRTOK_R +REPLACE_STRTOK_R REPLACE_STRSIGNAL +REPLACE_STRNLEN +REPLACE_STRNDUP +REPLACE_STRNCAT REPLACE_STRERROR REPLACE_STRCASESTR REPLACE_STRSTR REPLACE_STRDUP +REPLACE_STPNCPY REPLACE_MEMMEM REPLACE_MEMCHR HAVE_STRVERSCMP HAVE_DECL_STRSIGNAL -HAVE_DECL_STRERROR HAVE_DECL_STRTOK_R HAVE_STRCASESTR HAVE_STRSEP HAVE_STRPBRK HAVE_DECL_STRNLEN HAVE_DECL_STRNDUP -HAVE_STRNDUP HAVE_DECL_STRDUP HAVE_STRCHRNUL HAVE_STPNCPY @@ -845,6 +950,8 @@ HAVE_RAWMEMCHR HAVE_DECL_MEMRCHR HAVE_MEMPCPY HAVE_DECL_MEMMEM +HAVE_MEMCHR +HAVE_MBSLEN GNULIB_STRVERSCMP GNULIB_STRSIGNAL GNULIB_STRERROR @@ -869,6 +976,7 @@ GNULIB_STRSEP GNULIB_STRPBRK GNULIB_STRNLEN GNULIB_STRNDUP +GNULIB_STRNCAT GNULIB_STRDUP GNULIB_STRCHRNUL GNULIB_STPNCPY @@ -881,7 +989,6 @@ GNULIB_MEMCHR LOCALE_FR_UTF8 LOCALE_ZH_CN LOCALE_JA -WCHAR_H REPLACE_WCWIDTH REPLACE_WCSNRTOMBS REPLACE_WCSRTOMBS @@ -918,12 +1025,15 @@ GNULIB_WCTOB GNULIB_BTOWC NEXT_AS_FIRST_DIRECTIVE_MATH_H NEXT_MATH_H -VOID_UNSETENV +REPLACE_UNSETENV REPLACE_STRTOD +REPLACE_SETENV +REPLACE_REALPATH REPLACE_PUTENV REPLACE_MKSTEMP -HAVE_DECL_GETLOADAVG +REPLACE_CANONICALIZE_FILE_NAME HAVE_UNSETENV +HAVE_UNLOCKPT HAVE_SYS_LOADAVG_H HAVE_STRUCT_RANDOM_DATA HAVE_STRTOULL @@ -931,29 +1041,53 @@ HAVE_STRTOLL HAVE_STRTOD HAVE_SETENV HAVE_RPMATCH -HAVE_RANDOM_R +HAVE_REALPATH HAVE_REALLOC_POSIX +HAVE_RANDOM_R +HAVE_PTSNAME +HAVE_MKSTEMPS +HAVE_MKSTEMP +HAVE_MKOSTEMPS +HAVE_MKOSTEMP HAVE_MKDTEMP +HAVE_GRANTPT HAVE_GETSUBOPT +HAVE_DECL_GETLOADAVG +HAVE_CANONICALIZE_FILE_NAME HAVE_CALLOC_POSIX HAVE_ATOLL GNULIB_UNSETENV +GNULIB_UNLOCKPT GNULIB_STRTOULL GNULIB_STRTOLL GNULIB_STRTOD GNULIB_SETENV GNULIB_RPMATCH +GNULIB_REALPATH +GNULIB_REALLOC_POSIX GNULIB_RANDOM_R GNULIB_PUTENV +GNULIB_PTSNAME +GNULIB_MKSTEMPS GNULIB_MKSTEMP +GNULIB_MKOSTEMPS +GNULIB_MKOSTEMP GNULIB_MKDTEMP +GNULIB_MALLOC_POSIX +GNULIB_GRANTPT GNULIB_GETSUBOPT GNULIB_GETLOADAVG -GNULIB_ATOLL +GNULIB_CANONICALIZE_FILE_NAME GNULIB_CALLOC_POSIX -GNULIB_REALLOC_POSIX -GNULIB_MALLOC_POSIX +GNULIB_ATOLL HAVE_MALLOC_POSIX +LTLIBMULTITHREAD +LIBMULTITHREAD +LTLIBTHREAD +LIBTHREAD +LIBPTH_PREFIX +LTLIBPTH +LIBPTH INTL_MACOSX_LIBS LOCALCHARSET_TESTS_ENVIRONMENT GLIBC21 @@ -983,30 +1117,52 @@ REPLACE_FLOORL REPLACE_FLOORF REPLACE_CEILL REPLACE_CEILF +HAVE_DECL_TRUNCL HAVE_DECL_TRUNCF HAVE_DECL_TRUNC HAVE_DECL_TANL HAVE_DECL_SQRTL HAVE_DECL_SINL +HAVE_DECL_ROUNDL +HAVE_DECL_ROUNDF +HAVE_DECL_ROUND HAVE_DECL_LOGL +HAVE_DECL_LOGB HAVE_DECL_LDEXPL HAVE_DECL_FREXPL +HAVE_DECL_FLOORL +HAVE_DECL_FLOORF HAVE_DECL_EXPL HAVE_DECL_COSL +HAVE_DECL_CEILL +HAVE_DECL_CEILF HAVE_DECL_ATANL HAVE_DECL_ASINL HAVE_DECL_ACOSL +HAVE_TANL +HAVE_SQRTL +HAVE_SINL +HAVE_LOGL HAVE_ISNANL HAVE_ISNAND HAVE_ISNANF +HAVE_EXPL +HAVE_COSL +HAVE_ATANL +HAVE_ASINL +HAVE_ACOSL GNULIB_TRUNCL GNULIB_TRUNCF GNULIB_TRUNC +GNULIB_TANL +GNULIB_SQRTL +GNULIB_SINL GNULIB_SIGNBIT GNULIB_ROUNDL GNULIB_ROUNDF GNULIB_ROUND -GNULIB_MATHL +GNULIB_LOGL +GNULIB_LOGB GNULIB_LDEXPL GNULIB_ISNANL GNULIB_ISNAND @@ -1018,8 +1174,13 @@ GNULIB_FREXPL GNULIB_FREXP GNULIB_FLOORL GNULIB_FLOORF +GNULIB_EXPL +GNULIB_COSL GNULIB_CEILL GNULIB_CEILF +GNULIB_ATANL +GNULIB_ASINL +GNULIB_ACOSL FLOAT_H NEXT_AS_FIRST_DIRECTIVE_FLOAT_H NEXT_FLOAT_H @@ -1035,56 +1196,6 @@ NEXT_ERRNO_H PRAGMA_SYSTEM_HEADER INCLUDE_NEXT_AS_FIRST_DIRECTIVE INCLUDE_NEXT -UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS -UNISTD_H_HAVE_WINSOCK2_H -REPLACE_WRITE -REPLACE_LSEEK -REPLACE_LCHOWN -REPLACE_GETPAGESIZE -REPLACE_GETCWD -REPLACE_FCHDIR -REPLACE_DUP2 -REPLACE_CLOSE -REPLACE_CHOWN -HAVE_SYS_PARAM_H -HAVE_OS_H -HAVE_DECL_GETLOGIN_R -HAVE_DECL_ENVIRON -HAVE_SLEEP -HAVE_READLINK -HAVE_LINK -HAVE_GETUSERSHELL -HAVE_GETPAGESIZE -HAVE_GETHOSTNAME -HAVE_GETDTABLESIZE -HAVE_GETDOMAINNAME -HAVE_FTRUNCATE -HAVE_FSYNC -HAVE_EUIDACCESS -HAVE_DUP2 -GNULIB_WRITE -GNULIB_UNISTD_H_SIGPIPE -GNULIB_UNISTD_H_GETOPT -GNULIB_SLEEP -GNULIB_READLINK -GNULIB_LSEEK -GNULIB_LINK -GNULIB_LCHOWN -GNULIB_GETUSERSHELL -GNULIB_GETPAGESIZE -GNULIB_GETLOGIN_R -GNULIB_GETHOSTNAME -GNULIB_GETDTABLESIZE -GNULIB_GETDOMAINNAME -GNULIB_GETCWD -GNULIB_FTRUNCATE -GNULIB_FSYNC -GNULIB_FCHDIR -GNULIB_EUIDACCESS -GNULIB_ENVIRON -GNULIB_DUP2 -GNULIB_CLOSE -GNULIB_CHOWN ALLOCA_H ALLOCA GL_COND_LIBTOOL_FALSE @@ -1206,6 +1317,7 @@ ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking +enable_threads enable_shared enable_static with_pic @@ -1214,6 +1326,7 @@ with_gnu_ld enable_libtool_lock enable_rpath with_libiconv_prefix +with_libpth_prefix enable_relocatable enable_namespacing ' @@ -1336,7 +1449,7 @@ do expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed -e 's/[+]/x/g' -e 's/[-.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1362,7 +1475,7 @@ do expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed -e 's/[+]/x/g' -e 's/[-.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1566,7 +1679,7 @@ do expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed -e 's/[+]/x/g' -e 's/[-.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1582,7 +1695,7 @@ do expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed -e 's/[+]/x/g' -e 's/[-.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1847,13 +1960,17 @@ Optional Features: --disable-silent-rules verbose build output (undo: `make V=0') --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-threads={posix|solaris|pth|win32} + specify multithreading API + --disable-threads build without multithread safety --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-rpath do not hardcode runtime library paths - --enable-relocatable install a package that can be moved in the filesystem + --enable-relocatable install a package that can be moved in the file + system --disable-namespacing build a library that exports undesired symbols Optional Packages: @@ -1865,6 +1982,8 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libpth-prefix[=DIR] search for libpth in DIR/include and DIR/lib + --without-libpth-prefix don't search for libpth in includedir and libdir Some influential environment variables: CC C compiler command @@ -1872,7 +1991,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor @@ -1943,7 +2062,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.64 +generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1990,7 +2109,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -2027,7 +2146,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -2156,7 +2275,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -2233,7 +2352,7 @@ fi # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -2478,7 +2597,7 @@ rm -f conftest.val fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2579,7 +2698,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.64. Invocation command line was +generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2832,7 +2951,7 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 @@ -2841,9 +2960,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in @@ -2857,7 +2976,6 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_func_list " dup2" as_fn_append ac_header_list " errno.h" as_fn_append ac_header_list " float.h" as_fn_append ac_header_list " iconv.h" @@ -2866,6 +2984,7 @@ as_fn_append ac_func_list " mbsinit" as_fn_append ac_func_list " mbrtowc" as_fn_append ac_header_list " sys/mman.h" as_fn_append ac_func_list " mprotect" +as_fn_append ac_func_list " memchr" gl_printf_safe=yes as_fn_append ac_header_list " stddef.h" as_fn_append ac_header_list " stdint.h" @@ -2876,10 +2995,12 @@ as_fn_append ac_header_list " unistd.h" as_fn_append ac_func_list " stpcpy" as_fn_append ac_func_list " strdup" as_fn_append ac_func_list " iswcntrl" +as_fn_append ac_func_list " iswblank" as_fn_append ac_header_list " wctype.h" as_fn_append ac_func_list " wcwidth" -as_fn_append ac_header_list " fcntl.h" +as_fn_append ac_header_list " xlocale.h" as_fn_append ac_header_list " locale.h" +as_fn_append ac_func_list " newlocale" as_fn_append ac_func_list " setenv" as_fn_append ac_header_list " sys/socket.h" as_fn_append ac_func_list " wctob" @@ -3295,6 +3416,7 @@ IFS=$as_save_IFS fi + test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else @@ -3302,13 +3424,13 @@ fi # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } + mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; @@ -3809,32 +3931,30 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stdio.h> + int main () { -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -3896,10 +4016,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 @@ -3907,51 +4027,18 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" @@ -3984,13 +4071,72 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi -rm -f conftest$ac_cv_exeext +rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : @@ -5177,8 +5323,8 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# define __EXTENSIONS__ 1 - $ac_includes_default +# define __EXTENSIONS__ 1 + $ac_includes_default int main () { @@ -5246,6 +5392,1031 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + # Check whether --enable-threads was given. +if test "${enable_threads+set}" = set; then : + enableval=$enable_threads; gl_use_threads=$enableval +else + if test -n "$gl_use_threads_default"; then + gl_use_threads="$gl_use_threads_default" + else + case "$host_os" in + osf*) gl_use_threads=no ;; + cygwin*) + case `uname -r` in + 1.[0-5].*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + ;; + *) gl_use_threads=yes ;; + esac + fi + +fi + + if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + # For using <pthread.h>: + case "$host_os" in + osf*) + # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + # groks <pthread.h>. cc also understands the flag -pthread, but + # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # 2. putting a flag into CPPFLAGS that has an effect on the linker + # causes the AC_TRY_LINK test below to succeed unexpectedly, + # leading to wrong values of LIBTHREAD and LTLIBTHREAD. + CPPFLAGS="$CPPFLAGS -D_REENTRANT" + ;; + esac + # Some systems optimize for single-threaded programs by default, and + # need special flags to disable these optimizations. For example, the + # definition of 'errno' in <errno.h>. + case "$host_os" in + aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; + solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; + esac + fi + + + + + # Code from module alloca-opt: + # Code from module alloca-opt-tests: + # Code from module arg-nonnull: + # Code from module array-mergesort: + # Code from module array-mergesort-tests: + # Code from module c++defs: + # Code from module c-ctype: + # Code from module c-ctype-tests: + # Code from module c-strcase: + # Code from module c-strcase-tests: + # Code from module c-strcaseeq: + # Code from module configmake: + # Code from module environ: + # Code from module environ-tests: + # Code from module errno: + # Code from module errno-tests: + # Code from module error: + # Code from module exitfail: + # Code from module extensions: + + # Code from module float: + # Code from module fpieee: + + # Code from module fpucw: + # Code from module frexpl-nolibm: + # Code from module frexpl-nolibm-tests: + # Code from module fseterr: + # Code from module fseterr-tests: + # Code from module getpagesize: + # Code from module gettext-h: + # Code from module gperf: + # Code from module havelib: + # Code from module iconv: + # Code from module iconv-h: + # Code from module iconv-h-tests: + # Code from module iconv-tests: + # Code from module iconv_open: + # Code from module include_next: + # Code from module inline: + # Code from module intprops: + # Code from module isnand-nolibm: + # Code from module isnand-nolibm-tests: + # Code from module isnanf-nolibm: + # Code from module isnanf-nolibm-tests: + # Code from module isnanl-nolibm: + # Code from module isnanl-nolibm-tests: + # Code from module localcharset: + # Code from module locale: + # Code from module locale-tests: + # Code from module localename: + # Code from module localename-tests: + # Code from module lock: + # Code from module lock-tests: + # Code from module malloc-posix: + # Code from module malloca: + # Code from module malloca-tests: + # Code from module math: + # Code from module math-tests: + # Code from module mbchar: + # Code from module mbiter: + # Code from module mbrtowc: + # Code from module mbrtowc-tests: + # Code from module mbsinit: + # Code from module mbsinit-tests: + # Code from module mbsnlen: + # Code from module memchr: + # Code from module memchr-tests: + # Code from module memcmp2: + # Code from module memxfrm: + # Code from module minmax: + # Code from module multiarch: + # Code from module nocrash: + # Code from module printf-frexp: + # Code from module printf-frexp-tests: + # Code from module printf-frexpl: + # Code from module printf-frexpl-tests: + # Code from module printf-safe: + # Code from module progname: + # Code from module putenv: + # Code from module relocatable-lib-lgpl: + # Code from module setenv: + # Code from module setenv-tests: + # Code from module signbit: + # Code from module signbit-tests: + # Code from module size_max: + # Code from module stdbool: + # Code from module stdbool-tests: + # Code from module stddef: + # Code from module stddef-tests: + # Code from module stdint: + # Code from module stdint-tests: + # Code from module stdlib: + # Code from module stdlib-tests: + # Code from module streq: + # Code from module strerror: + # Code from module strerror-tests: + # Code from module striconveh: + # Code from module striconveh-tests: + # Code from module striconveha: + # Code from module striconveha-tests: + # Code from module string: + # Code from module string-tests: + # Code from module strncat: + # Code from module strncat-tests: + # Code from module thread: + # Code from module threadlib: + + + + # Code from module unicase/base: + # Code from module unicase/cased: + # Code from module unicase/cased-tests: + # Code from module unicase/empty-prefix-context: + # Code from module unicase/empty-suffix-context: + # Code from module unicase/ignorable: + # Code from module unicase/ignorable-tests: + # Code from module unicase/locale-language: + # Code from module unicase/locale-language-tests: + # Code from module unicase/special-casing: + # Code from module unicase/tocasefold: + # Code from module unicase/tolower: + # Code from module unicase/tolower-tests: + # Code from module unicase/totitle: + # Code from module unicase/totitle-tests: + # Code from module unicase/toupper: + # Code from module unicase/toupper-tests: + # Code from module unicase/u16-casecmp: + # Code from module unicase/u16-casecmp-tests: + # Code from module unicase/u16-casecoll: + # Code from module unicase/u16-casecoll-tests: + # Code from module unicase/u16-casefold: + # Code from module unicase/u16-casefold-tests: + # Code from module unicase/u16-casemap: + # Code from module unicase/u16-casexfrm: + # Code from module unicase/u16-ct-casefold: + # Code from module unicase/u16-ct-tolower: + # Code from module unicase/u16-ct-totitle: + # Code from module unicase/u16-ct-toupper: + # Code from module unicase/u16-is-cased: + # Code from module unicase/u16-is-cased-tests: + # Code from module unicase/u16-is-casefolded: + # Code from module unicase/u16-is-casefolded-tests: + # Code from module unicase/u16-is-invariant: + # Code from module unicase/u16-is-lowercase: + # Code from module unicase/u16-is-lowercase-tests: + # Code from module unicase/u16-is-titlecase: + # Code from module unicase/u16-is-titlecase-tests: + # Code from module unicase/u16-is-uppercase: + # Code from module unicase/u16-is-uppercase-tests: + # Code from module unicase/u16-tolower: + # Code from module unicase/u16-tolower-tests: + # Code from module unicase/u16-totitle: + # Code from module unicase/u16-totitle-tests: + # Code from module unicase/u16-toupper: + # Code from module unicase/u16-toupper-tests: + # Code from module unicase/u32-casecmp: + # Code from module unicase/u32-casecmp-tests: + # Code from module unicase/u32-casecoll: + # Code from module unicase/u32-casecoll-tests: + # Code from module unicase/u32-casefold: + # Code from module unicase/u32-casefold-tests: + # Code from module unicase/u32-casemap: + # Code from module unicase/u32-casexfrm: + # Code from module unicase/u32-ct-casefold: + # Code from module unicase/u32-ct-tolower: + # Code from module unicase/u32-ct-totitle: + # Code from module unicase/u32-ct-toupper: + # Code from module unicase/u32-is-cased: + # Code from module unicase/u32-is-cased-tests: + # Code from module unicase/u32-is-casefolded: + # Code from module unicase/u32-is-casefolded-tests: + # Code from module unicase/u32-is-invariant: + # Code from module unicase/u32-is-lowercase: + # Code from module unicase/u32-is-lowercase-tests: + # Code from module unicase/u32-is-titlecase: + # Code from module unicase/u32-is-titlecase-tests: + # Code from module unicase/u32-is-uppercase: + # Code from module unicase/u32-is-uppercase-tests: + # Code from module unicase/u32-tolower: + # Code from module unicase/u32-tolower-tests: + # Code from module unicase/u32-totitle: + # Code from module unicase/u32-totitle-tests: + # Code from module unicase/u32-toupper: + # Code from module unicase/u32-toupper-tests: + # Code from module unicase/u8-casecmp: + # Code from module unicase/u8-casecmp-tests: + # Code from module unicase/u8-casecoll: + # Code from module unicase/u8-casecoll-tests: + # Code from module unicase/u8-casefold: + # Code from module unicase/u8-casefold-tests: + # Code from module unicase/u8-casemap: + # Code from module unicase/u8-casexfrm: + # Code from module unicase/u8-ct-casefold: + # Code from module unicase/u8-ct-tolower: + # Code from module unicase/u8-ct-totitle: + # Code from module unicase/u8-ct-toupper: + # Code from module unicase/u8-is-cased: + # Code from module unicase/u8-is-cased-tests: + # Code from module unicase/u8-is-casefolded: + # Code from module unicase/u8-is-casefolded-tests: + # Code from module unicase/u8-is-invariant: + # Code from module unicase/u8-is-lowercase: + # Code from module unicase/u8-is-lowercase-tests: + # Code from module unicase/u8-is-titlecase: + # Code from module unicase/u8-is-titlecase-tests: + # Code from module unicase/u8-is-uppercase: + # Code from module unicase/u8-is-uppercase-tests: + # Code from module unicase/u8-tolower: + # Code from module unicase/u8-tolower-tests: + # Code from module unicase/u8-totitle: + # Code from module unicase/u8-totitle-tests: + # Code from module unicase/u8-toupper: + # Code from module unicase/u8-toupper-tests: + # Code from module unicase/ulc-casecmp: + # Code from module unicase/ulc-casecmp-tests: + # Code from module unicase/ulc-casecoll: + # Code from module unicase/ulc-casecoll-tests: + # Code from module unicase/ulc-casexfrm: + # Code from module uniconv/base: + # Code from module uniconv/u16-conv-from-enc: + # Code from module uniconv/u16-conv-from-enc-tests: + # Code from module uniconv/u16-conv-to-enc: + # Code from module uniconv/u16-conv-to-enc-tests: + # Code from module uniconv/u16-strconv-from-enc: + # Code from module uniconv/u16-strconv-from-enc-tests: + # Code from module uniconv/u16-strconv-from-locale: + # Code from module uniconv/u16-strconv-to-enc: + # Code from module uniconv/u16-strconv-to-enc-tests: + # Code from module uniconv/u16-strconv-to-locale: + # Code from module uniconv/u32-conv-from-enc: + # Code from module uniconv/u32-conv-from-enc-tests: + # Code from module uniconv/u32-conv-to-enc: + # Code from module uniconv/u32-conv-to-enc-tests: + # Code from module uniconv/u32-strconv-from-enc: + # Code from module uniconv/u32-strconv-from-enc-tests: + # Code from module uniconv/u32-strconv-from-locale: + # Code from module uniconv/u32-strconv-to-enc: + # Code from module uniconv/u32-strconv-to-enc-tests: + # Code from module uniconv/u32-strconv-to-locale: + # Code from module uniconv/u8-conv-from-enc: + # Code from module uniconv/u8-conv-from-enc-tests: + # Code from module uniconv/u8-conv-to-enc: + # Code from module uniconv/u8-conv-to-enc-tests: + # Code from module uniconv/u8-strconv-from-enc: + # Code from module uniconv/u8-strconv-from-enc-tests: + # Code from module uniconv/u8-strconv-from-locale: + # Code from module uniconv/u8-strconv-to-enc: + # Code from module uniconv/u8-strconv-to-enc-tests: + # Code from module uniconv/u8-strconv-to-locale: + # Code from module unictype/base: + # Code from module unictype/bidicategory-all: + # Code from module unictype/bidicategory-byname: + # Code from module unictype/bidicategory-byname-tests: + # Code from module unictype/bidicategory-name: + # Code from module unictype/bidicategory-name-tests: + # Code from module unictype/bidicategory-of: + # Code from module unictype/bidicategory-of-tests: + # Code from module unictype/bidicategory-test: + # Code from module unictype/bidicategory-test-tests: + # Code from module unictype/block-all: + # Code from module unictype/block-list: + # Code from module unictype/block-list-tests: + # Code from module unictype/block-of: + # Code from module unictype/block-of-tests: + # Code from module unictype/block-test: + # Code from module unictype/block-test-tests: + # Code from module unictype/category-C: + # Code from module unictype/category-C-tests: + # Code from module unictype/category-Cc: + # Code from module unictype/category-Cc-tests: + # Code from module unictype/category-Cf: + # Code from module unictype/category-Cf-tests: + # Code from module unictype/category-Cn: + # Code from module unictype/category-Cn-tests: + # Code from module unictype/category-Co: + # Code from module unictype/category-Co-tests: + # Code from module unictype/category-Cs: + # Code from module unictype/category-Cs-tests: + # Code from module unictype/category-L: + # Code from module unictype/category-L-tests: + # Code from module unictype/category-Ll: + # Code from module unictype/category-Ll-tests: + # Code from module unictype/category-Lm: + # Code from module unictype/category-Lm-tests: + # Code from module unictype/category-Lo: + # Code from module unictype/category-Lo-tests: + # Code from module unictype/category-Lt: + # Code from module unictype/category-Lt-tests: + # Code from module unictype/category-Lu: + # Code from module unictype/category-Lu-tests: + # Code from module unictype/category-M: + # Code from module unictype/category-M-tests: + # Code from module unictype/category-Mc: + # Code from module unictype/category-Mc-tests: + # Code from module unictype/category-Me: + # Code from module unictype/category-Me-tests: + # Code from module unictype/category-Mn: + # Code from module unictype/category-Mn-tests: + # Code from module unictype/category-N: + # Code from module unictype/category-N-tests: + # Code from module unictype/category-Nd: + # Code from module unictype/category-Nd-tests: + # Code from module unictype/category-Nl: + # Code from module unictype/category-Nl-tests: + # Code from module unictype/category-No: + # Code from module unictype/category-No-tests: + # Code from module unictype/category-P: + # Code from module unictype/category-P-tests: + # Code from module unictype/category-Pc: + # Code from module unictype/category-Pc-tests: + # Code from module unictype/category-Pd: + # Code from module unictype/category-Pd-tests: + # Code from module unictype/category-Pe: + # Code from module unictype/category-Pe-tests: + # Code from module unictype/category-Pf: + # Code from module unictype/category-Pf-tests: + # Code from module unictype/category-Pi: + # Code from module unictype/category-Pi-tests: + # Code from module unictype/category-Po: + # Code from module unictype/category-Po-tests: + # Code from module unictype/category-Ps: + # Code from module unictype/category-Ps-tests: + # Code from module unictype/category-S: + # Code from module unictype/category-S-tests: + # Code from module unictype/category-Sc: + # Code from module unictype/category-Sc-tests: + # Code from module unictype/category-Sk: + # Code from module unictype/category-Sk-tests: + # Code from module unictype/category-Sm: + # Code from module unictype/category-Sm-tests: + # Code from module unictype/category-So: + # Code from module unictype/category-So-tests: + # Code from module unictype/category-Z: + # Code from module unictype/category-Z-tests: + # Code from module unictype/category-Zl: + # Code from module unictype/category-Zl-tests: + # Code from module unictype/category-Zp: + # Code from module unictype/category-Zp-tests: + # Code from module unictype/category-Zs: + # Code from module unictype/category-Zs-tests: + # Code from module unictype/category-all: + # Code from module unictype/category-and: + # Code from module unictype/category-and-not: + # Code from module unictype/category-and-not-tests: + # Code from module unictype/category-and-tests: + # Code from module unictype/category-byname: + # Code from module unictype/category-byname-tests: + # Code from module unictype/category-name: + # Code from module unictype/category-name-tests: + # Code from module unictype/category-none: + # Code from module unictype/category-none-tests: + # Code from module unictype/category-of: + # Code from module unictype/category-of-tests: + # Code from module unictype/category-or: + # Code from module unictype/category-or-tests: + # Code from module unictype/category-test: + # Code from module unictype/category-test-withtable: + # Code from module unictype/category-test-withtable-tests: + # Code from module unictype/combining-class: + # Code from module unictype/combining-class-tests: + # Code from module unictype/ctype-alnum: + # Code from module unictype/ctype-alnum-tests: + # Code from module unictype/ctype-alpha: + # Code from module unictype/ctype-alpha-tests: + # Code from module unictype/ctype-blank: + # Code from module unictype/ctype-blank-tests: + # Code from module unictype/ctype-cntrl: + # Code from module unictype/ctype-cntrl-tests: + # Code from module unictype/ctype-digit: + # Code from module unictype/ctype-digit-tests: + # Code from module unictype/ctype-graph: + # Code from module unictype/ctype-graph-tests: + # Code from module unictype/ctype-lower: + # Code from module unictype/ctype-lower-tests: + # Code from module unictype/ctype-print: + # Code from module unictype/ctype-print-tests: + # Code from module unictype/ctype-punct: + # Code from module unictype/ctype-punct-tests: + # Code from module unictype/ctype-space: + # Code from module unictype/ctype-space-tests: + # Code from module unictype/ctype-upper: + # Code from module unictype/ctype-upper-tests: + # Code from module unictype/ctype-xdigit: + # Code from module unictype/ctype-xdigit-tests: + # Code from module unictype/decimal-digit: + # Code from module unictype/decimal-digit-tests: + # Code from module unictype/digit: + # Code from module unictype/digit-tests: + # Code from module unictype/mirror: + # Code from module unictype/mirror-tests: + # Code from module unictype/numeric: + # Code from module unictype/numeric-tests: + # Code from module unictype/property-all: + # Code from module unictype/property-alphabetic: + # Code from module unictype/property-alphabetic-tests: + # Code from module unictype/property-ascii-hex-digit: + # Code from module unictype/property-ascii-hex-digit-tests: + # Code from module unictype/property-bidi-arabic-digit: + # Code from module unictype/property-bidi-arabic-digit-tests: + # Code from module unictype/property-bidi-arabic-right-to-left: + # Code from module unictype/property-bidi-arabic-right-to-left-tests: + # Code from module unictype/property-bidi-block-separator: + # Code from module unictype/property-bidi-block-separator-tests: + # Code from module unictype/property-bidi-boundary-neutral: + # Code from module unictype/property-bidi-boundary-neutral-tests: + # Code from module unictype/property-bidi-common-separator: + # Code from module unictype/property-bidi-common-separator-tests: + # Code from module unictype/property-bidi-control: + # Code from module unictype/property-bidi-control-tests: + # Code from module unictype/property-bidi-embedding-or-override: + # Code from module unictype/property-bidi-embedding-or-override-tests: + # Code from module unictype/property-bidi-eur-num-separator: + # Code from module unictype/property-bidi-eur-num-separator-tests: + # Code from module unictype/property-bidi-eur-num-terminator: + # Code from module unictype/property-bidi-eur-num-terminator-tests: + # Code from module unictype/property-bidi-european-digit: + # Code from module unictype/property-bidi-european-digit-tests: + # Code from module unictype/property-bidi-hebrew-right-to-left: + # Code from module unictype/property-bidi-hebrew-right-to-left-tests: + # Code from module unictype/property-bidi-left-to-right: + # Code from module unictype/property-bidi-left-to-right-tests: + # Code from module unictype/property-bidi-non-spacing-mark: + # Code from module unictype/property-bidi-non-spacing-mark-tests: + # Code from module unictype/property-bidi-other-neutral: + # Code from module unictype/property-bidi-other-neutral-tests: + # Code from module unictype/property-bidi-pdf: + # Code from module unictype/property-bidi-pdf-tests: + # Code from module unictype/property-bidi-segment-separator: + # Code from module unictype/property-bidi-segment-separator-tests: + # Code from module unictype/property-bidi-whitespace: + # Code from module unictype/property-bidi-whitespace-tests: + # Code from module unictype/property-byname: + # Code from module unictype/property-byname-tests: + # Code from module unictype/property-combining: + # Code from module unictype/property-combining-tests: + # Code from module unictype/property-composite: + # Code from module unictype/property-composite-tests: + # Code from module unictype/property-currency-symbol: + # Code from module unictype/property-currency-symbol-tests: + # Code from module unictype/property-dash: + # Code from module unictype/property-dash-tests: + # Code from module unictype/property-decimal-digit: + # Code from module unictype/property-decimal-digit-tests: + # Code from module unictype/property-default-ignorable-code-point: + # Code from module unictype/property-default-ignorable-code-point-tests: + # Code from module unictype/property-deprecated: + # Code from module unictype/property-deprecated-tests: + # Code from module unictype/property-diacritic: + # Code from module unictype/property-diacritic-tests: + # Code from module unictype/property-extender: + # Code from module unictype/property-extender-tests: + # Code from module unictype/property-format-control: + # Code from module unictype/property-format-control-tests: + # Code from module unictype/property-grapheme-base: + # Code from module unictype/property-grapheme-base-tests: + # Code from module unictype/property-grapheme-extend: + # Code from module unictype/property-grapheme-extend-tests: + # Code from module unictype/property-grapheme-link: + # Code from module unictype/property-grapheme-link-tests: + # Code from module unictype/property-hex-digit: + # Code from module unictype/property-hex-digit-tests: + # Code from module unictype/property-hyphen: + # Code from module unictype/property-hyphen-tests: + # Code from module unictype/property-id-continue: + # Code from module unictype/property-id-continue-tests: + # Code from module unictype/property-id-start: + # Code from module unictype/property-id-start-tests: + # Code from module unictype/property-ideographic: + # Code from module unictype/property-ideographic-tests: + # Code from module unictype/property-ids-binary-operator: + # Code from module unictype/property-ids-binary-operator-tests: + # Code from module unictype/property-ids-trinary-operator: + # Code from module unictype/property-ids-trinary-operator-tests: + # Code from module unictype/property-ignorable-control: + # Code from module unictype/property-ignorable-control-tests: + # Code from module unictype/property-iso-control: + # Code from module unictype/property-iso-control-tests: + # Code from module unictype/property-join-control: + # Code from module unictype/property-join-control-tests: + # Code from module unictype/property-left-of-pair: + # Code from module unictype/property-left-of-pair-tests: + # Code from module unictype/property-line-separator: + # Code from module unictype/property-line-separator-tests: + # Code from module unictype/property-logical-order-exception: + # Code from module unictype/property-logical-order-exception-tests: + # Code from module unictype/property-lowercase: + # Code from module unictype/property-lowercase-tests: + # Code from module unictype/property-math: + # Code from module unictype/property-math-tests: + # Code from module unictype/property-non-break: + # Code from module unictype/property-non-break-tests: + # Code from module unictype/property-not-a-character: + # Code from module unictype/property-not-a-character-tests: + # Code from module unictype/property-numeric: + # Code from module unictype/property-numeric-tests: + # Code from module unictype/property-other-alphabetic: + # Code from module unictype/property-other-alphabetic-tests: + # Code from module unictype/property-other-default-ignorable-code-point: + # Code from module unictype/property-other-default-ignorable-code-point-tests: + # Code from module unictype/property-other-grapheme-extend: + # Code from module unictype/property-other-grapheme-extend-tests: + # Code from module unictype/property-other-id-continue: + # Code from module unictype/property-other-id-continue-tests: + # Code from module unictype/property-other-id-start: + # Code from module unictype/property-other-id-start-tests: + # Code from module unictype/property-other-lowercase: + # Code from module unictype/property-other-lowercase-tests: + # Code from module unictype/property-other-math: + # Code from module unictype/property-other-math-tests: + # Code from module unictype/property-other-uppercase: + # Code from module unictype/property-other-uppercase-tests: + # Code from module unictype/property-paired-punctuation: + # Code from module unictype/property-paired-punctuation-tests: + # Code from module unictype/property-paragraph-separator: + # Code from module unictype/property-paragraph-separator-tests: + # Code from module unictype/property-pattern-syntax: + # Code from module unictype/property-pattern-syntax-tests: + # Code from module unictype/property-pattern-white-space: + # Code from module unictype/property-pattern-white-space-tests: + # Code from module unictype/property-private-use: + # Code from module unictype/property-private-use-tests: + # Code from module unictype/property-punctuation: + # Code from module unictype/property-punctuation-tests: + # Code from module unictype/property-quotation-mark: + # Code from module unictype/property-quotation-mark-tests: + # Code from module unictype/property-radical: + # Code from module unictype/property-radical-tests: + # Code from module unictype/property-sentence-terminal: + # Code from module unictype/property-sentence-terminal-tests: + # Code from module unictype/property-soft-dotted: + # Code from module unictype/property-soft-dotted-tests: + # Code from module unictype/property-space: + # Code from module unictype/property-space-tests: + # Code from module unictype/property-terminal-punctuation: + # Code from module unictype/property-terminal-punctuation-tests: + # Code from module unictype/property-test: + # Code from module unictype/property-test-tests: + # Code from module unictype/property-titlecase: + # Code from module unictype/property-titlecase-tests: + # Code from module unictype/property-unassigned-code-value: + # Code from module unictype/property-unassigned-code-value-tests: + # Code from module unictype/property-unified-ideograph: + # Code from module unictype/property-unified-ideograph-tests: + # Code from module unictype/property-uppercase: + # Code from module unictype/property-uppercase-tests: + # Code from module unictype/property-variation-selector: + # Code from module unictype/property-variation-selector-tests: + # Code from module unictype/property-white-space: + # Code from module unictype/property-white-space-tests: + # Code from module unictype/property-xid-continue: + # Code from module unictype/property-xid-continue-tests: + # Code from module unictype/property-xid-start: + # Code from module unictype/property-xid-start-tests: + # Code from module unictype/property-zero-width: + # Code from module unictype/property-zero-width-tests: + # Code from module unictype/scripts: + # Code from module unictype/scripts-all: + # Code from module unictype/scripts-tests: + # Code from module unictype/syntax-c-ident: + # Code from module unictype/syntax-c-ident-tests: + # Code from module unictype/syntax-c-whitespace: + # Code from module unictype/syntax-c-whitespace-tests: + # Code from module unictype/syntax-java-ident: + # Code from module unictype/syntax-java-ident-tests: + # Code from module unictype/syntax-java-whitespace: + # Code from module unictype/syntax-java-whitespace-tests: + # Code from module unilbrk/base: + # Code from module unilbrk/tables: + # Code from module unilbrk/u16-possible-linebreaks: + # Code from module unilbrk/u16-possible-linebreaks-tests: + # Code from module unilbrk/u16-width-linebreaks: + # Code from module unilbrk/u16-width-linebreaks-tests: + # Code from module unilbrk/u32-possible-linebreaks: + # Code from module unilbrk/u32-possible-linebreaks-tests: + # Code from module unilbrk/u32-width-linebreaks: + # Code from module unilbrk/u32-width-linebreaks-tests: + # Code from module unilbrk/u8-possible-linebreaks: + # Code from module unilbrk/u8-possible-linebreaks-tests: + # Code from module unilbrk/u8-width-linebreaks: + # Code from module unilbrk/u8-width-linebreaks-tests: + # Code from module unilbrk/ulc-common: + # Code from module unilbrk/ulc-possible-linebreaks: + # Code from module unilbrk/ulc-possible-linebreaks-tests: + # Code from module unilbrk/ulc-width-linebreaks: + # Code from module unilbrk/ulc-width-linebreaks-tests: + # Code from module uniname/base: + # Code from module uniname/uniname: + # Code from module uniname/uniname-tests: + # Code from module uninorm/base: + # Code from module uninorm/canonical-decomposition: + # Code from module uninorm/canonical-decomposition-tests: + # Code from module uninorm/compat-decomposition: + # Code from module uninorm/compat-decomposition-tests: + # Code from module uninorm/composition: + # Code from module uninorm/composition-tests: + # Code from module uninorm/decompose-internal: + # Code from module uninorm/decomposing-form: + # Code from module uninorm/decomposing-form-tests: + # Code from module uninorm/decomposition: + # Code from module uninorm/decomposition-table: + # Code from module uninorm/decomposition-tests: + # Code from module uninorm/filter: + # Code from module uninorm/filter-tests: + # Code from module uninorm/nfc: + # Code from module uninorm/nfc-tests: + # Code from module uninorm/nfd: + # Code from module uninorm/nfd-tests: + # Code from module uninorm/nfkc: + # Code from module uninorm/nfkc-tests: + # Code from module uninorm/nfkd: + # Code from module uninorm/nfkd-tests: + # Code from module uninorm/u16-normalize: + # Code from module uninorm/u16-normcmp: + # Code from module uninorm/u16-normcmp-tests: + # Code from module uninorm/u16-normcoll: + # Code from module uninorm/u16-normcoll-tests: + # Code from module uninorm/u16-normxfrm: + # Code from module uninorm/u32-normalize: + # Code from module uninorm/u32-normcmp: + # Code from module uninorm/u32-normcmp-tests: + # Code from module uninorm/u32-normcoll: + # Code from module uninorm/u32-normcoll-tests: + # Code from module uninorm/u32-normxfrm: + # Code from module uninorm/u8-normalize: + # Code from module uninorm/u8-normcmp: + # Code from module uninorm/u8-normcmp-tests: + # Code from module uninorm/u8-normcoll: + # Code from module uninorm/u8-normcoll-tests: + # Code from module uninorm/u8-normxfrm: + # Code from module unistd: + # Code from module unistd-tests: + # Code from module unistdio/base: + # Code from module unistdio/u-printf-args: + # Code from module unistdio/u16-asnprintf: + # Code from module unistdio/u16-asnprintf-tests: + # Code from module unistdio/u16-asprintf: + # Code from module unistdio/u16-printf-parse: + # Code from module unistdio/u16-snprintf: + # Code from module unistdio/u16-sprintf: + # Code from module unistdio/u16-u16-asnprintf: + # Code from module unistdio/u16-u16-asprintf: + # Code from module unistdio/u16-u16-snprintf: + # Code from module unistdio/u16-u16-sprintf: + # Code from module unistdio/u16-u16-vasnprintf: + # Code from module unistdio/u16-u16-vasprintf: + # Code from module unistdio/u16-u16-vsnprintf: + # Code from module unistdio/u16-u16-vsprintf: + # Code from module unistdio/u16-vasnprintf: + # Code from module unistdio/u16-vasnprintf-tests: + # Code from module unistdio/u16-vasprintf: + # Code from module unistdio/u16-vasprintf-tests: + # Code from module unistdio/u16-vsnprintf: + # Code from module unistdio/u16-vsnprintf-tests: + # Code from module unistdio/u16-vsprintf: + # Code from module unistdio/u16-vsprintf-tests: + # Code from module unistdio/u32-asnprintf: + # Code from module unistdio/u32-asnprintf-tests: + # Code from module unistdio/u32-asprintf: + # Code from module unistdio/u32-printf-parse: + # Code from module unistdio/u32-snprintf: + # Code from module unistdio/u32-sprintf: + # Code from module unistdio/u32-u32-asnprintf: + # Code from module unistdio/u32-u32-asprintf: + # Code from module unistdio/u32-u32-snprintf: + # Code from module unistdio/u32-u32-sprintf: + # Code from module unistdio/u32-u32-vasnprintf: + # Code from module unistdio/u32-u32-vasprintf: + # Code from module unistdio/u32-u32-vsnprintf: + # Code from module unistdio/u32-u32-vsprintf: + # Code from module unistdio/u32-vasnprintf: + # Code from module unistdio/u32-vasnprintf-tests: + # Code from module unistdio/u32-vasprintf: + # Code from module unistdio/u32-vasprintf-tests: + # Code from module unistdio/u32-vsnprintf: + # Code from module unistdio/u32-vsnprintf-tests: + # Code from module unistdio/u32-vsprintf: + # Code from module unistdio/u32-vsprintf-tests: + # Code from module unistdio/u8-asnprintf: + # Code from module unistdio/u8-asnprintf-tests: + # Code from module unistdio/u8-asprintf: + # Code from module unistdio/u8-printf-parse: + # Code from module unistdio/u8-snprintf: + # Code from module unistdio/u8-sprintf: + # Code from module unistdio/u8-u8-asnprintf: + # Code from module unistdio/u8-u8-asprintf: + # Code from module unistdio/u8-u8-snprintf: + # Code from module unistdio/u8-u8-sprintf: + # Code from module unistdio/u8-u8-vasnprintf: + # Code from module unistdio/u8-u8-vasprintf: + # Code from module unistdio/u8-u8-vsnprintf: + # Code from module unistdio/u8-u8-vsprintf: + # Code from module unistdio/u8-vasnprintf: + # Code from module unistdio/u8-vasnprintf-tests: + # Code from module unistdio/u8-vasprintf: + # Code from module unistdio/u8-vasprintf-tests: + # Code from module unistdio/u8-vsnprintf: + # Code from module unistdio/u8-vsnprintf-tests: + # Code from module unistdio/u8-vsprintf: + # Code from module unistdio/u8-vsprintf-tests: + # Code from module unistdio/ulc-asnprintf: + # Code from module unistdio/ulc-asnprintf-tests: + # Code from module unistdio/ulc-asprintf: + # Code from module unistdio/ulc-fprintf: + # Code from module unistdio/ulc-printf-parse: + # Code from module unistdio/ulc-snprintf: + # Code from module unistdio/ulc-sprintf: + # Code from module unistdio/ulc-vasnprintf: + # Code from module unistdio/ulc-vasnprintf-tests: + # Code from module unistdio/ulc-vasprintf: + # Code from module unistdio/ulc-vasprintf-tests: + # Code from module unistdio/ulc-vfprintf: + # Code from module unistdio/ulc-vsnprintf: + # Code from module unistdio/ulc-vsnprintf-tests: + # Code from module unistdio/ulc-vsprintf: + # Code from module unistdio/ulc-vsprintf-tests: + # Code from module unistr/base: + # Code from module unistr/u16-check: + # Code from module unistr/u16-check-tests: + # Code from module unistr/u16-chr: + # Code from module unistr/u16-chr-tests: + # Code from module unistr/u16-cmp: + # Code from module unistr/u16-cmp-tests: + # Code from module unistr/u16-cmp2: + # Code from module unistr/u16-cmp2-tests: + # Code from module unistr/u16-cpy: + # Code from module unistr/u16-cpy-alloc: + # Code from module unistr/u16-cpy-alloc-tests: + # Code from module unistr/u16-cpy-tests: + # Code from module unistr/u16-endswith: + # Code from module unistr/u16-mblen: + # Code from module unistr/u16-mblen-tests: + # Code from module unistr/u16-mbsnlen: + # Code from module unistr/u16-mbsnlen-tests: + # Code from module unistr/u16-mbtouc: + # Code from module unistr/u16-mbtouc-tests: + # Code from module unistr/u16-mbtouc-unsafe: + # Code from module unistr/u16-mbtouc-unsafe-tests: + # Code from module unistr/u16-mbtoucr: + # Code from module unistr/u16-mbtoucr-tests: + # Code from module unistr/u16-move: + # Code from module unistr/u16-move-tests: + # Code from module unistr/u16-next: + # Code from module unistr/u16-next-tests: + # Code from module unistr/u16-prev: + # Code from module unistr/u16-prev-tests: + # Code from module unistr/u16-set: + # Code from module unistr/u16-set-tests: + # Code from module unistr/u16-startswith: + # Code from module unistr/u16-stpcpy: + # Code from module unistr/u16-stpcpy-tests: + # Code from module unistr/u16-stpncpy: + # Code from module unistr/u16-stpncpy-tests: + # Code from module unistr/u16-strcat: + # Code from module unistr/u16-strcat-tests: + # Code from module unistr/u16-strchr: + # Code from module unistr/u16-strcmp: + # Code from module unistr/u16-strcmp-tests: + # Code from module unistr/u16-strcoll: + # Code from module unistr/u16-strcoll-tests: + # Code from module unistr/u16-strcpy: + # Code from module unistr/u16-strcpy-tests: + # Code from module unistr/u16-strcspn: + # Code from module unistr/u16-strdup: + # Code from module unistr/u16-strdup-tests: + # Code from module unistr/u16-strlen: + # Code from module unistr/u16-strlen-tests: + # Code from module unistr/u16-strmblen: + # Code from module unistr/u16-strmblen-tests: + # Code from module unistr/u16-strmbtouc: + # Code from module unistr/u16-strmbtouc-tests: + # Code from module unistr/u16-strncat: + # Code from module unistr/u16-strncat-tests: + # Code from module unistr/u16-strncmp: + # Code from module unistr/u16-strncmp-tests: + # Code from module unistr/u16-strncpy: + # Code from module unistr/u16-strncpy-tests: + # Code from module unistr/u16-strnlen: + # Code from module unistr/u16-strnlen-tests: + # Code from module unistr/u16-strpbrk: + # Code from module unistr/u16-strrchr: + # Code from module unistr/u16-strspn: + # Code from module unistr/u16-strstr: + # Code from module unistr/u16-strtok: + # Code from module unistr/u16-to-u32: + # Code from module unistr/u16-to-u32-tests: + # Code from module unistr/u16-to-u8: + # Code from module unistr/u16-to-u8-tests: + # Code from module unistr/u16-uctomb: + # Code from module unistr/u16-uctomb-tests: + # Code from module unistr/u32-check: + # Code from module unistr/u32-check-tests: + # Code from module unistr/u32-chr: + # Code from module unistr/u32-chr-tests: + # Code from module unistr/u32-cmp: + # Code from module unistr/u32-cmp-tests: + # Code from module unistr/u32-cmp2: + # Code from module unistr/u32-cmp2-tests: + # Code from module unistr/u32-cpy: + # Code from module unistr/u32-cpy-alloc: + # Code from module unistr/u32-cpy-alloc-tests: + # Code from module unistr/u32-cpy-tests: + # Code from module unistr/u32-endswith: + # Code from module unistr/u32-mblen: + # Code from module unistr/u32-mblen-tests: + # Code from module unistr/u32-mbsnlen: + # Code from module unistr/u32-mbsnlen-tests: + # Code from module unistr/u32-mbtouc: + # Code from module unistr/u32-mbtouc-tests: + # Code from module unistr/u32-mbtouc-unsafe: + # Code from module unistr/u32-mbtouc-unsafe-tests: + # Code from module unistr/u32-mbtoucr: + # Code from module unistr/u32-mbtoucr-tests: + # Code from module unistr/u32-move: + # Code from module unistr/u32-move-tests: + # Code from module unistr/u32-next: + # Code from module unistr/u32-next-tests: + # Code from module unistr/u32-prev: + # Code from module unistr/u32-prev-tests: + # Code from module unistr/u32-set: + # Code from module unistr/u32-set-tests: + # Code from module unistr/u32-startswith: + # Code from module unistr/u32-stpcpy: + # Code from module unistr/u32-stpcpy-tests: + # Code from module unistr/u32-stpncpy: + # Code from module unistr/u32-stpncpy-tests: + # Code from module unistr/u32-strcat: + # Code from module unistr/u32-strcat-tests: + # Code from module unistr/u32-strchr: + # Code from module unistr/u32-strcmp: + # Code from module unistr/u32-strcmp-tests: + # Code from module unistr/u32-strcoll: + # Code from module unistr/u32-strcoll-tests: + # Code from module unistr/u32-strcpy: + # Code from module unistr/u32-strcpy-tests: + # Code from module unistr/u32-strcspn: + # Code from module unistr/u32-strdup: + # Code from module unistr/u32-strdup-tests: + # Code from module unistr/u32-strlen: + # Code from module unistr/u32-strlen-tests: + # Code from module unistr/u32-strmblen: + # Code from module unistr/u32-strmblen-tests: + # Code from module unistr/u32-strmbtouc: + # Code from module unistr/u32-strmbtouc-tests: + # Code from module unistr/u32-strncat: + # Code from module unistr/u32-strncat-tests: + # Code from module unistr/u32-strncmp: + # Code from module unistr/u32-strncmp-tests: + # Code from module unistr/u32-strncpy: + # Code from module unistr/u32-strncpy-tests: + # Code from module unistr/u32-strnlen: + # Code from module unistr/u32-strnlen-tests: + # Code from module unistr/u32-strpbrk: + # Code from module unistr/u32-strrchr: + # Code from module unistr/u32-strspn: + # Code from module unistr/u32-strstr: + # Code from module unistr/u32-strtok: + # Code from module unistr/u32-to-u16: + # Code from module unistr/u32-to-u16-tests: + # Code from module unistr/u32-to-u8: + # Code from module unistr/u32-to-u8-tests: + # Code from module unistr/u32-uctomb: + # Code from module unistr/u32-uctomb-tests: + # Code from module unistr/u8-check: + # Code from module unistr/u8-check-tests: + # Code from module unistr/u8-chr: + # Code from module unistr/u8-chr-tests: + # Code from module unistr/u8-cmp: + # Code from module unistr/u8-cmp-tests: + # Code from module unistr/u8-cmp2: + # Code from module unistr/u8-cmp2-tests: + # Code from module unistr/u8-cpy: + # Code from module unistr/u8-cpy-alloc: + # Code from module unistr/u8-cpy-alloc-tests: + # Code from module unistr/u8-cpy-tests: + # Code from module unistr/u8-endswith: + # Code from module unistr/u8-mblen: + # Code from module unistr/u8-mblen-tests: + # Code from module unistr/u8-mbsnlen: + # Code from module unistr/u8-mbsnlen-tests: + # Code from module unistr/u8-mbtouc: + # Code from module unistr/u8-mbtouc-tests: + # Code from module unistr/u8-mbtouc-unsafe: + # Code from module unistr/u8-mbtouc-unsafe-tests: + # Code from module unistr/u8-mbtoucr: + # Code from module unistr/u8-mbtoucr-tests: + # Code from module unistr/u8-move: + # Code from module unistr/u8-move-tests: + # Code from module unistr/u8-next: + # Code from module unistr/u8-next-tests: + # Code from module unistr/u8-prev: + # Code from module unistr/u8-prev-tests: + # Code from module unistr/u8-set: + # Code from module unistr/u8-set-tests: + # Code from module unistr/u8-startswith: + # Code from module unistr/u8-stpcpy: + # Code from module unistr/u8-stpcpy-tests: + # Code from module unistr/u8-stpncpy: + # Code from module unistr/u8-stpncpy-tests: + # Code from module unistr/u8-strcat: + # Code from module unistr/u8-strcat-tests: + # Code from module unistr/u8-strchr: + # Code from module unistr/u8-strcmp: + # Code from module unistr/u8-strcmp-tests: + # Code from module unistr/u8-strcoll: + # Code from module unistr/u8-strcoll-tests: + # Code from module unistr/u8-strcpy: + # Code from module unistr/u8-strcpy-tests: + # Code from module unistr/u8-strcspn: + # Code from module unistr/u8-strdup: + # Code from module unistr/u8-strdup-tests: + # Code from module unistr/u8-strlen: + # Code from module unistr/u8-strlen-tests: + # Code from module unistr/u8-strmblen: + # Code from module unistr/u8-strmblen-tests: + # Code from module unistr/u8-strmbtouc: + # Code from module unistr/u8-strmbtouc-tests: + # Code from module unistr/u8-strncat: + # Code from module unistr/u8-strncat-tests: + # Code from module unistr/u8-strncmp: + # Code from module unistr/u8-strncmp-tests: + # Code from module unistr/u8-strncpy: + # Code from module unistr/u8-strncpy-tests: + # Code from module unistr/u8-strnlen: + # Code from module unistr/u8-strnlen-tests: + # Code from module unistr/u8-strpbrk: + # Code from module unistr/u8-strrchr: + # Code from module unistr/u8-strspn: + # Code from module unistr/u8-strstr: + # Code from module unistr/u8-strtok: + # Code from module unistr/u8-to-u16: + # Code from module unistr/u8-to-u16-tests: + # Code from module unistr/u8-to-u32: + # Code from module unistr/u8-to-u32-tests: + # Code from module unistr/u8-uctomb: + # Code from module unistr/u8-uctomb-tests: + # Code from module unitypes: + # Code from module uniwbrk/base: + # Code from module uniwbrk/table: + # Code from module uniwbrk/u16-wordbreaks: + # Code from module uniwbrk/u16-wordbreaks-tests: + # Code from module uniwbrk/u32-wordbreaks: + # Code from module uniwbrk/u32-wordbreaks-tests: + # Code from module uniwbrk/u8-wordbreaks: + # Code from module uniwbrk/u8-wordbreaks-tests: + # Code from module uniwbrk/ulc-wordbreaks: + # Code from module uniwbrk/ulc-wordbreaks-tests: + # Code from module uniwbrk/wordbreak-property: + # Code from module uniwidth/base: + # Code from module uniwidth/u16-strwidth: + # Code from module uniwidth/u16-strwidth-tests: + # Code from module uniwidth/u16-width: + # Code from module uniwidth/u16-width-tests: + # Code from module uniwidth/u32-strwidth: + # Code from module uniwidth/u32-strwidth-tests: + # Code from module uniwidth/u32-width: + # Code from module uniwidth/u32-width-tests: + # Code from module uniwidth/u8-strwidth: + # Code from module uniwidth/u8-strwidth-tests: + # Code from module uniwidth/u8-width: + # Code from module uniwidth/u8-width-tests: + # Code from module uniwidth/width: + # Code from module uniwidth/width-tests: + # Code from module unsetenv: + # Code from module unsetenv-tests: + # Code from module unused-parameter: + # Code from module verify: + # Code from module warn-on-use: + # Code from module wchar: + # Code from module wchar-tests: + # Code from module wctob: + # Code from module wctype: + # Code from module wctype-tests: + # Code from module wcwidth: + # Code from module wcwidth-tests: + # Code from module xalloc: + # Code from module xalloc-die: + # Code from module xalloc-die-tests: + # Code from module xsize: + # Code from module yield: @@ -5789,13 +6960,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5792: $ac_compile\"" >&5) + (eval echo "\"\$as_me:6963: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5795: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:6966: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5798: output\"" >&5) + (eval echo "\"\$as_me:6969: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6997,7 +8168,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7000 "configure"' > conftest.$ac_ext + echo '#line 8171 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8557,11 +9728,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8560: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9731: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8564: \$? = $ac_status" >&5 + echo "$as_me:9735: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8896,11 +10067,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8899: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10070: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8903: \$? = $ac_status" >&5 + echo "$as_me:10074: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9001,11 +10172,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9004: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10175: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9008: \$? = $ac_status" >&5 + echo "$as_me:10179: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9056,11 +10227,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9059: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10230: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9063: \$? = $ac_status" >&5 + echo "$as_me:10234: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11423,7 +12594,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11426 "configure" +#line 12597 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11519,7 +12690,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11522 "configure" +#line 12693 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11940,6 +13111,8 @@ fi + LIBC_FATAL_STDERR_=1 + export LIBC_FATAL_STDERR_ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! @@ -12136,77 +13309,6 @@ _ACEOF fi - GNULIB_CHOWN=0; - GNULIB_CLOSE=0; - GNULIB_DUP2=0; - GNULIB_ENVIRON=0; - GNULIB_EUIDACCESS=0; - GNULIB_FCHDIR=0; - GNULIB_FSYNC=0; - GNULIB_FTRUNCATE=0; - GNULIB_GETCWD=0; - GNULIB_GETDOMAINNAME=0; - GNULIB_GETDTABLESIZE=0; - GNULIB_GETHOSTNAME=0; - GNULIB_GETLOGIN_R=0; - GNULIB_GETPAGESIZE=0; - GNULIB_GETUSERSHELL=0; - GNULIB_LCHOWN=0; - GNULIB_LINK=0; - GNULIB_LSEEK=0; - GNULIB_READLINK=0; - GNULIB_SLEEP=0; - GNULIB_UNISTD_H_GETOPT=0; - GNULIB_UNISTD_H_SIGPIPE=0; - GNULIB_WRITE=0; - HAVE_DUP2=1; - HAVE_EUIDACCESS=1; - HAVE_FSYNC=1; - HAVE_FTRUNCATE=1; - HAVE_GETDOMAINNAME=1; - HAVE_GETDTABLESIZE=1; - HAVE_GETHOSTNAME=1; - HAVE_GETPAGESIZE=1; - HAVE_GETUSERSHELL=1; - HAVE_LINK=1; - HAVE_READLINK=1; - HAVE_SLEEP=1; - HAVE_DECL_ENVIRON=1; - HAVE_DECL_GETLOGIN_R=1; - HAVE_OS_H=0; - HAVE_SYS_PARAM_H=0; - REPLACE_CHOWN=0; - REPLACE_CLOSE=0; - REPLACE_DUP2=0; - REPLACE_FCHDIR=0; - REPLACE_GETCWD=0; - REPLACE_GETPAGESIZE=0; - REPLACE_LCHOWN=0; - REPLACE_LSEEK=0; - REPLACE_WRITE=0; - UNISTD_H_HAVE_WINSOCK2_H=0; - UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; - - - - - - for ac_func in $ac_func_list -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 $as_echo_n "checking whether the preprocessor supports include_next... " >&6; } @@ -12383,26 +13485,26 @@ if test "${gl_cv_next_errno_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_errno_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_errno_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <errno.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_errno_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/errno.h#{ - s#.*"\(.*/errno.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_errno_h='<'errno.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_errno_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/errno.h#{ + s#.*"\(.*/errno.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_errno_h='<'errno.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_errno_h" >&5 @@ -12641,8 +13743,13 @@ $as_echo "$gl_cv_header_errno_h_EOVERFLOW" >&6; } + GNULIB_ACOSL=0; + GNULIB_ASINL=0; + GNULIB_ATANL=0; GNULIB_CEILF=0; GNULIB_CEILL=0; + GNULIB_COSL=0; + GNULIB_EXPL=0; GNULIB_FLOORF=0; GNULIB_FLOORL=0; GNULIB_FREXP=0; @@ -12654,30 +13761,52 @@ $as_echo "$gl_cv_header_errno_h_EOVERFLOW" >&6; } GNULIB_ISNAND=0; GNULIB_ISNANL=0; GNULIB_LDEXPL=0; - GNULIB_MATHL=0; + GNULIB_LOGB=0; + GNULIB_LOGL=0; GNULIB_ROUND=0; GNULIB_ROUNDF=0; GNULIB_ROUNDL=0; GNULIB_SIGNBIT=0; + GNULIB_SINL=0; + GNULIB_SQRTL=0; + GNULIB_TANL=0; GNULIB_TRUNC=0; GNULIB_TRUNCF=0; GNULIB_TRUNCL=0; - HAVE_ISNANF=1; + HAVE_ACOSL=1; + HAVE_ASINL=1; + HAVE_ATANL=1; + HAVE_COSL=1; + HAVE_EXPL=1; + HAVE_ISNANF=1; HAVE_ISNAND=1; HAVE_ISNANL=1; + HAVE_LOGL=1; + HAVE_SINL=1; + HAVE_SQRTL=1; + HAVE_TANL=1; HAVE_DECL_ACOSL=1; HAVE_DECL_ASINL=1; HAVE_DECL_ATANL=1; + HAVE_DECL_CEILF=1; + HAVE_DECL_CEILL=1; HAVE_DECL_COSL=1; HAVE_DECL_EXPL=1; + HAVE_DECL_FLOORF=1; + HAVE_DECL_FLOORL=1; HAVE_DECL_FREXPL=1; HAVE_DECL_LDEXPL=1; + HAVE_DECL_LOGB=1; HAVE_DECL_LOGL=1; + HAVE_DECL_ROUND=1; + HAVE_DECL_ROUNDF=1; + HAVE_DECL_ROUNDL=1; HAVE_DECL_SINL=1; HAVE_DECL_SQRTL=1; HAVE_DECL_TANL=1; HAVE_DECL_TRUNC=1; HAVE_DECL_TRUNCF=1; + HAVE_DECL_TRUNCL=1; REPLACE_CEILF=0; REPLACE_CEILL=0; REPLACE_FLOORF=0; @@ -12753,7 +13882,7 @@ $as_echo_n "checking for ld used by GCC... " >&6; } # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -12787,9 +13916,9 @@ else # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; + test "$with_gnu_ld" != no && break ;; *) - test "$with_gnu_ld" != yes && break ;; + test "$with_gnu_ld" != yes && break ;; esac fi done @@ -13808,6 +14937,103 @@ $as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 +$as_echo_n "checking for working fcntl.h... " >&6; } +if test "${gl_cv_header_working_fcntl_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + gl_cv_header_working_fcntl_h=cross-compiling +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> + #include <fcntl.h> + #ifndef O_NOATIME + #define O_NOATIME 0 + #endif + #ifndef O_NOFOLLOW + #define O_NOFOLLOW 0 + #endif + static int const constants[] = + { + O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, + O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY + }; + +int +main () +{ + + int status = !constants; + { + static char const sym[] = "conftest.sym"; + if (symlink (".", sym) != 0 + || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) + status |= 32; + unlink (sym); + } + { + static char const file[] = "confdefs.h"; + int fd = open (file, O_RDONLY | O_NOATIME); + char c; + struct stat st0, st1; + if (fd < 0 + || fstat (fd, &st0) != 0 + || sleep (1) != 0 + || read (fd, &c, 1) != 1 + || close (fd) != 0 + || stat (file, &st1) != 0 + || st0.st_atime != st1.st_atime) + status |= 64; + } + return status; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_header_working_fcntl_h=yes +else + case $? in #( + 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( + 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + *) gl_cv_header_working_fcntl_h='no';; + esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 +$as_echo "$gl_cv_header_working_fcntl_h" >&6; } + + case $gl_cv_header_working_fcntl_h in #( + *O_NOATIME* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + +cat >>confdefs.h <<_ACEOF +#define HAVE_WORKING_O_NOATIME $ac_val +_ACEOF + + + case $gl_cv_header_working_fcntl_h in #( + *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + +cat >>confdefs.h <<_ACEOF +#define HAVE_WORKING_O_NOFOLLOW $ac_val +_ACEOF + + ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" if test "x$ac_cv_have_decl_getc_unlocked" = x""yes; then : ac_have_decl=1 @@ -13962,6 +15188,907 @@ $as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + gl_threads_api=none + LIBTHREAD= + LTLIBTHREAD= + LIBMULTITHREAD= + LTLIBMULTITHREAD= + if test "$gl_use_threads" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } +if test "${gl_cv_have_weak+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main () +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_have_weak="guessing yes" +else + gl_cv_have_weak="guessing no" +fi +rm -f conftest* + + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <stdio.h> +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_have_weak=yes +else + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +$as_echo "$gl_cv_have_weak" >&6; } + if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = x""yes; then : + gl_have_pthread_h=yes +else + gl_have_pthread_h=no +fi + + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + gl_have_pthread= + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +pthread_mutex_lock((pthread_mutex_t*)0); + pthread_mutexattr_init((pthread_mutexattr_t*)0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_have_pthread=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test -n "$gl_have_pthread"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes +else + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = x""yes; then : + LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + case "$host_os" in + solaris* | hpux*) + +$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + +fi + + else + # Some library is needed. Try libpthread and libc_r. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes +else + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = x""yes; then : + gl_have_pthread=yes + LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread + LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread +fi + + if test -z "$gl_have_pthread"; then + # For FreeBSD 4. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } +if test "${ac_cv_lib_c_r_pthread_kill+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_r_pthread_kill=yes +else + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = x""yes; then : + gl_have_pthread=yes + LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r + LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r +fi + + fi + fi + if test -n "$gl_have_pthread"; then + gl_threads_api=posix + +$as_echo "#define USE_POSIX_THREADS 1" >>confdefs.h + + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + +$as_echo "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h + + LIBTHREAD= + LTLIBTHREAD= + fi + fi + fi + fi + fi + if test -z "$gl_have_pthread"; then + if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then + gl_have_solaristhread= + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <thread.h> +#include <synch.h> +int +main () +{ +thr_self(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_have_solaristhread=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gl_save_LIBS" + if test -n "$gl_have_solaristhread"; then + gl_threads_api=solaris + LIBTHREAD=-lthread + LTLIBTHREAD=-lthread + LIBMULTITHREAD="$LIBTHREAD" + LTLIBMULTITHREAD="$LTLIBTHREAD" + +$as_echo "#define USE_SOLARIS_THREADS 1" >>confdefs.h + + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + +$as_echo "#define USE_SOLARIS_THREADS_WEAK 1" >>confdefs.h + + LIBTHREAD= + LTLIBTHREAD= + fi + fi + fi + fi + if test "$gl_use_threads" = pth; then + gl_save_CPPFLAGS="$CPPFLAGS" + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libpth" >&5 +$as_echo_n "checking how to link with libpth... " >&6; } +if test "${ac_cv_libpth_libs+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libpth-prefix was given. +if test "${with_libpth_prefix+set}" = set; then : + withval=$with_libpth_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBPTH= + LTLIBPTH= + INCPTH= + LIBPTH_PREFIX= + HAVE_LIBPTH= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='pth ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBPTH="${LIBPTH}${LIBPTH:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBPTH; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBPTH; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBPTH="${LIBPTH}${LIBPTH:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" + else + LIBPTH="${LIBPTH}${LIBPTH:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBPTH="${LIBPTH}${LIBPTH:+ }$found_a" + else + LIBPTH="${LIBPTH}${LIBPTH:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'pth'; then + LIBPTH_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'pth'; then + LIBPTH_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCPTH; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCPTH="${INCPTH}${INCPTH:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBPTH; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBPTH="${LIBPTH}${LIBPTH:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBPTH; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBPTH="${LIBPTH}${LIBPTH:+ }$dep" + LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }$dep" + ;; + esac + done + fi + else + LIBPTH="${LIBPTH}${LIBPTH:+ }-l$name" + LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBPTH="${LIBPTH}${LIBPTH:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBPTH="${LIBPTH}${LIBPTH:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-R$found_dir" + done + fi + + + + + + + ac_cv_libpth_libs="$LIBPTH" + ac_cv_libpth_ltlibs="$LTLIBPTH" + ac_cv_libpth_cppflags="$INCPTH" + ac_cv_libpth_prefix="$LIBPTH_PREFIX" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libpth_libs" >&5 +$as_echo "$ac_cv_libpth_libs" >&6; } + LIBPTH="$ac_cv_libpth_libs" + LTLIBPTH="$ac_cv_libpth_ltlibs" + INCPTH="$ac_cv_libpth_cppflags" + LIBPTH_PREFIX="$ac_cv_libpth_prefix" + + for element in $INCPTH; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + + + HAVE_LIBPTH=yes + + + + gl_have_pth= + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lpth" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pth.h> +int +main () +{ +pth_self(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_have_pth=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gl_save_LIBS" + if test -n "$gl_have_pth"; then + gl_threads_api=pth + LIBTHREAD="$LIBPTH" + LTLIBTHREAD="$LTLIBPTH" + LIBMULTITHREAD="$LIBTHREAD" + LTLIBMULTITHREAD="$LTLIBTHREAD" + +$as_echo "#define USE_PTH_THREADS 1" >>confdefs.h + + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + +$as_echo "#define USE_PTH_THREADS_WEAK 1" >>confdefs.h + + LIBTHREAD= + LTLIBTHREAD= + fi + fi + else + CPPFLAGS="$gl_save_CPPFLAGS" + fi + fi + if test -z "$gl_have_pthread"; then + if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=win32 + +$as_echo "#define USE_WIN32_THREADS 1" >>confdefs.h + + fi + fi + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 +$as_echo_n "checking for multithread API to use... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 +$as_echo "$gl_threads_api" >&6; } + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc are POSIX compliant" >&5 $as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; } if test "${gl_cv_func_malloc_posix+set}" = set; then : @@ -13994,29 +16121,46 @@ fi $as_echo "$gl_cv_func_malloc_posix" >&6; } - GNULIB_MALLOC_POSIX=0; - GNULIB_REALLOC_POSIX=0; - GNULIB_CALLOC_POSIX=0; GNULIB_ATOLL=0; + GNULIB_CALLOC_POSIX=0; + GNULIB_CANONICALIZE_FILE_NAME=0; GNULIB_GETLOADAVG=0; GNULIB_GETSUBOPT=0; + GNULIB_GRANTPT=0; + GNULIB_MALLOC_POSIX=0; GNULIB_MKDTEMP=0; + GNULIB_MKOSTEMP=0; + GNULIB_MKOSTEMPS=0; GNULIB_MKSTEMP=0; + GNULIB_MKSTEMPS=0; + GNULIB_PTSNAME=0; GNULIB_PUTENV=0; GNULIB_RANDOM_R=0; + GNULIB_REALLOC_POSIX=0; + GNULIB_REALPATH=0; GNULIB_RPMATCH=0; GNULIB_SETENV=0; GNULIB_STRTOD=0; GNULIB_STRTOLL=0; GNULIB_STRTOULL=0; + GNULIB_UNLOCKPT=0; GNULIB_UNSETENV=0; HAVE_ATOLL=1; HAVE_CALLOC_POSIX=1; + HAVE_CANONICALIZE_FILE_NAME=1; + HAVE_DECL_GETLOADAVG=1; HAVE_GETSUBOPT=1; + HAVE_GRANTPT=1; HAVE_MALLOC_POSIX=1; HAVE_MKDTEMP=1; - HAVE_REALLOC_POSIX=1; + HAVE_MKOSTEMP=1; + HAVE_MKOSTEMPS=1; + HAVE_MKSTEMP=1; + HAVE_MKSTEMPS=1; + HAVE_PTSNAME=1; HAVE_RANDOM_R=1; + HAVE_REALLOC_POSIX=1; + HAVE_REALPATH=1; HAVE_RPMATCH=1; HAVE_SETENV=1; HAVE_STRTOD=1; @@ -14024,12 +16168,15 @@ $as_echo "$gl_cv_func_malloc_posix" >&6; } HAVE_STRTOULL=1; HAVE_STRUCT_RANDOM_DATA=1; HAVE_SYS_LOADAVG_H=0; + HAVE_UNLOCKPT=1; HAVE_UNSETENV=1; - HAVE_DECL_GETLOADAVG=1; + REPLACE_CANONICALIZE_FILE_NAME=0; REPLACE_MKSTEMP=0; REPLACE_PUTENV=0; + REPLACE_REALPATH=0; + REPLACE_SETENV=0; REPLACE_STRTOD=0; - VOID_UNSETENV=0; + REPLACE_UNSETENV=0; for ac_header in stdlib.h @@ -14102,18 +16249,18 @@ else /* end confdefs.h. */ /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; + ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; + ? 1 : -1)]; int i = 63; int main () @@ -14122,40 +16269,40 @@ main () long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : ac_cv_type_long_long_int=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <limits.h> - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif int main () { long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; ; return 0; } @@ -14195,7 +16342,7 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default -# include <wchar.h> +# include <wchar.h> int main () { @@ -14295,7 +16442,22 @@ $as_echo "#define HAVE_MBRTOWC 1" >>confdefs.h REPLACE_WCSRTOMBS=0; REPLACE_WCSNRTOMBS=0; REPLACE_WCWIDTH=0; - WCHAR_H=''; + + + + + for ac_func in $ac_func_list +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done @@ -14613,6 +16775,7 @@ $as_echo "$gt_cv_locale_fr_utf8" >&6; } GNULIB_STPNCPY=0; GNULIB_STRCHRNUL=0; GNULIB_STRDUP=0; + GNULIB_STRNCAT=0; GNULIB_STRNDUP=0; GNULIB_STRNLEN=0; GNULIB_STRPBRK=0; @@ -14637,7 +16800,9 @@ $as_echo "$gt_cv_locale_fr_utf8" >&6; } GNULIB_STRERROR=0; GNULIB_STRSIGNAL=0; GNULIB_STRVERSCMP=0; - HAVE_DECL_MEMMEM=1; + HAVE_MBSLEN=0; + HAVE_MEMCHR=1; + HAVE_DECL_MEMMEM=1; HAVE_MEMPCPY=1; HAVE_DECL_MEMRCHR=1; HAVE_RAWMEMCHR=1; @@ -14645,23 +16810,29 @@ $as_echo "$gt_cv_locale_fr_utf8" >&6; } HAVE_STPNCPY=1; HAVE_STRCHRNUL=1; HAVE_DECL_STRDUP=1; - HAVE_STRNDUP=1; HAVE_DECL_STRNDUP=1; HAVE_DECL_STRNLEN=1; HAVE_STRPBRK=1; HAVE_STRSEP=1; HAVE_STRCASESTR=1; HAVE_DECL_STRTOK_R=1; - HAVE_DECL_STRERROR=1; HAVE_DECL_STRSIGNAL=1; HAVE_STRVERSCMP=1; REPLACE_MEMCHR=0; REPLACE_MEMMEM=0; + REPLACE_STPNCPY=0; REPLACE_STRDUP=0; REPLACE_STRSTR=0; REPLACE_STRCASESTR=0; REPLACE_STRERROR=0; + REPLACE_STRNCAT=0; + REPLACE_STRNDUP=0; + REPLACE_STRNLEN=0; REPLACE_STRSIGNAL=0; + REPLACE_STRTOK_R=0; + UNDEFINE_STRTOK_R=0; + + @@ -14739,47 +16910,6 @@ $as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h - - - - - - - - for ac_func in memchr -do : - ac_fn_c_check_func "$LINENO" "memchr" "ac_cv_func_memchr" -if test "x$ac_cv_func_memchr" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MEMCHR 1 -_ACEOF - -else - - gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext" - -fi -done - - - if test $ac_cv_func_memchr = no; then - - for ac_header in bp-sym.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "bp-sym.h" "ac_cv_header_bp_sym_h" "$ac_includes_default" -if test "x$ac_cv_header_bp_sym_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_BP_SYM_H 1 -_ACEOF - -fi - -done - - - REPLACE_MEMCHR=1 - fi - if test $ac_cv_func_memchr = yes; then # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 @@ -14827,11 +16957,11 @@ main () { int pagesize = getpagesize (); char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - fence = two_pages + pagesize; + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; } #endif if (fence) @@ -14861,32 +16991,36 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 $as_echo "$gl_cv_func_memchr_works" >&6; } if test "$gl_cv_func_memchr_works" != yes; then + REPLACE_MEMCHR=1 + fi + else + HAVE_MEMCHR=0 + fi + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then - for ac_header in bp-sym.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "bp-sym.h" "ac_cv_header_bp_sym_h" "$ac_includes_default" -if test "x$ac_cv_header_bp_sym_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_BP_SYM_H 1 -_ACEOF -fi -done - REPLACE_MEMCHR=1 + gl_LIBOBJS="$gl_LIBOBJS memchr.$ac_objext" + for ac_header in bp-sym.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "bp-sym.h" "ac_cv_header_bp_sym_h" "$ac_includes_default" +if test "x$ac_cv_header_bp_sym_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_BP_SYM_H 1 +_ACEOF +fi +done - gl_LIBOBJS="$gl_LIBOBJS memchr.$ac_objext" - fi fi @@ -15055,76 +17189,76 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include <stdbool.h> - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - #if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a run-time - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); - #endif - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; + #include <stdbool.h> + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + #if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a run-time + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); + #endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; int main () { - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); ; return 0; @@ -15204,18 +17338,18 @@ else /* end confdefs.h. */ /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; + ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; + ? 1 : -1)]; int i = 63; int main () @@ -15224,9 +17358,9 @@ main () long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); ; return 0; } @@ -15320,26 +17454,26 @@ if test "${gl_cv_next_string_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_string_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_string_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_string_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/string.h#{ - s#.*"\(.*/string.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_string_h='<'string.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_string_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/string.h#{ + s#.*"\(.*/string.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_string_h='<'string.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_string_h" >&5 @@ -15360,6 +17494,340 @@ $as_echo "$gl_cv_next_string_h" >&6; } + for gl_func in memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if { as_var=$as_gl_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval as_val=\$$as_gl_Symbol + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + + eval ac_cv_have_decl_$gl_func=yes +fi + done + + + + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strncat works" >&5 +$as_echo_n "checking whether strncat works... " >&6; } +if test "${gl_cv_func_strncat_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + + case "$host_os" in + # Guess no on Solaris. + solaris*) gl_cv_func_strncat_works="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_strncat_works="guessing yes";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <string.h> +#if HAVE_SYS_MMAN_H +# include <fcntl.h> +# include <unistd.h> +# include <sys/types.h> +# include <sys/mman.h> +# ifndef MAP_FILE +# define MAP_FILE 0 +# endif +#endif + +int +main () +{ + + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT +# if HAVE_MAP_ANONYMOUS + const int flags = MAP_ANONYMOUS | MAP_PRIVATE; + const int fd = -1; +# else /* !HAVE_MAP_ANONYMOUS */ + const int flags = MAP_FILE | MAP_PRIVATE; + int fd = open ("/dev/zero", O_RDONLY, 0666); + if (fd >= 0) +# endif + { + int pagesize = getpagesize (); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + char dest[8]; + + dest[0] = '*'; + dest[1] = 'a'; + dest[2] = '\0'; + dest[3] = 'w'; + dest[4] = 'x'; + dest[5] = 'y'; + dest[6] = 'z'; + + *(fence - 3) = '7'; + *(fence - 2) = '2'; + *(fence - 1) = '9'; + + if (strncat (dest + 1, fence - 3, 3) != dest + 1) + return 1; + if (dest[0] != '*') + return 2; + if (dest[1] != 'a' + || dest[2] != '7' || dest[3] != '2' || dest[4] != '9' + || dest[5] != '\0') + return 3; + if (dest[6] != 'z') + return 4; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_strncat_works=yes +else + gl_cv_func_strncat_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strncat_works" >&5 +$as_echo "$gl_cv_func_strncat_works" >&6; } + case "$gl_cv_func_strncat_works" in + *yes) ;; + *) + REPLACE_STRNCAT=1 + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strncat.$ac_objext" + + + : + + ;; + esac + + + GNULIB_CHOWN=0; + GNULIB_CLOSE=0; + GNULIB_DUP2=0; + GNULIB_DUP3=0; + GNULIB_ENVIRON=0; + GNULIB_EUIDACCESS=0; + GNULIB_FACCESSAT=0; + GNULIB_FCHDIR=0; + GNULIB_FCHOWNAT=0; + GNULIB_FSYNC=0; + GNULIB_FTRUNCATE=0; + GNULIB_GETCWD=0; + GNULIB_GETDOMAINNAME=0; + GNULIB_GETDTABLESIZE=0; + GNULIB_GETGROUPS=0; + GNULIB_GETHOSTNAME=0; + GNULIB_GETLOGIN=0; + GNULIB_GETLOGIN_R=0; + GNULIB_GETPAGESIZE=0; + GNULIB_GETUSERSHELL=0; + GNULIB_LCHOWN=0; + GNULIB_LINK=0; + GNULIB_LINKAT=0; + GNULIB_LSEEK=0; + GNULIB_PIPE2=0; + GNULIB_PREAD=0; + GNULIB_READLINK=0; + GNULIB_READLINKAT=0; + GNULIB_RMDIR=0; + GNULIB_SLEEP=0; + GNULIB_SYMLINK=0; + GNULIB_SYMLINKAT=0; + GNULIB_TTYNAME_R=0; + GNULIB_UNISTD_H_GETOPT=0; + GNULIB_UNISTD_H_SIGPIPE=0; + GNULIB_UNLINK=0; + GNULIB_UNLINKAT=0; + GNULIB_USLEEP=0; + GNULIB_WRITE=0; + HAVE_CHOWN=1; + HAVE_DUP2=1; + HAVE_DUP3=1; + HAVE_EUIDACCESS=1; + HAVE_FACCESSAT=1; + HAVE_FCHDIR=1; + HAVE_FCHOWNAT=1; + HAVE_FSYNC=1; + HAVE_FTRUNCATE=1; + HAVE_GETDOMAINNAME=1; + HAVE_GETDTABLESIZE=1; + HAVE_GETGROUPS=1; + HAVE_GETHOSTNAME=1; + HAVE_GETLOGIN=1; + HAVE_GETPAGESIZE=1; + HAVE_LCHOWN=1; + HAVE_LINK=1; + HAVE_LINKAT=1; + HAVE_PIPE2=1; + HAVE_PREAD=1; + HAVE_READLINK=1; + HAVE_READLINKAT=1; + HAVE_SLEEP=1; + HAVE_SYMLINK=1; + HAVE_SYMLINKAT=1; + HAVE_TTYNAME_R=1; + HAVE_UNLINKAT=1; + HAVE_USLEEP=1; + HAVE_DECL_ENVIRON=1; + HAVE_DECL_GETLOGIN_R=1; + HAVE_DECL_GETPAGESIZE=1; + HAVE_DECL_GETUSERSHELL=1; + HAVE_OS_H=0; + HAVE_SYS_PARAM_H=0; + REPLACE_CHOWN=0; + REPLACE_CLOSE=0; + REPLACE_DUP=0; + REPLACE_DUP2=0; + REPLACE_FCHOWNAT=0; + REPLACE_GETCWD=0; + REPLACE_GETGROUPS=0; + REPLACE_GETPAGESIZE=0; + REPLACE_LCHOWN=0; + REPLACE_LINK=0; + REPLACE_LINKAT=0; + REPLACE_LSEEK=0; + REPLACE_PREAD=0; + REPLACE_READLINK=0; + REPLACE_RMDIR=0; + REPLACE_SLEEP=0; + REPLACE_SYMLINK=0; + REPLACE_TTYNAME_R=0; + REPLACE_UNLINK=0; + REPLACE_UNLINKAT=0; + REPLACE_USLEEP=0; + REPLACE_WRITE=0; + UNISTD_H_HAVE_WINSOCK2_H=0; + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 @@ -15538,6 +18006,75 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf returns a byte count as in C99" >&5 +$as_echo_n "checking whether snprintf returns a byte count as in C99... " >&6; } +if test "${gl_cv_func_snprintf_retval_c99+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; + darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_retval_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; + solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; + aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_retval_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_retval_c99="guessing no";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <stdio.h> +#include <string.h> +static char buf[100]; +int main () +{ + strcpy (buf, "ABCDEF"); + if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_snprintf_retval_c99=yes +else + gl_cv_func_snprintf_retval_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_retval_c99" >&5 +$as_echo "$gl_cv_func_snprintf_retval_c99" >&6; } + + + + @@ -15567,6 +18104,14 @@ cat >>confdefs.h <<_ACEOF _ACEOF + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + +$as_echo "#define HAVE_SNPRINTF_RETVAL_C99 1" >>confdefs.h + + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports 'long double' arguments" >&5 @@ -16712,10 +19257,116 @@ $as_echo "$gl_cv_func_printf_enomem" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <wchar.h> uses 'inline' correctly" >&5 +$as_echo_n "checking whether <wchar.h> uses 'inline' correctly... " >&6; } +if test "${gl_cv_header_wchar_h_correct_inline+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_header_wchar_h_correct_inline=yes + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define wcstod renamed_wcstod +#include <wchar.h> +extern int zero (void); +int main () { return zero(); } + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + mv conftest.$ac_objext conftest1.$ac_objext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define wcstod renamed_wcstod +#include <wchar.h> +int zero (void) { return 0; } + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + mv conftest.$ac_objext conftest2.$ac_objext + if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&5 2>&1; then + : + else + gl_cv_header_wchar_h_correct_inline=no + fi + fi + fi + rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_wchar_h_correct_inline" >&5 +$as_echo "$gl_cv_header_wchar_h_correct_inline" >&6; } + if test $gl_cv_header_wchar_h_correct_inline = no; then + as_fn_error "<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). +This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in +C99 mode. You have four options: + - Add the flag -fgnu89-inline to CC and reconfigure, or + - Fix your include files, using parts of + <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or + - Use a gcc version older than 4.3, or + - Don't use the flags -std=c99 or -std=gnu99. +Configuration aborted." "$LINENO" 5 + fi + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 +$as_echo_n "checking if environ is properly declared... " >&6; } + if test "${gt_cv_var_environ_declaration+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <unistd.h> + extern struct { int foo; } environ; +int +main () +{ +environ.foo = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gt_cv_var_environ_declaration=no +else + gt_cv_var_environ_declaration=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 +$as_echo "$gt_cv_var_environ_declaration" >&6; } + if test $gt_cv_var_environ_declaration = yes; then + +$as_echo "#define HAVE_ENVIRON_DECL 1" >>confdefs.h + + fi + + + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = x""yes; then : @@ -16813,58 +19464,104 @@ fi XGETTEXT_EXTRA_OPTIONS= - GNULIB_OPEN=0; - REPLACE_OPEN=0; + GNULIB_DUPLOCALE=0; + HAVE_DUPLOCALE=1; + REPLACE_DUPLOCALE=0; -ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = x""yes; then : -else -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5 -$as_echo_n "checking for promoted mode_t type... " >&6; } -if test "${gl_cv_promoted_mode_t+set}" = set; then : + + if test $ac_cv_func_setenv = no; then + HAVE_SETENV=0 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setenv validates arguments" >&5 +$as_echo_n "checking whether setenv validates arguments... " >&6; } +if test "${gl_cv_func_setenv_works+set}" = set; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$cross_compiling" = yes; then : + gl_cv_func_setenv_works="guessing no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/types.h> + + #include <stdlib.h> + #include <errno.h> + #include <string.h> + int main () { -typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1]; + + if (setenv ("", "", 0) != -1) return 1; + if (errno != EINVAL) return 2; + if (setenv ("a", "=", 1) != 0) return 3; + if (strcmp (getenv ("a"), "=") != 0) return 4; + ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_promoted_mode_t='int' +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_setenv_works=yes else - gl_cv_promoted_mode_t='mode_t' + gl_cv_func_setenv_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5 -$as_echo "$gl_cv_promoted_mode_t" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setenv_works" >&5 +$as_echo "$gl_cv_func_setenv_works" >&6; } + if test "$gl_cv_func_setenv_works" != yes; then + REPLACE_SETENV=1 -cat >>confdefs.h <<_ACEOF -#define PROMOTED_MODE_T $gl_cv_promoted_mode_t + + + + + + + + gltests_LIBOBJS="$gltests_LIBOBJS setenv.$ac_objext" + + fi + fi + + + + + for ac_header in search.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default" +if test "x$ac_cv_header_search_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SEARCH_H 1 +_ACEOF + +fi + +done + + for ac_func in tsearch +do : + ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" +if test "x$ac_cv_func_tsearch" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TSEARCH 1 _ACEOF +fi +done @@ -16985,6 +19682,7 @@ else fi gl_cond_libtool=true + gl_m4_base='gnulib-m4' @@ -16995,6 +19693,7 @@ fi gl_source_base='lib' + # Code from module alloca-opt: @@ -17045,87 +19744,17 @@ $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h fi + # Code from module arg-nonnull: + # Code from module array-mergesort: + # Code from module c++defs: + # Code from module c-ctype: + # Code from module c-strcase: + # Code from module c-strcaseeq: + # Code from module configmake: + # Code from module errno: - - - - if test $ac_cv_func_dup2 = no; then - HAVE_DUP2=0 - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether dup2 works" >&5 -$as_echo_n "checking whether dup2 works... " >&6; } -if test "${gl_cv_func_dup2_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - case "$host_os" in - mingw*) # on this platform, dup2 always returns 0 for success - gl_cv_func_dup2_works=no;; - cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 - gl_cv_func_dup2_works=no;; - *) gl_cv_func_dup2_works=yes;; - esac -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <unistd.h> - -int -main () -{ -return 1 - dup2 (1, 1); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_dup2_works=yes -else - gl_cv_func_dup2_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup2_works" >&5 -$as_echo "$gl_cv_func_dup2_works" >&6; } - if test "$gl_cv_func_dup2_works" = no; then - REPLACE_DUP2=1 - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" - - fi - fi - -cat >>confdefs.h <<_ACEOF -#define REPLACE_DUP2 $REPLACE_DUP2 -_ACEOF - - - - - GNULIB_DUP2=1 - - + # Code from module extensions: + # Code from module float: @@ -17148,26 +19777,26 @@ if test "${gl_cv_next_float_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_float_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_float_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <float.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_float_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/float.h#{ - s#.*"\(.*/float.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_float_h='<'float.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_float_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/float.h#{ + s#.*"\(.*/float.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_float_h='<'float.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_float_h" >&5 @@ -17190,18 +19819,30 @@ $as_echo "$gl_cv_next_float_h" >&6; } esac + # Code from module fpieee: + # Code from module fpucw: + # Code from module frexpl-nolibm: - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 + ac_fn_c_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include <math.h> +" +if test "x$ac_cv_have_decl_frexpl" = x""yes; then : + +else + HAVE_DECL_FREXPL=0 +fi + + if test $HAVE_DECL_FREXPL = 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl() can be used without linking with libm" >&5 $as_echo_n "checking whether frexpl() can be used without linking with libm... " >&6; } if test "${gl_cv_func_frexpl_no_libm+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <math.h> - long double x; + long double x; int main () { @@ -17221,7 +19862,7 @@ rm -f core conftest.err conftest.$ac_objext \ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_no_libm" >&5 $as_echo "$gl_cv_func_frexpl_no_libm" >&6; } - if test $gl_cv_func_frexpl_no_libm = yes; then + if test $gl_cv_func_frexpl_no_libm = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl works" >&5 @@ -17326,111 +19967,48 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_frexpl_works" >&5 $as_echo "$gl_cv_func_frexpl_works" >&6; } - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl_no_libm=yes ;; - *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl_no_libm=no - REPLACE_FREXPL=1 - fi - if test $gl_func_frexpl_no_libm = yes; then + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then $as_echo "#define HAVE_FREXPL_IN_LIBC 1" >>confdefs.h - ac_fn_c_check_decl "$LINENO" "frexpl" "ac_cv_have_decl_frexpl" "#include <math.h> -" -if test "x$ac_cv_have_decl_frexpl" = x""yes; then : - -else - HAVE_DECL_FREXPL=0 -fi - - else - HAVE_DECL_FREXPL=0 - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS frexpl.$ac_objext" - + fi fi + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then - GNULIB_FREXPL=1 - - - - - for ac_func in getpagesize -do : - ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" -if test "x$ac_cv_func_getpagesize" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETPAGESIZE 1 -_ACEOF - -fi -done - - if test $ac_cv_func_getpagesize = no; then - HAVE_GETPAGESIZE=0 - for ac_header in OS.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "OS.h" "ac_cv_header_OS_h" "$ac_includes_default" -if test "x$ac_cv_header_OS_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OS_H 1 -_ACEOF -fi -done - if test $ac_cv_header_OS_h = yes; then - HAVE_OS_H=1 - fi - for ac_header in sys/param.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_PARAM_H 1 -_ACEOF -fi -done + gl_LIBOBJS="$gl_LIBOBJS frexpl.$ac_objext" - if test $ac_cv_header_sys_param_h = yes; then - HAVE_SYS_PARAM_H=1 - fi fi - case "$host_os" in - mingw*) - REPLACE_GETPAGESIZE=1 - - - + GNULIB_FREXPL=1 - gl_LIBOBJS="$gl_LIBOBJS getpagesize.$ac_objext" - ;; - esac +$as_echo "#define GNULIB_TEST_FREXPL 1" >>confdefs.h - GNULIB_GETPAGESIZE=1 + # Code from module fseterr: + # Code from module gperf: + # Code from module havelib: + # Code from module iconv: @@ -17560,6 +20138,25 @@ int main () return 1; } } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { @@ -17684,6 +20281,8 @@ _ACEOF fi + # Code from module iconv-h: + @@ -17701,26 +20300,26 @@ if test "${gl_cv_next_iconv_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_iconv_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_iconv_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <iconv.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_iconv_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/iconv.h#{ - s#.*"\(.*/iconv.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_iconv_h='<'iconv.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_iconv_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/iconv.h#{ + s#.*"\(.*/iconv.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_iconv_h='<'iconv.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_iconv_h" >&5 @@ -17740,11 +20339,16 @@ $as_echo "$gl_cv_next_iconv_h" >&6; } + # Code from module iconv_open: if test "$am_cv_func_iconv" = yes; then + + + ICONV_H='iconv.h' + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17765,10 +20369,11 @@ rm -f conftest* if test $gl_func_iconv_gnu = no; then iconv_flavor= case "$host_os" in - aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; - irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; - hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; - osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; + irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; + hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; + osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; esac if test -n "$iconv_flavor"; then @@ -17797,6 +20402,8 @@ _ACEOF fi fi + # Code from module include_next: + # Code from module inline: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler generally respects inline" >&5 @@ -17837,6 +20444,7 @@ $as_echo "#define HAVE_INLINE 1" >>confdefs.h fi + # Code from module isnand-nolibm: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(double) can be used without linking with libm" >&5 @@ -18241,6 +20849,7 @@ _ACEOF fi + # Code from module isnanf-nolibm: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(float) can be used without linking with libm" >&5 @@ -18498,6 +21107,7 @@ _ACEOF fi + # Code from module isnanl-nolibm: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan(long double) can be used without linking with libm" >&5 @@ -18827,6 +21437,8 @@ _ACEOF fi + # Code from module localcharset: + @@ -18836,21 +21448,67 @@ _ACEOF LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + # Code from module localename: - for ac_func in setlocale + for ac_func in setlocale uselocale do : - ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" -if test "x$ac_cv_func_setlocale" = x""yes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_SETLOCALE 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done + # Code from module lock: + + + if test "$gl_threads_api" = posix; then + # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the + # pthread_rwlock_* functions. + ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include <pthread.h> +" +if test "x$ac_cv_type_pthread_rwlock_t" = x""yes; then : + +$as_echo "#define HAVE_PTHREAD_RWLOCK 1" >>confdefs.h + +fi + + # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +#if __FreeBSD__ == 4 +error "No, in FreeBSD 4.0 recursive mutexes actually don't work." +#else +int x = (int)PTHREAD_MUTEX_RECURSIVE; +return !x; +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_MUTEX_RECURSIVE 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + + + + # Code from module malloc-posix: if test $gl_cv_func_malloc_posix = yes; then @@ -18875,15 +21533,24 @@ $as_echo "#define HAVE_MALLOC_POSIX 1" >>confdefs.h + GNULIB_MALLOC_POSIX=1 +$as_echo "#define GNULIB_TEST_MALLOC_POSIX 1" >>confdefs.h + + + # Code from module malloca: + # Code from module math: + + + @@ -18898,26 +21565,26 @@ if test "${gl_cv_next_math_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_math_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_math_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <math.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_math_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/math.h#{ - s#.*"\(.*/math.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_math_h='<'math.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_math_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/math.h#{ + s#.*"\(.*/math.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_math_h='<'math.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_math_h" >&5 @@ -18936,6 +21603,8 @@ $as_echo "$gl_cv_next_math_h" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NAN macro works" >&5 $as_echo_n "checking whether NAN macro works... " >&6; } if test "${gl_cv_header_math_nan_works+set}" = set; then : @@ -18952,9 +21621,9 @@ main () test only needs to fail when NAN is provided but wrong. */ float f = 1.0f; #ifdef NAN - f = NAN; + f = NAN; #endif - return f == 0; + return f == 0; ; return 0; } @@ -18983,8 +21652,8 @@ int main () { /* Solaris 10 has a broken definition of HUGE_VAL. */ - double d = HUGE_VAL; - return d == 0; + double d = HUGE_VAL; + return d == 0; ; return 0; } @@ -19003,13 +21672,60 @@ $as_echo "$gl_cv_header_math_huge_val_works" >&6; } fi + for gl_func in acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if { as_var=$as_gl_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <math.h> + +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval as_val=\$$as_gl_Symbol + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + + eval ac_cv_have_decl_$gl_func=yes +fi + done + + + # Code from module mbchar: + + + # Code from module mbiter: + : + # Code from module mbrtowc: @@ -19151,19 +21867,18 @@ $as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } fi if test $REPLACE_MBSTATE_T = 1; then - - WCHAR_H=wchar.h + : fi - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBRTOWC=1 - fi + if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 - fi - if test $HAVE_MBRTOWC != 0 && test $REPLACE_MBRTOWC != 1; then + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOWC=1 + else @@ -19353,35 +22068,35 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_nul_retval" >&5 $as_echo "$gl_cv_func_mbrtowc_nul_retval" >&6; } - case "$gl_cv_func_mbrtowc_null_arg" in - *yes) ;; - *) + case "$gl_cv_func_mbrtowc_null_arg" in + *yes) ;; + *) $as_echo "#define MBRTOWC_NULL_ARG_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_retval" in - *yes) ;; - *) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_retval" in + *yes) ;; + *) $as_echo "#define MBRTOWC_RETVAL_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_nul_retval" in - *yes) ;; - *) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_nul_retval" in + *yes) ;; + *) $as_echo "#define MBRTOWC_NUL_RETVAL_BUG 1" >>confdefs.h - REPLACE_MBRTOWC=1 - ;; - esac + REPLACE_MBRTOWC=1 + ;; + esac + fi fi if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then - - WCHAR_H=wchar.h + : @@ -19400,10 +22115,18 @@ $as_echo "#define MBRTOWC_NUL_RETVAL_BUG 1" >>confdefs.h + GNULIB_MBRTOWC=1 +$as_echo "#define GNULIB_TEST_MBRTOWC 1" >>confdefs.h + + + + # Code from module mbsinit: + + @@ -19543,22 +22266,22 @@ $as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } fi if test $REPLACE_MBSTATE_T = 1; then - - WCHAR_H=wchar.h + : fi - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBSINIT=1 - fi + if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBSINIT=1 + fi fi if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then - - WCHAR_H=wchar.h + : @@ -19577,21 +22300,50 @@ $as_echo "$gl_cv_func_mbrtowc_sanitycheck" >&6; } + GNULIB_MBSINIT=1 +$as_echo "#define GNULIB_TEST_MBSINIT 1" >>confdefs.h + + + + # Code from module mbsnlen: + + + GNULIB_MBSNLEN=1 +$as_echo "#define GNULIB_TEST_MBSNLEN 1" >>confdefs.h + + + + # Code from module memchr: + + + GNULIB_MEMCHR=1 +$as_echo "#define GNULIB_TEST_MEMCHR 1" >>confdefs.h + + + + # Code from module memcmp2: + # Code from module memxfrm: + # Code from module minmax: + + # Code from module multiarch: + + # Code from module nocrash: + # Code from module printf-frexp: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexp can be used without linking with libm" >&5 $as_echo_n "checking whether frexp can be used without linking with libm... " >&6; } @@ -19742,6 +22494,7 @@ $as_echo "#define HAVE_LDEXP_IN_LIBC 1" >>confdefs.h fi + # Code from module printf-frexpl: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether frexpl can be used without linking with libm" >&5 @@ -19992,7 +22745,9 @@ fi esac fi + # Code from module printf-safe: + # Code from module relocatable-lib-lgpl: if test $RELOCATABLE = yes; then @@ -20008,6 +22763,7 @@ fi fi + # Code from module signbit: { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signbit macro" >&5 @@ -20715,9 +23471,17 @@ $as_echo "#define HAVE_COPYSIGNL_IN_LIBC 1" >>confdefs.h + GNULIB_SIGNBIT=1 + +$as_echo "#define GNULIB_TEST_SIGNBIT 1" >>confdefs.h + + + + # Code from module size_max: + for ac_header in stdint.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" @@ -20812,6 +23576,7 @@ _ACEOF fi + # Code from module stdbool: @@ -20831,6 +23596,7 @@ _ACEOF fi + # Code from module stddef: @@ -20885,26 +23651,26 @@ if test "${gl_cv_next_stddef_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_stddef_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_stddef_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stddef.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_stddef_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/stddef.h#{ - s#.*"\(.*/stddef.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_stddef_h='<'stddef.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stddef_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stddef.h#{ + s#.*"\(.*/stddef.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stddef_h='<'stddef.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 @@ -20925,6 +23691,7 @@ $as_echo "$gl_cv_next_stddef_h" >&6; } fi + # Code from module stdint: @@ -20971,26 +23738,26 @@ if test "${gl_cv_next_stdint_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_stdint_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_stdint_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdint.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_stdint_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/stdint.h#{ - s#.*"\(.*/stdint.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_stdint_h='<'stdint.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stdint_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdint.h#{ + s#.*"\(.*/stdint.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 @@ -21484,12 +24251,12 @@ else for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21556,12 +24323,12 @@ else for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21614,6 +24381,7 @@ _ACEOF fi + # Code from module stdlib: @@ -21631,26 +24399,26 @@ if test "${gl_cv_next_stdlib_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_stdlib_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_stdlib_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_stdlib_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/stdlib.h#{ - s#.*"\(.*/stdlib.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_stdlib_h='<'stdlib.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stdlib_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdlib.h#{ + s#.*"\(.*/stdlib.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdlib_h='<'stdlib.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdlib_h" >&5 @@ -21706,32 +24474,488 @@ else fi + + for gl_func in atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt unsetenv; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if { as_var=$as_gl_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#if HAVE_SYS_LOADAVG_H +# include <sys/loadavg.h> +#endif +#if HAVE_RANDOM_H +# include <random.h> +#endif + +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval as_val=\$$as_gl_Symbol + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + + eval ac_cv_have_decl_$gl_func=yes +fi + done + + + # Code from module streq: + # Code from module striconveh: if test $gl_cond_libtool = false; then gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" gl_libdeps="$gl_libdeps $LIBICONV" fi + # Code from module striconveha: + # Code from module string: + + + + # Code from module strncat: + + + + + GNULIB_STRNCAT=1 + + + +$as_echo "#define GNULIB_TEST_STRNCAT 1" >>confdefs.h + + + + # Code from module threadlib: + + + + + # Code from module unicase/base: + # Code from module unicase/cased: + + # Code from module unicase/empty-prefix-context: + # Code from module unicase/empty-suffix-context: + # Code from module unicase/ignorable: + + # Code from module unicase/locale-language: + # Code from module unicase/special-casing: + # Code from module unicase/tocasefold: + # Code from module unicase/tolower: + # Code from module unicase/totitle: + # Code from module unicase/toupper: + # Code from module unicase/u16-casecmp: + # Code from module unicase/u16-casecoll: + # Code from module unicase/u16-casefold: + # Code from module unicase/u16-casemap: + # Code from module unicase/u16-casexfrm: + # Code from module unicase/u16-ct-casefold: + # Code from module unicase/u16-ct-tolower: + # Code from module unicase/u16-ct-totitle: + # Code from module unicase/u16-ct-toupper: + # Code from module unicase/u16-is-cased: + # Code from module unicase/u16-is-casefolded: + # Code from module unicase/u16-is-invariant: + # Code from module unicase/u16-is-lowercase: + # Code from module unicase/u16-is-titlecase: + # Code from module unicase/u16-is-uppercase: + # Code from module unicase/u16-tolower: + # Code from module unicase/u16-totitle: + # Code from module unicase/u16-toupper: + # Code from module unicase/u32-casecmp: + # Code from module unicase/u32-casecoll: + # Code from module unicase/u32-casefold: + # Code from module unicase/u32-casemap: + # Code from module unicase/u32-casexfrm: + # Code from module unicase/u32-ct-casefold: + # Code from module unicase/u32-ct-tolower: + # Code from module unicase/u32-ct-totitle: + # Code from module unicase/u32-ct-toupper: + # Code from module unicase/u32-is-cased: + # Code from module unicase/u32-is-casefolded: + # Code from module unicase/u32-is-invariant: + # Code from module unicase/u32-is-lowercase: + # Code from module unicase/u32-is-titlecase: + # Code from module unicase/u32-is-uppercase: + # Code from module unicase/u32-tolower: + # Code from module unicase/u32-totitle: + # Code from module unicase/u32-toupper: + # Code from module unicase/u8-casecmp: + # Code from module unicase/u8-casecoll: + # Code from module unicase/u8-casefold: + # Code from module unicase/u8-casemap: + # Code from module unicase/u8-casexfrm: + # Code from module unicase/u8-ct-casefold: + # Code from module unicase/u8-ct-tolower: + # Code from module unicase/u8-ct-totitle: + # Code from module unicase/u8-ct-toupper: + # Code from module unicase/u8-is-cased: + # Code from module unicase/u8-is-casefolded: + # Code from module unicase/u8-is-invariant: + # Code from module unicase/u8-is-lowercase: + # Code from module unicase/u8-is-titlecase: + # Code from module unicase/u8-is-uppercase: + # Code from module unicase/u8-tolower: + # Code from module unicase/u8-totitle: + # Code from module unicase/u8-toupper: + # Code from module unicase/ulc-casecmp: + # Code from module unicase/ulc-casecoll: + # Code from module unicase/ulc-casexfrm: + # Code from module uniconv/base: + # Code from module uniconv/u16-conv-from-enc: + + # Code from module uniconv/u16-conv-to-enc: + + # Code from module uniconv/u16-strconv-from-enc: + # Code from module uniconv/u16-strconv-from-locale: + # Code from module uniconv/u16-strconv-to-enc: + + # Code from module uniconv/u16-strconv-to-locale: + # Code from module uniconv/u32-conv-from-enc: + # Code from module uniconv/u32-conv-to-enc: + # Code from module uniconv/u32-strconv-from-enc: + # Code from module uniconv/u32-strconv-from-locale: + # Code from module uniconv/u32-strconv-to-enc: + # Code from module uniconv/u32-strconv-to-locale: + # Code from module uniconv/u8-conv-from-enc: + # Code from module uniconv/u8-conv-to-enc: + # Code from module uniconv/u8-strconv-from-enc: + # Code from module uniconv/u8-strconv-from-locale: + # Code from module uniconv/u8-strconv-to-enc: + # Code from module uniconv/u8-strconv-to-locale: + # Code from module unictype/base: + # Code from module unictype/bidicategory-all: + # Code from module unictype/bidicategory-byname: + # Code from module unictype/bidicategory-name: + # Code from module unictype/bidicategory-of: + # Code from module unictype/bidicategory-test: + # Code from module unictype/block-all: + # Code from module unictype/block-list: + # Code from module unictype/block-of: + # Code from module unictype/block-test: + # Code from module unictype/category-C: + # Code from module unictype/category-Cc: + # Code from module unictype/category-Cf: + # Code from module unictype/category-Cn: + # Code from module unictype/category-Co: + # Code from module unictype/category-Cs: + # Code from module unictype/category-L: + # Code from module unictype/category-Ll: + # Code from module unictype/category-Lm: + # Code from module unictype/category-Lo: + # Code from module unictype/category-Lt: + # Code from module unictype/category-Lu: + # Code from module unictype/category-M: + # Code from module unictype/category-Mc: + # Code from module unictype/category-Me: + # Code from module unictype/category-Mn: + # Code from module unictype/category-N: + # Code from module unictype/category-Nd: + # Code from module unictype/category-Nl: + # Code from module unictype/category-No: + # Code from module unictype/category-P: + # Code from module unictype/category-Pc: + # Code from module unictype/category-Pd: + # Code from module unictype/category-Pe: + # Code from module unictype/category-Pf: + # Code from module unictype/category-Pi: + # Code from module unictype/category-Po: + # Code from module unictype/category-Ps: + # Code from module unictype/category-S: + # Code from module unictype/category-Sc: + # Code from module unictype/category-Sk: + # Code from module unictype/category-Sm: + # Code from module unictype/category-So: + # Code from module unictype/category-Z: + # Code from module unictype/category-Zl: + # Code from module unictype/category-Zp: + # Code from module unictype/category-Zs: + # Code from module unictype/category-all: + # Code from module unictype/category-and: + # Code from module unictype/category-and-not: + # Code from module unictype/category-byname: + # Code from module unictype/category-name: + # Code from module unictype/category-none: + # Code from module unictype/category-of: + + # Code from module unictype/category-or: + # Code from module unictype/category-test: + + # Code from module unictype/category-test-withtable: + # Code from module unictype/combining-class: + # Code from module unictype/ctype-alnum: + + # Code from module unictype/ctype-alpha: + + # Code from module unictype/ctype-blank: + + # Code from module unictype/ctype-cntrl: + + # Code from module unictype/ctype-digit: + + # Code from module unictype/ctype-graph: + + # Code from module unictype/ctype-lower: + + # Code from module unictype/ctype-print: + + # Code from module unictype/ctype-punct: + + # Code from module unictype/ctype-space: + + # Code from module unictype/ctype-upper: + + # Code from module unictype/ctype-xdigit: + + # Code from module unictype/decimal-digit: + # Code from module unictype/digit: + # Code from module unictype/mirror: + # Code from module unictype/numeric: + # Code from module unictype/property-all: + # Code from module unictype/property-alphabetic: + + # Code from module unictype/property-ascii-hex-digit: + + # Code from module unictype/property-bidi-arabic-digit: + + # Code from module unictype/property-bidi-arabic-right-to-left: + + # Code from module unictype/property-bidi-block-separator: + + # Code from module unictype/property-bidi-boundary-neutral: + + # Code from module unictype/property-bidi-common-separator: + + # Code from module unictype/property-bidi-control: + + # Code from module unictype/property-bidi-embedding-or-override: + + # Code from module unictype/property-bidi-eur-num-separator: + + # Code from module unictype/property-bidi-eur-num-terminator: + + # Code from module unictype/property-bidi-european-digit: + + # Code from module unictype/property-bidi-hebrew-right-to-left: + + # Code from module unictype/property-bidi-left-to-right: + + # Code from module unictype/property-bidi-non-spacing-mark: + + # Code from module unictype/property-bidi-other-neutral: + + # Code from module unictype/property-bidi-pdf: + + # Code from module unictype/property-bidi-segment-separator: + + # Code from module unictype/property-bidi-whitespace: + + # Code from module unictype/property-byname: + # Code from module unictype/property-combining: + + # Code from module unictype/property-composite: + + # Code from module unictype/property-currency-symbol: + + # Code from module unictype/property-dash: + + # Code from module unictype/property-decimal-digit: + + # Code from module unictype/property-default-ignorable-code-point: + + # Code from module unictype/property-deprecated: + + # Code from module unictype/property-diacritic: + + # Code from module unictype/property-extender: + # Code from module unictype/property-format-control: + # Code from module unictype/property-grapheme-base: + # Code from module unictype/property-grapheme-extend: + # Code from module unictype/property-grapheme-link: + # Code from module unictype/property-hex-digit: + # Code from module unictype/property-hyphen: + # Code from module unictype/property-id-continue: + # Code from module unictype/property-id-start: + # Code from module unictype/property-ideographic: -$as_echo "#define GNULIB_UNINORM_U16_NORMALIZE 1" >>confdefs.h + # Code from module unictype/property-ids-binary-operator: + # Code from module unictype/property-ids-trinary-operator: + # Code from module unictype/property-ignorable-control: + # Code from module unictype/property-iso-control: -$as_echo "#define GNULIB_UNINORM_U32_NORMALIZE 1" >>confdefs.h + # Code from module unictype/property-join-control: + # Code from module unictype/property-left-of-pair: + # Code from module unictype/property-line-separator: + # Code from module unictype/property-logical-order-exception: -$as_echo "#define GNULIB_UNINORM_U8_NORMALIZE 1" >>confdefs.h + # Code from module unictype/property-lowercase: + # Code from module unictype/property-math: + + # Code from module unictype/property-non-break: + + # Code from module unictype/property-not-a-character: + + # Code from module unictype/property-numeric: + + # Code from module unictype/property-other-alphabetic: + + # Code from module unictype/property-other-default-ignorable-code-point: + + # Code from module unictype/property-other-grapheme-extend: + + # Code from module unictype/property-other-id-continue: + + # Code from module unictype/property-other-id-start: + + # Code from module unictype/property-other-lowercase: + + # Code from module unictype/property-other-math: + + # Code from module unictype/property-other-uppercase: + + # Code from module unictype/property-paired-punctuation: + + # Code from module unictype/property-paragraph-separator: + + # Code from module unictype/property-pattern-syntax: + + # Code from module unictype/property-pattern-white-space: + + # Code from module unictype/property-private-use: + + # Code from module unictype/property-punctuation: + + # Code from module unictype/property-quotation-mark: + + # Code from module unictype/property-radical: + + # Code from module unictype/property-sentence-terminal: + + # Code from module unictype/property-soft-dotted: + + # Code from module unictype/property-space: + + # Code from module unictype/property-terminal-punctuation: + + # Code from module unictype/property-test: + # Code from module unictype/property-titlecase: + + # Code from module unictype/property-unassigned-code-value: + + # Code from module unictype/property-unified-ideograph: + + # Code from module unictype/property-uppercase: + + # Code from module unictype/property-variation-selector: + + # Code from module unictype/property-white-space: + + # Code from module unictype/property-xid-continue: + + # Code from module unictype/property-xid-start: + + # Code from module unictype/property-zero-width: + + # Code from module unictype/scripts: + # Code from module unictype/scripts-all: + # Code from module unictype/syntax-c-ident: + + # Code from module unictype/syntax-c-whitespace: + # Code from module unictype/syntax-java-ident: + + # Code from module unictype/syntax-java-whitespace: + # Code from module unilbrk/base: + # Code from module unilbrk/tables: + + # Code from module unilbrk/u16-possible-linebreaks: + # Code from module unilbrk/u16-width-linebreaks: + # Code from module unilbrk/u32-possible-linebreaks: + # Code from module unilbrk/u32-width-linebreaks: + # Code from module unilbrk/u8-possible-linebreaks: + # Code from module unilbrk/u8-width-linebreaks: + # Code from module unilbrk/ulc-common: + # Code from module unilbrk/ulc-possible-linebreaks: + # Code from module unilbrk/ulc-width-linebreaks: + # Code from module uniname/base: + # Code from module uniname/uniname: + # Code from module uninorm/base: + # Code from module uninorm/canonical-decomposition: + # Code from module uninorm/compat-decomposition: + # Code from module uninorm/composition: + # Code from module uninorm/decompose-internal: + # Code from module uninorm/decomposing-form: + # Code from module uninorm/decomposition: + # Code from module uninorm/decomposition-table: + + # Code from module uninorm/filter: + # Code from module uninorm/nfc: + # Code from module uninorm/nfd: + # Code from module uninorm/nfkc: + # Code from module uninorm/nfkd: + # Code from module uninorm/u16-normalize: + + +$as_echo "#define GNULIB_TEST_UNINORM_U16_NORMALIZE 1" >>confdefs.h + + + # Code from module uninorm/u16-normcmp: + # Code from module uninorm/u16-normcoll: + # Code from module uninorm/u16-normxfrm: + # Code from module uninorm/u32-normalize: + + +$as_echo "#define GNULIB_TEST_UNINORM_U32_NORMALIZE 1" >>confdefs.h + + + # Code from module uninorm/u32-normcmp: + # Code from module uninorm/u32-normcoll: + # Code from module uninorm/u32-normxfrm: + # Code from module uninorm/u8-normalize: + + +$as_echo "#define GNULIB_TEST_UNINORM_U8_NORMALIZE 1" >>confdefs.h + + + # Code from module uninorm/u8-normcmp: + # Code from module uninorm/u8-normcoll: + # Code from module uninorm/u8-normxfrm: + # Code from module unistd: @@ -21751,26 +24975,26 @@ if test "${gl_cv_next_unistd_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_unistd_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_unistd_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <unistd.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_unistd_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/unistd.h#{ - s#.*"\(.*/unistd.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_unistd_h='<'unistd.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_unistd_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/unistd.h#{ + s#.*"\(.*/unistd.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_unistd_h='<'unistd.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_unistd_h" >&5 @@ -21799,10 +25023,66 @@ $as_echo "$gl_cv_next_unistd_h" >&6; } + for gl_func in chown dup2 dup3 environ euidaccess faccessat fchdir fchownat fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell endusershell lchown link linkat lseek pipe2 pread readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if { as_var=$as_gl_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <unistd.h> +/* Some systems declare various items in the wrong headers. */ +#ifndef __GLIBC__ +# include <fcntl.h> +# include <stdio.h> +# include <stdlib.h> +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include <io.h> +# endif +#endif +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval as_val=\$$as_gl_Symbol + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + eval ac_cv_have_decl_$gl_func=yes +fi + done + # Code from module unistdio/base: + # Code from module unistdio/u-printf-args: + + + + + + # Code from module unistdio/u16-asnprintf: + # Code from module unistdio/u16-asprintf: + # Code from module unistdio/u16-printf-parse: @@ -21820,6 +25100,13 @@ fi + # Code from module unistdio/u16-snprintf: + # Code from module unistdio/u16-sprintf: + # Code from module unistdio/u16-u16-asnprintf: + # Code from module unistdio/u16-u16-asprintf: + # Code from module unistdio/u16-u16-snprintf: + # Code from module unistdio/u16-u16-sprintf: + # Code from module unistdio/u16-u16-vasnprintf: @@ -21972,6 +25259,10 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/u16-u16-vasprintf: + # Code from module unistdio/u16-u16-vsnprintf: + # Code from module unistdio/u16-u16-vsprintf: + # Code from module unistdio/u16-vasnprintf: @@ -22124,6 +25415,12 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/u16-vasprintf: + # Code from module unistdio/u16-vsnprintf: + # Code from module unistdio/u16-vsprintf: + # Code from module unistdio/u32-asnprintf: + # Code from module unistdio/u32-asprintf: + # Code from module unistdio/u32-printf-parse: @@ -22141,6 +25438,13 @@ fi + # Code from module unistdio/u32-snprintf: + # Code from module unistdio/u32-sprintf: + # Code from module unistdio/u32-u32-asnprintf: + # Code from module unistdio/u32-u32-asprintf: + # Code from module unistdio/u32-u32-snprintf: + # Code from module unistdio/u32-u32-sprintf: + # Code from module unistdio/u32-u32-vasnprintf: @@ -22293,6 +25597,10 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/u32-u32-vasprintf: + # Code from module unistdio/u32-u32-vsnprintf: + # Code from module unistdio/u32-u32-vsprintf: + # Code from module unistdio/u32-vasnprintf: @@ -22445,6 +25753,12 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/u32-vasprintf: + # Code from module unistdio/u32-vsnprintf: + # Code from module unistdio/u32-vsprintf: + # Code from module unistdio/u8-asnprintf: + # Code from module unistdio/u8-asprintf: + # Code from module unistdio/u8-printf-parse: @@ -22462,6 +25776,13 @@ fi + # Code from module unistdio/u8-snprintf: + # Code from module unistdio/u8-sprintf: + # Code from module unistdio/u8-u8-asnprintf: + # Code from module unistdio/u8-u8-asprintf: + # Code from module unistdio/u8-u8-snprintf: + # Code from module unistdio/u8-u8-sprintf: + # Code from module unistdio/u8-u8-vasnprintf: @@ -22614,6 +25935,10 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/u8-u8-vasprintf: + # Code from module unistdio/u8-u8-vsnprintf: + # Code from module unistdio/u8-u8-vsprintf: + # Code from module unistdio/u8-vasnprintf: @@ -22766,6 +26091,13 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/u8-vasprintf: + # Code from module unistdio/u8-vsnprintf: + # Code from module unistdio/u8-vsprintf: + # Code from module unistdio/ulc-asnprintf: + # Code from module unistdio/ulc-asprintf: + # Code from module unistdio/ulc-fprintf: + # Code from module unistdio/ulc-printf-parse: @@ -22783,6 +26115,9 @@ fi + # Code from module unistdio/ulc-snprintf: + # Code from module unistdio/ulc-sprintf: + # Code from module unistdio/ulc-vasnprintf: @@ -22935,111 +26270,244 @@ $as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h esac + # Code from module unistdio/ulc-vasprintf: + # Code from module unistdio/ulc-vfprintf: + # Code from module unistdio/ulc-vsnprintf: + # Code from module unistdio/ulc-vsprintf: + # Code from module unistr/base: + # Code from module unistr/u16-check: + # Code from module unistr/u16-chr: + # Code from module unistr/u16-cmp: + # Code from module unistr/u16-cmp2: + # Code from module unistr/u16-cpy: + # Code from module unistr/u16-cpy-alloc: + # Code from module unistr/u16-endswith: + # Code from module unistr/u16-mblen: + # Code from module unistr/u16-mbsnlen: + # Code from module unistr/u16-mbtouc: -$as_echo "#define GNULIB_UNISTR_U16_MBTOUC 1" >>confdefs.h - - - - -$as_echo "#define GNULIB_UNISTR_U16_MBTOUC_UNSAFE 1" >>confdefs.h - - - - -$as_echo "#define GNULIB_UNISTR_U16_MBTOUCR 1" >>confdefs.h - - - - -$as_echo "#define GNULIB_UNISTR_U16_UCTOMB 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U16_MBTOUC 1 +_ACEOF + # Code from module unistr/u16-mbtouc-unsafe: -$as_echo "#define GNULIB_UNISTR_U32_MBTOUC 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U16_MBTOUC_UNSAFE 1 +_ACEOF + # Code from module unistr/u16-mbtoucr: -$as_echo "#define GNULIB_UNISTR_U32_MBTOUC_UNSAFE 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U16_MBTOUCR 1 +_ACEOF + + + # Code from module unistr/u16-move: + # Code from module unistr/u16-next: + # Code from module unistr/u16-prev: + # Code from module unistr/u16-set: + # Code from module unistr/u16-startswith: + # Code from module unistr/u16-stpcpy: + # Code from module unistr/u16-stpncpy: + # Code from module unistr/u16-strcat: + # Code from module unistr/u16-strchr: + # Code from module unistr/u16-strcmp: + # Code from module unistr/u16-strcoll: + # Code from module unistr/u16-strcpy: + # Code from module unistr/u16-strcspn: + # Code from module unistr/u16-strdup: + # Code from module unistr/u16-strlen: + # Code from module unistr/u16-strmblen: + # Code from module unistr/u16-strmbtouc: + # Code from module unistr/u16-strncat: + # Code from module unistr/u16-strncmp: + # Code from module unistr/u16-strncpy: + # Code from module unistr/u16-strnlen: + # Code from module unistr/u16-strpbrk: + # Code from module unistr/u16-strrchr: + # Code from module unistr/u16-strspn: + # Code from module unistr/u16-strstr: + # Code from module unistr/u16-strtok: + # Code from module unistr/u16-to-u32: + # Code from module unistr/u16-to-u8: + # Code from module unistr/u16-uctomb: +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U16_UCTOMB 1 +_ACEOF -$as_echo "#define GNULIB_UNISTR_U32_MBTOUCR 1" >>confdefs.h + # Code from module unistr/u32-check: + # Code from module unistr/u32-chr: + # Code from module unistr/u32-cmp: + # Code from module unistr/u32-cmp2: + # Code from module unistr/u32-cpy: + # Code from module unistr/u32-cpy-alloc: + # Code from module unistr/u32-endswith: + # Code from module unistr/u32-mblen: + # Code from module unistr/u32-mbsnlen: + # Code from module unistr/u32-mbtouc: +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U32_MBTOUC 1 +_ACEOF -$as_echo "#define GNULIB_UNISTR_U32_UCTOMB 1" >>confdefs.h + # Code from module unistr/u32-mbtouc-unsafe: +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U32_MBTOUC_UNSAFE 1 +_ACEOF -$as_echo "#define GNULIB_UNISTR_U8_MBTOUC 1" >>confdefs.h + # Code from module unistr/u32-mbtoucr: +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U32_MBTOUCR 1 +_ACEOF + + + # Code from module unistr/u32-move: + # Code from module unistr/u32-next: + # Code from module unistr/u32-prev: + # Code from module unistr/u32-set: + # Code from module unistr/u32-startswith: + # Code from module unistr/u32-stpcpy: + # Code from module unistr/u32-stpncpy: + # Code from module unistr/u32-strcat: + # Code from module unistr/u32-strchr: + # Code from module unistr/u32-strcmp: + # Code from module unistr/u32-strcoll: + # Code from module unistr/u32-strcpy: + # Code from module unistr/u32-strcspn: + # Code from module unistr/u32-strdup: + # Code from module unistr/u32-strlen: + # Code from module unistr/u32-strmblen: + # Code from module unistr/u32-strmbtouc: + # Code from module unistr/u32-strncat: + # Code from module unistr/u32-strncmp: + # Code from module unistr/u32-strncpy: + # Code from module unistr/u32-strnlen: + # Code from module unistr/u32-strpbrk: + # Code from module unistr/u32-strrchr: + # Code from module unistr/u32-strspn: + # Code from module unistr/u32-strstr: + # Code from module unistr/u32-strtok: + # Code from module unistr/u32-to-u16: + # Code from module unistr/u32-to-u8: + # Code from module unistr/u32-uctomb: -$as_echo "#define GNULIB_UNISTR_U8_MBTOUC_UNSAFE 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U32_UCTOMB 1 +_ACEOF + # Code from module unistr/u8-check: + # Code from module unistr/u8-chr: + # Code from module unistr/u8-cmp: + # Code from module unistr/u8-cmp2: + # Code from module unistr/u8-cpy: + # Code from module unistr/u8-cpy-alloc: + # Code from module unistr/u8-endswith: + # Code from module unistr/u8-mblen: + # Code from module unistr/u8-mbsnlen: + # Code from module unistr/u8-mbtouc: -$as_echo "#define GNULIB_UNISTR_U8_MBTOUCR 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U8_MBTOUC 1 +_ACEOF + # Code from module unistr/u8-mbtouc-unsafe: +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U8_MBTOUC_UNSAFE 1 +_ACEOF -$as_echo "#define GNULIB_UNISTR_U8_UCTOMB 1" >>confdefs.h + # Code from module unistr/u8-mbtoucr: +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U8_MBTOUCR 1 +_ACEOF + + + # Code from module unistr/u8-move: + # Code from module unistr/u8-next: + # Code from module unistr/u8-prev: + # Code from module unistr/u8-set: + # Code from module unistr/u8-startswith: + # Code from module unistr/u8-stpcpy: + + # Code from module unistr/u8-stpncpy: + # Code from module unistr/u8-strcat: + # Code from module unistr/u8-strchr: + # Code from module unistr/u8-strcmp: + # Code from module unistr/u8-strcoll: + # Code from module unistr/u8-strcpy: + # Code from module unistr/u8-strcspn: + # Code from module unistr/u8-strdup: + + # Code from module unistr/u8-strlen: + # Code from module unistr/u8-strmblen: + # Code from module unistr/u8-strmbtouc: + # Code from module unistr/u8-strncat: + # Code from module unistr/u8-strncmp: + # Code from module unistr/u8-strncpy: + # Code from module unistr/u8-strnlen: + # Code from module unistr/u8-strpbrk: + # Code from module unistr/u8-strrchr: + # Code from module unistr/u8-strspn: + # Code from module unistr/u8-strstr: + # Code from module unistr/u8-strtok: + # Code from module unistr/u8-to-u16: + # Code from module unistr/u8-to-u32: + # Code from module unistr/u8-uctomb: - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <wchar.h> is standalone" >&5 -$as_echo_n "checking whether <wchar.h> is standalone... " >&6; } -if test "${gl_cv_header_wchar_h_standalone+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <wchar.h> -wchar_t w; +cat >>confdefs.h <<_ACEOF +#define GNULIB_UNISTR_U8_UCTOMB 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_wchar_h_standalone=yes -else - gl_cv_header_wchar_h_standalone=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_wchar_h_standalone" >&5 -$as_echo "$gl_cv_header_wchar_h_standalone" >&6; } - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else - HAVE_WINT_T=0 - fi + # Code from module unitypes: + # Code from module uniwbrk/base: + # Code from module uniwbrk/table: + # Code from module uniwbrk/u16-wordbreaks: + # Code from module uniwbrk/u32-wordbreaks: + # Code from module uniwbrk/u8-wordbreaks: + # Code from module uniwbrk/ulc-wordbreaks: + # Code from module uniwbrk/wordbreak-property: + # Code from module uniwidth/base: + # Code from module uniwidth/u16-strwidth: + # Code from module uniwidth/u16-width: + # Code from module uniwidth/u32-strwidth: + # Code from module uniwidth/u32-width: + # Code from module uniwidth/u8-strwidth: + # Code from module uniwidth/u8-width: + # Code from module uniwidth/width: + # Code from module unused-parameter: + # Code from module verify: + # Code from module warn-on-use: + # Code from module wchar: - if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then - WCHAR_H=wchar.h - fi - - - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi - @@ -23055,26 +26523,26 @@ if test "${gl_cv_next_wchar_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_wchar_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_wchar_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wchar.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_wchar_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/wchar.h#{ - s#.*"\(.*/wchar.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_wchar_h='<'wchar.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_wchar_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wchar.h#{ + s#.*"\(.*/wchar.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wchar_h='<'wchar.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wchar_h" >&5 @@ -23093,6 +26561,71 @@ $as_echo "$gl_cv_next_wchar_h" >&6; } + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + + for gl_func in btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb wcsrtombs wcsnrtombs wcwidth; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if { as_var=$as_gl_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Some systems require additional headers. */ +#ifndef __GLIBC__ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +#endif +#include <wchar.h> + +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval as_val=\$$as_gl_Symbol + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + + eval ac_cv_have_decl_$gl_func=yes +fi + done + + + # Code from module wctype: @@ -23104,6 +26637,13 @@ $as_echo "$gl_cv_next_wchar_h" >&6; } fi + if test $ac_cv_func_iswblank = yes; then + HAVE_ISWBLANK=1 + else + HAVE_ISWBLANK=0 + fi + + @@ -23114,7 +26654,6 @@ $as_echo "$gl_cv_next_wchar_h" >&6; } fi - WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 @@ -23148,12 +26687,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> - #include <wctype.h> - int main () { return iswprint ('x') == 0; } + + #include <stddef.h> + #include <stdio.h> + #include <time.h> + #include <wchar.h> + #include <wctype.h> + int main () { return iswprint ('x') == 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : gl_cv_func_iswcntrl_works=yes @@ -23168,9 +26708,6 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 $as_echo "$gl_cv_func_iswcntrl_works" >&6; } - if test $gl_cv_func_iswcntrl_works = yes; then - WCTYPE_H= - fi fi @@ -23187,26 +26724,26 @@ if test "${gl_cv_next_wctype_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_wctype_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_wctype_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <wctype.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_wctype_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/wctype.h#{ - s#.*"\(.*/wctype.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_wctype_h='<'wctype.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_wctype_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wctype.h#{ + s#.*"\(.*/wctype.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wctype_h='<'wctype.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 @@ -23231,7 +26768,6 @@ $as_echo "$gl_cv_next_wctype_h" >&6; } fi - if test "$gl_cv_func_iswcntrl_works" = no; then REPLACE_ISWCNTRL=1 else @@ -23239,6 +26775,7 @@ $as_echo "$gl_cv_next_wctype_h" >&6; } fi + # Code from module wcwidth: @@ -23277,9 +26814,7 @@ _ACEOF HAVE_DECL_WCWIDTH=0 fi - if test $ac_cv_func_wcwidth = no; then - REPLACE_WCWIDTH=1 - else + if test $ac_cv_func_wcwidth = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wcwidth works reasonably in UTF-8 locales" >&5 $as_echo_n "checking whether wcwidth works reasonably in UTF-8 locales... " >&6; } if test "${gl_cv_func_wcwidth_works+set}" = set; then : @@ -23342,7 +26877,7 @@ $as_echo "$gl_cv_func_wcwidth_works" >&6; } *no) REPLACE_WCWIDTH=1 ;; esac fi - if test $REPLACE_WCWIDTH = 1; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1; then @@ -23354,20 +26889,27 @@ $as_echo "$gl_cv_func_wcwidth_works" >&6; } gl_LIBOBJS="$gl_LIBOBJS wcwidth.$ac_objext" fi + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1 \ + || test $HAVE_DECL_WCWIDTH = 0; then - if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then - - - WCHAR_H=wchar.h + : fi + GNULIB_WCWIDTH=1 +$as_echo "#define GNULIB_TEST_WCWIDTH 1" >>confdefs.h + + + + # Code from module xsize: + + for ac_header in stdint.h do : @@ -23382,6 +26924,7 @@ fi done + # End of code from modules @@ -23403,6 +26946,10 @@ done gl_source_base='tests' + gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS + + gl_module_indicator_condition=$gltests_WITNESS + @@ -23608,49 +27155,13 @@ $as_echo "$gt_cv_locale_tr_utf8" >&6; } + GNULIB_ENVIRON=$gl_module_indicator_condition - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 -$as_echo_n "checking if environ is properly declared... " >&6; } - if test "${gt_cv_var_environ_declaration+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <unistd.h> - extern struct { int foo; } environ; -int -main () -{ -environ.foo = 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_var_environ_declaration=no -else - gt_cv_var_environ_declaration=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 -$as_echo "$gt_cv_var_environ_declaration" >&6; } - if test $gt_cv_var_environ_declaration = yes; then - -$as_echo "#define HAVE_ENVIRON_DECL 1" >>confdefs.h - - fi - - - if test $gt_cv_var_environ_declaration != yes; then - HAVE_DECL_ENVIRON=0 - fi +$as_echo "#define GNULIB_TEST_ENVIRON 1" >>confdefs.h - GNULIB_ENVIRON=1 @@ -23706,6 +27217,7 @@ fi + : @@ -23720,168 +27232,82 @@ fi + for ac_func in getpagesize +do : + ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" +if test "x$ac_cv_func_getpagesize" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETPAGESIZE 1 +_ACEOF +fi +done + if test $ac_cv_func_getpagesize = no; then + HAVE_GETPAGESIZE=0 + for ac_header in OS.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "OS.h" "ac_cv_header_OS_h" "$ac_includes_default" +if test "x$ac_cv_header_OS_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OS_H 1 +_ACEOF +fi +done - - gltests_LIBOBJS="$gltests_LIBOBJS exitfail.$ac_objext" - - - : - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 -$as_echo_n "checking for working fcntl.h... " >&6; } -if test "${gl_cv_header_working_fcntl_h+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - gl_cv_header_working_fcntl_h=cross-compiling -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/types.h> - #include <sys/stat.h> - #include <unistd.h> - #include <fcntl.h> - #ifndef O_NOATIME - #define O_NOATIME 0 - #endif - #ifndef O_NOFOLLOW - #define O_NOFOLLOW 0 - #endif - static int const constants[] = - { - O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, - O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY - }; - -int -main () -{ - - int status = !constants; - { - static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0 - || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) - status |= 32; - } - { - static char const file[] = "confdefs.h"; - int fd = open (file, O_RDONLY | O_NOATIME); - char c; - struct stat st0, st1; - if (fd < 0 - || fstat (fd, &st0) != 0 - || sleep (1) != 0 - || read (fd, &c, 1) != 1 - || close (fd) != 0 - || stat (file, &st1) != 0 - || st0.st_atime != st1.st_atime) - status |= 64; - } - return status; - ; - return 0; -} + if test $ac_cv_header_OS_h = yes; then + HAVE_OS_H=1 + fi + for ac_header in sys/param.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_PARAM_H 1 _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_header_working_fcntl_h=yes -else - case $? in #( - 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 -$as_echo "$gl_cv_header_working_fcntl_h" >&6; } - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac +done -cat >>confdefs.h <<_ACEOF -#define HAVE_WORKING_O_NOATIME $ac_val -_ACEOF + if test $ac_cv_header_sys_param_h = yes; then + HAVE_SYS_PARAM_H=1 + fi + fi + case "$host_os" in + mingw*) + REPLACE_GETPAGESIZE=1 - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - -cat >>confdefs.h <<_ACEOF -#define HAVE_WORKING_O_NOFOLLOW $ac_val -_ACEOF + gltests_LIBOBJS="$gltests_LIBOBJS getpagesize.$ac_objext" + ;; + esac + ac_fn_c_check_decl "$LINENO" "getpagesize" "ac_cv_have_decl_getpagesize" "$ac_includes_default" +if test "x$ac_cv_have_decl_getpagesize" = x""yes; then : - if test $gl_cv_have_include_next = yes; then - gl_cv_next_fcntl_h='<'fcntl.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <fcntl.h>" >&5 -$as_echo_n "checking absolute name of <fcntl.h>... " >&6; } -if test "${gl_cv_next_fcntl_h+set}" = set; then : - $as_echo_n "(cached) " >&6 else + HAVE_DECL_GETPAGESIZE=0 +fi - if test $ac_cv_header_fcntl_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <fcntl.h> -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_fcntl_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/fcntl.h#{ - s#.*"\(.*/fcntl.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_fcntl_h='<'fcntl.h'>' - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fcntl_h" >&5 -$as_echo "$gl_cv_next_fcntl_h" >&6; } - fi - NEXT_FCNTL_H=$gl_cv_next_fcntl_h - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'fcntl.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_fcntl_h - fi - NEXT_AS_FIRST_DIRECTIVE_FCNTL_H=$gl_next_as_first_directive + GNULIB_GETPAGESIZE=$gl_module_indicator_condition - FCNTL_H='fcntl.h' + +$as_echo "#define GNULIB_TEST_GETPAGESIZE 1" >>confdefs.h + @@ -24455,9 +27881,15 @@ _ACEOF esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h conforms to POSIX" >&5 -$as_echo_n "checking whether locale.h conforms to POSIX... " >&6; } -if test "${gl_cv_header_working_locale_h+set}" = set; then : + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h conforms to POSIX:2001" >&5 +$as_echo_n "checking whether locale.h conforms to POSIX:2001... " >&6; } +if test "${gl_cv_header_locale_h_posix2001+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24473,20 +27905,56 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_working_locale_h=yes + gl_cv_header_locale_h_posix2001=yes else - gl_cv_header_working_locale_h=no + gl_cv_header_locale_h_posix2001=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_locale_h" >&5 -$as_echo "$gl_cv_header_working_locale_h" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_h_posix2001" >&5 +$as_echo "$gl_cv_header_locale_h_posix2001" >&6; } + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h defines locale_t" >&5 +$as_echo_n "checking whether locale.h defines locale_t... " >&6; } +if test "${gl_cv_header_locale_has_locale_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <locale.h> +locale_t x; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_locale_has_locale_t=yes +else + gl_cv_header_locale_has_locale_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $gl_cv_header_working_locale_h = yes && test -z "$STDDEF_H"; then - LOCALE_H= +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_has_locale_t" >&5 +$as_echo "$gl_cv_header_locale_has_locale_t" >&6; } + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi else + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no + fi + + @@ -24502,26 +27970,26 @@ if test "${gl_cv_next_locale_h+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_locale_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_cv_header_locale_h = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <locale.h> _ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_locale_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/locale.h#{ - s#.*"\(.*/locale.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_locale_h='<'locale.h'>' - fi + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_locale_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/locale.h#{ + s#.*"\(.*/locale.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_locale_h='<'locale.h'>' + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_locale_h" >&5 @@ -24540,10 +28008,63 @@ $as_echo "$gl_cv_next_locale_h" >&6; } - LOCALE_H=locale.h + + if test -n "$STDDEF_H" \ + || test $gl_cv_header_locale_h_posix2001 = no \ + || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then + + : + fi + for gl_func in duplocale; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if { as_var=$as_gl_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <locale.h> +/* Some systems provide declarations in a non-standard header. */ +#if HAVE_XLOCALE_H +# include <xlocale.h> +#endif + +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval as_val=\$$as_gl_Symbol + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + + eval ac_cv_have_decl_$gl_func=yes +fi + done + + + + @@ -25044,115 +28565,106 @@ $as_echo "$gt_cv_locale_fr_utf8" >&6; } LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 + ac_fn_c_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include <errno.h> +" +if test "x$ac_cv_have_decl_program_invocation_name" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl +_ACEOF - case "$host_os" in - mingw* | pw*) - - - REPLACE_OPEN=1 - - - - - - - - - gltests_LIBOBJS="$gltests_LIBOBJS open.$ac_objext" - - + ac_fn_c_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include <errno.h> +" +if test "x$ac_cv_have_decl_program_invocation_short_name" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl +_ACEOF - : - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 -$as_echo_n "checking whether open recognizes a trailing slash... " >&6; } -if test "${gl_cv_func_open_slash+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for putenv compatible with GNU and SVID" >&5 +$as_echo_n "checking for putenv compatible with GNU and SVID... " >&6; } +if test "${gl_cv_func_svid_putenv+set}" = set; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - - case "$host_os" in - solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; - hpux*) gl_cv_func_open_slash="guessing no" ;; - *) gl_cv_func_open_slash="guessing yes" ;; - esac - + if test "$cross_compiling" = yes; then : + gl_cv_func_svid_putenv=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include <fcntl.h> -#if HAVE_UNISTD_H -# include <unistd.h> -#endif -int main () +$ac_includes_default +int +main () { - return open ("conftest.sl/", O_CREAT, 0600) >= 0; + + /* Put it in env. */ + if (putenv ("CONFTEST_putenv=val")) + return 1; + + /* Try to remove it. */ + if (putenv ("CONFTEST_putenv")) + return 1; + + /* Make sure it was deleted. */ + if (getenv ("CONFTEST_putenv") != 0) + return 1; + + return 0; + + ; + return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_open_slash=yes + gl_cv_func_svid_putenv=yes else - gl_cv_func_open_slash=no + gl_cv_func_svid_putenv=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.sl fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5 -$as_echo "$gl_cv_func_open_slash" >&6; } - case "$gl_cv_func_open_slash" in - *no) - -$as_echo "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_svid_putenv" >&5 +$as_echo "$gl_cv_func_svid_putenv" >&6; } + if test $gl_cv_func_svid_putenv = no; then + REPLACE_PUTENV=1 - REPLACE_OPEN=1 + gltests_LIBOBJS="$gltests_LIBOBJS putenv.$ac_objext" + fi - gltests_LIBOBJS="$gltests_LIBOBJS open.$ac_objext" + GNULIB_PUTENV=$gl_module_indicator_condition - : - - ;; - esac - ;; - esac +$as_echo "#define GNULIB_TEST_PUTENV 1" >>confdefs.h -$as_echo "#define GNULIB_OPEN 1" >>confdefs.h - - - GNULIB_OPEN=1 - - - - - if test $ac_cv_func_setenv = no; then - HAVE_SETENV=0 + if test $HAVE_SETENV$REPLACE_SETENV != 10; then @@ -25163,39 +28675,18 @@ $as_echo "#define GNULIB_OPEN 1" >>confdefs.h gltests_LIBOBJS="$gltests_LIBOBJS setenv.$ac_objext" + fi - for ac_header in search.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default" -if test "x$ac_cv_header_search_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SEARCH_H 1 -_ACEOF - -fi - -done - - for ac_func in tsearch -do : - ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" -if test "x$ac_cv_func_tsearch" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TSEARCH 1 -_ACEOF - -fi -done + GNULIB_SETENV=$gl_module_indicator_condition - fi +$as_echo "#define GNULIB_TEST_SETENV 1" >>confdefs.h - GNULIB_SETENV=1 @@ -25296,7 +28787,103 @@ _ACEOF - GNULIB_STRERROR=1 + + GNULIB_STRERROR=$gl_module_indicator_condition + + + +$as_echo "#define GNULIB_TEST_STRERROR 1" >>confdefs.h + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + if test $gl_threads_api = posix; then + gl_save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + for ac_func in pthread_atfork +do : + ac_fn_c_check_func "$LINENO" "pthread_atfork" "ac_cv_func_pthread_atfork" +if test "x$ac_cv_func_pthread_atfork" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_ATFORK 1 +_ACEOF + +fi +done + + LIBS="$gl_save_LIBS" + fi @@ -26996,6 +30583,1230 @@ $as_echo "$gt_cv_locale_fr_utf8" >&6; } + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = x""yes; then : + gl_have_mmap=yes +else + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cant identify this map." >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a traditional french locale" >&5 $as_echo_n "checking for a traditional french locale... " >&6; } if test "${gt_cv_locale_fr+set}" = set; then : @@ -27124,7 +31935,7 @@ done else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsetenv() return type" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsetenv() return type" >&5 $as_echo_n "checking for unsetenv() return type... " >&6; } if test "${gt_cv_func_unsetenv_ret+set}" = set; then : $as_echo_n "(cached) " >&6 @@ -27160,13 +31971,87 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_unsetenv_ret" >&5 $as_echo "$gt_cv_func_unsetenv_ret" >&6; } if test $gt_cv_func_unsetenv_ret = 'void'; then - VOID_UNSETENV=1 + +$as_echo "#define VOID_UNSETENV 1" >>confdefs.h + + REPLACE_UNSETENV=1 + + + + + + + + + gltests_LIBOBJS="$gltests_LIBOBJS unsetenv.$ac_objext" + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether unsetenv works on duplicates" >&5 +$as_echo_n "checking whether unsetenv works on duplicates... " >&6; } +if test "${gl_cv_func_unsetenv_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + gl_cv_func_unsetenv_works="guessing no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <stdlib.h> + +int +main () +{ + + char entry[] = "b=2"; + if (putenv ((char *) "a=1")) return 1; + if (putenv (entry)) return 2; + entry[0] = 'a'; + unsetenv ("a"); + if (getenv ("a")) return 3; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_unsetenv_works=yes +else + gl_cv_func_unsetenv_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_unsetenv_works" >&5 +$as_echo "$gl_cv_func_unsetenv_works" >&6; } + if test "$gl_cv_func_unsetenv_works" != yes; then + REPLACE_UNSETENV=1 + + + + + + + + + gltests_LIBOBJS="$gltests_LIBOBJS unsetenv.$ac_objext" + fi fi - GNULIB_UNSETENV=1 + + GNULIB_UNSETENV=$gl_module_indicator_condition + + + +$as_echo "#define GNULIB_TEST_UNSETENV 1" >>confdefs.h + + @@ -27175,8 +32060,7 @@ $as_echo "$gt_cv_func_unsetenv_ret" >&6; } if test $ac_cv_func_wctob = no; then HAVE_DECL_WCTOB=0 - - WCHAR_H=wchar.h + : @@ -27202,13 +32086,49 @@ if test "${gl_cv_func_wctob_works+set}" = set; then : else case "$host_os" in - # Guess no on Solaris <= 9. - solaris2.[1-9] | solaris2.[1-9].*) + # Guess no on Solaris <= 9 and Cygwin. + solaris2.[1-9] | solaris2.[1-9].* | cygwin*) gl_cv_func_wctob_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_wctob_works="guessing yes" ;; esac - if test $LOCALE_FR != none; then + case "$host_os" in + cygwin*) + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <locale.h> +#include <wchar.h> + +register long global __asm__ ("%ebx"); + +int main () +{ + setlocale (LC_ALL, "en_US.UTF-8"); + + global = 0x12345678; + if (wctob (0x00FC) != -1) + return 1; + if (global != 0x12345678) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + : +else + gl_cv_func_wctob_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ;; + esac + if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then if test "$cross_compiling" = yes; then : : else @@ -27251,8 +32171,7 @@ $as_echo "$gl_cv_func_wctob_works" >&6; } esac if test $REPLACE_WCTOB = 1; then - - WCHAR_H=wchar.h + : @@ -27293,8 +32212,7 @@ _ACEOF if test $ac_cv_have_decl_wctob != yes; then HAVE_DECL_WCTOB=0 - - WCHAR_H=wchar.h + : fi fi @@ -27302,7 +32220,14 @@ _ACEOF - GNULIB_WCTOB=1 + + GNULIB_WCTOB=$gl_module_indicator_condition + + + +$as_echo "#define GNULIB_TEST_WCTOB 1" >>confdefs.h + + @@ -27326,6 +32251,95 @@ _ACEOF + YIELD_LIB= + if test $gl_threads_api = posix; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +$as_echo_n "checking for sched_yield in -lrt... " >&6; } +if test "${ac_cv_lib_rt_sched_yield+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_sched_yield=yes +else + ac_cv_lib_rt_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = x""yes; then : + YIELD_LIB=-lrt +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +$as_echo_n "checking for sched_yield in -lposix4... " >&6; } +if test "${ac_cv_lib_posix4_sched_yield+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix4_sched_yield=yes +else + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = x""yes; then : + YIELD_LIB=-lposix4 +fi + +fi + + fi + + + + + @@ -27565,13 +32579,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:27568: $ac_compile\"" >&5) + (eval echo "\"\$as_me:32582: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:27571: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:32585: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:27574: output\"" >&5) + (eval echo "\"\$as_me:32588: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -27581,6 +32595,291 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi @@ -27923,7 +33222,7 @@ fi if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done @@ -27940,7 +33239,7 @@ fi if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done @@ -28363,7 +33662,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.64. Invocation command line was +generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -28403,6 +33702,7 @@ Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit + --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -28425,10 +33725,11 @@ Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.64, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.65, + with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -28466,6 +33767,8 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) @@ -28989,7 +34292,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -29003,7 +34306,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p diff --git a/configure.ac b/configure.ac index 4c51345..460244f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Configuration for the toplevel directory of GNU libunistring -dnl Copyright (C) 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. dnl dnl This program is free software: you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by diff --git a/doc/Makefile.in b/doc/Makefile.in index b42c7d4..26bd774 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -41,17 +41,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/alloca.m4 \ $(top_srcdir)/gnulib-m4/codeset.m4 \ - $(top_srcdir)/gnulib-m4/dup2.m4 \ $(top_srcdir)/gnulib-m4/eealloc.m4 \ $(top_srcdir)/gnulib-m4/environ.m4 \ $(top_srcdir)/gnulib-m4/errno_h.m4 \ $(top_srcdir)/gnulib-m4/error.m4 \ - $(top_srcdir)/gnulib-m4/exitfail.m4 \ $(top_srcdir)/gnulib-m4/exponentd.m4 \ $(top_srcdir)/gnulib-m4/exponentf.m4 \ $(top_srcdir)/gnulib-m4/exponentl.m4 \ $(top_srcdir)/gnulib-m4/extensions.m4 \ - $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ $(top_srcdir)/gnulib-m4/float_h.m4 \ $(top_srcdir)/gnulib-m4/fpieee.m4 \ $(top_srcdir)/gnulib-m4/frexp.m4 \ @@ -83,6 +81,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/locale-zh.m4 \ $(top_srcdir)/gnulib-m4/locale_h.m4 \ $(top_srcdir)/gnulib-m4/localename.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ $(top_srcdir)/gnulib-m4/longlong.m4 \ $(top_srcdir)/gnulib-m4/malloc.m4 \ $(top_srcdir)/gnulib-m4/malloca.m4 \ @@ -95,13 +94,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/memchr.m4 \ $(top_srcdir)/gnulib-m4/minmax.m4 \ $(top_srcdir)/gnulib-m4/mmap-anon.m4 \ - $(top_srcdir)/gnulib-m4/mode_t.m4 \ $(top_srcdir)/gnulib-m4/multiarch.m4 \ $(top_srcdir)/gnulib-m4/nocrash.m4 \ - $(top_srcdir)/gnulib-m4/open.m4 \ $(top_srcdir)/gnulib-m4/printf-frexp.m4 \ $(top_srcdir)/gnulib-m4/printf-frexpl.m4 \ $(top_srcdir)/gnulib-m4/printf.m4 \ + $(top_srcdir)/gnulib-m4/putenv.m4 \ $(top_srcdir)/gnulib-m4/relocatable-lib.m4 \ $(top_srcdir)/gnulib-m4/setenv.m4 \ $(top_srcdir)/gnulib-m4/signbit.m4 \ @@ -113,16 +111,21 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/stdlib_h.m4 \ $(top_srcdir)/gnulib-m4/strerror.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/thread.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ $(top_srcdir)/gnulib-m4/unistd_h.m4 \ $(top_srcdir)/gnulib-m4/vasnprintf.m4 \ - $(top_srcdir)/gnulib-m4/wchar.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_h.m4 \ $(top_srcdir)/gnulib-m4/wchar_t.m4 \ $(top_srcdir)/gnulib-m4/wctob.m4 \ - $(top_srcdir)/gnulib-m4/wctype.m4 \ + $(top_srcdir)/gnulib-m4/wctype_h.m4 \ $(top_srcdir)/gnulib-m4/wcwidth.m4 \ $(top_srcdir)/gnulib-m4/wint_t.m4 \ $(top_srcdir)/gnulib-m4/xalloc.m4 \ - $(top_srcdir)/gnulib-m4/xsize.m4 $(top_srcdir)/m4/exported.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/yield.m4 $(top_srcdir)/m4/exported.m4 \ $(top_srcdir)/m4/init-package-version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ @@ -222,22 +225,31 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GLIBC21 = @GLIBC21@ GLOBAL_SYMBOL_PIPE = @GLOBAL_SYMBOL_PIPE@ +GNULIB_ACOSL = @GNULIB_ACOSL@ +GNULIB_ASINL = @GNULIB_ASINL@ +GNULIB_ATANL = @GNULIB_ATANL@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_BTOWC = @GNULIB_BTOWC@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ GNULIB_CEILF = @GNULIB_CEILF@ GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_COSL = @GNULIB_COSL@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_DUP3 = @GNULIB_DUP3@ +GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FLOORF = @GNULIB_FLOORF@ GNULIB_FLOORL = @GNULIB_FLOORL@ GNULIB_FREXP = @GNULIB_FREXP@ @@ -247,12 +259,15 @@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_ISINF = @GNULIB_ISINF@ GNULIB_ISNAN = @GNULIB_ISNAN@ @@ -262,9 +277,11 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ +GNULIB_LINKAT = @GNULIB_LINKAT@ +GNULIB_LOGB = @GNULIB_LOGB@ +GNULIB_LOGL = @GNULIB_LOGL@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MBRLEN = @GNULIB_MBRLEN@ GNULIB_MBRTOWC = @GNULIB_MBRTOWC@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ @@ -289,26 +306,37 @@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ +GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ +GNULIB_PIPE2 = @GNULIB_PIPE2@ +GNULIB_PREAD = @GNULIB_PREAD@ +GNULIB_PTSNAME = @GNULIB_PTSNAME@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_REALPATH = @GNULIB_REALPATH@ +GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_ROUND = @GNULIB_ROUND@ GNULIB_ROUNDF = @GNULIB_ROUNDF@ GNULIB_ROUNDL = @GNULIB_ROUNDL@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SINL = @GNULIB_SINL@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SQRTL = @GNULIB_SQRTL@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ @@ -320,12 +348,20 @@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_SYMLINK = @GNULIB_SYMLINK@ +GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ +GNULIB_TANL = @GNULIB_TANL@ GNULIB_TRUNC = @GNULIB_TRUNC@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNLINK = @GNULIB_UNLINK@ +GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ +GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ @@ -333,26 +369,41 @@ GNULIB_WCTOB = @GNULIB_WCTOB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ +HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ASINL = @HAVE_ASINL@ +HAVE_ATANL = @HAVE_ATANL@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COSL = @HAVE_COSL@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILF = @HAVE_DECL_CEILF@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORF = @HAVE_DECL_FLOORF@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGB = @HAVE_DECL_LOGB@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_ROUND = @HAVE_DECL_ROUND@ +HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ +HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -360,52 +411,77 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPL = @HAVE_EXPL@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ HAVE_GLOBAL_SYMBOL_PIPE = @HAVE_GLOBAL_SYMBOL_PIPE@ +HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ HAVE_ISNANL = @HAVE_ISNANL@ +HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LOGL = @HAVE_LOGL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ +HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ +HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ +HAVE_MKSTEMP = @HAVE_MKSTEMP@ +HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SINL = @HAVE_SINL@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ @@ -413,14 +489,21 @@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TANL = @HAVE_TANL@ +HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ @@ -428,6 +511,7 @@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HEXVERSION = @HEXVERSION@ ICONV_H = @ICONV_H@ @@ -443,27 +527,32 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ LIBS = @LIBS@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LIBTHREAD = @LIBTHREAD@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ -LOCALE_H = @LOCALE_H@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@ MKDIR_P = @MKDIR_P@ NAMESPACING = @NAMESPACING@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -476,7 +565,6 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -509,17 +597,21 @@ RANLIB = @RANLIB@ RC = @RC@ RELOCATABLE = @RELOCATABLE@ REPLACE_BTOWC = @REPLACE_BTOWC@ +REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CEILF = @REPLACE_CEILF@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FLOORF = @REPLACE_FLOORF@ REPLACE_FLOORL = @REPLACE_FLOORL@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_ICONV = @REPLACE_ICONV@ @@ -531,6 +623,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ @@ -543,20 +637,36 @@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_NAN = @REPLACE_NAN@ REPLACE_NULL = @REPLACE_NULL@ -REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_REALPATH = @REPLACE_REALPATH@ +REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ +REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_UNSETENV = @REPLACE_UNSETENV@ +REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ @@ -578,14 +688,13 @@ STRIP = @STRIP@ # Override of automake's definition: #TEXI2DVI = @TEXI2DVI@ TEXI2DVI = @TEXI2DVI@ $(TEXINCLUDES) +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ -VOID_UNSETENV = @VOID_UNSETENV@ -WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +YIELD_LIB = @YIELD_LIB@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -613,6 +722,7 @@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ diff --git a/doc/libunistring.info b/doc/libunistring.info index 2fad8fe..749dd9b 100644 --- a/doc/libunistring.info +++ b/doc/libunistring.info @@ -953,8 +953,10 @@ previous character in a Unicode string. *SRC, size_t N) -- Function: uint32_t * u32_stpncpy (uint32_t *DEST, const uint32_t *SRC, size_t N) - Copies no more than N units of SRC to DEST, returning the address - of the last unit written into DEST. + Copies no more than N units of SRC to DEST. Returns a pointer + past the last non-NUL unit written into DEST. In other words, if + the units written into DEST include a NUL, the return value is the + address of the first such NUL unit, otherwise it is `DEST + N'. This function is similar to `stpncpy', except that it operates on Unicode strings. @@ -5227,7 +5229,7 @@ Index * combining, Unicode characters: Composition of characters. (line 6) * comparing <1>: Elementary string functions on NUL terminated strings. - (line 128) + (line 130) * comparing: Elementary string functions. (line 108) * comparing, ignoring case: Case insensitive comparison. @@ -5243,7 +5245,7 @@ Index * comparing, ignoring normalization, with collation rules: Normalizing comparisons. (line 23) * comparing, with collation rules: Elementary string functions on NUL terminated strings. - (line 140) + (line 142) * comparing, with collation rules, ignoring case: Case insensitive comparison. (line 66) * comparing, with collation rules, ignoring normalization: Normalizing comparisons. @@ -5267,7 +5269,7 @@ Index * dependencies: Installation. (line 6) * detecting case: Case detection. (line 6) * duplicating <1>: Elementary string functions on NUL terminated strings. - (line 166) + (line 168) * duplicating: Elementary string functions with memory allocation. (line 6) * enum iconv_ilseq_handler: uniconv.h. (line 30) @@ -5315,11 +5317,11 @@ Index * return value conventions: Conventions. (line 47) * scripts: Scripts. (line 6) * searching, for a character <1>: Elementary string functions on NUL terminated strings. - (line 176) + (line 178) * searching, for a character: Elementary string functions. (line 140) * searching, for a substring: Elementary string functions on NUL terminated strings. - (line 232) + (line 234) * stream, normalizing a: Normalization of streams. (line 6) * struct uninorm_filter: Normalization of streams. @@ -5367,7 +5369,7 @@ Index * u16_ct_toupper: Case mappings of substrings. (line 89) * u16_endswith: Elementary string functions on NUL terminated strings. - (line 258) + (line 260) * u16_is_cased: Case detection. (line 57) * u16_is_casefolded: Case detection. (line 44) * u16_is_lowercase: Case detection. (line 24) @@ -5403,19 +5405,19 @@ Index * u16_snprintf: unistdio.h. (line 126) * u16_sprintf: unistdio.h. (line 123) * u16_startswith: Elementary string functions on NUL terminated strings. - (line 250) + (line 252) * u16_stpcpy: Elementary string functions on NUL terminated strings. (line 76) * u16_stpncpy: Elementary string functions on NUL terminated strings. (line 99) * u16_strcat: Elementary string functions on NUL terminated strings. - (line 110) + (line 112) * u16_strchr: Elementary string functions on NUL terminated strings. - (line 180) + (line 182) * u16_strcmp: Elementary string functions on NUL terminated strings. - (line 132) + (line 134) * u16_strcoll: Elementary string functions on NUL terminated strings. - (line 142) + (line 144) * u16_strconv_from_encoding: uniconv.h. (line 129) * u16_strconv_from_locale: uniconv.h. (line 157) * u16_strconv_to_encoding: uniconv.h. (line 142) @@ -5423,9 +5425,9 @@ Index * u16_strcpy: Elementary string functions on NUL terminated strings. (line 66) * u16_strcspn: Elementary string functions on NUL terminated strings. - (line 201) + (line 203) * u16_strdup: Elementary string functions on NUL terminated strings. - (line 170) + (line 172) * u16_strlen: Elementary string functions on NUL terminated strings. (line 47) * u16_strmblen: Elementary string functions on NUL terminated strings. @@ -5433,23 +5435,23 @@ Index * u16_strmbtouc: Elementary string functions on NUL terminated strings. (line 17) * u16_strncat: Elementary string functions on NUL terminated strings. - (line 121) + (line 123) * u16_strncmp: Elementary string functions on NUL terminated strings. - (line 159) + (line 161) * u16_strncpy: Elementary string functions on NUL terminated strings. (line 88) * u16_strnlen: Elementary string functions on NUL terminated strings. (line 55) * u16_strpbrk: Elementary string functions on NUL terminated strings. - (line 225) + (line 227) * u16_strrchr: Elementary string functions on NUL terminated strings. - (line 188) + (line 190) * u16_strspn: Elementary string functions on NUL terminated strings. - (line 213) + (line 215) * u16_strstr: Elementary string functions on NUL terminated strings. - (line 239) + (line 241) * u16_strtok: Elementary string functions on NUL terminated strings. - (line 268) + (line 270) * u16_strwidth: uniwidth.h. (line 39) * u16_to_u32: Elementary string conversions. (line 23) @@ -5520,7 +5522,7 @@ Index * u32_ct_toupper: Case mappings of substrings. (line 94) * u32_endswith: Elementary string functions on NUL terminated strings. - (line 260) + (line 262) * u32_is_cased: Case detection. (line 59) * u32_is_casefolded: Case detection. (line 46) * u32_is_lowercase: Case detection. (line 26) @@ -5556,19 +5558,19 @@ Index * u32_snprintf: unistdio.h. (line 179) * u32_sprintf: unistdio.h. (line 176) * u32_startswith: Elementary string functions on NUL terminated strings. - (line 252) + (line 254) * u32_stpcpy: Elementary string functions on NUL terminated strings. (line 78) * u32_stpncpy: Elementary string functions on NUL terminated strings. (line 101) * u32_strcat: Elementary string functions on NUL terminated strings. - (line 112) + (line 114) * u32_strchr: Elementary string functions on NUL terminated strings. - (line 181) + (line 183) * u32_strcmp: Elementary string functions on NUL terminated strings. - (line 133) + (line 135) * u32_strcoll: Elementary string functions on NUL terminated strings. - (line 143) + (line 145) * u32_strconv_from_encoding: uniconv.h. (line 131) * u32_strconv_from_locale: uniconv.h. (line 158) * u32_strconv_to_encoding: uniconv.h. (line 144) @@ -5576,9 +5578,9 @@ Index * u32_strcpy: Elementary string functions on NUL terminated strings. (line 68) * u32_strcspn: Elementary string functions on NUL terminated strings. - (line 203) + (line 205) * u32_strdup: Elementary string functions on NUL terminated strings. - (line 171) + (line 173) * u32_strlen: Elementary string functions on NUL terminated strings. (line 48) * u32_strmblen: Elementary string functions on NUL terminated strings. @@ -5586,23 +5588,23 @@ Index * u32_strmbtouc: Elementary string functions on NUL terminated strings. (line 18) * u32_strncat: Elementary string functions on NUL terminated strings. - (line 123) + (line 125) * u32_strncmp: Elementary string functions on NUL terminated strings. - (line 161) + (line 163) * u32_strncpy: Elementary string functions on NUL terminated strings. (line 90) * u32_strnlen: Elementary string functions on NUL terminated strings. (line 56) * u32_strpbrk: Elementary string functions on NUL terminated strings. - (line 227) + (line 229) * u32_strrchr: Elementary string functions on NUL terminated strings. - (line 189) + (line 191) * u32_strspn: Elementary string functions on NUL terminated strings. - (line 215) + (line 217) * u32_strstr: Elementary string functions on NUL terminated strings. - (line 241) + (line 243) * u32_strtok: Elementary string functions on NUL terminated strings. - (line 270) + (line 272) * u32_strwidth: uniwidth.h. (line 40) * u32_to_u16: Elementary string conversions. (line 31) @@ -5673,7 +5675,7 @@ Index * u8_ct_toupper: Case mappings of substrings. (line 84) * u8_endswith: Elementary string functions on NUL terminated strings. - (line 256) + (line 258) * u8_is_cased: Case detection. (line 55) * u8_is_casefolded: Case detection. (line 42) * u8_is_lowercase: Case detection. (line 22) @@ -5709,19 +5711,19 @@ Index * u8_snprintf: unistdio.h. (line 73) * u8_sprintf: unistdio.h. (line 70) * u8_startswith: Elementary string functions on NUL terminated strings. - (line 248) + (line 250) * u8_stpcpy: Elementary string functions on NUL terminated strings. (line 74) * u8_stpncpy: Elementary string functions on NUL terminated strings. (line 97) * u8_strcat: Elementary string functions on NUL terminated strings. - (line 108) + (line 110) * u8_strchr: Elementary string functions on NUL terminated strings. - (line 179) + (line 181) * u8_strcmp: Elementary string functions on NUL terminated strings. - (line 131) + (line 133) * u8_strcoll: Elementary string functions on NUL terminated strings. - (line 141) + (line 143) * u8_strconv_from_encoding: uniconv.h. (line 127) * u8_strconv_from_locale: uniconv.h. (line 156) * u8_strconv_to_encoding: uniconv.h. (line 140) @@ -5729,9 +5731,9 @@ Index * u8_strcpy: Elementary string functions on NUL terminated strings. (line 64) * u8_strcspn: Elementary string functions on NUL terminated strings. - (line 199) + (line 201) * u8_strdup: Elementary string functions on NUL terminated strings. - (line 169) + (line 171) * u8_strlen: Elementary string functions on NUL terminated strings. (line 46) * u8_strmblen: Elementary string functions on NUL terminated strings. @@ -5739,23 +5741,23 @@ Index * u8_strmbtouc: Elementary string functions on NUL terminated strings. (line 16) * u8_strncat: Elementary string functions on NUL terminated strings. - (line 119) + (line 121) * u8_strncmp: Elementary string functions on NUL terminated strings. - (line 157) + (line 159) * u8_strncpy: Elementary string functions on NUL terminated strings. (line 86) * u8_strnlen: Elementary string functions on NUL terminated strings. (line 54) * u8_strpbrk: Elementary string functions on NUL terminated strings. - (line 223) + (line 225) * u8_strrchr: Elementary string functions on NUL terminated strings. - (line 187) + (line 189) * u8_strspn: Elementary string functions on NUL terminated strings. - (line 211) + (line 213) * u8_strstr: Elementary string functions on NUL terminated strings. - (line 237) + (line 239) * u8_strtok: Elementary string functions on NUL terminated strings. - (line 266) + (line 268) * u8_strwidth: uniwidth.h. (line 38) * u8_to_u16: Elementary string conversions. (line 11) @@ -6141,56 +6143,56 @@ Node: Elementary string conversions24459 Node: Elementary string functions25761 Node: Elementary string functions with memory allocation32732 Node: Elementary string functions on NUL terminated strings33354 -Node: uniconv.h45090 -Node: unistdio.h52801 -Node: uniname.h61004 -Node: unictype.h62337 -Node: General category63246 -Node: Object oriented API64289 -Node: Bit mask API72751 -Node: Canonical combining class75005 -Node: Bidirectional category78219 -Node: Decimal digit value81276 -Node: Digit value81837 -Node: Numeric value82398 -Node: Mirrored character83289 -Node: Properties83962 -Node: Properties as objects84653 -Node: Properties as functions91031 -Node: Scripts96582 -Node: Blocks97968 -Node: ISO C and Java syntax99291 -Node: Classifications like in ISO C101001 -Node: uniwidth.h103705 -Node: uniwbrk.h105742 -Node: Word breaks in a string106269 -Node: Word break property107320 -Node: unilbrk.h108416 -Node: uninorm.h112587 -Node: Decomposition of characters113219 -Node: Composition of characters116595 -Node: Normalization of strings117304 -Node: Normalizing comparisons119366 -Node: Normalization of streams121722 -Node: unicase.h123810 -Node: Case mappings of characters124495 -Node: Case mappings of strings126542 -Node: Case mappings of substrings129875 -Node: Case insensitive comparison136805 -Node: Case detection142156 -Node: uniregex.h145424 -Node: Using the library145647 -Node: Installation146058 -Node: Compiler options146531 -Node: Include files148090 -Node: Autoconf macro149314 -Node: Reporting problems150872 -Node: More functionality151669 -Node: Licenses152112 -Node: GNU GPL153747 -Node: GNU LGPL191292 -Node: GNU FDL199738 -Node: Index224863 +Node: uniconv.h45258 +Node: unistdio.h52969 +Node: uniname.h61172 +Node: unictype.h62505 +Node: General category63414 +Node: Object oriented API64457 +Node: Bit mask API72919 +Node: Canonical combining class75173 +Node: Bidirectional category78387 +Node: Decimal digit value81444 +Node: Digit value82005 +Node: Numeric value82566 +Node: Mirrored character83457 +Node: Properties84130 +Node: Properties as objects84821 +Node: Properties as functions91199 +Node: Scripts96750 +Node: Blocks98136 +Node: ISO C and Java syntax99459 +Node: Classifications like in ISO C101169 +Node: uniwidth.h103873 +Node: uniwbrk.h105910 +Node: Word breaks in a string106437 +Node: Word break property107488 +Node: unilbrk.h108584 +Node: uninorm.h112755 +Node: Decomposition of characters113387 +Node: Composition of characters116763 +Node: Normalization of strings117472 +Node: Normalizing comparisons119534 +Node: Normalization of streams121890 +Node: unicase.h123978 +Node: Case mappings of characters124663 +Node: Case mappings of strings126710 +Node: Case mappings of substrings130043 +Node: Case insensitive comparison136973 +Node: Case detection142324 +Node: uniregex.h145592 +Node: Using the library145815 +Node: Installation146226 +Node: Compiler options146699 +Node: Include files148258 +Node: Autoconf macro149482 +Node: Reporting problems151040 +Node: More functionality151837 +Node: Licenses152280 +Node: GNU GPL153915 +Node: GNU LGPL191460 +Node: GNU FDL199906 +Node: Index225031 End Tag Table diff --git a/doc/libunistring.texi b/doc/libunistring.texi index 8eb8061..5778c75 100644 --- a/doc/libunistring.texi +++ b/doc/libunistring.texi @@ -86,7 +86,7 @@ This manual is for GNU libunistring. @ignore @c This was: @copying but it triggers a makeinfo 4.13 bug -Copyright (C) 2001-2009 Free Software Foundation, Inc. +Copyright (C) 2001-2010 Free Software Foundation, Inc. This manual is free documentation. It is dually licensed under the GNU FDL and the GNU GPL. This means that you can redistribute this @@ -118,7 +118,7 @@ A copy of the license is included in @ref{GNU GPL}. @page @vskip 0pt plus 1filll @c @insertcopying -Copyright (C) 2001-2009 Free Software Foundation, Inc. +Copyright (C) 2001-2010 Free Software Foundation, Inc. This manual is free documentation. It is dually licensed under the GNU FDL and the GNU GPL. This means that you can redistribute this diff --git a/doc/libunistring_1.html b/doc/libunistring_1.html index 0e1375c..7212f3f 100644 --- a/doc/libunistring_1.html +++ b/doc/libunistring_1.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -522,7 +522,7 @@ zero-valued unit used as “end marker”. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_10.html b/doc/libunistring_10.html index 923d000..617406d 100644 --- a/doc/libunistring_10.html +++ b/doc/libunistring_10.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -183,7 +183,7 @@ may be added in the future. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_11.html b/doc/libunistring_11.html index 8b7320c..7fd2dc3 100644 --- a/doc/libunistring_11.html +++ b/doc/libunistring_11.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -191,7 +191,7 @@ the values <code>UC_BREAK_MANDATORY</code>, <code>UC_BREAK_POSSIBLE</code>, </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_12.html b/doc/libunistring_12.html index 51a5253..1a4db37 100644 --- a/doc/libunistring_12.html +++ b/doc/libunistring_12.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -498,7 +498,7 @@ then closes and frees the filter. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_13.html b/doc/libunistring_13.html index f47761b..8b77910 100644 --- a/doc/libunistring_13.html +++ b/doc/libunistring_13.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -602,7 +602,7 @@ characters. Upon failure, returns -1 with <code>errno</code> set. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_14.html b/doc/libunistring_14.html index bcc34f3..1a7a338 100644 --- a/doc/libunistring_14.html +++ b/doc/libunistring_14.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -78,7 +78,7 @@ ul.toc {list-style: none} </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_15.html b/doc/libunistring_15.html index 1b347b7..8b44419 100644 --- a/doc/libunistring_15.html +++ b/doc/libunistring_15.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -223,7 +223,7 @@ a description of the options that you passed to the ‘<samp>configure</samp </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_16.html b/doc/libunistring_16.html index b03d659..5e9abeb 100644 --- a/doc/libunistring_16.html +++ b/doc/libunistring_16.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -84,7 +84,7 @@ ul.toc {list-style: none} </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_17.html b/doc/libunistring_17.html index c7396c9..7eeed07 100644 --- a/doc/libunistring_17.html +++ b/doc/libunistring_17.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -1517,7 +1517,7 @@ to permit their use in free software. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_18.html b/doc/libunistring_18.html index 0c96d87..61efd62 100644 --- a/doc/libunistring_18.html +++ b/doc/libunistring_18.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -761,7 +761,7 @@ ul.toc {list-style: none} </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_19.html b/doc/libunistring_19.html index 74215ac..bd513cc 100644 --- a/doc/libunistring_19.html +++ b/doc/libunistring_19.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -179,7 +179,7 @@ ul.toc {list-style: none} </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_2.html b/doc/libunistring_2.html index a73366a..f90fd55 100644 --- a/doc/libunistring_2.html +++ b/doc/libunistring_2.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -132,7 +132,7 @@ NULL is returned and <code>errno</code> is set. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_3.html b/doc/libunistring_3.html index d897b14..f86bf87 100644 --- a/doc/libunistring_3.html +++ b/doc/libunistring_3.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -98,7 +98,7 @@ taken from <code><stdint.h></code>, on platforms where this include file i </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_4.html b/doc/libunistring_4.html index 10d8a42..b00d3a6 100644 --- a/doc/libunistring_4.html +++ b/doc/libunistring_4.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -567,8 +567,11 @@ that it operates on Unicode strings. <dt><u>Function:</u> uint32_t * <b>u32_stpncpy</b><i> (uint32_t *<var>dest</var>, const uint32_t *<var>src</var>, size_t <var>n</var>)</i> <a name="IDX103"></a> </dt> -<dd><p>Copies no more than <var>n</var> units of <var>src</var> to <var>dest</var>, returning the -address of the last unit written into <var>dest</var>. +<dd><p>Copies no more than <var>n</var> units of <var>src</var> to <var>dest</var>. Returns a +pointer past the last non-NUL unit written into <var>dest</var>. In other words, +if the units written into <var>dest</var> include a NUL, the return value is the +address of the first such NUL unit, otherwise it is +<code><var>dest</var> + <var>n</var></code>. </p> <p>This function is similar to <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/stpncpy.html"><code>stpncpy</code></a>, except that it operates on Unicode strings. @@ -855,7 +858,7 @@ that it operates on Unicode strings. Its interface is actually more similar to </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_5.html b/doc/libunistring_5.html index fbffc63..313b063 100644 --- a/doc/libunistring_5.html +++ b/doc/libunistring_5.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -287,7 +287,7 @@ strings in locale encoding and NUL terminated Unicode strings. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_6.html b/doc/libunistring_6.html index 54bf254..2ec4ddb 100644 --- a/doc/libunistring_6.html +++ b/doc/libunistring_6.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -442,7 +442,7 @@ locale encoding to a <code>FILE</code> stream. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_7.html b/doc/libunistring_7.html index 378eab3..c1ac3eb 100644 --- a/doc/libunistring_7.html +++ b/doc/libunistring_7.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -116,7 +116,7 @@ ASCII. Returns the character if found, or <code>UNINAME_INVALID</code> if not f </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_8.html b/doc/libunistring_8.html index 8d7ecc3..b288712 100644 --- a/doc/libunistring_8.html +++ b/doc/libunistring_8.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -2062,7 +2062,7 @@ a locale-specific set of characters for which <code>uc_is_alnum</code> is false. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_9.html b/doc/libunistring_9.html index dd29fdc..6b5d13d 100644 --- a/doc/libunistring_9.html +++ b/doc/libunistring_9.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -132,7 +132,7 @@ This function ignores control characters in the string. </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_abt.html b/doc/libunistring_abt.html index 0b987a1..40e4977 100644 --- a/doc/libunistring_abt.html +++ b/doc/libunistring_abt.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -50,7 +50,7 @@ ul.toc {list-style: none} </tr></table> <h1>About This Document</h1> <p> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </p> <p> The buttons in the navigation panels have the following meaning: @@ -158,7 +158,7 @@ ul.toc {list-style: none} </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/libunistring_toc.html b/doc/libunistring_toc.html index a9a15a7..6dd04ac 100644 --- a/doc/libunistring_toc.html +++ b/doc/libunistring_toc.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> -<!-- Created on August, 17 2009 by texi2html 1.78a --> +<!-- Created on March, 30 2010 by texi2html 1.78a --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> @@ -155,7 +155,7 @@ ul.toc {list-style: none} </tr></table> <p> <font size="-1"> - This document was generated by <em>Bruno Haible</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. + This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. </font> <br> diff --git a/doc/stamp-vti b/doc/stamp-vti index ff8daab..4384b70 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 29 June 2009 -@set UPDATED-MONTH June 2009 -@set EDITION 0.9.1.1 -@set VERSION 0.9.1.1 +@set UPDATED 1 January 2010 +@set UPDATED-MONTH January 2010 +@set EDITION 0.9.3 +@set VERSION 0.9.3 diff --git a/doc/unistr.texi b/doc/unistr.texi index 9c6261b..ad04f42 100644 --- a/doc/unistr.texi +++ b/doc/unistr.texi @@ -324,8 +324,11 @@ that it operates on Unicode strings. @deftypefun {uint8_t *} u8_stpncpy (uint8_t *@var{dest}, const uint8_t *@var{src}, size_t @var{n}) @deftypefunx {uint16_t *} u16_stpncpy (uint16_t *@var{dest}, const uint16_t *@var{src}, size_t @var{n}) @deftypefunx {uint32_t *} u32_stpncpy (uint32_t *@var{dest}, const uint32_t *@var{src}, size_t @var{n}) -Copies no more than @var{n} units of @var{src} to @var{dest}, returning the -address of the last unit written into @var{dest}. +Copies no more than @var{n} units of @var{src} to @var{dest}. Returns a +pointer past the last non-NUL unit written into @var{dest}. In other words, +if the units written into @var{dest} include a NUL, the return value is the +address of the first such NUL unit, otherwise it is +@code{@var{dest} + @var{n}}. This function is similar to @posixfunc{stpncpy}, except that it operates on Unicode strings. diff --git a/doc/version.texi b/doc/version.texi index ff8daab..4384b70 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 29 June 2009 -@set UPDATED-MONTH June 2009 -@set EDITION 0.9.1.1 -@set VERSION 0.9.1.1 +@set UPDATED 1 January 2010 +@set UPDATED-MONTH January 2010 +@set EDITION 0.9.3 +@set VERSION 0.9.3 diff --git a/gnulib-local/Makefile.in b/gnulib-local/Makefile.in index 1f0c6bb..b5e966c 100644 --- a/gnulib-local/Makefile.in +++ b/gnulib-local/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,17 +39,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/alloca.m4 \ $(top_srcdir)/gnulib-m4/codeset.m4 \ - $(top_srcdir)/gnulib-m4/dup2.m4 \ $(top_srcdir)/gnulib-m4/eealloc.m4 \ $(top_srcdir)/gnulib-m4/environ.m4 \ $(top_srcdir)/gnulib-m4/errno_h.m4 \ $(top_srcdir)/gnulib-m4/error.m4 \ - $(top_srcdir)/gnulib-m4/exitfail.m4 \ $(top_srcdir)/gnulib-m4/exponentd.m4 \ $(top_srcdir)/gnulib-m4/exponentf.m4 \ $(top_srcdir)/gnulib-m4/exponentl.m4 \ $(top_srcdir)/gnulib-m4/extensions.m4 \ - $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ $(top_srcdir)/gnulib-m4/float_h.m4 \ $(top_srcdir)/gnulib-m4/fpieee.m4 \ $(top_srcdir)/gnulib-m4/frexp.m4 \ @@ -81,6 +79,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/locale-zh.m4 \ $(top_srcdir)/gnulib-m4/locale_h.m4 \ $(top_srcdir)/gnulib-m4/localename.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ $(top_srcdir)/gnulib-m4/longlong.m4 \ $(top_srcdir)/gnulib-m4/malloc.m4 \ $(top_srcdir)/gnulib-m4/malloca.m4 \ @@ -93,13 +92,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/memchr.m4 \ $(top_srcdir)/gnulib-m4/minmax.m4 \ $(top_srcdir)/gnulib-m4/mmap-anon.m4 \ - $(top_srcdir)/gnulib-m4/mode_t.m4 \ $(top_srcdir)/gnulib-m4/multiarch.m4 \ $(top_srcdir)/gnulib-m4/nocrash.m4 \ - $(top_srcdir)/gnulib-m4/open.m4 \ $(top_srcdir)/gnulib-m4/printf-frexp.m4 \ $(top_srcdir)/gnulib-m4/printf-frexpl.m4 \ $(top_srcdir)/gnulib-m4/printf.m4 \ + $(top_srcdir)/gnulib-m4/putenv.m4 \ $(top_srcdir)/gnulib-m4/relocatable-lib.m4 \ $(top_srcdir)/gnulib-m4/setenv.m4 \ $(top_srcdir)/gnulib-m4/signbit.m4 \ @@ -111,16 +109,21 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/stdlib_h.m4 \ $(top_srcdir)/gnulib-m4/strerror.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/thread.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ $(top_srcdir)/gnulib-m4/unistd_h.m4 \ $(top_srcdir)/gnulib-m4/vasnprintf.m4 \ - $(top_srcdir)/gnulib-m4/wchar.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_h.m4 \ $(top_srcdir)/gnulib-m4/wchar_t.m4 \ $(top_srcdir)/gnulib-m4/wctob.m4 \ - $(top_srcdir)/gnulib-m4/wctype.m4 \ + $(top_srcdir)/gnulib-m4/wctype_h.m4 \ $(top_srcdir)/gnulib-m4/wcwidth.m4 \ $(top_srcdir)/gnulib-m4/wint_t.m4 \ $(top_srcdir)/gnulib-m4/xalloc.m4 \ - $(top_srcdir)/gnulib-m4/xsize.m4 $(top_srcdir)/m4/exported.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/yield.m4 $(top_srcdir)/m4/exported.m4 \ $(top_srcdir)/m4/init-package-version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ @@ -183,22 +186,31 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GLIBC21 = @GLIBC21@ GLOBAL_SYMBOL_PIPE = @GLOBAL_SYMBOL_PIPE@ +GNULIB_ACOSL = @GNULIB_ACOSL@ +GNULIB_ASINL = @GNULIB_ASINL@ +GNULIB_ATANL = @GNULIB_ATANL@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_BTOWC = @GNULIB_BTOWC@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ GNULIB_CEILF = @GNULIB_CEILF@ GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_COSL = @GNULIB_COSL@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_DUP3 = @GNULIB_DUP3@ +GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FLOORF = @GNULIB_FLOORF@ GNULIB_FLOORL = @GNULIB_FLOORL@ GNULIB_FREXP = @GNULIB_FREXP@ @@ -208,12 +220,15 @@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_ISINF = @GNULIB_ISINF@ GNULIB_ISNAN = @GNULIB_ISNAN@ @@ -223,9 +238,11 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ +GNULIB_LINKAT = @GNULIB_LINKAT@ +GNULIB_LOGB = @GNULIB_LOGB@ +GNULIB_LOGL = @GNULIB_LOGL@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MBRLEN = @GNULIB_MBRLEN@ GNULIB_MBRTOWC = @GNULIB_MBRTOWC@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ @@ -250,26 +267,37 @@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ +GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ +GNULIB_PIPE2 = @GNULIB_PIPE2@ +GNULIB_PREAD = @GNULIB_PREAD@ +GNULIB_PTSNAME = @GNULIB_PTSNAME@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_REALPATH = @GNULIB_REALPATH@ +GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_ROUND = @GNULIB_ROUND@ GNULIB_ROUNDF = @GNULIB_ROUNDF@ GNULIB_ROUNDL = @GNULIB_ROUNDL@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SINL = @GNULIB_SINL@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SQRTL = @GNULIB_SQRTL@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ @@ -281,12 +309,20 @@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_SYMLINK = @GNULIB_SYMLINK@ +GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ +GNULIB_TANL = @GNULIB_TANL@ GNULIB_TRUNC = @GNULIB_TRUNC@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNLINK = @GNULIB_UNLINK@ +GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ +GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ @@ -294,26 +330,41 @@ GNULIB_WCTOB = @GNULIB_WCTOB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ +HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ASINL = @HAVE_ASINL@ +HAVE_ATANL = @HAVE_ATANL@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COSL = @HAVE_COSL@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILF = @HAVE_DECL_CEILF@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORF = @HAVE_DECL_FLOORF@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGB = @HAVE_DECL_LOGB@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_ROUND = @HAVE_DECL_ROUND@ +HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ +HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -321,52 +372,77 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPL = @HAVE_EXPL@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ HAVE_GLOBAL_SYMBOL_PIPE = @HAVE_GLOBAL_SYMBOL_PIPE@ +HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ HAVE_ISNANL = @HAVE_ISNANL@ +HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LOGL = @HAVE_LOGL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ +HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ +HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ +HAVE_MKSTEMP = @HAVE_MKSTEMP@ +HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SINL = @HAVE_SINL@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ @@ -374,14 +450,21 @@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TANL = @HAVE_TANL@ +HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ @@ -389,6 +472,7 @@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HEXVERSION = @HEXVERSION@ ICONV_H = @ICONV_H@ @@ -404,27 +488,32 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ LIBS = @LIBS@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LIBTHREAD = @LIBTHREAD@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ -LOCALE_H = @LOCALE_H@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NAMESPACING = @NAMESPACING@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -437,7 +526,6 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -470,17 +558,21 @@ RANLIB = @RANLIB@ RC = @RC@ RELOCATABLE = @RELOCATABLE@ REPLACE_BTOWC = @REPLACE_BTOWC@ +REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CEILF = @REPLACE_CEILF@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FLOORF = @REPLACE_FLOORF@ REPLACE_FLOORL = @REPLACE_FLOORL@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_ICONV = @REPLACE_ICONV@ @@ -492,6 +584,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ @@ -504,20 +598,36 @@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_NAN = @REPLACE_NAN@ REPLACE_NULL = @REPLACE_NULL@ -REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_REALPATH = @REPLACE_REALPATH@ +REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ +REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_UNSETENV = @REPLACE_UNSETENV@ +REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ @@ -534,14 +644,13 @@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ TEXI2DVI = @TEXI2DVI@ +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ -VOID_UNSETENV = @VOID_UNSETENV@ -WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +YIELD_LIB = @YIELD_LIB@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -569,6 +678,7 @@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ diff --git a/gnulib-local/lib/unistr.h.diff b/gnulib-local/lib/unistr.h.diff index 4572049..3e59093 100644 --- a/gnulib-local/lib/unistr.h.diff +++ b/gnulib-local/lib/unistr.h.diff @@ -1,22 +1,26 @@ -*** unistr.h.orig 2009-04-05 12:22:17.000000000 +0200 ---- unistr.h 2009-04-10 18:57:37.000000000 +0200 +*** unistr.h.orig 2009-12-24 23:21:27.000000000 +0100 +--- unistr.h 2009-12-25 02:04:40.000000000 +0100 *************** -*** 19,26 **** - +*** 20,29 **** #include "unitypes.h" + /* Get common macros for C. */ +! #include "unused-parameter.h" + /* Get bool. */ ! #include <stdbool.h> /* Get size_t. */ #include <stddef.h> ---- 19,29 ---- - +--- 20,32 ---- #include "unitypes.h" -+ /* Get inline if available. */ -+ #include <unistring/inline.h> -+ + /* Get common macros for C. */ +! #include <unistring/cdefs.h> +! +! /* Get inline if available. */ +! #include <unistring/inline.h> + /* Get bool. */ ! #include <unistring/stdbool.h> diff --git a/gnulib-m4/00gnulib.m4 b/gnulib-m4/00gnulib.m4 index d4d04d1..301469b 100644 --- a/gnulib-m4/00gnulib.m4 +++ b/gnulib-m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 2 -dnl Copyright (C) 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2010 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. diff --git a/gnulib-m4/alloca.m4 b/gnulib-m4/alloca.m4 index 4b978e1..f3ee343 100644 --- a/gnulib-m4/alloca.m4 +++ b/gnulib-m4/alloca.m4 @@ -1,5 +1,6 @@ # alloca.m4 serial 9 -dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl 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. diff --git a/gnulib-m4/codeset.m4 b/gnulib-m4/codeset.m4 index 413217b..a53c042 100644 --- a/gnulib-m4/codeset.m4 +++ b/gnulib-m4/codeset.m4 @@ -1,5 +1,5 @@ # codeset.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 2000-2002, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2006, 2008-2010 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. diff --git a/gnulib-m4/dup2.m4 b/gnulib-m4/dup2.m4 deleted file mode 100644 index 2abc74c..0000000 --- a/gnulib-m4/dup2.m4 +++ /dev/null @@ -1,35 +0,0 @@ -#serial 6 -dnl Copyright (C) 2002, 2005, 2007, 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_FUNC_DUP2], -[ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_FUNCS_ONCE([dup2]) - if test $ac_cv_func_dup2 = no; then - HAVE_DUP2=0 - AC_LIBOBJ([dup2]) - else - AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include <unistd.h> -]], [return 1 - dup2 (1, 1);])], - [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], - [case "$host_os" in - mingw*) # on this platform, dup2 always returns 0 for success - gl_cv_func_dup2_works=no;; - cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 - gl_cv_func_dup2_works=no;; - *) gl_cv_func_dup2_works=yes;; - esac])]) - if test "$gl_cv_func_dup2_works" = no; then - REPLACE_DUP2=1 - AC_LIBOBJ([dup2]) - fi - fi - AC_DEFINE_UNQUOTED([REPLACE_DUP2], [$REPLACE_DUP2], - [Define to 1 if dup2 returns 0 instead of the target fd.]) -]) diff --git a/gnulib-m4/eealloc.m4 b/gnulib-m4/eealloc.m4 index 3c9c0b5..63dd920 100644 --- a/gnulib-m4/eealloc.m4 +++ b/gnulib-m4/eealloc.m4 @@ -1,5 +1,5 @@ # eealloc.m4 serial 2 -dnl Copyright (C) 2003, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2009, 2010 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. diff --git a/gnulib-m4/environ.m4 b/gnulib-m4/environ.m4 index b17bb60..5f50d6e 100644 --- a/gnulib-m4/environ.m4 +++ b/gnulib-m4/environ.m4 @@ -1,10 +1,10 @@ -# environ.m4 serial 2 -dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. +# environ.m4 serial 3 +dnl Copyright (C) 2001-2004, 2006-2010 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_ENVIRON], +AC_DEFUN_ONCE([gl_ENVIRON], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl Persuade glibc <unistd.h> to declare environ. diff --git a/gnulib-m4/errno_h.m4 b/gnulib-m4/errno_h.m4 index 4ce1ccb..d02a039 100644 --- a/gnulib-m4/errno_h.m4 +++ b/gnulib-m4/errno_h.m4 @@ -1,5 +1,5 @@ # errno_h.m4 serial 6 -dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 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. diff --git a/gnulib-m4/error.m4 b/gnulib-m4/error.m4 index 7c7746e..9f1307a 100644 --- a/gnulib-m4/error.m4 +++ b/gnulib-m4/error.m4 @@ -1,7 +1,6 @@ -#serial 11 +#serial 12 -# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software -# Foundation, Inc. +# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -18,5 +17,6 @@ AC_DEFUN([gl_ERROR], AC_DEFUN([gl_PREREQ_ERROR], [ AC_REQUIRE([AC_FUNC_STRERROR_R]) + AC_REQUIRE([AC_C_INLINE]) : ]) diff --git a/gnulib-m4/exitfail.m4 b/gnulib-m4/exitfail.m4 deleted file mode 100644 index b7a691e..0000000 --- a/gnulib-m4/exitfail.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# exitfail.m4 serial 6 -dnl Copyright (C) 2002, 2003, 2005, 2006 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_EXITFAIL], -[ - AC_LIBOBJ([exitfail]) - - dnl No prerequisites of lib/exitfail.c. - : -]) diff --git a/gnulib-m4/exponentd.m4 b/gnulib-m4/exponentd.m4 index 140cee4..5d44d0e 100644 --- a/gnulib-m4/exponentd.m4 +++ b/gnulib-m4/exponentd.m4 @@ -1,5 +1,5 @@ # exponentd.m4 serial 1 -dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/exponentf.m4 b/gnulib-m4/exponentf.m4 index 7ff3413..4d8063f 100644 --- a/gnulib-m4/exponentf.m4 +++ b/gnulib-m4/exponentf.m4 @@ -1,5 +1,5 @@ # exponentf.m4 serial 1 -dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/exponentl.m4 b/gnulib-m4/exponentl.m4 index 98e35eb..a700d3b 100644 --- a/gnulib-m4/exponentl.m4 +++ b/gnulib-m4/exponentl.m4 @@ -1,5 +1,5 @@ # exponentl.m4 serial 2 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/extensions.m4 b/gnulib-m4/extensions.m4 index ba6d5e1..7d9458a 100644 --- a/gnulib-m4/extensions.m4 +++ b/gnulib-m4/extensions.m4 @@ -1,7 +1,7 @@ -# serial 8 -*- Autoconf -*- +# serial 9 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,6 +12,20 @@ # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. +# If autoconf reports a warning +# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS +# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS +# the fix is +# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked +# but always AC_REQUIREd, +# 2) to ensure that for each occurrence of +# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) +# or +# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) +# the corresponding gnulib module description has 'extensions' among +# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS +# invocation occurs in gl_EARLY, not in gl_INIT. + # AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, @@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ -# define __EXTENSIONS__ 1 - ]AC_INCLUDES_DEFAULT])], +# define __EXTENSIONS__ 1 + ]AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && diff --git a/gnulib-m4/fcntl-o.m4 b/gnulib-m4/fcntl-o.m4 new file mode 100644 index 0000000..d416a61 --- /dev/null +++ b/gnulib-m4/fcntl-o.m4 @@ -0,0 +1,81 @@ +# fcntl-o.m4 serial 1 +dnl Copyright (C) 2006, 2009-2010 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 Written by Paul Eggert. + +# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. +# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. +# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. +AC_DEFUN([gl_FCNTL_O_FLAGS], +[ + dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> + #include <fcntl.h> + #ifndef O_NOATIME + #define O_NOATIME 0 + #endif + #ifndef O_NOFOLLOW + #define O_NOFOLLOW 0 + #endif + static int const constants[] = + { + O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, + O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY + }; + ]], + [[ + int status = !constants; + { + static char const sym[] = "conftest.sym"; + if (symlink (".", sym) != 0 + || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) + status |= 32; + unlink (sym); + } + { + static char const file[] = "confdefs.h"; + int fd = open (file, O_RDONLY | O_NOATIME); + char c; + struct stat st0, st1; + if (fd < 0 + || fstat (fd, &st0) != 0 + || sleep (1) != 0 + || read (fd, &c, 1) != 1 + || close (fd) != 0 + || stat (file, &st1) != 0 + || st0.st_atime != st1.st_atime) + status |= 64; + } + return status;]])], + [gl_cv_header_working_fcntl_h=yes], + [case $? in #( + 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( + 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + *) gl_cv_header_working_fcntl_h='no';; + esac], + [gl_cv_header_working_fcntl_h=cross-compiling])]) + + case $gl_cv_header_working_fcntl_h in #( + *O_NOATIME* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], + [Define to 1 if O_NOATIME works.]) + + case $gl_cv_header_working_fcntl_h in #( + *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], + [Define to 1 if O_NOFOLLOW works.]) +]) diff --git a/gnulib-m4/fcntl_h.m4 b/gnulib-m4/fcntl_h.m4 deleted file mode 100644 index 1ae0b15..0000000 --- a/gnulib-m4/fcntl_h.m4 +++ /dev/null @@ -1,96 +0,0 @@ -# Configure fcntl.h. -dnl Copyright (C) 2006, 2007, 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. - -dnl Written by Paul Eggert. - -AC_DEFUN([gl_FCNTL_H], -[ - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/types.h> - #include <sys/stat.h> - #include <unistd.h> - #include <fcntl.h> - #ifndef O_NOATIME - #define O_NOATIME 0 - #endif - #ifndef O_NOFOLLOW - #define O_NOFOLLOW 0 - #endif - static int const constants[] = - { - O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, - O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY - }; - ]], - [[ - int status = !constants; - { - static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0 - || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) - status |= 32; - } - { - static char const file[] = "confdefs.h"; - int fd = open (file, O_RDONLY | O_NOATIME); - char c; - struct stat st0, st1; - if (fd < 0 - || fstat (fd, &st0) != 0 - || sleep (1) != 0 - || read (fd, &c, 1) != 1 - || close (fd) != 0 - || stat (file, &st1) != 0 - || st0.st_atime != st1.st_atime) - status |= 64; - } - return status;]])], - [gl_cv_header_working_fcntl_h=yes], - [case $? in #( - 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac], - [gl_cv_header_working_fcntl_h=cross-compiling])]) - - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], - [Define to 1 if O_NOATIME works.]) - - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], - [Define to 1 if O_NOFOLLOW works.]) - - gl_CHECK_NEXT_HEADERS([fcntl.h]) - FCNTL_H='fcntl.h' - AC_SUBST([FCNTL_H]) -]) - -AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 -]) - -AC_DEFUN([gl_FCNTL_H_DEFAULTS], -[ - GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) - dnl Assume proper GNU behavior unless another module says otherwise. - REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) -]) diff --git a/gnulib-m4/float_h.m4 b/gnulib-m4/float_h.m4 index d36e3a4..a74a0d9 100644 --- a/gnulib-m4/float_h.m4 +++ b/gnulib-m4/float_h.m4 @@ -1,5 +1,5 @@ # float_h.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009, 2010 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. diff --git a/gnulib-m4/fpieee.m4 b/gnulib-m4/fpieee.m4 index 9f4a92c..532802d 100644 --- a/gnulib-m4/fpieee.m4 +++ b/gnulib-m4/fpieee.m4 @@ -1,5 +1,5 @@ # fpieee.m4 serial 1 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009, 2010 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. diff --git a/gnulib-m4/frexp.m4 b/gnulib-m4/frexp.m4 index 6c91112..3a450f6 100644 --- a/gnulib-m4/frexp.m4 +++ b/gnulib-m4/frexp.m4 @@ -1,5 +1,5 @@ # frexp.m4 serial 7 -dnl Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2008, 2009, 2010 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. diff --git a/gnulib-m4/frexpl.m4 b/gnulib-m4/frexpl.m4 index c5da744..8016520 100644 --- a/gnulib-m4/frexpl.m4 +++ b/gnulib-m4/frexpl.m4 @@ -1,5 +1,5 @@ # frexpl.m4 serial 9 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. @@ -7,54 +7,56 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FREXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + dnl Check whether it's declared. + dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) FREXPL_LIBM= - AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], - [gl_cv_func_frexpl_no_libm], - [ - AC_TRY_LINK([#include <math.h> - long double x;], - [int e; return frexpl (x, &e) > 0;], - [gl_cv_func_frexpl_no_libm=yes], - [gl_cv_func_frexpl_no_libm=no]) - ]) - if test $gl_cv_func_frexpl_no_libm = no; then - AC_CACHE_CHECK([whether frexpl() can be used with libm], - [gl_cv_func_frexpl_in_libm], + if test $HAVE_DECL_FREXPL = 1; then + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], [ - save_LIBS="$LIBS" - LIBS="$LIBS -lm" AC_TRY_LINK([#include <math.h> long double x;], [int e; return frexpl (x, &e) > 0;], - [gl_cv_func_frexpl_in_libm=yes], - [gl_cv_func_frexpl_in_libm=no]) - LIBS="$save_LIBS" + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) ]) - if test $gl_cv_func_frexpl_in_libm = yes; then - FREXPL_LIBM=-lm + if test $gl_cv_func_frexpl_no_libm = no; then + AC_CACHE_CHECK([whether frexpl() can be used with libm], + [gl_cv_func_frexpl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include <math.h> + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_in_libm=yes], + [gl_cv_func_frexpl_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_frexpl_in_libm = yes; then + FREXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_frexpl_no_libm = yes \ + || test $gl_cv_func_frexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $FREXPL_LIBM" + gl_FUNC_FREXPL_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl=yes ;; + *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;; + esac + else + gl_func_frexpl=no + fi + if test $gl_func_frexpl = yes; then + AC_DEFINE([HAVE_FREXPL], [1], + [Define if the frexpl() function is available.]) fi fi - if test $gl_cv_func_frexpl_no_libm = yes \ - || test $gl_cv_func_frexpl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $FREXPL_LIBM" - gl_FUNC_FREXPL_WORKS - LIBS="$save_LIBS" - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl=yes ;; - *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;; - esac - else - gl_func_frexpl=no - fi - if test $gl_func_frexpl = yes; then - AC_DEFINE([HAVE_FREXPL], [1], - [Define if the frexpl() function is available.]) - dnl Also check whether it's declared. - dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) - else - HAVE_DECL_FREXPL=0 + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then AC_LIBOBJ([frexpl]) fi AC_SUBST([FREXPL_LIBM]) @@ -63,34 +65,36 @@ AC_DEFUN([gl_FUNC_FREXPL], AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) - AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], - [gl_cv_func_frexpl_no_libm], - [ - AC_TRY_LINK([#include <math.h> - long double x;], - [int e; return frexpl (x, &e) > 0;], - [gl_cv_func_frexpl_no_libm=yes], - [gl_cv_func_frexpl_no_libm=no]) - ]) - if test $gl_cv_func_frexpl_no_libm = yes; then - gl_FUNC_FREXPL_WORKS - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl_no_libm=yes ;; - *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl_no_libm=no - dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. - REPLACE_FREXPL=1 + dnl Check whether it's declared. + dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) + if test $HAVE_DECL_FREXPL = 1; then + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], + [ + AC_TRY_LINK([#include <math.h> + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) + ]) + if test $gl_cv_func_frexpl_no_libm = yes; then + gl_FUNC_FREXPL_WORKS + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then + AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1], + [Define if the frexpl() function is available in libc.]) + fi fi - if test $gl_func_frexpl_no_libm = yes; then - AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1], - [Define if the frexpl() function is available in libc.]) - dnl Also check whether it's declared. - dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) - else - HAVE_DECL_FREXPL=0 + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then AC_LIBOBJ([frexpl]) fi ]) diff --git a/gnulib-m4/getpagesize.m4 b/gnulib-m4/getpagesize.m4 index 0d07a3a..313ad7f 100644 --- a/gnulib-m4/getpagesize.m4 +++ b/gnulib-m4/getpagesize.m4 @@ -1,5 +1,6 @@ -# getpagesize.m4 serial 7 -dnl Copyright (C) 2002, 2004-2005, 2007 Free Software Foundation, Inc. +# getpagesize.m4 serial 8 +dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2010 Free Software Foundation, +dnl 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. @@ -26,4 +27,7 @@ AC_DEFUN([gl_FUNC_GETPAGESIZE], AC_LIBOBJ([getpagesize]) ;; esac + dnl Also check whether it's declared. + dnl mingw has getpagesize() in libgcc.a but doesn't declare it. + AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0]) ]) diff --git a/gnulib-m4/glibc21.m4 b/gnulib-m4/glibc21.m4 index 93fbf47..68ada9d 100644 --- a/gnulib-m4/glibc21.m4 +++ b/gnulib-m4/glibc21.m4 @@ -1,5 +1,5 @@ # glibc21.m4 serial 4 -dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2004, 2008-2010 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. @@ -12,16 +12,16 @@ AC_DEFUN([gl_GLIBC21], AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], [ac_cv_gnu_library_2_1], [AC_EGREP_CPP([Lucky GNU user], - [ + [ #include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif - ], - [ac_cv_gnu_library_2_1=yes], - [ac_cv_gnu_library_2_1=no]) + ], + [ac_cv_gnu_library_2_1=yes], + [ac_cv_gnu_library_2_1=no]) ] ) AC_SUBST([GLIBC21]) diff --git a/gnulib-m4/gnulib-cache.m4 b/gnulib-m4/gnulib-cache.m4 index b3ae1d2..72bc8cc 100644 --- a/gnulib-m4/gnulib-cache.m4 +++ b/gnulib-m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --lgpl --makefile-name=Makefile.gnulib --libtool --macro-prefix=gl relocatable-lib-lgpl unicase/base unicase/empty-prefix-context unicase/empty-suffix-context unicase/locale-language unicase/tolower unicase/totitle unicase/toupper unicase/u16-casecmp unicase/u16-casecoll unicase/u16-casefold unicase/u16-casexfrm unicase/u16-ct-casefold unicase/u16-ct-tolower unicase/u16-ct-totitle unicase/u16-ct-toupper unicase/u16-is-cased unicase/u16-is-casefolded unicase/u16-is-lowercase unicase/u16-is-titlecase unicase/u16-is-uppercase unicase/u16-tolower unicase/u16-totitle unicase/u16-toupper unicase/u32-casecmp unicase/u32-casecoll unicase/u32-casefold unicase/u32-casexfrm unicase/u32-ct-casefold unicase/u32-ct-tolower unicase/u32-ct-totitle unicase/u32-ct-toupper unicase/u32-is-cased unicase/u32-is-casefolded unicase/u32-is-lowercase unicase/u32-is-titlecase unicase/u32-is-uppercase unicase/u32-tolower unicase/u32-totitle unicase/u32-toupper unicase/u8-casecmp unicase/u8-casecoll unicase/u8-casefold unicase/u8-casexfrm unicase/u8-ct-casefold unicase/u8-ct-tolower unicase/u8-ct-totitle unicase/u8-ct-toupper unicase/u8-is-cased unicase/u8-is-casefolded unicase/u8-is-lowercase unicase/u8-is-titlecase unicase/u8-is-uppercase unicase/u8-tolower unicase/u8-totitle unicase/u8-toupper unicase/ulc-casecmp unicase/ulc-casecoll unicase/ulc-casexfrm uniconv/base uniconv/u16-conv-from-enc uniconv/u16-conv-to-enc uniconv/u16-strconv-from-enc uniconv/u16-strconv-from-locale uniconv/u16-strconv-to-enc uniconv/u16-strconv-to-locale uniconv/u32-conv-from-enc uniconv/u32-conv-to-enc uniconv/u32-strconv-from-enc uniconv/u32-strconv-from-locale uniconv/u32-strconv-to-enc uniconv/u32-strconv-to-locale uniconv/u8-conv-from-enc uniconv/u8-conv-to-enc uniconv/u8-strconv-from-enc uniconv/u8-strconv-from-locale uniconv/u8-strconv-to-enc uniconv/u8-strconv-to-locale unictype/base unictype/bidicategory-all unictype/block-all unictype/category-all unictype/combining-class unictype/ctype-alnum unictype/ctype-alpha unictype/ctype-blank unictype/ctype-cntrl unictype/ctype-digit unictype/ctype-graph unictype/ctype-lower unictype/ctype-print unictype/ctype-punct unictype/ctype-space unictype/ctype-upper unictype/ctype-xdigit unictype/decimal-digit unictype/digit unictype/mirror unictype/numeric unictype/property-all unictype/scripts-all unictype/syntax-c-ident unictype/syntax-c-whitespace unictype/syntax-java-ident unictype/syntax-java-whitespace unilbrk/base unilbrk/tables unilbrk/u16-possible-linebreaks unilbrk/u16-width-linebreaks unilbrk/u32-possible-linebreaks unilbrk/u32-width-linebreaks unilbrk/u8-possible-linebreaks unilbrk/u8-width-linebreaks unilbrk/ulc-possible-linebreaks unilbrk/ulc-width-linebreaks uniname/base uniname/uniname uninorm/base uninorm/canonical-decomposition uninorm/compat-decomposition uninorm/composition uninorm/decomposition uninorm/filter uninorm/nfc uninorm/nfd uninorm/nfkc uninorm/nfkd uninorm/u16-normalize uninorm/u16-normcmp uninorm/u16-normcoll uninorm/u16-normxfrm uninorm/u32-normalize uninorm/u32-normcmp uninorm/u32-normcoll uninorm/u32-normxfrm uninorm/u8-normalize uninorm/u8-normcmp uninorm/u8-normcoll uninorm/u8-normxfrm unistdio/base unistdio/u16-asnprintf unistdio/u16-asprintf unistdio/u16-snprintf unistdio/u16-sprintf unistdio/u16-u16-asnprintf unistdio/u16-u16-asprintf unistdio/u16-u16-snprintf unistdio/u16-u16-sprintf unistdio/u16-u16-vasnprintf unistdio/u16-u16-vasprintf unistdio/u16-u16-vsnprintf unistdio/u16-u16-vsprintf unistdio/u16-vasnprintf unistdio/u16-vasprintf unistdio/u16-vsnprintf unistdio/u16-vsprintf unistdio/u32-asnprintf unistdio/u32-asprintf unistdio/u32-snprintf unistdio/u32-sprintf unistdio/u32-u32-asnprintf unistdio/u32-u32-asprintf unistdio/u32-u32-snprintf unistdio/u32-u32-sprintf unistdio/u32-u32-vasnprintf unistdio/u32-u32-vasprintf unistdio/u32-u32-vsnprintf unistdio/u32-u32-vsprintf unistdio/u32-vasnprintf unistdio/u32-vasprintf unistdio/u32-vsnprintf unistdio/u32-vsprintf unistdio/u8-asnprintf unistdio/u8-asprintf unistdio/u8-snprintf unistdio/u8-sprintf unistdio/u8-u8-asnprintf unistdio/u8-u8-asprintf unistdio/u8-u8-snprintf unistdio/u8-u8-sprintf unistdio/u8-u8-vasnprintf unistdio/u8-u8-vasprintf unistdio/u8-u8-vsnprintf unistdio/u8-u8-vsprintf unistdio/u8-vasnprintf unistdio/u8-vasprintf unistdio/u8-vsnprintf unistdio/u8-vsprintf unistdio/ulc-asnprintf unistdio/ulc-asprintf unistdio/ulc-fprintf unistdio/ulc-snprintf unistdio/ulc-sprintf unistdio/ulc-vasnprintf unistdio/ulc-vasprintf unistdio/ulc-vfprintf unistdio/ulc-vsnprintf unistdio/ulc-vsprintf unistr/base unistr/u16-check unistr/u16-chr unistr/u16-cmp unistr/u16-cmp2 unistr/u16-cpy unistr/u16-cpy-alloc unistr/u16-endswith unistr/u16-mblen unistr/u16-mbsnlen unistr/u16-mbtouc unistr/u16-mbtouc-unsafe unistr/u16-mbtoucr unistr/u16-move unistr/u16-next unistr/u16-prev unistr/u16-set unistr/u16-startswith unistr/u16-stpcpy unistr/u16-stpncpy unistr/u16-strcat unistr/u16-strchr unistr/u16-strcmp unistr/u16-strcoll unistr/u16-strcpy unistr/u16-strcspn unistr/u16-strdup unistr/u16-strlen unistr/u16-strmblen unistr/u16-strmbtouc unistr/u16-strncat unistr/u16-strncmp unistr/u16-strncpy unistr/u16-strnlen unistr/u16-strpbrk unistr/u16-strrchr unistr/u16-strspn unistr/u16-strstr unistr/u16-strtok unistr/u16-to-u32 unistr/u16-to-u8 unistr/u16-uctomb unistr/u32-check unistr/u32-chr unistr/u32-cmp unistr/u32-cmp2 unistr/u32-cpy unistr/u32-cpy-alloc unistr/u32-endswith unistr/u32-mblen unistr/u32-mbsnlen unistr/u32-mbtouc unistr/u32-mbtouc-unsafe unistr/u32-mbtoucr unistr/u32-move unistr/u32-next unistr/u32-prev unistr/u32-set unistr/u32-startswith unistr/u32-stpcpy unistr/u32-stpncpy unistr/u32-strcat unistr/u32-strchr unistr/u32-strcmp unistr/u32-strcoll unistr/u32-strcpy unistr/u32-strcspn unistr/u32-strdup unistr/u32-strlen unistr/u32-strmblen unistr/u32-strmbtouc unistr/u32-strncat unistr/u32-strncmp unistr/u32-strncpy unistr/u32-strnlen unistr/u32-strpbrk unistr/u32-strrchr unistr/u32-strspn unistr/u32-strstr unistr/u32-strtok unistr/u32-to-u16 unistr/u32-to-u8 unistr/u32-uctomb unistr/u8-check unistr/u8-chr unistr/u8-cmp unistr/u8-cmp2 unistr/u8-cpy unistr/u8-cpy-alloc unistr/u8-endswith unistr/u8-mblen unistr/u8-mbsnlen unistr/u8-mbtouc unistr/u8-mbtouc-unsafe unistr/u8-mbtoucr unistr/u8-move unistr/u8-next unistr/u8-prev unistr/u8-set unistr/u8-startswith unistr/u8-stpcpy unistr/u8-stpncpy unistr/u8-strcat unistr/u8-strchr unistr/u8-strcmp unistr/u8-strcoll unistr/u8-strcpy unistr/u8-strcspn unistr/u8-strdup unistr/u8-strlen unistr/u8-strmblen unistr/u8-strmbtouc unistr/u8-strncat unistr/u8-strncmp unistr/u8-strncpy unistr/u8-strnlen unistr/u8-strpbrk unistr/u8-strrchr unistr/u8-strspn unistr/u8-strstr unistr/u8-strtok unistr/u8-to-u16 unistr/u8-to-u32 unistr/u8-uctomb unitypes uniwbrk/base uniwbrk/u16-wordbreaks uniwbrk/u32-wordbreaks uniwbrk/u8-wordbreaks uniwbrk/ulc-wordbreaks uniwbrk/wordbreak-property uniwidth/base uniwidth/u16-strwidth uniwidth/u16-width uniwidth/u32-strwidth uniwidth/u32-width uniwidth/u8-strwidth uniwidth/u8-width uniwidth/width +# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --lgpl --makefile-name=Makefile.gnulib --libtool --macro-prefix=gl relocatable-lib-lgpl unicase/base unicase/empty-prefix-context unicase/empty-suffix-context unicase/locale-language unicase/tolower unicase/totitle unicase/toupper unicase/u16-casecmp unicase/u16-casecoll unicase/u16-casefold unicase/u16-casexfrm unicase/u16-ct-casefold unicase/u16-ct-tolower unicase/u16-ct-totitle unicase/u16-ct-toupper unicase/u16-is-cased unicase/u16-is-casefolded unicase/u16-is-lowercase unicase/u16-is-titlecase unicase/u16-is-uppercase unicase/u16-tolower unicase/u16-totitle unicase/u16-toupper unicase/u32-casecmp unicase/u32-casecoll unicase/u32-casefold unicase/u32-casexfrm unicase/u32-ct-casefold unicase/u32-ct-tolower unicase/u32-ct-totitle unicase/u32-ct-toupper unicase/u32-is-cased unicase/u32-is-casefolded unicase/u32-is-lowercase unicase/u32-is-titlecase unicase/u32-is-uppercase unicase/u32-tolower unicase/u32-totitle unicase/u32-toupper unicase/u8-casecmp unicase/u8-casecoll unicase/u8-casefold unicase/u8-casexfrm unicase/u8-ct-casefold unicase/u8-ct-tolower unicase/u8-ct-totitle unicase/u8-ct-toupper unicase/u8-is-cased unicase/u8-is-casefolded unicase/u8-is-lowercase unicase/u8-is-titlecase unicase/u8-is-uppercase unicase/u8-tolower unicase/u8-totitle unicase/u8-toupper unicase/ulc-casecmp unicase/ulc-casecoll unicase/ulc-casexfrm uniconv/base uniconv/u16-conv-from-enc uniconv/u16-conv-to-enc uniconv/u16-strconv-from-enc uniconv/u16-strconv-from-locale uniconv/u16-strconv-to-enc uniconv/u16-strconv-to-locale uniconv/u32-conv-from-enc uniconv/u32-conv-to-enc uniconv/u32-strconv-from-enc uniconv/u32-strconv-from-locale uniconv/u32-strconv-to-enc uniconv/u32-strconv-to-locale uniconv/u8-conv-from-enc uniconv/u8-conv-to-enc uniconv/u8-strconv-from-enc uniconv/u8-strconv-from-locale uniconv/u8-strconv-to-enc uniconv/u8-strconv-to-locale unictype/base unictype/bidicategory-all unictype/block-all unictype/category-all unictype/combining-class unictype/ctype-alnum unictype/ctype-alpha unictype/ctype-blank unictype/ctype-cntrl unictype/ctype-digit unictype/ctype-graph unictype/ctype-lower unictype/ctype-print unictype/ctype-punct unictype/ctype-space unictype/ctype-upper unictype/ctype-xdigit unictype/decimal-digit unictype/digit unictype/mirror unictype/numeric unictype/property-all unictype/scripts-all unictype/syntax-c-ident unictype/syntax-c-whitespace unictype/syntax-java-ident unictype/syntax-java-whitespace unilbrk/base unilbrk/u16-possible-linebreaks unilbrk/u16-width-linebreaks unilbrk/u32-possible-linebreaks unilbrk/u32-width-linebreaks unilbrk/u8-possible-linebreaks unilbrk/u8-width-linebreaks unilbrk/ulc-possible-linebreaks unilbrk/ulc-width-linebreaks uniname/base uniname/uniname uninorm/base uninorm/canonical-decomposition uninorm/composition uninorm/decomposition uninorm/filter uninorm/nfc uninorm/nfd uninorm/nfkc uninorm/nfkd uninorm/u16-normalize uninorm/u16-normcmp uninorm/u16-normcoll uninorm/u16-normxfrm uninorm/u32-normalize uninorm/u32-normcmp uninorm/u32-normcoll uninorm/u32-normxfrm uninorm/u8-normalize uninorm/u8-normcmp uninorm/u8-normcoll uninorm/u8-normxfrm unistdio/base unistdio/u16-asnprintf unistdio/u16-asprintf unistdio/u16-snprintf unistdio/u16-sprintf unistdio/u16-u16-asnprintf unistdio/u16-u16-asprintf unistdio/u16-u16-snprintf unistdio/u16-u16-sprintf unistdio/u16-u16-vasnprintf unistdio/u16-u16-vasprintf unistdio/u16-u16-vsnprintf unistdio/u16-u16-vsprintf unistdio/u16-vasnprintf unistdio/u16-vasprintf unistdio/u16-vsnprintf unistdio/u16-vsprintf unistdio/u32-asnprintf unistdio/u32-asprintf unistdio/u32-snprintf unistdio/u32-sprintf unistdio/u32-u32-asnprintf unistdio/u32-u32-asprintf unistdio/u32-u32-snprintf unistdio/u32-u32-sprintf unistdio/u32-u32-vasnprintf unistdio/u32-u32-vasprintf unistdio/u32-u32-vsnprintf unistdio/u32-u32-vsprintf unistdio/u32-vasnprintf unistdio/u32-vasprintf unistdio/u32-vsnprintf unistdio/u32-vsprintf unistdio/u8-asnprintf unistdio/u8-asprintf unistdio/u8-snprintf unistdio/u8-sprintf unistdio/u8-u8-asnprintf unistdio/u8-u8-asprintf unistdio/u8-u8-snprintf unistdio/u8-u8-sprintf unistdio/u8-u8-vasnprintf unistdio/u8-u8-vasprintf unistdio/u8-u8-vsnprintf unistdio/u8-u8-vsprintf unistdio/u8-vasnprintf unistdio/u8-vasprintf unistdio/u8-vsnprintf unistdio/u8-vsprintf unistdio/ulc-asnprintf unistdio/ulc-asprintf unistdio/ulc-fprintf unistdio/ulc-snprintf unistdio/ulc-sprintf unistdio/ulc-vasnprintf unistdio/ulc-vasprintf unistdio/ulc-vfprintf unistdio/ulc-vsnprintf unistdio/ulc-vsprintf unistr/base unistr/u16-check unistr/u16-chr unistr/u16-cmp unistr/u16-cmp2 unistr/u16-cpy unistr/u16-cpy-alloc unistr/u16-endswith unistr/u16-mblen unistr/u16-mbsnlen unistr/u16-mbtouc unistr/u16-mbtouc-unsafe unistr/u16-mbtoucr unistr/u16-move unistr/u16-next unistr/u16-prev unistr/u16-set unistr/u16-startswith unistr/u16-stpcpy unistr/u16-stpncpy unistr/u16-strcat unistr/u16-strchr unistr/u16-strcmp unistr/u16-strcoll unistr/u16-strcpy unistr/u16-strcspn unistr/u16-strdup unistr/u16-strlen unistr/u16-strmblen unistr/u16-strmbtouc unistr/u16-strncat unistr/u16-strncmp unistr/u16-strncpy unistr/u16-strnlen unistr/u16-strpbrk unistr/u16-strrchr unistr/u16-strspn unistr/u16-strstr unistr/u16-strtok unistr/u16-to-u32 unistr/u16-to-u8 unistr/u16-uctomb unistr/u32-check unistr/u32-chr unistr/u32-cmp unistr/u32-cmp2 unistr/u32-cpy unistr/u32-cpy-alloc unistr/u32-endswith unistr/u32-mblen unistr/u32-mbsnlen unistr/u32-mbtouc unistr/u32-mbtouc-unsafe unistr/u32-mbtoucr unistr/u32-move unistr/u32-next unistr/u32-prev unistr/u32-set unistr/u32-startswith unistr/u32-stpcpy unistr/u32-stpncpy unistr/u32-strcat unistr/u32-strchr unistr/u32-strcmp unistr/u32-strcoll unistr/u32-strcpy unistr/u32-strcspn unistr/u32-strdup unistr/u32-strlen unistr/u32-strmblen unistr/u32-strmbtouc unistr/u32-strncat unistr/u32-strncmp unistr/u32-strncpy unistr/u32-strnlen unistr/u32-strpbrk unistr/u32-strrchr unistr/u32-strspn unistr/u32-strstr unistr/u32-strtok unistr/u32-to-u16 unistr/u32-to-u8 unistr/u32-uctomb unistr/u8-check unistr/u8-chr unistr/u8-cmp unistr/u8-cmp2 unistr/u8-cpy unistr/u8-cpy-alloc unistr/u8-endswith unistr/u8-mblen unistr/u8-mbsnlen unistr/u8-mbtouc unistr/u8-mbtouc-unsafe unistr/u8-mbtoucr unistr/u8-move unistr/u8-next unistr/u8-prev unistr/u8-set unistr/u8-startswith unistr/u8-stpcpy unistr/u8-stpncpy unistr/u8-strcat unistr/u8-strchr unistr/u8-strcmp unistr/u8-strcoll unistr/u8-strcpy unistr/u8-strcspn unistr/u8-strdup unistr/u8-strlen unistr/u8-strmblen unistr/u8-strmbtouc unistr/u8-strncat unistr/u8-strncmp unistr/u8-strncpy unistr/u8-strnlen unistr/u8-strpbrk unistr/u8-strrchr unistr/u8-strspn unistr/u8-strstr unistr/u8-strtok unistr/u8-to-u16 unistr/u8-to-u32 unistr/u8-uctomb unitypes uniwbrk/base uniwbrk/u16-wordbreaks uniwbrk/u32-wordbreaks uniwbrk/u8-wordbreaks uniwbrk/ulc-wordbreaks uniwbrk/wordbreak-property uniwidth/base uniwidth/u16-strwidth uniwidth/u16-width uniwidth/u32-strwidth uniwidth/u32-width uniwidth/u8-strwidth uniwidth/u8-width uniwidth/width # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gnulib-local]) @@ -126,7 +126,6 @@ gl_MODULES([ unictype/syntax-java-ident unictype/syntax-java-whitespace unilbrk/base - unilbrk/tables unilbrk/u16-possible-linebreaks unilbrk/u16-width-linebreaks unilbrk/u32-possible-linebreaks @@ -139,7 +138,6 @@ gl_MODULES([ uniname/uniname uninorm/base uninorm/canonical-decomposition - uninorm/compat-decomposition uninorm/composition uninorm/decomposition uninorm/filter diff --git a/gnulib-m4/gnulib-common.m4 b/gnulib-m4/gnulib-common.m4 index c8fda20..4c7ac30 100644 --- a/gnulib-m4/gnulib-common.m4 +++ b/gnulib-m4/gnulib-common.m4 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 11 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# gnulib-common.m4 serial 20 +dnl Copyright (C) 2007-2010 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. @@ -23,23 +23,83 @@ AC_DEFUN([gl_COMMON_BODY], [ # define __GNUC_STDC_INLINE__ 1 #endif]) AH_VERBATIM([unused_parameter], -[/* Define as a marker that can be attached to function parameter declarations - for parameters that are not used. This helps to reduce warnings, such as - from GCC -Wunused-parameter. */ +[/* Define as a marker that can be attached to declarations that might not + be used. This helps to reduce warnings, such as from + GCC -Wunused-parameter. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) +# define _GL_UNUSED __attribute__ ((__unused__)) #else -# define _UNUSED_PARAMETER_ +# define _GL_UNUSED #endif +/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name + is a misnomer outside of parameter lists. */ +#define _UNUSED_PARAMETER_ _GL_UNUSED ]) + dnl Preparation for running test programs: + dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not + dnl to /dev/tty, so they can be redirected to log files. Such diagnostics + dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. + LIBC_FATAL_STDERR_=1 + export LIBC_FATAL_STDERR_ +]) + +# gl_MODULE_INDICATOR_CONDITION +# expands to a C preprocessor expression that evaluates to 1 or 0, depending +# whether a gnulib module that has been requested shall be considered present +# or not. +AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) + +# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) +# sets the shell variable that indicates the presence of the given module to +# a C preprocessor expression that will evaluate to 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], +[ + GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION ]) # gl_MODULE_INDICATOR([modulename]) -# defines a C macro indicating the presence of the given module. +# defines a C macro indicating the presence of the given module +# in a location where it can be used. +# | Value | Value | +# | in lib/ | in tests/ | +# --------------------------------------------+---------+-----------+ +# Module present among main modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module present among tests-related modules: | 0 | 1 | +# --------------------------------------------+---------+-----------+ +# Module not present at all: | 0 | 0 | +# --------------------------------------------+---------+-----------+ AC_DEFUN([gl_MODULE_INDICATOR], [ - AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], - [Define to 1 when using the gnulib module ]$1[.]) + AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), + [gl_MODULE_INDICATOR_CONDITION], + [Define to a C preprocessor expression that evaluates to 1 or 0, + depending whether the gnulib module $1 shall be considered present.]) +]) + +# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) +# defines a C macro indicating the presence of the given module +# in lib or tests. This is useful to determine whether the module +# should be tested. +# | Value | Value | +# | in lib/ | in tests/ | +# --------------------------------------------+---------+-----------+ +# Module present among main modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module present among tests-related modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module not present at all: | 0 | 0 | +# --------------------------------------------+---------+-----------+ +AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], +[ + AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], + [Define to 1 when the gnulib module $1 should be tested.]) ]) # m4_foreach_w @@ -49,10 +109,25 @@ m4_ifndef([m4_foreach_w], [m4_define([m4_foreach_w], [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) +# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) +# ---------------------------------------------------- +# Backport of autoconf-2.63b's macro. +# Remove this macro when we can assume autoconf >= 2.64. +m4_ifndef([AS_VAR_IF], +[m4_define([AS_VAR_IF], +[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) + # AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifdef([AC_PROG_MKDIR_P], [], [ +# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix +# for interoperability with automake-1.9.6 from autoconf-2.62. +# Remove this macro when we can assume autoconf >= 2.62 or +# autoconf >= 2.60 && automake >= 1.10. +m4_ifdef([AC_PROG_MKDIR_P], [ + dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. + m4_define([AC_PROG_MKDIR_P], + m4_defn([AC_PROG_MKDIR_P])[ + AC_SUBST([MKDIR_P])])], [ + dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. AC_DEFUN_ONCE([AC_PROG_MKDIR_P], [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake MKDIR_P='$(mkdir_p)' @@ -63,6 +138,7 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [ # so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ # works. # This definition can be removed once autoconf >= 2.62 can be assumed. +m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no @@ -70,13 +146,13 @@ AC_DEFUN([AC_C_RESTRICT], for ac_kw in __restrict __restrict__ _Restrict restrict; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; + int foo (int_ptr $ac_kw ip) { + return ip[0]; }]], [[int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t)]])], + int * $ac_kw t = s; + t[0] = 0; + return foo(t)]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done @@ -100,6 +176,7 @@ AC_DEFUN([AC_C_RESTRICT], *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; esac ]) +]) # gl_BIGENDIAN # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. diff --git a/gnulib-m4/gnulib-comp.m4 b/gnulib-m4/gnulib-comp.m4 index 39e7d19..21284a4 100644 --- a/gnulib-m4/gnulib-comp.m4 +++ b/gnulib-m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -26,8 +26,983 @@ AC_DEFUN([gl_EARLY], m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AM_PROG_CC_C_O]) + # Code from module alloca-opt: + # Code from module alloca-opt-tests: + # Code from module arg-nonnull: + # Code from module array-mergesort: + # Code from module array-mergesort-tests: + # Code from module c++defs: + # Code from module c-ctype: + # Code from module c-ctype-tests: + # Code from module c-strcase: + # Code from module c-strcase-tests: + # Code from module c-strcaseeq: + # Code from module configmake: + # Code from module environ: + # Code from module environ-tests: + # Code from module errno: + # Code from module errno-tests: + # Code from module error: + # Code from module exitfail: + # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module float: + # Code from module fpieee: AC_REQUIRE([gl_FP_IEEE]) + # Code from module fpucw: + # Code from module frexpl-nolibm: + # Code from module frexpl-nolibm-tests: + # Code from module fseterr: + # Code from module fseterr-tests: + # Code from module getpagesize: + # Code from module gettext-h: + # Code from module gperf: + # Code from module havelib: + # Code from module iconv: + # Code from module iconv-h: + # Code from module iconv-h-tests: + # Code from module iconv-tests: + # Code from module iconv_open: + # Code from module include_next: + # Code from module inline: + # Code from module intprops: + # Code from module isnand-nolibm: + # Code from module isnand-nolibm-tests: + # Code from module isnanf-nolibm: + # Code from module isnanf-nolibm-tests: + # Code from module isnanl-nolibm: + # Code from module isnanl-nolibm-tests: + # Code from module localcharset: + # Code from module locale: + # Code from module locale-tests: + # Code from module localename: + # Code from module localename-tests: + # Code from module lock: + # Code from module lock-tests: + # Code from module malloc-posix: + # Code from module malloca: + # Code from module malloca-tests: + # Code from module math: + # Code from module math-tests: + # Code from module mbchar: + # Code from module mbiter: + # Code from module mbrtowc: + # Code from module mbrtowc-tests: + # Code from module mbsinit: + # Code from module mbsinit-tests: + # Code from module mbsnlen: + # Code from module memchr: + # Code from module memchr-tests: + # Code from module memcmp2: + # Code from module memxfrm: + # Code from module minmax: + # Code from module multiarch: + # Code from module nocrash: + # Code from module printf-frexp: + # Code from module printf-frexp-tests: + # Code from module printf-frexpl: + # Code from module printf-frexpl-tests: + # Code from module printf-safe: + # Code from module progname: + # Code from module putenv: + # Code from module relocatable-lib-lgpl: + # Code from module setenv: + # Code from module setenv-tests: + # Code from module signbit: + # Code from module signbit-tests: + # Code from module size_max: + # Code from module stdbool: + # Code from module stdbool-tests: + # Code from module stddef: + # Code from module stddef-tests: + # Code from module stdint: + # Code from module stdint-tests: + # Code from module stdlib: + # Code from module stdlib-tests: + # Code from module streq: + # Code from module strerror: + # Code from module strerror-tests: + # Code from module striconveh: + # Code from module striconveh-tests: + # Code from module striconveha: + # Code from module striconveha-tests: + # Code from module string: + # Code from module string-tests: + # Code from module strncat: + # Code from module strncat-tests: + # Code from module thread: + # Code from module threadlib: + gl_THREADLIB_EARLY + # Code from module unicase/base: + # Code from module unicase/cased: + # Code from module unicase/cased-tests: + # Code from module unicase/empty-prefix-context: + # Code from module unicase/empty-suffix-context: + # Code from module unicase/ignorable: + # Code from module unicase/ignorable-tests: + # Code from module unicase/locale-language: + # Code from module unicase/locale-language-tests: + # Code from module unicase/special-casing: + # Code from module unicase/tocasefold: + # Code from module unicase/tolower: + # Code from module unicase/tolower-tests: + # Code from module unicase/totitle: + # Code from module unicase/totitle-tests: + # Code from module unicase/toupper: + # Code from module unicase/toupper-tests: + # Code from module unicase/u16-casecmp: + # Code from module unicase/u16-casecmp-tests: + # Code from module unicase/u16-casecoll: + # Code from module unicase/u16-casecoll-tests: + # Code from module unicase/u16-casefold: + # Code from module unicase/u16-casefold-tests: + # Code from module unicase/u16-casemap: + # Code from module unicase/u16-casexfrm: + # Code from module unicase/u16-ct-casefold: + # Code from module unicase/u16-ct-tolower: + # Code from module unicase/u16-ct-totitle: + # Code from module unicase/u16-ct-toupper: + # Code from module unicase/u16-is-cased: + # Code from module unicase/u16-is-cased-tests: + # Code from module unicase/u16-is-casefolded: + # Code from module unicase/u16-is-casefolded-tests: + # Code from module unicase/u16-is-invariant: + # Code from module unicase/u16-is-lowercase: + # Code from module unicase/u16-is-lowercase-tests: + # Code from module unicase/u16-is-titlecase: + # Code from module unicase/u16-is-titlecase-tests: + # Code from module unicase/u16-is-uppercase: + # Code from module unicase/u16-is-uppercase-tests: + # Code from module unicase/u16-tolower: + # Code from module unicase/u16-tolower-tests: + # Code from module unicase/u16-totitle: + # Code from module unicase/u16-totitle-tests: + # Code from module unicase/u16-toupper: + # Code from module unicase/u16-toupper-tests: + # Code from module unicase/u32-casecmp: + # Code from module unicase/u32-casecmp-tests: + # Code from module unicase/u32-casecoll: + # Code from module unicase/u32-casecoll-tests: + # Code from module unicase/u32-casefold: + # Code from module unicase/u32-casefold-tests: + # Code from module unicase/u32-casemap: + # Code from module unicase/u32-casexfrm: + # Code from module unicase/u32-ct-casefold: + # Code from module unicase/u32-ct-tolower: + # Code from module unicase/u32-ct-totitle: + # Code from module unicase/u32-ct-toupper: + # Code from module unicase/u32-is-cased: + # Code from module unicase/u32-is-cased-tests: + # Code from module unicase/u32-is-casefolded: + # Code from module unicase/u32-is-casefolded-tests: + # Code from module unicase/u32-is-invariant: + # Code from module unicase/u32-is-lowercase: + # Code from module unicase/u32-is-lowercase-tests: + # Code from module unicase/u32-is-titlecase: + # Code from module unicase/u32-is-titlecase-tests: + # Code from module unicase/u32-is-uppercase: + # Code from module unicase/u32-is-uppercase-tests: + # Code from module unicase/u32-tolower: + # Code from module unicase/u32-tolower-tests: + # Code from module unicase/u32-totitle: + # Code from module unicase/u32-totitle-tests: + # Code from module unicase/u32-toupper: + # Code from module unicase/u32-toupper-tests: + # Code from module unicase/u8-casecmp: + # Code from module unicase/u8-casecmp-tests: + # Code from module unicase/u8-casecoll: + # Code from module unicase/u8-casecoll-tests: + # Code from module unicase/u8-casefold: + # Code from module unicase/u8-casefold-tests: + # Code from module unicase/u8-casemap: + # Code from module unicase/u8-casexfrm: + # Code from module unicase/u8-ct-casefold: + # Code from module unicase/u8-ct-tolower: + # Code from module unicase/u8-ct-totitle: + # Code from module unicase/u8-ct-toupper: + # Code from module unicase/u8-is-cased: + # Code from module unicase/u8-is-cased-tests: + # Code from module unicase/u8-is-casefolded: + # Code from module unicase/u8-is-casefolded-tests: + # Code from module unicase/u8-is-invariant: + # Code from module unicase/u8-is-lowercase: + # Code from module unicase/u8-is-lowercase-tests: + # Code from module unicase/u8-is-titlecase: + # Code from module unicase/u8-is-titlecase-tests: + # Code from module unicase/u8-is-uppercase: + # Code from module unicase/u8-is-uppercase-tests: + # Code from module unicase/u8-tolower: + # Code from module unicase/u8-tolower-tests: + # Code from module unicase/u8-totitle: + # Code from module unicase/u8-totitle-tests: + # Code from module unicase/u8-toupper: + # Code from module unicase/u8-toupper-tests: + # Code from module unicase/ulc-casecmp: + # Code from module unicase/ulc-casecmp-tests: + # Code from module unicase/ulc-casecoll: + # Code from module unicase/ulc-casecoll-tests: + # Code from module unicase/ulc-casexfrm: + # Code from module uniconv/base: + # Code from module uniconv/u16-conv-from-enc: + # Code from module uniconv/u16-conv-from-enc-tests: + # Code from module uniconv/u16-conv-to-enc: + # Code from module uniconv/u16-conv-to-enc-tests: + # Code from module uniconv/u16-strconv-from-enc: + # Code from module uniconv/u16-strconv-from-enc-tests: + # Code from module uniconv/u16-strconv-from-locale: + # Code from module uniconv/u16-strconv-to-enc: + # Code from module uniconv/u16-strconv-to-enc-tests: + # Code from module uniconv/u16-strconv-to-locale: + # Code from module uniconv/u32-conv-from-enc: + # Code from module uniconv/u32-conv-from-enc-tests: + # Code from module uniconv/u32-conv-to-enc: + # Code from module uniconv/u32-conv-to-enc-tests: + # Code from module uniconv/u32-strconv-from-enc: + # Code from module uniconv/u32-strconv-from-enc-tests: + # Code from module uniconv/u32-strconv-from-locale: + # Code from module uniconv/u32-strconv-to-enc: + # Code from module uniconv/u32-strconv-to-enc-tests: + # Code from module uniconv/u32-strconv-to-locale: + # Code from module uniconv/u8-conv-from-enc: + # Code from module uniconv/u8-conv-from-enc-tests: + # Code from module uniconv/u8-conv-to-enc: + # Code from module uniconv/u8-conv-to-enc-tests: + # Code from module uniconv/u8-strconv-from-enc: + # Code from module uniconv/u8-strconv-from-enc-tests: + # Code from module uniconv/u8-strconv-from-locale: + # Code from module uniconv/u8-strconv-to-enc: + # Code from module uniconv/u8-strconv-to-enc-tests: + # Code from module uniconv/u8-strconv-to-locale: + # Code from module unictype/base: + # Code from module unictype/bidicategory-all: + # Code from module unictype/bidicategory-byname: + # Code from module unictype/bidicategory-byname-tests: + # Code from module unictype/bidicategory-name: + # Code from module unictype/bidicategory-name-tests: + # Code from module unictype/bidicategory-of: + # Code from module unictype/bidicategory-of-tests: + # Code from module unictype/bidicategory-test: + # Code from module unictype/bidicategory-test-tests: + # Code from module unictype/block-all: + # Code from module unictype/block-list: + # Code from module unictype/block-list-tests: + # Code from module unictype/block-of: + # Code from module unictype/block-of-tests: + # Code from module unictype/block-test: + # Code from module unictype/block-test-tests: + # Code from module unictype/category-C: + # Code from module unictype/category-C-tests: + # Code from module unictype/category-Cc: + # Code from module unictype/category-Cc-tests: + # Code from module unictype/category-Cf: + # Code from module unictype/category-Cf-tests: + # Code from module unictype/category-Cn: + # Code from module unictype/category-Cn-tests: + # Code from module unictype/category-Co: + # Code from module unictype/category-Co-tests: + # Code from module unictype/category-Cs: + # Code from module unictype/category-Cs-tests: + # Code from module unictype/category-L: + # Code from module unictype/category-L-tests: + # Code from module unictype/category-Ll: + # Code from module unictype/category-Ll-tests: + # Code from module unictype/category-Lm: + # Code from module unictype/category-Lm-tests: + # Code from module unictype/category-Lo: + # Code from module unictype/category-Lo-tests: + # Code from module unictype/category-Lt: + # Code from module unictype/category-Lt-tests: + # Code from module unictype/category-Lu: + # Code from module unictype/category-Lu-tests: + # Code from module unictype/category-M: + # Code from module unictype/category-M-tests: + # Code from module unictype/category-Mc: + # Code from module unictype/category-Mc-tests: + # Code from module unictype/category-Me: + # Code from module unictype/category-Me-tests: + # Code from module unictype/category-Mn: + # Code from module unictype/category-Mn-tests: + # Code from module unictype/category-N: + # Code from module unictype/category-N-tests: + # Code from module unictype/category-Nd: + # Code from module unictype/category-Nd-tests: + # Code from module unictype/category-Nl: + # Code from module unictype/category-Nl-tests: + # Code from module unictype/category-No: + # Code from module unictype/category-No-tests: + # Code from module unictype/category-P: + # Code from module unictype/category-P-tests: + # Code from module unictype/category-Pc: + # Code from module unictype/category-Pc-tests: + # Code from module unictype/category-Pd: + # Code from module unictype/category-Pd-tests: + # Code from module unictype/category-Pe: + # Code from module unictype/category-Pe-tests: + # Code from module unictype/category-Pf: + # Code from module unictype/category-Pf-tests: + # Code from module unictype/category-Pi: + # Code from module unictype/category-Pi-tests: + # Code from module unictype/category-Po: + # Code from module unictype/category-Po-tests: + # Code from module unictype/category-Ps: + # Code from module unictype/category-Ps-tests: + # Code from module unictype/category-S: + # Code from module unictype/category-S-tests: + # Code from module unictype/category-Sc: + # Code from module unictype/category-Sc-tests: + # Code from module unictype/category-Sk: + # Code from module unictype/category-Sk-tests: + # Code from module unictype/category-Sm: + # Code from module unictype/category-Sm-tests: + # Code from module unictype/category-So: + # Code from module unictype/category-So-tests: + # Code from module unictype/category-Z: + # Code from module unictype/category-Z-tests: + # Code from module unictype/category-Zl: + # Code from module unictype/category-Zl-tests: + # Code from module unictype/category-Zp: + # Code from module unictype/category-Zp-tests: + # Code from module unictype/category-Zs: + # Code from module unictype/category-Zs-tests: + # Code from module unictype/category-all: + # Code from module unictype/category-and: + # Code from module unictype/category-and-not: + # Code from module unictype/category-and-not-tests: + # Code from module unictype/category-and-tests: + # Code from module unictype/category-byname: + # Code from module unictype/category-byname-tests: + # Code from module unictype/category-name: + # Code from module unictype/category-name-tests: + # Code from module unictype/category-none: + # Code from module unictype/category-none-tests: + # Code from module unictype/category-of: + # Code from module unictype/category-of-tests: + # Code from module unictype/category-or: + # Code from module unictype/category-or-tests: + # Code from module unictype/category-test: + # Code from module unictype/category-test-withtable: + # Code from module unictype/category-test-withtable-tests: + # Code from module unictype/combining-class: + # Code from module unictype/combining-class-tests: + # Code from module unictype/ctype-alnum: + # Code from module unictype/ctype-alnum-tests: + # Code from module unictype/ctype-alpha: + # Code from module unictype/ctype-alpha-tests: + # Code from module unictype/ctype-blank: + # Code from module unictype/ctype-blank-tests: + # Code from module unictype/ctype-cntrl: + # Code from module unictype/ctype-cntrl-tests: + # Code from module unictype/ctype-digit: + # Code from module unictype/ctype-digit-tests: + # Code from module unictype/ctype-graph: + # Code from module unictype/ctype-graph-tests: + # Code from module unictype/ctype-lower: + # Code from module unictype/ctype-lower-tests: + # Code from module unictype/ctype-print: + # Code from module unictype/ctype-print-tests: + # Code from module unictype/ctype-punct: + # Code from module unictype/ctype-punct-tests: + # Code from module unictype/ctype-space: + # Code from module unictype/ctype-space-tests: + # Code from module unictype/ctype-upper: + # Code from module unictype/ctype-upper-tests: + # Code from module unictype/ctype-xdigit: + # Code from module unictype/ctype-xdigit-tests: + # Code from module unictype/decimal-digit: + # Code from module unictype/decimal-digit-tests: + # Code from module unictype/digit: + # Code from module unictype/digit-tests: + # Code from module unictype/mirror: + # Code from module unictype/mirror-tests: + # Code from module unictype/numeric: + # Code from module unictype/numeric-tests: + # Code from module unictype/property-all: + # Code from module unictype/property-alphabetic: + # Code from module unictype/property-alphabetic-tests: + # Code from module unictype/property-ascii-hex-digit: + # Code from module unictype/property-ascii-hex-digit-tests: + # Code from module unictype/property-bidi-arabic-digit: + # Code from module unictype/property-bidi-arabic-digit-tests: + # Code from module unictype/property-bidi-arabic-right-to-left: + # Code from module unictype/property-bidi-arabic-right-to-left-tests: + # Code from module unictype/property-bidi-block-separator: + # Code from module unictype/property-bidi-block-separator-tests: + # Code from module unictype/property-bidi-boundary-neutral: + # Code from module unictype/property-bidi-boundary-neutral-tests: + # Code from module unictype/property-bidi-common-separator: + # Code from module unictype/property-bidi-common-separator-tests: + # Code from module unictype/property-bidi-control: + # Code from module unictype/property-bidi-control-tests: + # Code from module unictype/property-bidi-embedding-or-override: + # Code from module unictype/property-bidi-embedding-or-override-tests: + # Code from module unictype/property-bidi-eur-num-separator: + # Code from module unictype/property-bidi-eur-num-separator-tests: + # Code from module unictype/property-bidi-eur-num-terminator: + # Code from module unictype/property-bidi-eur-num-terminator-tests: + # Code from module unictype/property-bidi-european-digit: + # Code from module unictype/property-bidi-european-digit-tests: + # Code from module unictype/property-bidi-hebrew-right-to-left: + # Code from module unictype/property-bidi-hebrew-right-to-left-tests: + # Code from module unictype/property-bidi-left-to-right: + # Code from module unictype/property-bidi-left-to-right-tests: + # Code from module unictype/property-bidi-non-spacing-mark: + # Code from module unictype/property-bidi-non-spacing-mark-tests: + # Code from module unictype/property-bidi-other-neutral: + # Code from module unictype/property-bidi-other-neutral-tests: + # Code from module unictype/property-bidi-pdf: + # Code from module unictype/property-bidi-pdf-tests: + # Code from module unictype/property-bidi-segment-separator: + # Code from module unictype/property-bidi-segment-separator-tests: + # Code from module unictype/property-bidi-whitespace: + # Code from module unictype/property-bidi-whitespace-tests: + # Code from module unictype/property-byname: + # Code from module unictype/property-byname-tests: + # Code from module unictype/property-combining: + # Code from module unictype/property-combining-tests: + # Code from module unictype/property-composite: + # Code from module unictype/property-composite-tests: + # Code from module unictype/property-currency-symbol: + # Code from module unictype/property-currency-symbol-tests: + # Code from module unictype/property-dash: + # Code from module unictype/property-dash-tests: + # Code from module unictype/property-decimal-digit: + # Code from module unictype/property-decimal-digit-tests: + # Code from module unictype/property-default-ignorable-code-point: + # Code from module unictype/property-default-ignorable-code-point-tests: + # Code from module unictype/property-deprecated: + # Code from module unictype/property-deprecated-tests: + # Code from module unictype/property-diacritic: + # Code from module unictype/property-diacritic-tests: + # Code from module unictype/property-extender: + # Code from module unictype/property-extender-tests: + # Code from module unictype/property-format-control: + # Code from module unictype/property-format-control-tests: + # Code from module unictype/property-grapheme-base: + # Code from module unictype/property-grapheme-base-tests: + # Code from module unictype/property-grapheme-extend: + # Code from module unictype/property-grapheme-extend-tests: + # Code from module unictype/property-grapheme-link: + # Code from module unictype/property-grapheme-link-tests: + # Code from module unictype/property-hex-digit: + # Code from module unictype/property-hex-digit-tests: + # Code from module unictype/property-hyphen: + # Code from module unictype/property-hyphen-tests: + # Code from module unictype/property-id-continue: + # Code from module unictype/property-id-continue-tests: + # Code from module unictype/property-id-start: + # Code from module unictype/property-id-start-tests: + # Code from module unictype/property-ideographic: + # Code from module unictype/property-ideographic-tests: + # Code from module unictype/property-ids-binary-operator: + # Code from module unictype/property-ids-binary-operator-tests: + # Code from module unictype/property-ids-trinary-operator: + # Code from module unictype/property-ids-trinary-operator-tests: + # Code from module unictype/property-ignorable-control: + # Code from module unictype/property-ignorable-control-tests: + # Code from module unictype/property-iso-control: + # Code from module unictype/property-iso-control-tests: + # Code from module unictype/property-join-control: + # Code from module unictype/property-join-control-tests: + # Code from module unictype/property-left-of-pair: + # Code from module unictype/property-left-of-pair-tests: + # Code from module unictype/property-line-separator: + # Code from module unictype/property-line-separator-tests: + # Code from module unictype/property-logical-order-exception: + # Code from module unictype/property-logical-order-exception-tests: + # Code from module unictype/property-lowercase: + # Code from module unictype/property-lowercase-tests: + # Code from module unictype/property-math: + # Code from module unictype/property-math-tests: + # Code from module unictype/property-non-break: + # Code from module unictype/property-non-break-tests: + # Code from module unictype/property-not-a-character: + # Code from module unictype/property-not-a-character-tests: + # Code from module unictype/property-numeric: + # Code from module unictype/property-numeric-tests: + # Code from module unictype/property-other-alphabetic: + # Code from module unictype/property-other-alphabetic-tests: + # Code from module unictype/property-other-default-ignorable-code-point: + # Code from module unictype/property-other-default-ignorable-code-point-tests: + # Code from module unictype/property-other-grapheme-extend: + # Code from module unictype/property-other-grapheme-extend-tests: + # Code from module unictype/property-other-id-continue: + # Code from module unictype/property-other-id-continue-tests: + # Code from module unictype/property-other-id-start: + # Code from module unictype/property-other-id-start-tests: + # Code from module unictype/property-other-lowercase: + # Code from module unictype/property-other-lowercase-tests: + # Code from module unictype/property-other-math: + # Code from module unictype/property-other-math-tests: + # Code from module unictype/property-other-uppercase: + # Code from module unictype/property-other-uppercase-tests: + # Code from module unictype/property-paired-punctuation: + # Code from module unictype/property-paired-punctuation-tests: + # Code from module unictype/property-paragraph-separator: + # Code from module unictype/property-paragraph-separator-tests: + # Code from module unictype/property-pattern-syntax: + # Code from module unictype/property-pattern-syntax-tests: + # Code from module unictype/property-pattern-white-space: + # Code from module unictype/property-pattern-white-space-tests: + # Code from module unictype/property-private-use: + # Code from module unictype/property-private-use-tests: + # Code from module unictype/property-punctuation: + # Code from module unictype/property-punctuation-tests: + # Code from module unictype/property-quotation-mark: + # Code from module unictype/property-quotation-mark-tests: + # Code from module unictype/property-radical: + # Code from module unictype/property-radical-tests: + # Code from module unictype/property-sentence-terminal: + # Code from module unictype/property-sentence-terminal-tests: + # Code from module unictype/property-soft-dotted: + # Code from module unictype/property-soft-dotted-tests: + # Code from module unictype/property-space: + # Code from module unictype/property-space-tests: + # Code from module unictype/property-terminal-punctuation: + # Code from module unictype/property-terminal-punctuation-tests: + # Code from module unictype/property-test: + # Code from module unictype/property-test-tests: + # Code from module unictype/property-titlecase: + # Code from module unictype/property-titlecase-tests: + # Code from module unictype/property-unassigned-code-value: + # Code from module unictype/property-unassigned-code-value-tests: + # Code from module unictype/property-unified-ideograph: + # Code from module unictype/property-unified-ideograph-tests: + # Code from module unictype/property-uppercase: + # Code from module unictype/property-uppercase-tests: + # Code from module unictype/property-variation-selector: + # Code from module unictype/property-variation-selector-tests: + # Code from module unictype/property-white-space: + # Code from module unictype/property-white-space-tests: + # Code from module unictype/property-xid-continue: + # Code from module unictype/property-xid-continue-tests: + # Code from module unictype/property-xid-start: + # Code from module unictype/property-xid-start-tests: + # Code from module unictype/property-zero-width: + # Code from module unictype/property-zero-width-tests: + # Code from module unictype/scripts: + # Code from module unictype/scripts-all: + # Code from module unictype/scripts-tests: + # Code from module unictype/syntax-c-ident: + # Code from module unictype/syntax-c-ident-tests: + # Code from module unictype/syntax-c-whitespace: + # Code from module unictype/syntax-c-whitespace-tests: + # Code from module unictype/syntax-java-ident: + # Code from module unictype/syntax-java-ident-tests: + # Code from module unictype/syntax-java-whitespace: + # Code from module unictype/syntax-java-whitespace-tests: + # Code from module unilbrk/base: + # Code from module unilbrk/tables: + # Code from module unilbrk/u16-possible-linebreaks: + # Code from module unilbrk/u16-possible-linebreaks-tests: + # Code from module unilbrk/u16-width-linebreaks: + # Code from module unilbrk/u16-width-linebreaks-tests: + # Code from module unilbrk/u32-possible-linebreaks: + # Code from module unilbrk/u32-possible-linebreaks-tests: + # Code from module unilbrk/u32-width-linebreaks: + # Code from module unilbrk/u32-width-linebreaks-tests: + # Code from module unilbrk/u8-possible-linebreaks: + # Code from module unilbrk/u8-possible-linebreaks-tests: + # Code from module unilbrk/u8-width-linebreaks: + # Code from module unilbrk/u8-width-linebreaks-tests: + # Code from module unilbrk/ulc-common: + # Code from module unilbrk/ulc-possible-linebreaks: + # Code from module unilbrk/ulc-possible-linebreaks-tests: + # Code from module unilbrk/ulc-width-linebreaks: + # Code from module unilbrk/ulc-width-linebreaks-tests: + # Code from module uniname/base: + # Code from module uniname/uniname: + # Code from module uniname/uniname-tests: + # Code from module uninorm/base: + # Code from module uninorm/canonical-decomposition: + # Code from module uninorm/canonical-decomposition-tests: + # Code from module uninorm/compat-decomposition: + # Code from module uninorm/compat-decomposition-tests: + # Code from module uninorm/composition: + # Code from module uninorm/composition-tests: + # Code from module uninorm/decompose-internal: + # Code from module uninorm/decomposing-form: + # Code from module uninorm/decomposing-form-tests: + # Code from module uninorm/decomposition: + # Code from module uninorm/decomposition-table: + # Code from module uninorm/decomposition-tests: + # Code from module uninorm/filter: + # Code from module uninorm/filter-tests: + # Code from module uninorm/nfc: + # Code from module uninorm/nfc-tests: + # Code from module uninorm/nfd: + # Code from module uninorm/nfd-tests: + # Code from module uninorm/nfkc: + # Code from module uninorm/nfkc-tests: + # Code from module uninorm/nfkd: + # Code from module uninorm/nfkd-tests: + # Code from module uninorm/u16-normalize: + # Code from module uninorm/u16-normcmp: + # Code from module uninorm/u16-normcmp-tests: + # Code from module uninorm/u16-normcoll: + # Code from module uninorm/u16-normcoll-tests: + # Code from module uninorm/u16-normxfrm: + # Code from module uninorm/u32-normalize: + # Code from module uninorm/u32-normcmp: + # Code from module uninorm/u32-normcmp-tests: + # Code from module uninorm/u32-normcoll: + # Code from module uninorm/u32-normcoll-tests: + # Code from module uninorm/u32-normxfrm: + # Code from module uninorm/u8-normalize: + # Code from module uninorm/u8-normcmp: + # Code from module uninorm/u8-normcmp-tests: + # Code from module uninorm/u8-normcoll: + # Code from module uninorm/u8-normcoll-tests: + # Code from module uninorm/u8-normxfrm: + # Code from module unistd: + # Code from module unistd-tests: + # Code from module unistdio/base: + # Code from module unistdio/u-printf-args: + # Code from module unistdio/u16-asnprintf: + # Code from module unistdio/u16-asnprintf-tests: + # Code from module unistdio/u16-asprintf: + # Code from module unistdio/u16-printf-parse: + # Code from module unistdio/u16-snprintf: + # Code from module unistdio/u16-sprintf: + # Code from module unistdio/u16-u16-asnprintf: + # Code from module unistdio/u16-u16-asprintf: + # Code from module unistdio/u16-u16-snprintf: + # Code from module unistdio/u16-u16-sprintf: + # Code from module unistdio/u16-u16-vasnprintf: + # Code from module unistdio/u16-u16-vasprintf: + # Code from module unistdio/u16-u16-vsnprintf: + # Code from module unistdio/u16-u16-vsprintf: + # Code from module unistdio/u16-vasnprintf: + # Code from module unistdio/u16-vasnprintf-tests: + # Code from module unistdio/u16-vasprintf: + # Code from module unistdio/u16-vasprintf-tests: + # Code from module unistdio/u16-vsnprintf: + # Code from module unistdio/u16-vsnprintf-tests: + # Code from module unistdio/u16-vsprintf: + # Code from module unistdio/u16-vsprintf-tests: + # Code from module unistdio/u32-asnprintf: + # Code from module unistdio/u32-asnprintf-tests: + # Code from module unistdio/u32-asprintf: + # Code from module unistdio/u32-printf-parse: + # Code from module unistdio/u32-snprintf: + # Code from module unistdio/u32-sprintf: + # Code from module unistdio/u32-u32-asnprintf: + # Code from module unistdio/u32-u32-asprintf: + # Code from module unistdio/u32-u32-snprintf: + # Code from module unistdio/u32-u32-sprintf: + # Code from module unistdio/u32-u32-vasnprintf: + # Code from module unistdio/u32-u32-vasprintf: + # Code from module unistdio/u32-u32-vsnprintf: + # Code from module unistdio/u32-u32-vsprintf: + # Code from module unistdio/u32-vasnprintf: + # Code from module unistdio/u32-vasnprintf-tests: + # Code from module unistdio/u32-vasprintf: + # Code from module unistdio/u32-vasprintf-tests: + # Code from module unistdio/u32-vsnprintf: + # Code from module unistdio/u32-vsnprintf-tests: + # Code from module unistdio/u32-vsprintf: + # Code from module unistdio/u32-vsprintf-tests: + # Code from module unistdio/u8-asnprintf: + # Code from module unistdio/u8-asnprintf-tests: + # Code from module unistdio/u8-asprintf: + # Code from module unistdio/u8-printf-parse: + # Code from module unistdio/u8-snprintf: + # Code from module unistdio/u8-sprintf: + # Code from module unistdio/u8-u8-asnprintf: + # Code from module unistdio/u8-u8-asprintf: + # Code from module unistdio/u8-u8-snprintf: + # Code from module unistdio/u8-u8-sprintf: + # Code from module unistdio/u8-u8-vasnprintf: + # Code from module unistdio/u8-u8-vasprintf: + # Code from module unistdio/u8-u8-vsnprintf: + # Code from module unistdio/u8-u8-vsprintf: + # Code from module unistdio/u8-vasnprintf: + # Code from module unistdio/u8-vasnprintf-tests: + # Code from module unistdio/u8-vasprintf: + # Code from module unistdio/u8-vasprintf-tests: + # Code from module unistdio/u8-vsnprintf: + # Code from module unistdio/u8-vsnprintf-tests: + # Code from module unistdio/u8-vsprintf: + # Code from module unistdio/u8-vsprintf-tests: + # Code from module unistdio/ulc-asnprintf: + # Code from module unistdio/ulc-asnprintf-tests: + # Code from module unistdio/ulc-asprintf: + # Code from module unistdio/ulc-fprintf: + # Code from module unistdio/ulc-printf-parse: + # Code from module unistdio/ulc-snprintf: + # Code from module unistdio/ulc-sprintf: + # Code from module unistdio/ulc-vasnprintf: + # Code from module unistdio/ulc-vasnprintf-tests: + # Code from module unistdio/ulc-vasprintf: + # Code from module unistdio/ulc-vasprintf-tests: + # Code from module unistdio/ulc-vfprintf: + # Code from module unistdio/ulc-vsnprintf: + # Code from module unistdio/ulc-vsnprintf-tests: + # Code from module unistdio/ulc-vsprintf: + # Code from module unistdio/ulc-vsprintf-tests: + # Code from module unistr/base: + # Code from module unistr/u16-check: + # Code from module unistr/u16-check-tests: + # Code from module unistr/u16-chr: + # Code from module unistr/u16-chr-tests: + # Code from module unistr/u16-cmp: + # Code from module unistr/u16-cmp-tests: + # Code from module unistr/u16-cmp2: + # Code from module unistr/u16-cmp2-tests: + # Code from module unistr/u16-cpy: + # Code from module unistr/u16-cpy-alloc: + # Code from module unistr/u16-cpy-alloc-tests: + # Code from module unistr/u16-cpy-tests: + # Code from module unistr/u16-endswith: + # Code from module unistr/u16-mblen: + # Code from module unistr/u16-mblen-tests: + # Code from module unistr/u16-mbsnlen: + # Code from module unistr/u16-mbsnlen-tests: + # Code from module unistr/u16-mbtouc: + # Code from module unistr/u16-mbtouc-tests: + # Code from module unistr/u16-mbtouc-unsafe: + # Code from module unistr/u16-mbtouc-unsafe-tests: + # Code from module unistr/u16-mbtoucr: + # Code from module unistr/u16-mbtoucr-tests: + # Code from module unistr/u16-move: + # Code from module unistr/u16-move-tests: + # Code from module unistr/u16-next: + # Code from module unistr/u16-next-tests: + # Code from module unistr/u16-prev: + # Code from module unistr/u16-prev-tests: + # Code from module unistr/u16-set: + # Code from module unistr/u16-set-tests: + # Code from module unistr/u16-startswith: + # Code from module unistr/u16-stpcpy: + # Code from module unistr/u16-stpcpy-tests: + # Code from module unistr/u16-stpncpy: + # Code from module unistr/u16-stpncpy-tests: + # Code from module unistr/u16-strcat: + # Code from module unistr/u16-strcat-tests: + # Code from module unistr/u16-strchr: + # Code from module unistr/u16-strcmp: + # Code from module unistr/u16-strcmp-tests: + # Code from module unistr/u16-strcoll: + # Code from module unistr/u16-strcoll-tests: + # Code from module unistr/u16-strcpy: + # Code from module unistr/u16-strcpy-tests: + # Code from module unistr/u16-strcspn: + # Code from module unistr/u16-strdup: + # Code from module unistr/u16-strdup-tests: + # Code from module unistr/u16-strlen: + # Code from module unistr/u16-strlen-tests: + # Code from module unistr/u16-strmblen: + # Code from module unistr/u16-strmblen-tests: + # Code from module unistr/u16-strmbtouc: + # Code from module unistr/u16-strmbtouc-tests: + # Code from module unistr/u16-strncat: + # Code from module unistr/u16-strncat-tests: + # Code from module unistr/u16-strncmp: + # Code from module unistr/u16-strncmp-tests: + # Code from module unistr/u16-strncpy: + # Code from module unistr/u16-strncpy-tests: + # Code from module unistr/u16-strnlen: + # Code from module unistr/u16-strnlen-tests: + # Code from module unistr/u16-strpbrk: + # Code from module unistr/u16-strrchr: + # Code from module unistr/u16-strspn: + # Code from module unistr/u16-strstr: + # Code from module unistr/u16-strtok: + # Code from module unistr/u16-to-u32: + # Code from module unistr/u16-to-u32-tests: + # Code from module unistr/u16-to-u8: + # Code from module unistr/u16-to-u8-tests: + # Code from module unistr/u16-uctomb: + # Code from module unistr/u16-uctomb-tests: + # Code from module unistr/u32-check: + # Code from module unistr/u32-check-tests: + # Code from module unistr/u32-chr: + # Code from module unistr/u32-chr-tests: + # Code from module unistr/u32-cmp: + # Code from module unistr/u32-cmp-tests: + # Code from module unistr/u32-cmp2: + # Code from module unistr/u32-cmp2-tests: + # Code from module unistr/u32-cpy: + # Code from module unistr/u32-cpy-alloc: + # Code from module unistr/u32-cpy-alloc-tests: + # Code from module unistr/u32-cpy-tests: + # Code from module unistr/u32-endswith: + # Code from module unistr/u32-mblen: + # Code from module unistr/u32-mblen-tests: + # Code from module unistr/u32-mbsnlen: + # Code from module unistr/u32-mbsnlen-tests: + # Code from module unistr/u32-mbtouc: + # Code from module unistr/u32-mbtouc-tests: + # Code from module unistr/u32-mbtouc-unsafe: + # Code from module unistr/u32-mbtouc-unsafe-tests: + # Code from module unistr/u32-mbtoucr: + # Code from module unistr/u32-mbtoucr-tests: + # Code from module unistr/u32-move: + # Code from module unistr/u32-move-tests: + # Code from module unistr/u32-next: + # Code from module unistr/u32-next-tests: + # Code from module unistr/u32-prev: + # Code from module unistr/u32-prev-tests: + # Code from module unistr/u32-set: + # Code from module unistr/u32-set-tests: + # Code from module unistr/u32-startswith: + # Code from module unistr/u32-stpcpy: + # Code from module unistr/u32-stpcpy-tests: + # Code from module unistr/u32-stpncpy: + # Code from module unistr/u32-stpncpy-tests: + # Code from module unistr/u32-strcat: + # Code from module unistr/u32-strcat-tests: + # Code from module unistr/u32-strchr: + # Code from module unistr/u32-strcmp: + # Code from module unistr/u32-strcmp-tests: + # Code from module unistr/u32-strcoll: + # Code from module unistr/u32-strcoll-tests: + # Code from module unistr/u32-strcpy: + # Code from module unistr/u32-strcpy-tests: + # Code from module unistr/u32-strcspn: + # Code from module unistr/u32-strdup: + # Code from module unistr/u32-strdup-tests: + # Code from module unistr/u32-strlen: + # Code from module unistr/u32-strlen-tests: + # Code from module unistr/u32-strmblen: + # Code from module unistr/u32-strmblen-tests: + # Code from module unistr/u32-strmbtouc: + # Code from module unistr/u32-strmbtouc-tests: + # Code from module unistr/u32-strncat: + # Code from module unistr/u32-strncat-tests: + # Code from module unistr/u32-strncmp: + # Code from module unistr/u32-strncmp-tests: + # Code from module unistr/u32-strncpy: + # Code from module unistr/u32-strncpy-tests: + # Code from module unistr/u32-strnlen: + # Code from module unistr/u32-strnlen-tests: + # Code from module unistr/u32-strpbrk: + # Code from module unistr/u32-strrchr: + # Code from module unistr/u32-strspn: + # Code from module unistr/u32-strstr: + # Code from module unistr/u32-strtok: + # Code from module unistr/u32-to-u16: + # Code from module unistr/u32-to-u16-tests: + # Code from module unistr/u32-to-u8: + # Code from module unistr/u32-to-u8-tests: + # Code from module unistr/u32-uctomb: + # Code from module unistr/u32-uctomb-tests: + # Code from module unistr/u8-check: + # Code from module unistr/u8-check-tests: + # Code from module unistr/u8-chr: + # Code from module unistr/u8-chr-tests: + # Code from module unistr/u8-cmp: + # Code from module unistr/u8-cmp-tests: + # Code from module unistr/u8-cmp2: + # Code from module unistr/u8-cmp2-tests: + # Code from module unistr/u8-cpy: + # Code from module unistr/u8-cpy-alloc: + # Code from module unistr/u8-cpy-alloc-tests: + # Code from module unistr/u8-cpy-tests: + # Code from module unistr/u8-endswith: + # Code from module unistr/u8-mblen: + # Code from module unistr/u8-mblen-tests: + # Code from module unistr/u8-mbsnlen: + # Code from module unistr/u8-mbsnlen-tests: + # Code from module unistr/u8-mbtouc: + # Code from module unistr/u8-mbtouc-tests: + # Code from module unistr/u8-mbtouc-unsafe: + # Code from module unistr/u8-mbtouc-unsafe-tests: + # Code from module unistr/u8-mbtoucr: + # Code from module unistr/u8-mbtoucr-tests: + # Code from module unistr/u8-move: + # Code from module unistr/u8-move-tests: + # Code from module unistr/u8-next: + # Code from module unistr/u8-next-tests: + # Code from module unistr/u8-prev: + # Code from module unistr/u8-prev-tests: + # Code from module unistr/u8-set: + # Code from module unistr/u8-set-tests: + # Code from module unistr/u8-startswith: + # Code from module unistr/u8-stpcpy: + # Code from module unistr/u8-stpcpy-tests: + # Code from module unistr/u8-stpncpy: + # Code from module unistr/u8-stpncpy-tests: + # Code from module unistr/u8-strcat: + # Code from module unistr/u8-strcat-tests: + # Code from module unistr/u8-strchr: + # Code from module unistr/u8-strcmp: + # Code from module unistr/u8-strcmp-tests: + # Code from module unistr/u8-strcoll: + # Code from module unistr/u8-strcoll-tests: + # Code from module unistr/u8-strcpy: + # Code from module unistr/u8-strcpy-tests: + # Code from module unistr/u8-strcspn: + # Code from module unistr/u8-strdup: + # Code from module unistr/u8-strdup-tests: + # Code from module unistr/u8-strlen: + # Code from module unistr/u8-strlen-tests: + # Code from module unistr/u8-strmblen: + # Code from module unistr/u8-strmblen-tests: + # Code from module unistr/u8-strmbtouc: + # Code from module unistr/u8-strmbtouc-tests: + # Code from module unistr/u8-strncat: + # Code from module unistr/u8-strncat-tests: + # Code from module unistr/u8-strncmp: + # Code from module unistr/u8-strncmp-tests: + # Code from module unistr/u8-strncpy: + # Code from module unistr/u8-strncpy-tests: + # Code from module unistr/u8-strnlen: + # Code from module unistr/u8-strnlen-tests: + # Code from module unistr/u8-strpbrk: + # Code from module unistr/u8-strrchr: + # Code from module unistr/u8-strspn: + # Code from module unistr/u8-strstr: + # Code from module unistr/u8-strtok: + # Code from module unistr/u8-to-u16: + # Code from module unistr/u8-to-u16-tests: + # Code from module unistr/u8-to-u32: + # Code from module unistr/u8-to-u32-tests: + # Code from module unistr/u8-uctomb: + # Code from module unistr/u8-uctomb-tests: + # Code from module unitypes: + # Code from module uniwbrk/base: + # Code from module uniwbrk/table: + # Code from module uniwbrk/u16-wordbreaks: + # Code from module uniwbrk/u16-wordbreaks-tests: + # Code from module uniwbrk/u32-wordbreaks: + # Code from module uniwbrk/u32-wordbreaks-tests: + # Code from module uniwbrk/u8-wordbreaks: + # Code from module uniwbrk/u8-wordbreaks-tests: + # Code from module uniwbrk/ulc-wordbreaks: + # Code from module uniwbrk/ulc-wordbreaks-tests: + # Code from module uniwbrk/wordbreak-property: + # Code from module uniwidth/base: + # Code from module uniwidth/u16-strwidth: + # Code from module uniwidth/u16-strwidth-tests: + # Code from module uniwidth/u16-width: + # Code from module uniwidth/u16-width-tests: + # Code from module uniwidth/u32-strwidth: + # Code from module uniwidth/u32-strwidth-tests: + # Code from module uniwidth/u32-width: + # Code from module uniwidth/u32-width-tests: + # Code from module uniwidth/u8-strwidth: + # Code from module uniwidth/u8-strwidth-tests: + # Code from module uniwidth/u8-width: + # Code from module uniwidth/u8-width-tests: + # Code from module uniwidth/width: + # Code from module uniwidth/width-tests: + # Code from module unsetenv: + # Code from module unsetenv-tests: + # Code from module unused-parameter: + # Code from module verify: + # Code from module warn-on-use: + # Code from module wchar: + # Code from module wchar-tests: + # Code from module wctob: + # Code from module wctype: + # Code from module wctype-tests: + # Code from module wcwidth: + # Code from module wcwidth-tests: + # Code from module xalloc: + # Code from module xalloc-die: + # Code from module xalloc-die-tests: + # Code from module xsize: + # Code from module yield: ]) # This macro should be invoked from ./configure.ac, in the section @@ -36,6 +1011,7 @@ AC_DEFUN([gl_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) gl_cond_libtool=true + gl_m4_base='gnulib-m4' m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) @@ -43,97 +1019,752 @@ AC_DEFUN([gl_INIT], m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='lib' + # Code from module alloca-opt: gl_FUNC_ALLOCA - gl_FUNC_DUP2 - gl_UNISTD_MODULE_INDICATOR([dup2]) + # Code from module arg-nonnull: + # Code from module array-mergesort: + # Code from module c++defs: + # Code from module c-ctype: + # Code from module c-strcase: + # Code from module c-strcaseeq: + # Code from module configmake: + # Code from module errno: gl_HEADER_ERRNO_H + # Code from module extensions: + # Code from module float: gl_FLOAT_H + # Code from module fpieee: + # Code from module fpucw: + # Code from module frexpl-nolibm: gl_FUNC_FREXPL_NO_LIBM gl_MATH_MODULE_INDICATOR([frexpl]) - gl_FUNC_GETPAGESIZE - gl_UNISTD_MODULE_INDICATOR([getpagesize]) + # Code from module fseterr: + # Code from module gperf: + # Code from module havelib: + # Code from module iconv: AM_ICONV + # Code from module iconv-h: gl_ICONV_H + # Code from module iconv_open: gl_FUNC_ICONV_OPEN + # Code from module include_next: + # Code from module inline: gl_INLINE + # Code from module isnand-nolibm: gl_FUNC_ISNAND_NO_LIBM + # Code from module isnanf-nolibm: gl_FUNC_ISNANF_NO_LIBM + # Code from module isnanl-nolibm: gl_FUNC_ISNANL_NO_LIBM + # Code from module localcharset: gl_LOCALCHARSET LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) + # Code from module localename: gl_LOCALENAME + # Code from module lock: + gl_LOCK + # Code from module malloc-posix: gl_FUNC_MALLOC_POSIX gl_STDLIB_MODULE_INDICATOR([malloc-posix]) + # Code from module malloca: gl_MALLOCA + # Code from module math: gl_MATH_H + # Code from module mbchar: gl_MBCHAR + # Code from module mbiter: gl_MBITER + # Code from module mbrtowc: gl_FUNC_MBRTOWC gl_WCHAR_MODULE_INDICATOR([mbrtowc]) + # Code from module mbsinit: gl_FUNC_MBSINIT gl_WCHAR_MODULE_INDICATOR([mbsinit]) + # Code from module mbsnlen: gl_STRING_MODULE_INDICATOR([mbsnlen]) + # Code from module memchr: gl_FUNC_MEMCHR gl_STRING_MODULE_INDICATOR([memchr]) + # Code from module memcmp2: + # Code from module memxfrm: + # Code from module minmax: gl_MINMAX + # Code from module multiarch: gl_MULTIARCH + # Code from module nocrash: + # Code from module printf-frexp: gl_FUNC_PRINTF_FREXP + # Code from module printf-frexpl: gl_FUNC_PRINTF_FREXPL + # Code from module printf-safe: m4_divert_text([INIT_PREPARE], [gl_printf_safe=yes]) + # Code from module relocatable-lib-lgpl: gl_RELOCATABLE_LIBRARY + # Code from module signbit: gl_SIGNBIT gl_MATH_MODULE_INDICATOR([signbit]) + # Code from module size_max: gl_SIZE_MAX + # Code from module stdbool: AM_STDBOOL_H + # Code from module stddef: gl_STDDEF_H + # Code from module stdint: gl_STDINT_H + # Code from module stdlib: gl_STDLIB_H + # Code from module streq: + # Code from module striconveh: if test $gl_cond_libtool = false; then gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" gl_libdeps="$gl_libdeps $LIBICONV" fi + # Code from module striconveha: + # Code from module string: gl_HEADER_STRING_H + # Code from module strncat: + gl_FUNC_STRNCAT + gl_STRING_MODULE_INDICATOR([strncat]) + # Code from module threadlib: + gl_THREADLIB + # Code from module unicase/base: + # Code from module unicase/cased: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unicase/empty-prefix-context: + # Code from module unicase/empty-suffix-context: + # Code from module unicase/ignorable: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unicase/locale-language: + # Code from module unicase/special-casing: + # Code from module unicase/tocasefold: + # Code from module unicase/tolower: + # Code from module unicase/totitle: + # Code from module unicase/toupper: + # Code from module unicase/u16-casecmp: + # Code from module unicase/u16-casecoll: + # Code from module unicase/u16-casefold: + # Code from module unicase/u16-casemap: + # Code from module unicase/u16-casexfrm: + # Code from module unicase/u16-ct-casefold: + # Code from module unicase/u16-ct-tolower: + # Code from module unicase/u16-ct-totitle: + # Code from module unicase/u16-ct-toupper: + # Code from module unicase/u16-is-cased: + # Code from module unicase/u16-is-casefolded: + # Code from module unicase/u16-is-invariant: + # Code from module unicase/u16-is-lowercase: + # Code from module unicase/u16-is-titlecase: + # Code from module unicase/u16-is-uppercase: + # Code from module unicase/u16-tolower: + # Code from module unicase/u16-totitle: + # Code from module unicase/u16-toupper: + # Code from module unicase/u32-casecmp: + # Code from module unicase/u32-casecoll: + # Code from module unicase/u32-casefold: + # Code from module unicase/u32-casemap: + # Code from module unicase/u32-casexfrm: + # Code from module unicase/u32-ct-casefold: + # Code from module unicase/u32-ct-tolower: + # Code from module unicase/u32-ct-totitle: + # Code from module unicase/u32-ct-toupper: + # Code from module unicase/u32-is-cased: + # Code from module unicase/u32-is-casefolded: + # Code from module unicase/u32-is-invariant: + # Code from module unicase/u32-is-lowercase: + # Code from module unicase/u32-is-titlecase: + # Code from module unicase/u32-is-uppercase: + # Code from module unicase/u32-tolower: + # Code from module unicase/u32-totitle: + # Code from module unicase/u32-toupper: + # Code from module unicase/u8-casecmp: + # Code from module unicase/u8-casecoll: + # Code from module unicase/u8-casefold: + # Code from module unicase/u8-casemap: + # Code from module unicase/u8-casexfrm: + # Code from module unicase/u8-ct-casefold: + # Code from module unicase/u8-ct-tolower: + # Code from module unicase/u8-ct-totitle: + # Code from module unicase/u8-ct-toupper: + # Code from module unicase/u8-is-cased: + # Code from module unicase/u8-is-casefolded: + # Code from module unicase/u8-is-invariant: + # Code from module unicase/u8-is-lowercase: + # Code from module unicase/u8-is-titlecase: + # Code from module unicase/u8-is-uppercase: + # Code from module unicase/u8-tolower: + # Code from module unicase/u8-totitle: + # Code from module unicase/u8-toupper: + # Code from module unicase/ulc-casecmp: + # Code from module unicase/ulc-casecoll: + # Code from module unicase/ulc-casexfrm: + # Code from module uniconv/base: + # Code from module uniconv/u16-conv-from-enc: AC_REQUIRE([gl_BIGENDIAN]) + # Code from module uniconv/u16-conv-to-enc: AC_REQUIRE([gl_BIGENDIAN]) + # Code from module uniconv/u16-strconv-from-enc: + # Code from module uniconv/u16-strconv-from-locale: + # Code from module uniconv/u16-strconv-to-enc: AC_REQUIRE([gl_BIGENDIAN]) + # Code from module uniconv/u16-strconv-to-locale: + # Code from module uniconv/u32-conv-from-enc: + # Code from module uniconv/u32-conv-to-enc: + # Code from module uniconv/u32-strconv-from-enc: + # Code from module uniconv/u32-strconv-from-locale: + # Code from module uniconv/u32-strconv-to-enc: + # Code from module uniconv/u32-strconv-to-locale: + # Code from module uniconv/u8-conv-from-enc: + # Code from module uniconv/u8-conv-to-enc: + # Code from module uniconv/u8-strconv-from-enc: + # Code from module uniconv/u8-strconv-from-locale: + # Code from module uniconv/u8-strconv-to-enc: + # Code from module uniconv/u8-strconv-to-locale: + # Code from module unictype/base: + # Code from module unictype/bidicategory-all: + # Code from module unictype/bidicategory-byname: + # Code from module unictype/bidicategory-name: + # Code from module unictype/bidicategory-of: + # Code from module unictype/bidicategory-test: + # Code from module unictype/block-all: + # Code from module unictype/block-list: + # Code from module unictype/block-of: + # Code from module unictype/block-test: + # Code from module unictype/category-C: + # Code from module unictype/category-Cc: + # Code from module unictype/category-Cf: + # Code from module unictype/category-Cn: + # Code from module unictype/category-Co: + # Code from module unictype/category-Cs: + # Code from module unictype/category-L: + # Code from module unictype/category-Ll: + # Code from module unictype/category-Lm: + # Code from module unictype/category-Lo: + # Code from module unictype/category-Lt: + # Code from module unictype/category-Lu: + # Code from module unictype/category-M: + # Code from module unictype/category-Mc: + # Code from module unictype/category-Me: + # Code from module unictype/category-Mn: + # Code from module unictype/category-N: + # Code from module unictype/category-Nd: + # Code from module unictype/category-Nl: + # Code from module unictype/category-No: + # Code from module unictype/category-P: + # Code from module unictype/category-Pc: + # Code from module unictype/category-Pd: + # Code from module unictype/category-Pe: + # Code from module unictype/category-Pf: + # Code from module unictype/category-Pi: + # Code from module unictype/category-Po: + # Code from module unictype/category-Ps: + # Code from module unictype/category-S: + # Code from module unictype/category-Sc: + # Code from module unictype/category-Sk: + # Code from module unictype/category-Sm: + # Code from module unictype/category-So: + # Code from module unictype/category-Z: + # Code from module unictype/category-Zl: + # Code from module unictype/category-Zp: + # Code from module unictype/category-Zs: + # Code from module unictype/category-all: + # Code from module unictype/category-and: + # Code from module unictype/category-and-not: + # Code from module unictype/category-byname: + # Code from module unictype/category-name: + # Code from module unictype/category-none: + # Code from module unictype/category-of: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/category-or: + # Code from module unictype/category-test: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/category-test-withtable: + # Code from module unictype/combining-class: + # Code from module unictype/ctype-alnum: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-alpha: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-blank: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-cntrl: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-digit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-graph: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-lower: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-print: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-punct: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-space: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-upper: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/ctype-xdigit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/decimal-digit: + # Code from module unictype/digit: + # Code from module unictype/mirror: + # Code from module unictype/numeric: + # Code from module unictype/property-all: + # Code from module unictype/property-alphabetic: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-ascii-hex-digit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-arabic-digit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-arabic-right-to-left: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-block-separator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-boundary-neutral: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-common-separator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-control: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-embedding-or-override: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-eur-num-separator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-eur-num-terminator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-european-digit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-hebrew-right-to-left: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-left-to-right: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-non-spacing-mark: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-other-neutral: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-pdf: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-segment-separator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-bidi-whitespace: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-byname: + # Code from module unictype/property-combining: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-composite: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-currency-symbol: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-dash: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-decimal-digit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-default-ignorable-code-point: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-deprecated: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-diacritic: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-extender: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-format-control: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-grapheme-base: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-grapheme-extend: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-grapheme-link: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-hex-digit: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-hyphen: AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-id-continue: AC_REQUIRE([AC_C_INLINE]) - gl_MODULE_INDICATOR([uninorm/u16-normalize]) - gl_MODULE_INDICATOR([uninorm/u32-normalize]) - gl_MODULE_INDICATOR([uninorm/u8-normalize]) + # Code from module unictype/property-id-start: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-ideographic: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-ids-binary-operator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-ids-trinary-operator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-ignorable-control: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-iso-control: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-join-control: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-left-of-pair: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-line-separator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-logical-order-exception: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-lowercase: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-math: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-non-break: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-not-a-character: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-numeric: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-alphabetic: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-default-ignorable-code-point: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-grapheme-extend: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-id-continue: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-id-start: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-lowercase: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-math: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-other-uppercase: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-paired-punctuation: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-paragraph-separator: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-pattern-syntax: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-pattern-white-space: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-private-use: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-punctuation: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-quotation-mark: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-radical: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-sentence-terminal: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-soft-dotted: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-space: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-terminal-punctuation: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-test: + # Code from module unictype/property-titlecase: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-unassigned-code-value: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-unified-ideograph: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-uppercase: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-variation-selector: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-white-space: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-xid-continue: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-xid-start: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/property-zero-width: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/scripts: + # Code from module unictype/scripts-all: + # Code from module unictype/syntax-c-ident: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/syntax-c-whitespace: + # Code from module unictype/syntax-java-ident: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unictype/syntax-java-whitespace: + # Code from module unilbrk/base: + # Code from module unilbrk/tables: + AC_REQUIRE([AC_C_INLINE]) + # Code from module unilbrk/u16-possible-linebreaks: + # Code from module unilbrk/u16-width-linebreaks: + # Code from module unilbrk/u32-possible-linebreaks: + # Code from module unilbrk/u32-width-linebreaks: + # Code from module unilbrk/u8-possible-linebreaks: + # Code from module unilbrk/u8-width-linebreaks: + # Code from module unilbrk/ulc-common: + # Code from module unilbrk/ulc-possible-linebreaks: + # Code from module unilbrk/ulc-width-linebreaks: + # Code from module uniname/base: + # Code from module uniname/uniname: + # Code from module uninorm/base: + # Code from module uninorm/canonical-decomposition: + # Code from module uninorm/compat-decomposition: + # Code from module uninorm/composition: + # Code from module uninorm/decompose-internal: + # Code from module uninorm/decomposing-form: + # Code from module uninorm/decomposition: + # Code from module uninorm/decomposition-table: + AC_REQUIRE([AC_C_INLINE]) + # Code from module uninorm/filter: + # Code from module uninorm/nfc: + # Code from module uninorm/nfd: + # Code from module uninorm/nfkc: + # Code from module uninorm/nfkd: + # Code from module uninorm/u16-normalize: + gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u16-normalize]) + # Code from module uninorm/u16-normcmp: + # Code from module uninorm/u16-normcoll: + # Code from module uninorm/u16-normxfrm: + # Code from module uninorm/u32-normalize: + gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u32-normalize]) + # Code from module uninorm/u32-normcmp: + # Code from module uninorm/u32-normcoll: + # Code from module uninorm/u32-normxfrm: + # Code from module uninorm/u8-normalize: + gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u8-normalize]) + # Code from module uninorm/u8-normcmp: + # Code from module uninorm/u8-normcoll: + # Code from module uninorm/u8-normxfrm: + # Code from module unistd: gl_UNISTD_H + # Code from module unistdio/base: + # Code from module unistdio/u-printf-args: gl_PREREQ_PRINTF_ARGS + # Code from module unistdio/u16-asnprintf: + # Code from module unistdio/u16-asprintf: + # Code from module unistdio/u16-printf-parse: gl_PREREQ_PRINTF_PARSE + # Code from module unistdio/u16-snprintf: + # Code from module unistdio/u16-sprintf: + # Code from module unistdio/u16-u16-asnprintf: + # Code from module unistdio/u16-u16-asprintf: + # Code from module unistdio/u16-u16-snprintf: + # Code from module unistdio/u16-u16-sprintf: + # Code from module unistdio/u16-u16-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/u16-u16-vasprintf: + # Code from module unistdio/u16-u16-vsnprintf: + # Code from module unistdio/u16-u16-vsprintf: + # Code from module unistdio/u16-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/u16-vasprintf: + # Code from module unistdio/u16-vsnprintf: + # Code from module unistdio/u16-vsprintf: + # Code from module unistdio/u32-asnprintf: + # Code from module unistdio/u32-asprintf: + # Code from module unistdio/u32-printf-parse: gl_PREREQ_PRINTF_PARSE + # Code from module unistdio/u32-snprintf: + # Code from module unistdio/u32-sprintf: + # Code from module unistdio/u32-u32-asnprintf: + # Code from module unistdio/u32-u32-asprintf: + # Code from module unistdio/u32-u32-snprintf: + # Code from module unistdio/u32-u32-sprintf: + # Code from module unistdio/u32-u32-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/u32-u32-vasprintf: + # Code from module unistdio/u32-u32-vsnprintf: + # Code from module unistdio/u32-u32-vsprintf: + # Code from module unistdio/u32-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/u32-vasprintf: + # Code from module unistdio/u32-vsnprintf: + # Code from module unistdio/u32-vsprintf: + # Code from module unistdio/u8-asnprintf: + # Code from module unistdio/u8-asprintf: + # Code from module unistdio/u8-printf-parse: gl_PREREQ_PRINTF_PARSE + # Code from module unistdio/u8-snprintf: + # Code from module unistdio/u8-sprintf: + # Code from module unistdio/u8-u8-asnprintf: + # Code from module unistdio/u8-u8-asprintf: + # Code from module unistdio/u8-u8-snprintf: + # Code from module unistdio/u8-u8-sprintf: + # Code from module unistdio/u8-u8-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/u8-u8-vasprintf: + # Code from module unistdio/u8-u8-vsnprintf: + # Code from module unistdio/u8-u8-vsprintf: + # Code from module unistdio/u8-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/u8-vasprintf: + # Code from module unistdio/u8-vsnprintf: + # Code from module unistdio/u8-vsprintf: + # Code from module unistdio/ulc-asnprintf: + # Code from module unistdio/ulc-asprintf: + # Code from module unistdio/ulc-fprintf: + # Code from module unistdio/ulc-printf-parse: gl_PREREQ_PRINTF_PARSE + # Code from module unistdio/ulc-snprintf: + # Code from module unistdio/ulc-sprintf: + # Code from module unistdio/ulc-vasnprintf: gl_PREREQ_VASNPRINTF_WITH_EXTRAS + # Code from module unistdio/ulc-vasprintf: + # Code from module unistdio/ulc-vfprintf: + # Code from module unistdio/ulc-vsnprintf: + # Code from module unistdio/ulc-vsprintf: + # Code from module unistr/base: + # Code from module unistr/u16-check: + # Code from module unistr/u16-chr: + # Code from module unistr/u16-cmp: + # Code from module unistr/u16-cmp2: + # Code from module unistr/u16-cpy: + # Code from module unistr/u16-cpy-alloc: + # Code from module unistr/u16-endswith: + # Code from module unistr/u16-mblen: + # Code from module unistr/u16-mbsnlen: + # Code from module unistr/u16-mbtouc: gl_MODULE_INDICATOR([unistr/u16-mbtouc]) + # Code from module unistr/u16-mbtouc-unsafe: gl_MODULE_INDICATOR([unistr/u16-mbtouc-unsafe]) + # Code from module unistr/u16-mbtoucr: gl_MODULE_INDICATOR([unistr/u16-mbtoucr]) + # Code from module unistr/u16-move: + # Code from module unistr/u16-next: + # Code from module unistr/u16-prev: + # Code from module unistr/u16-set: + # Code from module unistr/u16-startswith: + # Code from module unistr/u16-stpcpy: + # Code from module unistr/u16-stpncpy: + # Code from module unistr/u16-strcat: + # Code from module unistr/u16-strchr: + # Code from module unistr/u16-strcmp: + # Code from module unistr/u16-strcoll: + # Code from module unistr/u16-strcpy: + # Code from module unistr/u16-strcspn: + # Code from module unistr/u16-strdup: + # Code from module unistr/u16-strlen: + # Code from module unistr/u16-strmblen: + # Code from module unistr/u16-strmbtouc: + # Code from module unistr/u16-strncat: + # Code from module unistr/u16-strncmp: + # Code from module unistr/u16-strncpy: + # Code from module unistr/u16-strnlen: + # Code from module unistr/u16-strpbrk: + # Code from module unistr/u16-strrchr: + # Code from module unistr/u16-strspn: + # Code from module unistr/u16-strstr: + # Code from module unistr/u16-strtok: + # Code from module unistr/u16-to-u32: + # Code from module unistr/u16-to-u8: + # Code from module unistr/u16-uctomb: gl_MODULE_INDICATOR([unistr/u16-uctomb]) + # Code from module unistr/u32-check: + # Code from module unistr/u32-chr: + # Code from module unistr/u32-cmp: + # Code from module unistr/u32-cmp2: + # Code from module unistr/u32-cpy: + # Code from module unistr/u32-cpy-alloc: + # Code from module unistr/u32-endswith: + # Code from module unistr/u32-mblen: + # Code from module unistr/u32-mbsnlen: + # Code from module unistr/u32-mbtouc: gl_MODULE_INDICATOR([unistr/u32-mbtouc]) + # Code from module unistr/u32-mbtouc-unsafe: gl_MODULE_INDICATOR([unistr/u32-mbtouc-unsafe]) + # Code from module unistr/u32-mbtoucr: gl_MODULE_INDICATOR([unistr/u32-mbtoucr]) + # Code from module unistr/u32-move: + # Code from module unistr/u32-next: + # Code from module unistr/u32-prev: + # Code from module unistr/u32-set: + # Code from module unistr/u32-startswith: + # Code from module unistr/u32-stpcpy: + # Code from module unistr/u32-stpncpy: + # Code from module unistr/u32-strcat: + # Code from module unistr/u32-strchr: + # Code from module unistr/u32-strcmp: + # Code from module unistr/u32-strcoll: + # Code from module unistr/u32-strcpy: + # Code from module unistr/u32-strcspn: + # Code from module unistr/u32-strdup: + # Code from module unistr/u32-strlen: + # Code from module unistr/u32-strmblen: + # Code from module unistr/u32-strmbtouc: + # Code from module unistr/u32-strncat: + # Code from module unistr/u32-strncmp: + # Code from module unistr/u32-strncpy: + # Code from module unistr/u32-strnlen: + # Code from module unistr/u32-strpbrk: + # Code from module unistr/u32-strrchr: + # Code from module unistr/u32-strspn: + # Code from module unistr/u32-strstr: + # Code from module unistr/u32-strtok: + # Code from module unistr/u32-to-u16: + # Code from module unistr/u32-to-u8: + # Code from module unistr/u32-uctomb: gl_MODULE_INDICATOR([unistr/u32-uctomb]) + # Code from module unistr/u8-check: + # Code from module unistr/u8-chr: + # Code from module unistr/u8-cmp: + # Code from module unistr/u8-cmp2: + # Code from module unistr/u8-cpy: + # Code from module unistr/u8-cpy-alloc: + # Code from module unistr/u8-endswith: + # Code from module unistr/u8-mblen: + # Code from module unistr/u8-mbsnlen: + # Code from module unistr/u8-mbtouc: gl_MODULE_INDICATOR([unistr/u8-mbtouc]) + # Code from module unistr/u8-mbtouc-unsafe: gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe]) + # Code from module unistr/u8-mbtoucr: gl_MODULE_INDICATOR([unistr/u8-mbtoucr]) + # Code from module unistr/u8-move: + # Code from module unistr/u8-next: + # Code from module unistr/u8-prev: + # Code from module unistr/u8-set: + # Code from module unistr/u8-startswith: + # Code from module unistr/u8-stpcpy: AC_CHECK_FUNCS_ONCE([stpcpy]) + # Code from module unistr/u8-stpncpy: + # Code from module unistr/u8-strcat: + # Code from module unistr/u8-strchr: + # Code from module unistr/u8-strcmp: + # Code from module unistr/u8-strcoll: + # Code from module unistr/u8-strcpy: + # Code from module unistr/u8-strcspn: + # Code from module unistr/u8-strdup: AC_CHECK_FUNCS_ONCE([strdup]) + # Code from module unistr/u8-strlen: + # Code from module unistr/u8-strmblen: + # Code from module unistr/u8-strmbtouc: + # Code from module unistr/u8-strncat: + # Code from module unistr/u8-strncmp: + # Code from module unistr/u8-strncpy: + # Code from module unistr/u8-strnlen: + # Code from module unistr/u8-strpbrk: + # Code from module unistr/u8-strrchr: + # Code from module unistr/u8-strspn: + # Code from module unistr/u8-strstr: + # Code from module unistr/u8-strtok: + # Code from module unistr/u8-to-u16: + # Code from module unistr/u8-to-u32: + # Code from module unistr/u8-uctomb: gl_MODULE_INDICATOR([unistr/u8-uctomb]) + # Code from module unitypes: + # Code from module uniwbrk/base: + # Code from module uniwbrk/table: + # Code from module uniwbrk/u16-wordbreaks: + # Code from module uniwbrk/u32-wordbreaks: + # Code from module uniwbrk/u8-wordbreaks: + # Code from module uniwbrk/ulc-wordbreaks: + # Code from module uniwbrk/wordbreak-property: + # Code from module uniwidth/base: + # Code from module uniwidth/u16-strwidth: + # Code from module uniwidth/u16-width: + # Code from module uniwidth/u32-strwidth: + # Code from module uniwidth/u32-width: + # Code from module uniwidth/u8-strwidth: + # Code from module uniwidth/u8-width: + # Code from module uniwidth/width: + # Code from module unused-parameter: + # Code from module verify: + # Code from module warn-on-use: + # Code from module wchar: gl_WCHAR_H + # Code from module wctype: gl_WCTYPE_H + # Code from module wcwidth: gl_FUNC_WCWIDTH gl_WCHAR_MODULE_INDICATOR([wcwidth]) + # Code from module xsize: gl_XSIZE + # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || for gl_file in ]gl_LIBSOURCES_LIST[ ; do @@ -156,7 +1787,7 @@ AC_DEFUN([gl_INIT], if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done @@ -173,6 +1804,12 @@ AC_DEFUN([gl_INIT], m4_pushdef([gltests_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='tests' +changequote(,)dnl + gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS +changequote([, ])dnl + AC_SUBST([gltests_WITNESS]) + gl_module_indicator_condition=$gltests_WITNESS + m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) gt_LOCALE_FR gt_LOCALE_TR_UTF8 gl_ENVIRON @@ -181,22 +1818,25 @@ AC_DEFUN([gl_INIT], m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) - gl_EXITFAIL - gl_FCNTL_H + gl_FUNC_GETPAGESIZE + gl_UNISTD_MODULE_INDICATOR([getpagesize]) AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) gl_DOUBLE_EXPONENT_LOCATION gl_FLOAT_EXPONENT_LOCATION gl_LONG_DOUBLE_EXPONENT_LOCATION gl_LOCALE_H + AC_CHECK_FUNCS_ONCE([newlocale]) + AC_CHECK_FUNCS_ONCE([newlocale]) gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN gt_LOCALE_FR_UTF8 - gl_FUNC_OPEN - gl_MODULE_INDICATOR([open]) - gl_FCNTL_MODULE_INDICATOR([open]) + AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>]) + AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>]) + gl_FUNC_PUTENV + gl_STDLIB_MODULE_INDICATOR([putenv]) gl_FUNC_SETENV gl_STDLIB_MODULE_INDICATOR([setenv]) AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION]) @@ -206,6 +1846,10 @@ AC_DEFUN([gl_INIT], gt_TYPE_WINT_T gl_FUNC_STRERROR gl_STRING_MODULE_INDICATOR([strerror]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_THREAD gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA @@ -227,12 +1871,68 @@ AC_DEFUN([gl_INIT], gt_LOCALE_FR_UTF8 gt_LOCALE_FR gt_LOCALE_FR_UTF8 + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) gt_LOCALE_FR gl_FUNC_UNSETENV gl_STDLIB_MODULE_INDICATOR([unsetenv]) gl_FUNC_WCTOB gl_WCHAR_MODULE_INDICATOR([wctob]) gl_XALLOC + gl_YIELD + m4_popdef([gl_MODULE_INDICATOR_CONDITION]) m4_ifval(gltests_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || for gl_file in ]gltests_LIBSOURCES_LIST[ ; do @@ -255,7 +1955,7 @@ AC_DEFUN([gl_INIT], if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done @@ -324,8 +2024,11 @@ AC_DEFUN([gltests_LIBSOURCES], [ # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ + build-aux/arg-nonnull.h + build-aux/c++defs.h build-aux/config.rpath - build-aux/link-warning.h + build-aux/unused-parameter.h + build-aux/warn-on-use.h doc/relocatable.texi lib/alloca.in.h lib/array-mergesort.h @@ -336,7 +2039,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/c-strcaseeq.h lib/c-strncasecmp.c lib/config.charset - lib/dup2.c lib/errno.in.h lib/float+.h lib/float.in.h @@ -345,12 +2047,15 @@ AC_DEFUN([gl_FILE_LIST], [ lib/frexpl.c lib/fseterr.c lib/fseterr.h - lib/getpagesize.c + lib/glthread/lock.c + lib/glthread/lock.h + lib/glthread/threadlib.c lib/iconv.in.h lib/iconv_open-aix.gperf lib/iconv_open-hpux.gperf lib/iconv_open-irix.gperf lib/iconv_open-osf.gperf + lib/iconv_open-solaris.gperf lib/iconv_open.c lib/iconveh.h lib/isnan.c @@ -409,6 +2114,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/striconveha.c lib/striconveha.h lib/string.in.h + lib/strncat.c lib/unicase.h lib/unicase/cased.c lib/unicase/cased.h @@ -1132,17 +2838,15 @@ AC_DEFUN([gl_FILE_LIST], [ m4/00gnulib.m4 m4/alloca.m4 m4/codeset.m4 - m4/dup2.m4 m4/eealloc.m4 m4/environ.m4 m4/errno_h.m4 m4/error.m4 - m4/exitfail.m4 m4/exponentd.m4 m4/exponentf.m4 m4/exponentl.m4 m4/extensions.m4 - m4/fcntl_h.m4 + m4/fcntl-o.m4 m4/float_h.m4 m4/fpieee.m4 m4/frexp.m4 @@ -1173,6 +2877,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/locale-zh.m4 m4/locale_h.m4 m4/localename.m4 + m4/lock.m4 m4/longlong.m4 m4/malloc.m4 m4/malloca.m4 @@ -1185,13 +2890,12 @@ AC_DEFUN([gl_FILE_LIST], [ m4/memchr.m4 m4/minmax.m4 m4/mmap-anon.m4 - m4/mode_t.m4 m4/multiarch.m4 m4/nocrash.m4 - m4/open.m4 m4/printf-frexp.m4 m4/printf-frexpl.m4 m4/printf.m4 + m4/putenv.m4 m4/relocatable-lib.m4 m4/setenv.m4 m4/signbit.m4 @@ -1203,29 +2907,36 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stdlib_h.m4 m4/strerror.m4 m4/string_h.m4 + m4/strncat.m4 + m4/thread.m4 + m4/threadlib.m4 m4/unistd_h.m4 m4/vasnprintf.m4 - m4/wchar.m4 + m4/warn-on-use.m4 + m4/wchar_h.m4 m4/wchar_t.m4 m4/wctob.m4 - m4/wctype.m4 + m4/wctype_h.m4 m4/wcwidth.m4 m4/wint_t.m4 m4/xalloc.m4 m4/xsize.m4 + m4/yield.m4 + tests/init.sh + tests/macros.h tests/nan.h + tests/signature.h tests/test-alloca-opt.c tests/test-array-mergesort.c tests/test-c-ctype.c tests/test-c-strcase.sh tests/test-c-strcasecmp.c tests/test-c-strncasecmp.c - tests/test-dup2.c tests/test-environ.c tests/test-errno.c - tests/test-fcntl.c tests/test-frexpl.c tests/test-fseterr.c + tests/test-iconv-h.c tests/test-iconv.c tests/test-isnand-nolibm.c tests/test-isnand.h @@ -1235,6 +2946,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-isnanl.h tests/test-locale.c tests/test-localename.c + tests/test-lock.c tests/test-malloca.c tests/test-math.c tests/test-mbrtowc.c @@ -1245,9 +2957,9 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-mbsinit.c tests/test-mbsinit.sh tests/test-memchr.c - tests/test-open.c tests/test-printf-frexp.c tests/test-printf-frexpl.c + tests/test-setenv.c tests/test-signbit.c tests/test-stdbool.c tests/test-stddef.c @@ -1257,10 +2969,14 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-striconveh.c tests/test-striconveha.c tests/test-string.c + tests/test-strncat.c tests/test-unistd.c + tests/test-unsetenv.c tests/test-wchar.c tests/test-wctype.c tests/test-wcwidth.c + tests/test-xalloc-die.c + tests/test-xalloc-die.sh tests/unicase/test-casecmp.h tests/unicase/test-cased.c tests/unicase/test-ignorable.c @@ -1586,6 +3302,125 @@ AC_DEFUN([gl_FILE_LIST], [ tests/unistdio/test-ulc-vasprintf1.c tests/unistdio/test-ulc-vsnprintf1.c tests/unistdio/test-ulc-vsprintf1.c + tests/unistr/test-chr.h + tests/unistr/test-cmp.h + tests/unistr/test-cmp2.h + tests/unistr/test-cpy-alloc.h + tests/unistr/test-cpy.h + tests/unistr/test-move.h + tests/unistr/test-set.h + tests/unistr/test-stpcpy.h + tests/unistr/test-stpncpy.h + tests/unistr/test-strcat.h + tests/unistr/test-strcmp.h + tests/unistr/test-strcpy.h + tests/unistr/test-strdup.h + tests/unistr/test-strncat.h + tests/unistr/test-strncmp.h + tests/unistr/test-strncpy.h + tests/unistr/test-strnlen.h + tests/unistr/test-u16-check.c + tests/unistr/test-u16-chr.c + tests/unistr/test-u16-cmp.c + tests/unistr/test-u16-cmp2.c + tests/unistr/test-u16-cpy-alloc.c + tests/unistr/test-u16-cpy.c + tests/unistr/test-u16-mblen.c + tests/unistr/test-u16-mbsnlen.c + tests/unistr/test-u16-mbtouc-unsafe.c + tests/unistr/test-u16-mbtouc.c + tests/unistr/test-u16-mbtouc.h + tests/unistr/test-u16-mbtoucr.c + tests/unistr/test-u16-move.c + tests/unistr/test-u16-next.c + tests/unistr/test-u16-prev.c + tests/unistr/test-u16-set.c + tests/unistr/test-u16-stpcpy.c + tests/unistr/test-u16-stpncpy.c + tests/unistr/test-u16-strcat.c + tests/unistr/test-u16-strcmp.c + tests/unistr/test-u16-strcmp.h + tests/unistr/test-u16-strcoll.c + tests/unistr/test-u16-strcpy.c + tests/unistr/test-u16-strdup.c + tests/unistr/test-u16-strlen.c + tests/unistr/test-u16-strmblen.c + tests/unistr/test-u16-strmbtouc.c + tests/unistr/test-u16-strncat.c + tests/unistr/test-u16-strncmp.c + tests/unistr/test-u16-strncpy.c + tests/unistr/test-u16-strnlen.c + tests/unistr/test-u16-to-u32.c + tests/unistr/test-u16-to-u8.c + tests/unistr/test-u16-uctomb.c + tests/unistr/test-u32-check.c + tests/unistr/test-u32-chr.c + tests/unistr/test-u32-cmp.c + tests/unistr/test-u32-cmp2.c + tests/unistr/test-u32-cpy-alloc.c + tests/unistr/test-u32-cpy.c + tests/unistr/test-u32-mblen.c + tests/unistr/test-u32-mbsnlen.c + tests/unistr/test-u32-mbtouc-unsafe.c + tests/unistr/test-u32-mbtouc.c + tests/unistr/test-u32-mbtouc.h + tests/unistr/test-u32-mbtoucr.c + tests/unistr/test-u32-move.c + tests/unistr/test-u32-next.c + tests/unistr/test-u32-prev.c + tests/unistr/test-u32-set.c + tests/unistr/test-u32-stpcpy.c + tests/unistr/test-u32-stpncpy.c + tests/unistr/test-u32-strcat.c + tests/unistr/test-u32-strcmp.c + tests/unistr/test-u32-strcmp.h + tests/unistr/test-u32-strcoll.c + tests/unistr/test-u32-strcpy.c + tests/unistr/test-u32-strdup.c + tests/unistr/test-u32-strlen.c + tests/unistr/test-u32-strmblen.c + tests/unistr/test-u32-strmbtouc.c + tests/unistr/test-u32-strncat.c + tests/unistr/test-u32-strncmp.c + tests/unistr/test-u32-strncpy.c + tests/unistr/test-u32-strnlen.c + tests/unistr/test-u32-to-u16.c + tests/unistr/test-u32-to-u8.c + tests/unistr/test-u32-uctomb.c + tests/unistr/test-u8-check.c + tests/unistr/test-u8-chr.c + tests/unistr/test-u8-cmp.c + tests/unistr/test-u8-cmp2.c + tests/unistr/test-u8-cpy-alloc.c + tests/unistr/test-u8-cpy.c + tests/unistr/test-u8-mblen.c + tests/unistr/test-u8-mbsnlen.c + tests/unistr/test-u8-mbtouc-unsafe.c + tests/unistr/test-u8-mbtouc.c + tests/unistr/test-u8-mbtouc.h + tests/unistr/test-u8-mbtoucr.c + tests/unistr/test-u8-move.c + tests/unistr/test-u8-next.c + tests/unistr/test-u8-prev.c + tests/unistr/test-u8-set.c + tests/unistr/test-u8-stpcpy.c + tests/unistr/test-u8-stpncpy.c + tests/unistr/test-u8-strcat.c + tests/unistr/test-u8-strcmp.c + tests/unistr/test-u8-strcmp.h + tests/unistr/test-u8-strcoll.c + tests/unistr/test-u8-strcpy.c + tests/unistr/test-u8-strdup.c + tests/unistr/test-u8-strlen.c + tests/unistr/test-u8-strmblen.c + tests/unistr/test-u8-strmbtouc.c + tests/unistr/test-u8-strncat.c + tests/unistr/test-u8-strncmp.c + tests/unistr/test-u8-strncpy.c + tests/unistr/test-u8-strnlen.c + tests/unistr/test-u8-to-u16.c + tests/unistr/test-u8-to-u32.c + tests/unistr/test-u8-uctomb.c tests/uniwbrk/test-u16-wordbreaks.c tests/uniwbrk/test-u32-wordbreaks.c tests/uniwbrk/test-u8-wordbreaks.c @@ -1605,13 +3440,16 @@ AC_DEFUN([gl_FILE_LIST], [ tests=lib/error.h tests=lib/exitfail.c tests=lib/exitfail.h - tests=lib/fcntl.in.h + tests=lib/getpagesize.c tests=lib/gettext.h + tests=lib/glthread/thread.c + tests=lib/glthread/thread.h + tests=lib/glthread/yield.h tests=lib/intprops.h tests=lib/locale.in.h - tests=lib/open.c tests=lib/progname.c tests=lib/progname.h + tests=lib/putenv.c tests=lib/setenv.c tests=lib/strerror.c tests=lib/unsetenv.c diff --git a/gnulib-m4/iconv.m4 b/gnulib-m4/iconv.m4 index ce21b0b..f46ff14 100644 --- a/gnulib-m4/iconv.m4 +++ b/gnulib-m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial AM8 (gettext-0.18) -dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc. +# iconv.m4 serial 9 (gettext-0.18) +dnl Copyright (C) 2000-2002, 2007-2010 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. @@ -58,7 +58,7 @@ AC_DEFUN([AM_ICONV_LINK], ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ - dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. + dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" @@ -87,6 +87,25 @@ int main () return 1; } } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { diff --git a/gnulib-m4/iconv_h.m4 b/gnulib-m4/iconv_h.m4 index bc05b05..7366cb9 100644 --- a/gnulib-m4/iconv_h.m4 +++ b/gnulib-m4/iconv_h.m4 @@ -1,5 +1,5 @@ -# iconv_h.m4 serial 4 -dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +# iconv_h.m4 serial 6 +dnl Copyright (C) 2007-2010 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. @@ -7,6 +7,9 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_ICONV_H], [ AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + + dnl Execute this unconditionally, because ICONV_H may be set by other + dnl modules, after this code is executed. gl_CHECK_NEXT_HEADERS([iconv.h]) ]) @@ -21,7 +24,7 @@ AC_DEFUN([gl_ICONV_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) AC_DEFUN([gl_ICONV_H_DEFAULTS], diff --git a/gnulib-m4/iconv_open.m4 b/gnulib-m4/iconv_open.m4 index c7b948e..60f62ca 100644 --- a/gnulib-m4/iconv_open.m4 +++ b/gnulib-m4/iconv_open.m4 @@ -1,5 +1,5 @@ -# iconv_open.m4 serial 5 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# iconv_open.m4 serial 7 +dnl Copyright (C) 2007-2010 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. @@ -10,6 +10,8 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_ICONV_H_DEFAULTS]) if test "$am_cv_func_iconv" = yes; then + dnl Provide the <iconv.h> override, for the sake of the C++ aliases. + gl_REPLACE_ICONV_H dnl Test whether iconv_open accepts standardized encoding names. dnl We know that GNU libiconv and GNU libc do. AC_EGREP_CPP([gnu_iconv], [ @@ -21,10 +23,11 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN], if test $gl_func_iconv_gnu = no; then iconv_flavor= case "$host_os" in - aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; - irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; - hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; - osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; + irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; + hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; + osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; esac if test -n "$iconv_flavor"; then AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor], @@ -89,8 +92,8 @@ int main () outptr = buf; outbytesleft = sizeof (buf); res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); @@ -116,8 +119,8 @@ int main () outptr = buf; outbytesleft = sizeof (buf); res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); @@ -143,8 +146,8 @@ int main () outptr = buf; outbytesleft = sizeof (buf); res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); @@ -170,8 +173,8 @@ int main () outptr = buf; outbytesleft = sizeof (buf); res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); @@ -198,8 +201,8 @@ int main () outptr = buf; outbytesleft = sizeof (buf); res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); diff --git a/gnulib-m4/include_next.m4 b/gnulib-m4/include_next.m4 index 5e22ded..c7e0672 100644 --- a/gnulib-m4/include_next.m4 +++ b/gnulib-m4/include_next.m4 @@ -1,5 +1,5 @@ # include_next.m4 serial 14 -dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2010 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. @@ -109,11 +109,11 @@ EOF # be # '"///usr/include/foo.h"', or whatever other absolute file name is suitable. # That way, a header file with the following line: -# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# #@INCLUDE_NEXT@ @NEXT_FOO_H@ # or -# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ +# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ # behaves (after sed substitution) as if it contained -# #include_next <foo.h> +# #include_next <foo.h> # even if the compiler does not support include_next. # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". @@ -129,46 +129,46 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS], m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], - [gl_cv_next_]m4_defn([gl_HEADER_NAME])) + [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( - [absolute name of <]m4_defn([gl_HEADER_NAME])[>], - m4_defn([gl_next_header]), - [AS_VAR_PUSHDEF([gl_header_exists], - [ac_cv_header_]m4_defn([gl_HEADER_NAME])) - if test AS_VAR_GET(gl_header_exists) = yes; then - AC_LANG_CONFTEST( - [AC_LANG_SOURCE( - [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] - )]) - dnl AIX "xlc -E" and "cc -E" omit #line directives for header files - dnl that contain only a #include of other header files and no - dnl non-comment tokens of their own. This leads to a failure to - dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> - dnl and others. The workaround is to force preservation of comments - dnl through option -C. This ensures all necessary #line directives - dnl are present. GCC supports option -C as well. - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - dnl eval is necessary to expand gl_absname_cpp. - dnl Ultrix and Pyramid sh refuse to redirect output of eval, - dnl so use subshell. - AS_VAR_SET([gl_next_header], - ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ - s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"']) - else - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) - fi - AS_VAR_POPDEF([gl_header_exists])]) + [absolute name of <]m4_defn([gl_HEADER_NAME])[>], + m4_defn([gl_next_header]), + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME])) + if test AS_VAR_GET(gl_header_exists) = yes; then + AC_LANG_CONFTEST( + [AC_LANG_SOURCE( + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] + )]) + dnl AIX "xlc -E" and "cc -E" omit #line directives for header files + dnl that contain only a #include of other header files and no + dnl non-comment tokens of their own. This leads to a failure to + dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> + dnl and others. The workaround is to force preservation of comments + dnl through option -C. This ensures all necessary #line directives + dnl are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + dnl eval is necessary to expand gl_absname_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_next_header], + ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ + s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"']) + else + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + fi + AS_VAR_POPDEF([gl_header_exists])]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), diff --git a/gnulib-m4/inline.m4 b/gnulib-m4/inline.m4 index cee5109..4ef768d 100644 --- a/gnulib-m4/inline.m4 +++ b/gnulib-m4/inline.m4 @@ -1,5 +1,5 @@ # inline.m4 serial 4 -dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009, 2010 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. diff --git a/gnulib-m4/intlmacosx.m4 b/gnulib-m4/intlmacosx.m4 index c24837c..dd91025 100644 --- a/gnulib-m4/intlmacosx.m4 +++ b/gnulib-m4/intlmacosx.m4 @@ -1,5 +1,5 @@ # intlmacosx.m4 serial 3 (gettext-0.18) -dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2010 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. diff --git a/gnulib-m4/intmax_t.m4 b/gnulib-m4/intmax_t.m4 index 264cb57..975caac 100644 --- a/gnulib-m4/intmax_t.m4 +++ b/gnulib-m4/intmax_t.m4 @@ -1,5 +1,6 @@ # intmax_t.m4 serial 7 -dnl Copyright (C) 1997-2004, 2006-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl 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. diff --git a/gnulib-m4/inttypes_h.m4 b/gnulib-m4/inttypes_h.m4 index f4ca160..782d77e 100644 --- a/gnulib-m4/inttypes_h.m4 +++ b/gnulib-m4/inttypes_h.m4 @@ -1,5 +1,5 @@ # inttypes_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2010 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. diff --git a/gnulib-m4/isnand.m4 b/gnulib-m4/isnand.m4 index c823c2c..cd91628 100644 --- a/gnulib-m4/isnand.m4 +++ b/gnulib-m4/isnand.m4 @@ -1,5 +1,5 @@ # isnand.m4 serial 6 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/isnanf.m4 b/gnulib-m4/isnanf.m4 index 2ad8f94..1509fb4 100644 --- a/gnulib-m4/isnanf.m4 +++ b/gnulib-m4/isnanf.m4 @@ -1,5 +1,5 @@ # isnanf.m4 serial 10 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/isnanl.m4 b/gnulib-m4/isnanl.m4 index e3029f5..25daeca 100644 --- a/gnulib-m4/isnanl.m4 +++ b/gnulib-m4/isnanl.m4 @@ -1,5 +1,5 @@ # isnanl.m4 serial 12 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/lcmessage.m4 b/gnulib-m4/lcmessage.m4 index fa8e416..1a70543 100644 --- a/gnulib-m4/lcmessage.m4 +++ b/gnulib-m4/lcmessage.m4 @@ -1,5 +1,6 @@ # lcmessage.m4 serial 6 (gettext-0.18) -dnl Copyright (C) 1995-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, +dnl 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. diff --git a/gnulib-m4/ldexpl.m4 b/gnulib-m4/ldexpl.m4 index 8ba85c6..d84b50f 100644 --- a/gnulib-m4/ldexpl.m4 +++ b/gnulib-m4/ldexpl.m4 @@ -1,5 +1,5 @@ -# ldexpl.m4 serial 4 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# ldexpl.m4 serial 5 +dnl Copyright (C) 2007-2010 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. @@ -7,54 +7,56 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_LDEXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + dnl Check whether it's declared. + dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. + AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>]) LDEXPL_LIBM= - AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm], - [gl_cv_func_ldexpl_no_libm], - [ - AC_TRY_LINK([#include <math.h> - long double x;], - [return ldexpl (x, -1) > 0;], - [gl_cv_func_ldexpl_no_libm=yes], - [gl_cv_func_ldexpl_no_libm=no]) - ]) - if test $gl_cv_func_ldexpl_no_libm = no; then - AC_CACHE_CHECK([whether ldexpl() can be used with libm], - [gl_cv_func_ldexpl_in_libm], + if test $HAVE_DECL_LDEXPL = 1; then + AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm], + [gl_cv_func_ldexpl_no_libm], [ - save_LIBS="$LIBS" - LIBS="$LIBS -lm" AC_TRY_LINK([#include <math.h> long double x;], [return ldexpl (x, -1) > 0;], - [gl_cv_func_ldexpl_in_libm=yes], - [gl_cv_func_ldexpl_in_libm=no]) - LIBS="$save_LIBS" + [gl_cv_func_ldexpl_no_libm=yes], + [gl_cv_func_ldexpl_no_libm=no]) ]) - if test $gl_cv_func_ldexpl_in_libm = yes; then - LDEXPL_LIBM=-lm + if test $gl_cv_func_ldexpl_no_libm = no; then + AC_CACHE_CHECK([whether ldexpl() can be used with libm], + [gl_cv_func_ldexpl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include <math.h> + long double x;], + [return ldexpl (x, -1) > 0;], + [gl_cv_func_ldexpl_in_libm=yes], + [gl_cv_func_ldexpl_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_ldexpl_in_libm = yes; then + LDEXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_ldexpl_no_libm = yes \ + || test $gl_cv_func_ldexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $LDEXPL_LIBM" + gl_FUNC_LDEXPL_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_ldexpl_works" in + *yes) gl_func_ldexpl=yes ;; + *) gl_func_ldexpl=no; REPLACE_LDEXPL=1; LDEXPL_LIBM= ;; + esac + else + gl_func_ldexpl=no + fi + if test $gl_func_ldexpl = yes; then + AC_DEFINE([HAVE_LDEXPL], [1], + [Define if the ldexpl() function is available.]) fi fi - if test $gl_cv_func_ldexpl_no_libm = yes \ - || test $gl_cv_func_ldexpl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $LDEXPL_LIBM" - gl_FUNC_LDEXPL_WORKS - LIBS="$save_LIBS" - case "$gl_cv_func_ldexpl_works" in - *yes) gl_func_ldexpl=yes ;; - *) gl_func_ldexpl=no; REPLACE_LDEXPL=1; LDEXPL_LIBM= ;; - esac - else - gl_func_ldexpl=no - fi - if test $gl_func_ldexpl = yes; then - AC_DEFINE([HAVE_LDEXPL], [1], - [Define if the ldexpl() function is available.]) - dnl Also check whether it's declared. - dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>]) - else - HAVE_DECL_LDEXPL=0 + if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then AC_LIBOBJ([ldexpl]) fi AC_SUBST([LDEXPL_LIBM]) diff --git a/gnulib-m4/lib-ld.m4 b/gnulib-m4/lib-ld.m4 index e4863f2..ebb3052 100644 --- a/gnulib-m4/lib-ld.m4 +++ b/gnulib-m4/lib-ld.m4 @@ -1,5 +1,5 @@ # lib-ld.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 2009-2010 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. @@ -59,7 +59,7 @@ if test "$GCC" = yes; then # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD], # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; + test "$with_gnu_ld" != no && break ;; *) - test "$with_gnu_ld" != yes && break ;; + test "$with_gnu_ld" != yes && break ;; esac fi done diff --git a/gnulib-m4/lib-link.m4 b/gnulib-m4/lib-link.m4 index 2f8b7ff..c73bd8e 100644 --- a/gnulib-m4/lib-link.m4 +++ b/gnulib-m4/lib-link.m4 @@ -1,5 +1,5 @@ -# lib-link.m4 serial 20 (gettext-0.18) -dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. +# lib-link.m4 serial 21 (gettext-0.18) +dnl Copyright (C) 2001-2010 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. @@ -74,7 +74,17 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" + dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, + dnl because these -l options might require -L options that are present in + dnl LIBS. -l options benefit only from the -L options listed before it. + dnl Otherwise, add it to the front of LIBS, because it may be a static + dnl library that depends on another static library that is present in LIBS. + dnl Static libraries benefit only from the static libraries listed after + dnl it. + case " $LIB[]NAME" in + *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; + *) LIBS="$LIB[]NAME $LIBS" ;; + esac AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) diff --git a/gnulib-m4/lib-prefix.m4 b/gnulib-m4/lib-prefix.m4 index 4b7ee33..1601cea 100644 --- a/gnulib-m4/lib-prefix.m4 +++ b/gnulib-m4/lib-prefix.m4 @@ -1,5 +1,5 @@ # lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2005, 2008-2010 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. diff --git a/gnulib-m4/localcharset.m4 b/gnulib-m4/localcharset.m4 index e960104..ee2e801 100644 --- a/gnulib-m4/localcharset.m4 +++ b/gnulib-m4/localcharset.m4 @@ -1,5 +1,5 @@ -# localcharset.m4 serial 6 -dnl Copyright (C) 2002, 2004, 2006, 2009 Free Software Foundation, Inc. +# localcharset.m4 serial 7 +dnl Copyright (C) 2002, 2004, 2006, 2009, 2010 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. @@ -8,6 +8,7 @@ AC_DEFUN([gl_LOCALCHARSET], [ dnl Prerequisites of lib/localcharset.c. AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) AC_CHECK_DECLS_ONCE([getc_unlocked]) dnl Prerequisites of the lib/Makefile.am snippet. diff --git a/gnulib-m4/locale-fr.m4 b/gnulib-m4/locale-fr.m4 index 653a5bc..001f539 100644 --- a/gnulib-m4/locale-fr.m4 +++ b/gnulib-m4/locale-fr.m4 @@ -1,5 +1,5 @@ # locale-fr.m4 serial 11 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2010 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. diff --git a/gnulib-m4/locale-ja.m4 b/gnulib-m4/locale-ja.m4 index 9360576..0eedaf1 100644 --- a/gnulib-m4/locale-ja.m4 +++ b/gnulib-m4/locale-ja.m4 @@ -1,5 +1,5 @@ # locale-ja.m4 serial 7 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2010 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. diff --git a/gnulib-m4/locale-tr.m4 b/gnulib-m4/locale-tr.m4 index 6162f65..404c063 100644 --- a/gnulib-m4/locale-tr.m4 +++ b/gnulib-m4/locale-tr.m4 @@ -1,5 +1,5 @@ # locale-tr.m4 serial 6 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2010 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. diff --git a/gnulib-m4/locale-zh.m4 b/gnulib-m4/locale-zh.m4 index 36a5f1d..777fd14 100644 --- a/gnulib-m4/locale-zh.m4 +++ b/gnulib-m4/locale-zh.m4 @@ -1,5 +1,5 @@ # locale-zh.m4 serial 6 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2010 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. diff --git a/gnulib-m4/locale_h.m4 b/gnulib-m4/locale_h.m4 index 8612367..18a119b 100644 --- a/gnulib-m4/locale_h.m4 +++ b/gnulib-m4/locale_h.m4 @@ -1,26 +1,92 @@ -# locale_h.m4 serial 3 -dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. +# locale_h.m4 serial 10 +dnl Copyright (C) 2007, 2009-2010 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_LOCALE_H], [ - AC_CACHE_CHECK([whether locale.h conforms to POSIX], - [gl_cv_header_working_locale_h], - [AC_TRY_COMPILE([#include <locale.h> -int x = LC_MESSAGES;], [], - [gl_cv_header_working_locale_h=yes], - [gl_cv_header_working_locale_h=no])]) + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + + dnl Persuade glibc <locale.h> to define locale_t. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. AC_REQUIRE([gl_STDDEF_H]) - if test $gl_cv_header_working_locale_h = yes && test -z "$STDDEF_H"; then - LOCALE_H= + AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001], + [gl_cv_header_locale_h_posix2001], + [AC_TRY_COMPILE([#include <locale.h> +int x = LC_MESSAGES;], [], + [gl_cv_header_locale_h_posix2001=yes], + [gl_cv_header_locale_h_posix2001=no])]) + + dnl Check for <xlocale.h>. + AC_CHECK_HEADERS_ONCE([xlocale.h]) + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + dnl Check whether use of locale_t requires inclusion of <xlocale.h>, + dnl e.g. on MacOS X 10.5. If <locale.h> does not define locale_t by + dnl itself, we assume that <xlocale.h> will do so. + AC_CACHE_CHECK([whether locale.h defines locale_t], + [gl_cv_header_locale_has_locale_t], + [AC_TRY_COMPILE([#include <locale.h> +locale_t x;], [], + [gl_cv_header_locale_has_locale_t=yes], + [gl_cv_header_locale_has_locale_t=no]) + ]) + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi else - gl_CHECK_NEXT_HEADERS([locale.h]) - LOCALE_H=locale.h + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no fi - AC_SUBST([LOCALE_H]) + AC_SUBST([HAVE_XLOCALE_H]) + + dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([locale.h]) + + if test -n "$STDDEF_H" \ + || test $gl_cv_header_locale_h_posix2001 = no \ + || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then + gl_REPLACE_LOCALE_H + fi + + 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 <locale.h> +/* Some systems provide declarations in a non-standard header. */ +#if HAVE_XLOCALE_H +# include <xlocale.h> +#endif + ]], [duplocale]) +]) + +dnl Unconditionally enables the replacement of <locale.h>. +AC_DEFUN([gl_REPLACE_LOCALE_H], +[ + dnl This is a no-op, because <locale.h> is always overridden. + : +]) + +AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_LOCALE_H_DEFAULTS], +[ + GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) + REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) ]) diff --git a/gnulib-m4/localename.m4 b/gnulib-m4/localename.m4 index 94e9705..9ff5eea 100644 --- a/gnulib-m4/localename.m4 +++ b/gnulib-m4/localename.m4 @@ -1,5 +1,5 @@ -# localename.m4 serial 1 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# localename.m4 serial 2 +dnl Copyright (C) 2007, 2009, 2010 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. @@ -8,5 +8,5 @@ AC_DEFUN([gl_LOCALENAME], [ AC_REQUIRE([gt_LC_MESSAGES]) AC_REQUIRE([gt_INTL_MACOSX]) - AC_CHECK_FUNCS([setlocale]) + AC_CHECK_FUNCS([setlocale uselocale]) ]) diff --git a/gnulib-m4/lock.m4 b/gnulib-m4/lock.m4 new file mode 100644 index 0000000..9da8465 --- /dev/null +++ b/gnulib-m4/lock.m4 @@ -0,0 +1,37 @@ +# lock.m4 serial 10 (gettext-0.18) +dnl Copyright (C) 2005-2010 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. + +AC_DEFUN([gl_LOCK], +[ + AC_REQUIRE([gl_THREADLIB]) + if test "$gl_threads_api" = posix; then + # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the + # pthread_rwlock_* functions. + AC_CHECK_TYPE([pthread_rwlock_t], + [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], + [Define if the POSIX multithreading library has read/write locks.])], + [], + [#include <pthread.h>]) + # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. + AC_TRY_COMPILE([#include <pthread.h>], + [#if __FreeBSD__ == 4 +error "No, in FreeBSD 4.0 recursive mutexes actually don't work." +#else +int x = (int)PTHREAD_MUTEX_RECURSIVE; +return !x; +#endif], + [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], + [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) + fi + gl_PREREQ_LOCK +]) + +# Prerequisites of lib/lock.c. +AC_DEFUN([gl_PREREQ_LOCK], [ + AC_REQUIRE([AC_C_INLINE]) +]) diff --git a/gnulib-m4/longlong.m4 b/gnulib-m4/longlong.m4 index eedc8d5..cca3c1a 100644 --- a/gnulib-m4/longlong.m4 +++ b/gnulib-m4/longlong.m4 @@ -1,5 +1,5 @@ # longlong.m4 serial 14 -dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1999-2007, 2009-2010 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. @@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], [AC_LINK_IFELSE( [_AC_TYPE_LONG_LONG_SNIPPET], [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. - dnl If cross compiling, assume the bug isn't important, since - dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include <limits.h> - @%:@ifndef LLONG_MAX - @%:@ define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - @%:@ define LLONG_MAX (HALF - 1 + HALF) - @%:@endif]], - [[long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0;]])], - [ac_cv_type_long_long_int=yes], - [ac_cv_type_long_long_int=no], - [ac_cv_type_long_long_int=yes])], + dnl If cross compiling, assume the bug isn't important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include <limits.h> + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [ac_cv_type_long_long_int=yes], + [ac_cv_type_long_long_int=no], + [ac_cv_type_long_long_int=yes])], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], [1], @@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], [ AC_LANG_PROGRAM( [[/* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; + ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; + ? 1 : -1)]; int i = 63;]], [[/* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull));]]) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) ]) diff --git a/gnulib-m4/malloc.m4 b/gnulib-m4/malloc.m4 index 8070171..910ac92 100644 --- a/gnulib-m4/malloc.m4 +++ b/gnulib-m4/malloc.m4 @@ -1,5 +1,5 @@ # malloc.m4 serial 9 -dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009, 2010 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. diff --git a/gnulib-m4/malloca.m4 b/gnulib-m4/malloca.m4 index 2841ae8..e07c6d9 100644 --- a/gnulib-m4/malloca.m4 +++ b/gnulib-m4/malloca.m4 @@ -1,5 +1,6 @@ # malloca.m4 serial 1 -dnl Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl 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. diff --git a/gnulib-m4/math_h.m4 b/gnulib-m4/math_h.m4 index d941bc3..2d89ca3 100644 --- a/gnulib-m4/math_h.m4 +++ b/gnulib-m4/math_h.m4 @@ -1,5 +1,5 @@ -# math_h.m4 serial 14 -dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +# math_h.m4 serial 21 +dnl Copyright (C) 2007-2010 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. @@ -8,6 +8,8 @@ AC_DEFUN([gl_MATH_H], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([math.h]) + AC_REQUIRE([AC_C_INLINE]) + AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], [[/* Solaris 10 has a broken definition of NAN. Other platforms @@ -15,9 +17,9 @@ AC_DEFUN([gl_MATH_H], test only needs to fail when NAN is provided but wrong. */ float f = 1.0f; #ifdef NAN - f = NAN; + f = NAN; #endif - return f == 0;]])], + return f == 0;]])], [gl_cv_header_math_nan_works=yes], [gl_cv_header_math_nan_works=no])]) if test $gl_cv_header_math_nan_works = no; then @@ -26,26 +28,39 @@ AC_DEFUN([gl_MATH_H], AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], [[/* Solaris 10 has a broken definition of HUGE_VAL. */ - double d = HUGE_VAL; - return d == 0;]])], + double d = HUGE_VAL; + return d == 0;]])], [gl_cv_header_math_huge_val_works=yes], [gl_cv_header_math_huge_val_works=no])]) if test $gl_cv_header_math_huge_val_works = no; then REPLACE_HUGE_VAL=1 fi + + 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 <math.h> + ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl + ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl]) ]) AC_DEFUN([gl_MATH_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_MATH_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_MATH_H_DEFAULTS], [ + GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) + GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) + GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) + GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) + GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) @@ -57,31 +72,53 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) - GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) + GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) + GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) + GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) + GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) + GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) + HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) + HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) + HAVE_COSL=1; AC_SUBST([HAVE_COSL]) + HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) + HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) + HAVE_SINL=1; AC_SUBST([HAVE_SINL]) + HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) + HAVE_TANL=1; AC_SUBST([HAVE_TANL]) HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) + HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) + HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) + HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) + HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) + HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) + HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) + HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) + HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) + HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) diff --git a/gnulib-m4/mbchar.m4 b/gnulib-m4/mbchar.m4 index e73e2b4..116ce7e 100644 --- a/gnulib-m4/mbchar.m4 +++ b/gnulib-m4/mbchar.m4 @@ -1,5 +1,5 @@ -# mbchar.m4 serial 7 -dnl Copyright (C) 2005-2007 Free Software Foundation, Inc. +# mbchar.m4 serial 8 +dnl Copyright (C) 2005-2007, 2009-2010 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. @@ -10,4 +10,5 @@ dnl From Bruno Haible. AC_DEFUN([gl_MBCHAR], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_C_INLINE]) ]) diff --git a/gnulib-m4/mbiter.m4 b/gnulib-m4/mbiter.m4 index 88ba569..3481050 100644 --- a/gnulib-m4/mbiter.m4 +++ b/gnulib-m4/mbiter.m4 @@ -1,5 +1,5 @@ -# mbiter.m4 serial 4 -dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc. +# mbiter.m4 serial 5 +dnl Copyright (C) 2005, 2008, 2009, 2010 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. @@ -9,6 +9,7 @@ dnl From Bruno Haible. AC_DEFUN([gl_MBITER], [ + AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) dnl The following line is that so the user can test HAVE_MBRTOWC before dnl #include "mbiter.h" or "mbuiter.h". It can be removed in 2010. diff --git a/gnulib-m4/mbrtowc.m4 b/gnulib-m4/mbrtowc.m4 index 2fddcc8..606de5c 100644 --- a/gnulib-m4/mbrtowc.m4 +++ b/gnulib-m4/mbrtowc.m4 @@ -1,5 +1,6 @@ -# mbrtowc.m4 serial 16 -dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. +# mbrtowc.m4 serial 17 +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, +dnl 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. @@ -10,38 +11,39 @@ AC_DEFUN([gl_FUNC_MBRTOWC], AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBRTOWC=1 - fi + AC_CHECK_FUNCS_ONCE([mbrtowc]) if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 - fi - if test $HAVE_MBRTOWC != 0 && test $REPLACE_MBRTOWC != 1; then - gl_MBRTOWC_NULL_ARG - gl_MBRTOWC_RETVAL - gl_MBRTOWC_NUL_RETVAL - case "$gl_cv_func_mbrtowc_null_arg" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], - [Define if the mbrtowc function has the NULL string argument bug.]) - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_retval" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], - [Define if the mbrtowc function returns a wrong return value.]) - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_nul_retval" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], - [Define if the mbrtowc function does not return 0 for a NUL character.]) - REPLACE_MBRTOWC=1 - ;; - esac + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOWC=1 + else + gl_MBRTOWC_NULL_ARG + gl_MBRTOWC_RETVAL + gl_MBRTOWC_NUL_RETVAL + case "$gl_cv_func_mbrtowc_null_arg" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], + [Define if the mbrtowc function has the NULL string argument bug.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_retval" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], + [Define if the mbrtowc function returns a wrong return value.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_nul_retval" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], + [Define if the mbrtowc function does not return 0 for a NUL character.]) + REPLACE_MBRTOWC=1 + ;; + esac + fi fi if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then gl_REPLACE_WCHAR_H diff --git a/gnulib-m4/mbsinit.m4 b/gnulib-m4/mbsinit.m4 index 03b055c..46c106f 100644 --- a/gnulib-m4/mbsinit.m4 +++ b/gnulib-m4/mbsinit.m4 @@ -1,5 +1,5 @@ -# mbsinit.m4 serial 3 -dnl Copyright (C) 2008 Free Software Foundation, Inc. +# mbsinit.m4 serial 4 +dnl Copyright (C) 2008, 2010 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. @@ -10,12 +10,14 @@ AC_DEFUN([gl_FUNC_MBSINIT], AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBSINIT=1 - fi + AC_CHECK_FUNCS_ONCE([mbsinit]) if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBSINIT=1 + fi fi if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then gl_REPLACE_WCHAR_H diff --git a/gnulib-m4/mbstate_t.m4 b/gnulib-m4/mbstate_t.m4 index d4ec6f0..3e2df29 100644 --- a/gnulib-m4/mbstate_t.m4 +++ b/gnulib-m4/mbstate_t.m4 @@ -1,5 +1,5 @@ # mbstate_t.m4 serial 12 -dnl Copyright (C) 2000-2002, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2008-2010 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. @@ -18,17 +18,17 @@ AC_DEFUN([AC_TYPE_MBSTATE_T], AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t], [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT[ -# include <wchar.h>]], - [[mbstate_t x; return sizeof x;]])], - [ac_cv_type_mbstate_t=yes], - [ac_cv_type_mbstate_t=no])]) + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT[ +# include <wchar.h>]], + [[mbstate_t x; return sizeof x;]])], + [ac_cv_type_mbstate_t=yes], + [ac_cv_type_mbstate_t=no])]) if test $ac_cv_type_mbstate_t = yes; then AC_DEFINE([HAVE_MBSTATE_T], [1], - [Define to 1 if <wchar.h> declares mbstate_t.]) + [Define to 1 if <wchar.h> declares mbstate_t.]) else AC_DEFINE([mbstate_t], [int], - [Define to a type if <wchar.h> does not define.]) + [Define to a type if <wchar.h> does not define.]) fi ]) diff --git a/gnulib-m4/memchr.m4 b/gnulib-m4/memchr.m4 index 1194bac..ab773b8 100644 --- a/gnulib-m4/memchr.m4 +++ b/gnulib-m4/memchr.m4 @@ -1,5 +1,5 @@ -# memchr.m4 serial 7 -dnl Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc. +# memchr.m4 serial 8 +dnl Copyright (C) 2002-2004, 2009-2010 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. @@ -13,12 +13,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], dnl These days, we assume memchr is present. But just in case... AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([memchr]) - if test $ac_cv_func_memchr = no; then - gl_PREREQ_MEMCHR - REPLACE_MEMCHR=1 - fi - + AC_CHECK_FUNCS_ONCE([memchr]) if test $ac_cv_func_memchr = yes; then # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 @@ -53,11 +48,11 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], { int pagesize = getpagesize (); char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - fence = two_pages + pagesize; + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; } #endif if (fence) @@ -73,10 +68,14 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], [dnl Be pessimistic for now. gl_cv_func_memchr_works="guessing no"])]) if test "$gl_cv_func_memchr_works" != yes; then - gl_PREREQ_MEMCHR REPLACE_MEMCHR=1 - AC_LIBOBJ([memchr]) fi + else + HAVE_MEMCHR=0 + fi + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + AC_LIBOBJ([memchr]) + gl_PREREQ_MEMCHR fi ]) diff --git a/gnulib-m4/minmax.m4 b/gnulib-m4/minmax.m4 index d2993fb..d9e9cec 100644 --- a/gnulib-m4/minmax.m4 +++ b/gnulib-m4/minmax.m4 @@ -1,5 +1,5 @@ # minmax.m4 serial 3 -dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009, 2010 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. diff --git a/gnulib-m4/mmap-anon.m4 b/gnulib-m4/mmap-anon.m4 index 14b6270..a6b7b9a 100644 --- a/gnulib-m4/mmap-anon.m4 +++ b/gnulib-m4/mmap-anon.m4 @@ -1,5 +1,5 @@ # mmap-anon.m4 serial 8 -dnl Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2007, 2009-2010 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. diff --git a/gnulib-m4/mode_t.m4 b/gnulib-m4/mode_t.m4 deleted file mode 100644 index a4dd694..0000000 --- a/gnulib-m4/mode_t.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# mode_t.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. - -# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and -# include <sys/types.h>. - -# Define PROMOTED_MODE_T to the type that is the result of "default argument -# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. -AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], -[ - AC_REQUIRE([AC_TYPE_MODE_T]) - AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ - dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', - dnl and to itself otherwise. This assumption is not guaranteed by the ISO C - dnl standard, but we don't know of any real-world counterexamples. - AC_TRY_COMPILE([#include <sys/types.h>], - [typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];], - [gl_cv_promoted_mode_t='int'], - [gl_cv_promoted_mode_t='mode_t']) - ]) - AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], - [Define to the type that is the result of default argument promotions of type mode_t.]) -]) diff --git a/gnulib-m4/multiarch.m4 b/gnulib-m4/multiarch.m4 index ec377ba..389bd2b 100644 --- a/gnulib-m4/multiarch.m4 +++ b/gnulib-m4/multiarch.m4 @@ -1,5 +1,5 @@ # multiarch.m4 serial 5 -dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2009, 2010 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. diff --git a/gnulib-m4/nocrash.m4 b/gnulib-m4/nocrash.m4 index 8626ea0..efbcfa6 100644 --- a/gnulib-m4/nocrash.m4 +++ b/gnulib-m4/nocrash.m4 @@ -1,5 +1,5 @@ # nocrash.m4 serial 2 -dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009, 2010 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. diff --git a/gnulib-m4/open.m4 b/gnulib-m4/open.m4 deleted file mode 100644 index c0eb8e8..0000000 --- a/gnulib-m4/open.m4 +++ /dev/null @@ -1,65 +0,0 @@ -# open.m4 serial 7 -dnl Copyright (C) 2007-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_FUNC_OPEN], -[ - AC_REQUIRE([AC_CANONICAL_HOST]) - case "$host_os" in - mingw* | pw*) - gl_REPLACE_OPEN - ;; - *) - dnl open("foo/") should not create a file when the file name has a - dnl trailing slash. - AC_CACHE_CHECK([whether open recognizes a trailing slash], - [gl_cv_func_open_slash], - [ - AC_TRY_RUN([ -#include <fcntl.h> -#if HAVE_UNISTD_H -# include <unistd.h> -#endif -int main () -{ - return open ("conftest.sl/", O_CREAT, 0600) >= 0; -}], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], - [ -changequote(,)dnl - case "$host_os" in - solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; - hpux*) gl_cv_func_open_slash="guessing no" ;; - *) gl_cv_func_open_slash="guessing yes" ;; - esac -changequote([,])dnl - ]) - rm -f conftest.sl - ]) - case "$gl_cv_func_open_slash" in - *no) - AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], - [Define to 1 if open() fails to recognize a trailing slash.]) - gl_REPLACE_OPEN - ;; - esac - ;; - esac -]) - -AC_DEFUN([gl_REPLACE_OPEN], -[ - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - REPLACE_OPEN=1 - AC_LIBOBJ([open]) - gl_PREREQ_OPEN -]) - -# Prerequisites of lib/open.c. -AC_DEFUN([gl_PREREQ_OPEN], -[ - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) - : -]) diff --git a/gnulib-m4/printf-frexp.m4 b/gnulib-m4/printf-frexp.m4 index fa0aa15..c42391a 100644 --- a/gnulib-m4/printf-frexp.m4 +++ b/gnulib-m4/printf-frexp.m4 @@ -1,5 +1,5 @@ # printf-frexp.m4 serial 3 -dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009, 2010 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. diff --git a/gnulib-m4/printf-frexpl.m4 b/gnulib-m4/printf-frexpl.m4 index f2eb200..14ffe1f 100644 --- a/gnulib-m4/printf-frexpl.m4 +++ b/gnulib-m4/printf-frexpl.m4 @@ -1,5 +1,5 @@ # printf-frexpl.m4 serial 6 -dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009, 2010 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. diff --git a/gnulib-m4/printf.m4 b/gnulib-m4/printf.m4 index 87aa45c..ebca536 100644 --- a/gnulib-m4/printf.m4 +++ b/gnulib-m4/printf.m4 @@ -1,5 +1,5 @@ # printf.m4 serial 33 -dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2010 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. diff --git a/gnulib-m4/putenv.m4 b/gnulib-m4/putenv.m4 new file mode 100644 index 0000000..dd9140c --- /dev/null +++ b/gnulib-m4/putenv.m4 @@ -0,0 +1,41 @@ +# putenv.m4 serial 16 +dnl Copyright (C) 2002-2010 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 Jim Meyering. +dnl +dnl Check whether putenv ("FOO") removes FOO from the environment. +dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that. + +AC_DEFUN([gl_FUNC_PUTENV], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_CACHE_CHECK([for putenv compatible with GNU and SVID], + [gl_cv_func_svid_putenv], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[ + /* Put it in env. */ + if (putenv ("CONFTEST_putenv=val")) + return 1; + + /* Try to remove it. */ + if (putenv ("CONFTEST_putenv")) + return 1; + + /* Make sure it was deleted. */ + if (getenv ("CONFTEST_putenv") != 0) + return 1; + + return 0; + ]])], + gl_cv_func_svid_putenv=yes, + gl_cv_func_svid_putenv=no, + dnl When crosscompiling, assume putenv is broken. + gl_cv_func_svid_putenv=no) + ]) + if test $gl_cv_func_svid_putenv = no; then + REPLACE_PUTENV=1 + AC_LIBOBJ([putenv]) + fi +]) diff --git a/gnulib-m4/relocatable-lib.m4 b/gnulib-m4/relocatable-lib.m4 index fd99cda..c192378 100644 --- a/gnulib-m4/relocatable-lib.m4 +++ b/gnulib-m4/relocatable-lib.m4 @@ -1,5 +1,5 @@ -# relocatable-lib.m4 serial 4 -dnl Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc. +# relocatable-lib.m4 serial 5 +dnl Copyright (C) 2003, 2005-2007, 2009-2010 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. @@ -27,7 +27,8 @@ AC_DEFUN([gl_RELOCATABLE_LIBRARY_BODY], [Define to the value of ${prefix}, as a string.]) if test $RELOCATABLE = yes; then AC_DEFINE([ENABLE_RELOCATABLE], [1], - [Define to 1 if the package shall run at any location in the filesystem.]) + [Define to 1 if the package shall run at any location in the file + system.]) fi ]) @@ -43,7 +44,8 @@ AC_DEFUN([gl_RELOCATABLE_NOP], [ AC_MSG_CHECKING([whether to activate relocatable installation]) AC_ARG_ENABLE([relocatable], - [ --enable-relocatable install a package that can be moved in the filesystem], + [AS_HELP_STRING([--enable-relocatable], + [install a package that can be moved in the file system])], [if test "$enableval" != no; then RELOCATABLE=yes else diff --git a/gnulib-m4/setenv.m4 b/gnulib-m4/setenv.m4 index e28407e..58f6d13 100644 --- a/gnulib-m4/setenv.m4 +++ b/gnulib-m4/setenv.m4 @@ -1,17 +1,14 @@ -# setenv.m4 serial 11 -dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. +# setenv.m4 serial 16 +dnl Copyright (C) 2001-2004, 2006-2010 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_FUNC_SETENV], [ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([setenv]) - if test $ac_cv_func_setenv = no; then - HAVE_SETENV=0 + AC_REQUIRE([gl_FUNC_SETENV_SEPARATE]) + if test $HAVE_SETENV$REPLACE_SETENV != 10; then AC_LIBOBJ([setenv]) - gl_PREREQ_SETENV fi ]) @@ -22,6 +19,25 @@ AC_DEFUN([gl_FUNC_SETENV_SEPARATE], AC_CHECK_FUNCS_ONCE([setenv]) if test $ac_cv_func_setenv = no; then HAVE_SETENV=0 + else + AC_CACHE_CHECK([whether setenv validates arguments], + [gl_cv_func_setenv_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + #include <stdlib.h> + #include <errno.h> + #include <string.h> + ]], [[ + if (setenv ("", "", 0) != -1) return 1; + if (errno != EINVAL) return 2; + if (setenv ("a", "=", 1) != 0) return 3; + if (strcmp (getenv ("a"), "=") != 0) return 4; + ]])], + [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], + [gl_cv_func_setenv_works="guessing no"])]) + if test "$gl_cv_func_setenv_works" != yes; then + REPLACE_SETENV=1 + AC_LIBOBJ([setenv]) + fi fi gl_PREREQ_SETENV ]) @@ -35,6 +51,7 @@ AC_DEFUN([gl_FUNC_UNSETENV], AC_LIBOBJ([unsetenv]) gl_PREREQ_UNSETENV else + dnl Some BSDs return void, failing to do error checking. AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret], [AC_TRY_COMPILE([#include <stdlib.h> extern @@ -48,7 +65,30 @@ int unsetenv(); #endif ], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')]) if test $gt_cv_func_unsetenv_ret = 'void'; then - VOID_UNSETENV=1 + AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void + instead of int.]) + REPLACE_UNSETENV=1 + AC_LIBOBJ([unsetenv]) + fi + + dnl Solaris 10 unsetenv does not remove all copies of a name. + AC_CACHE_CHECK([whether unsetenv works on duplicates], + [gl_cv_func_unsetenv_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + #include <stdlib.h> + ]], [[ + char entry[] = "b=2"; + if (putenv ((char *) "a=1")) return 1; + if (putenv (entry)) return 2; + entry[0] = 'a'; + unsetenv ("a"); + if (getenv ("a")) return 3; + ]])], + [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no], + [gl_cv_func_unsetenv_works="guessing no"])]) + if test "$gl_cv_func_unsetenv_works" != yes; then + REPLACE_UNSETENV=1 + AC_LIBOBJ([unsetenv]) fi fi ]) diff --git a/gnulib-m4/signbit.m4 b/gnulib-m4/signbit.m4 index 233bf2a..56ff825 100644 --- a/gnulib-m4/signbit.m4 +++ b/gnulib-m4/signbit.m4 @@ -1,5 +1,5 @@ # signbit.m4 serial 6 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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. diff --git a/gnulib-m4/size_max.m4 b/gnulib-m4/size_max.m4 index 35bd3d6..ce992db 100644 --- a/gnulib-m4/size_max.m4 +++ b/gnulib-m4/size_max.m4 @@ -1,5 +1,5 @@ # size_max.m4 serial 9 -dnl Copyright (C) 2003, 2005-2006, 2008-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2006, 2008-2010 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. diff --git a/gnulib-m4/stdbool.m4 b/gnulib-m4/stdbool.m4 index 57c804a..3d672d7 100644 --- a/gnulib-m4/stdbool.m4 +++ b/gnulib-m4/stdbool.m4 @@ -1,6 +1,6 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2010 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. @@ -38,77 +38,77 @@ AC_DEFUN([AC_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], [AC_TRY_COMPILE( - [ - #include <stdbool.h> - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif + [ + #include <stdbool.h> + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif - struct s { _Bool s: 1; _Bool t; } s; + struct s { _Bool s: 1; _Bool t; } s; - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - #if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a run-time - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); - #endif - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - ], - [ - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - ], - [ac_cv_header_stdbool_h=yes], - [ac_cv_header_stdbool_h=no])]) + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + #if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a run-time + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); + #endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + ], + [ + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ], + [ac_cv_header_stdbool_h=yes], + [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) if test $ac_cv_header_stdbool_h = yes; then AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.]) diff --git a/gnulib-m4/stddef_h.m4 b/gnulib-m4/stddef_h.m4 index 682e9c6..c3ae569 100644 --- a/gnulib-m4/stddef_h.m4 +++ b/gnulib-m4/stddef_h.m4 @@ -1,6 +1,6 @@ dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. -# stddef_h.m4 serial 1 -dnl Copyright (C) 2009 Free Software Foundation, Inc. +# stddef_h.m4 serial 2 +dnl Copyright (C) 2009, 2010 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. @@ -33,7 +33,7 @@ AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) AC_DEFUN([gl_STDDEF_H_DEFAULTS], diff --git a/gnulib-m4/stdint.m4 b/gnulib-m4/stdint.m4 index a2e8bdd..1cc57e6 100644 --- a/gnulib-m4/stdint.m4 +++ b/gnulib-m4/stdint.m4 @@ -1,5 +1,5 @@ # stdint.m4 serial 34 -dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2010 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. @@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac AC_COMPILE_IFELSE( diff --git a/gnulib-m4/stdint_h.m4 b/gnulib-m4/stdint_h.m4 index 82f0c24..b8e3c6c 100644 --- a/gnulib-m4/stdint_h.m4 +++ b/gnulib-m4/stdint_h.m4 @@ -1,5 +1,5 @@ # stdint_h.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2010 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. diff --git a/gnulib-m4/stdlib_h.m4 b/gnulib-m4/stdlib_h.m4 index b295f16..dd84796 100644 --- a/gnulib-m4/stdlib_h.m4 +++ b/gnulib-m4/stdlib_h.m4 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 15 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# stdlib_h.m4 serial 28 +dnl Copyright (C) 2007-2010 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. @@ -22,41 +22,75 @@ AC_DEFUN([gl_STDLIB_H], # include <random.h> #endif ]]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> +#if HAVE_SYS_LOADAVG_H +# include <sys/loadavg.h> +#endif +#if HAVE_RANDOM_H +# include <random.h> +#endif + ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp + mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r + setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt + unsetenv]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ - GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) - GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) - GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) + GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) + GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) + GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) + GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) + HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) + HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) - HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) + HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) + HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) + HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) + HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) + HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) + HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) + HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) @@ -64,10 +98,13 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) + HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) - HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) + REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) + REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) - VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) + REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) ]) diff --git a/gnulib-m4/strerror.m4 b/gnulib-m4/strerror.m4 index 8c16ca9..1649b24 100644 --- a/gnulib-m4/strerror.m4 +++ b/gnulib-m4/strerror.m4 @@ -1,5 +1,5 @@ # strerror.m4 serial 9 -dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2007-2010 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. diff --git a/gnulib-m4/string_h.m4 b/gnulib-m4/string_h.m4 index 11f09c8..1977aec 100644 --- a/gnulib-m4/string_h.m4 +++ b/gnulib-m4/string_h.m4 @@ -1,11 +1,11 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2007-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 7 +# serial 17 # Written by Paul Eggert. @@ -21,13 +21,24 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([string.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <string.h> + ]], + [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup + strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal + strverscmp]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], @@ -41,6 +52,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) + GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) @@ -64,31 +76,37 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) - GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) + GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) + HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) - HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) - HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) - HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) - HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) - HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) - HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) - HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) - HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP]) - HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) - HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) - HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) - HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) - HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) - HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) - HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) - HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) - HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) - REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) - REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) - REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) - REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) - REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) - REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) - REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) + HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) + HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) + HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) + REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) + REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) + REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) + UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) diff --git a/gnulib-m4/strncat.m4 b/gnulib-m4/strncat.m4 new file mode 100644 index 0000000..e4ff70e --- /dev/null +++ b/gnulib-m4/strncat.m4 @@ -0,0 +1,106 @@ +# strncat.m4 serial 1 +dnl Copyright (C) 2002-2004, 2009-2010 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_ONCE([gl_FUNC_STRNCAT], +[ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Check for prerequisites for memory fence checks. + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + + dnl Detect bug in Solaris 8..10 on SPARC: + dnl strncat should not dereference more than n bytes, but always dereferences + dnl n+1 bytes if the first n bytes don't contain a NUL byte. + dnl Assume that strncat works on platforms that lack mprotect. + AC_CACHE_CHECK([whether strncat works], [gl_cv_func_strncat_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <string.h> +#if HAVE_SYS_MMAN_H +# include <fcntl.h> +# include <unistd.h> +# include <sys/types.h> +# include <sys/mman.h> +# ifndef MAP_FILE +# define MAP_FILE 0 +# endif +#endif +]], [[ + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT +# if HAVE_MAP_ANONYMOUS + const int flags = MAP_ANONYMOUS | MAP_PRIVATE; + const int fd = -1; +# else /* !HAVE_MAP_ANONYMOUS */ + const int flags = MAP_FILE | MAP_PRIVATE; + int fd = open ("/dev/zero", O_RDONLY, 0666); + if (fd >= 0) +# endif + { + int pagesize = getpagesize (); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + char dest[8]; + + dest[0] = '*'; + dest[1] = 'a'; + dest[2] = '\0'; + dest[3] = 'w'; + dest[4] = 'x'; + dest[5] = 'y'; + dest[6] = 'z'; + + *(fence - 3) = '7'; + *(fence - 2) = '2'; + *(fence - 1) = '9'; + + if (strncat (dest + 1, fence - 3, 3) != dest + 1) + return 1; + if (dest[0] != '*') + return 2; + if (dest[1] != 'a' + || dest[2] != '7' || dest[3] != '2' || dest[4] != '9' + || dest[5] != '\0') + return 3; + if (dest[6] != 'z') + return 4; + } + return 0; +]])], [gl_cv_func_strncat_works=yes], [gl_cv_func_strncat_works=no], + [ + case "$host_os" in + # Guess no on Solaris. + solaris*) gl_cv_func_strncat_works="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_strncat_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_strncat_works" in + *yes) ;; + *) + REPLACE_STRNCAT=1 + AC_LIBOBJ([strncat]) + gl_PREREQ_STRNCAT + ;; + esac +]) + +# Prerequisites of lib/strncat.c. +AC_DEFUN([gl_PREREQ_STRNCAT], [ + : +]) diff --git a/gnulib-m4/thread.m4 b/gnulib-m4/thread.m4 new file mode 100644 index 0000000..8e79075 --- /dev/null +++ b/gnulib-m4/thread.m4 @@ -0,0 +1,18 @@ +# thread.m4 serial 2 +dnl Copyright (C) 2008, 2009, 2010 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_THREAD], +[ + AC_REQUIRE([gl_THREADLIB]) + AC_REQUIRE([AC_C_INLINE]) + + if test $gl_threads_api = posix; then + gl_save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_CHECK_FUNCS([pthread_atfork]) + LIBS="$gl_save_LIBS" + fi +]) diff --git a/gnulib-m4/threadlib.m4 b/gnulib-m4/threadlib.m4 new file mode 100644 index 0000000..05cc4ff --- /dev/null +++ b/gnulib-m4/threadlib.m4 @@ -0,0 +1,347 @@ +# threadlib.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 2005-2010 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 gl_THREADLIB +dnl ------------ +dnl Tests for a multithreading library to be used. +dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, +dnl USE_PTH_THREADS, USE_WIN32_THREADS +dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use +dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with +dnl libtool). +dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for +dnl programs that really need multithread functionality. The difference +dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak +dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread". +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. + +AC_DEFUN([gl_THREADLIB_EARLY], +[ + AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) +]) + +dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once. + +AC_DEFUN([gl_THREADLIB_EARLY_BODY], +[ + dnl Ordering constraints: This macro modifies CPPFLAGS in a way that + dnl influences the result of the autoconf tests that test for *_unlocked + dnl declarations, on AIX 5 at least. Therefore it must come early. + AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl + AC_BEFORE([$0], [gl_ARGP])dnl + + AC_REQUIRE([AC_CANONICAL_HOST]) + dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. + dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes + dnl AC_GNU_SOURCE. + m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], + [AC_REQUIRE([AC_GNU_SOURCE])]) + dnl Check for multithreading. + m4_divert_text([DEFAULTS], [gl_use_threads_default=]) + AC_ARG_ENABLE([threads], +AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) +AC_HELP_STRING([--disable-threads], [build without multithread safety]), + [gl_use_threads=$enableval], + [if test -n "$gl_use_threads_default"; then + gl_use_threads="$gl_use_threads_default" + else +changequote(,)dnl + case "$host_os" in + dnl Disable multithreading by default on OSF/1, because it interferes + dnl with fork()/exec(): When msgexec is linked with -lpthread, its + dnl child process gets an endless segmentation fault inside execvp(). + dnl Disable multithreading by default on Cygwin 1.5.x, because it has + dnl bugs that lead to endless loops or crashes. See + dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>. + osf*) gl_use_threads=no ;; + cygwin*) + case `uname -r` in + 1.[0-5].*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + ;; + *) gl_use_threads=yes ;; + esac +changequote([,])dnl + fi + ]) + if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + # For using <pthread.h>: + case "$host_os" in + osf*) + # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + # groks <pthread.h>. cc also understands the flag -pthread, but + # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # 2. putting a flag into CPPFLAGS that has an effect on the linker + # causes the AC_TRY_LINK test below to succeed unexpectedly, + # leading to wrong values of LIBTHREAD and LTLIBTHREAD. + CPPFLAGS="$CPPFLAGS -D_REENTRANT" + ;; + esac + # Some systems optimize for single-threaded programs by default, and + # need special flags to disable these optimizations. For example, the + # definition of 'errno' in <errno.h>. + case "$host_os" in + aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; + solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; + esac + fi +]) + +dnl The guts of gl_THREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_THREADLIB_BODY], +[ + AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) + gl_threads_api=none + LIBTHREAD= + LTLIBTHREAD= + LIBMULTITHREAD= + LTLIBMULTITHREAD= + if test "$gl_use_threads" != no; then + dnl Check whether the compiler and linker support weak declarations. + AC_CACHE_CHECK([whether imported symbols can be declared weak], + [gl_cv_have_weak], + [gl_cv_have_weak=no + dnl First, test whether the compiler accepts it syntactically. + AC_TRY_LINK([extern void xyzzy (); +#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe]) + if test $gl_cv_have_weak = maybe; then + dnl Second, test whether it actually works. On Cygwin 1.7.2, with + dnl gcc 4.3, symbols declared weak always evaluate to the address 0. + AC_TRY_RUN([ +#include <stdio.h> +#pragma weak fputs +int main () +{ + return (fputs == NULL); +}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no], + [dnl When cross-compiling, assume that only ELF platforms support + dnl weak symbols. + AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_have_weak="guessing yes"], + [gl_cv_have_weak="guessing no"]) + ]) + fi + ]) + if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. + AC_CHECK_HEADER([pthread.h], + [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + gl_have_pthread= + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + AC_TRY_LINK([#include <pthread.h>], + [pthread_mutex_lock((pthread_mutex_t*)0); + pthread_mutexattr_init((pthread_mutexattr_t*)0);], + [gl_have_pthread=yes]) + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test -n "$gl_have_pthread"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + AC_CHECK_LIB([pthread], [pthread_kill], + [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + case "$host_os" in + solaris* | hpux*) + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + esac + ]) + else + # Some library is needed. Try libpthread and libc_r. + AC_CHECK_LIB([pthread], [pthread_kill], + [gl_have_pthread=yes + LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread + LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) + if test -z "$gl_have_pthread"; then + # For FreeBSD 4. + AC_CHECK_LIB([c_r], [pthread_kill], + [gl_have_pthread=yes + LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r + LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) + fi + fi + if test -n "$gl_have_pthread"; then + gl_threads_api=posix + AC_DEFINE([USE_POSIX_THREADS], [1], + [Define if the POSIX multithreading library can be used.]) + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], + [Define if references to the POSIX multithreading library should be made weak.]) + LIBTHREAD= + LTLIBTHREAD= + fi + fi + fi + fi + fi + if test -z "$gl_have_pthread"; then + if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then + gl_have_solaristhread= + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lthread" + AC_TRY_LINK([#include <thread.h> +#include <synch.h>], + [thr_self();], + [gl_have_solaristhread=yes]) + LIBS="$gl_save_LIBS" + if test -n "$gl_have_solaristhread"; then + gl_threads_api=solaris + LIBTHREAD=-lthread + LTLIBTHREAD=-lthread + LIBMULTITHREAD="$LIBTHREAD" + LTLIBMULTITHREAD="$LTLIBTHREAD" + AC_DEFINE([USE_SOLARIS_THREADS], [1], + [Define if the old Solaris multithreading library can be used.]) + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], + [Define if references to the old Solaris multithreading library should be made weak.]) + LIBTHREAD= + LTLIBTHREAD= + fi + fi + fi + fi + if test "$gl_use_threads" = pth; then + gl_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_LINKFLAGS([pth]) + gl_have_pth= + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lpth" + AC_TRY_LINK([#include <pth.h>], [pth_self();], [gl_have_pth=yes]) + LIBS="$gl_save_LIBS" + if test -n "$gl_have_pth"; then + gl_threads_api=pth + LIBTHREAD="$LIBPTH" + LTLIBTHREAD="$LTLIBPTH" + LIBMULTITHREAD="$LIBTHREAD" + LTLIBMULTITHREAD="$LTLIBTHREAD" + AC_DEFINE([USE_PTH_THREADS], [1], + [Define if the GNU Pth multithreading library can be used.]) + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + AC_DEFINE([USE_PTH_THREADS_WEAK], [1], + [Define if references to the GNU Pth multithreading library should be made weak.]) + LIBTHREAD= + LTLIBTHREAD= + fi + fi + else + CPPFLAGS="$gl_save_CPPFLAGS" + fi + fi + if test -z "$gl_have_pthread"; then + if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=win32 + AC_DEFINE([USE_WIN32_THREADS], [1], + [Define if the Win32 multithreading API can be used.]) + fi + fi + fi + fi + AC_MSG_CHECKING([for multithread API to use]) + AC_MSG_RESULT([$gl_threads_api]) + AC_SUBST([LIBTHREAD]) + AC_SUBST([LTLIBTHREAD]) + AC_SUBST([LIBMULTITHREAD]) + AC_SUBST([LTLIBMULTITHREAD]) +]) + +AC_DEFUN([gl_THREADLIB], +[ + AC_REQUIRE([gl_THREADLIB_EARLY]) + AC_REQUIRE([gl_THREADLIB_BODY]) +]) + + +dnl gl_DISABLE_THREADS +dnl ------------------ +dnl Sets the gl_THREADLIB default so that threads are not used by default. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_DISABLE_THREADS], [ + m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) +]) + + +dnl Survey of platforms: +dnl +dnl Platform Available Compiler Supports test-lock +dnl flavours option weak result +dnl --------------- --------- --------- -------- --------- +dnl Linux 2.4/glibc posix -lpthread Y OK +dnl +dnl GNU Hurd/glibc posix +dnl +dnl FreeBSD 5.3 posix -lc_r Y +dnl posix -lkse ? Y +dnl posix -lpthread ? Y +dnl posix -lthr Y +dnl +dnl FreeBSD 5.2 posix -lc_r Y +dnl posix -lkse Y +dnl posix -lthr Y +dnl +dnl FreeBSD 4.0,4.10 posix -lc_r Y OK +dnl +dnl NetBSD 1.6 -- +dnl +dnl OpenBSD 3.4 posix -lpthread Y OK +dnl +dnl MacOS X 10.[123] posix -lpthread Y OK +dnl +dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK +dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK +dnl +dnl HP-UX 11 posix -lpthread N (cc) OK +dnl Y (gcc) +dnl +dnl IRIX 6.5 posix -lpthread Y 0.5 +dnl +dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK +dnl +dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK +dnl -lpthread (gcc) Y +dnl +dnl Cygwin posix -lpthread Y OK +dnl +dnl Any of the above pth -lpth 0.0 +dnl +dnl Mingw win32 N OK +dnl +dnl BeOS 5 -- +dnl +dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is +dnl turned off: +dnl OK if all three tests terminate OK, +dnl 0.5 if the first test terminates OK but the second one loops endlessly, +dnl 0.0 if the first test already loops endlessly. diff --git a/gnulib-m4/unistd_h.m4 b/gnulib-m4/unistd_h.m4 index d7a89e1..b26d0a9 100644 --- a/gnulib-m4/unistd_h.m4 +++ b/gnulib-m4/unistd_h.m4 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 19 -dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. +# unistd_h.m4 serial 46 +dnl Copyright (C) 2006-2010 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. @@ -11,6 +11,7 @@ AC_DEFUN([gl_UNISTD_H], dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) @@ -21,13 +22,33 @@ AC_DEFUN([gl_UNISTD_H], HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_UNISTD_H]) + + 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 <unistd.h> +/* Some systems declare various items in the wrong headers. */ +#ifndef __GLIBC__ +# include <fcntl.h> +# include <stdio.h> +# include <stdlib.h> +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include <io.h> +# endif +#endif + ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat + fsync ftruncate getcwd getdomainname getdtablesize getgroups + gethostname getlogin getlogin_r getpagesize getusershell setusershell + endusershell lchown link linkat lseek pipe2 pread readlink readlinkat + rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_UNISTD_H_DEFAULTS], @@ -35,51 +56,98 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) + GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) + GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) + GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) + GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) + GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) + GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) + GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) + GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) + GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) + GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) + HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) + HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) + HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) + HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) + HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) - HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) + HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) + HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) + HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) + HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) + HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) + HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R]) + HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) + HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) + HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) + REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) - REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) + REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) + REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) + REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) + REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) + REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) + REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) + REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) + REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) + REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; diff --git a/gnulib-m4/vasnprintf.m4 b/gnulib-m4/vasnprintf.m4 index 3a1d1e0..ebe3c52 100644 --- a/gnulib-m4/vasnprintf.m4 +++ b/gnulib-m4/vasnprintf.m4 @@ -1,5 +1,5 @@ -# vasnprintf.m4 serial 29 -dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc. +# vasnprintf.m4 serial 31 +dnl Copyright (C) 2002-2004, 2006-2010 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. @@ -54,6 +54,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], # Prerequisites of lib/vasnprintf.c. AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], [ + AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) @@ -62,6 +63,17 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) + dnl We can avoid a lot of code by assuming that snprintf's return value + dnl conforms to ISO C99. So check that. + AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1], + [Define if the return value of the snprintf function is the number of + of bytes (excluding the terminating NUL) that would have been produced + if the buffer had been large enough.]) + ;; + esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' diff --git a/gnulib-m4/warn-on-use.m4 b/gnulib-m4/warn-on-use.m4 new file mode 100644 index 0000000..42daae8 --- /dev/null +++ b/gnulib-m4/warn-on-use.m4 @@ -0,0 +1,45 @@ +# warn-on-use.m4 serial 2 +dnl Copyright (C) 2010 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. + +# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) +# --------------------------------------- +# For each whitespace-separated element in the list of NAMES, define +# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES +# even after being undefined as a macro. +# +# See warn-on-use.h for some hints on how to poison function names, as +# well as ideas on poisoning global variables and macros. NAMES may +# include global variables, but remember that only functions work with +# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single +# header, but if the replacement header pulls in other headers because +# some systems declare functions in the wrong header, then INCLUDES +# should do likewise. +# +# If you assume C89, then it is generally safe to assume declarations +# for functions declared in that standard (such as gets) without +# needing gl_WARN_ON_USE_PREPARE. +AC_DEFUN([gl_WARN_ON_USE_PREPARE], +[ + m4_foreach_w([gl_decl], [$2], + [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), + [Define to 1 if ]m4_defn([gl_decl])[ is declared even after + undefining macros.])])dnl + for gl_func in m4_flatten([$2]); do + AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl + AC_CACHE_CHECK([whether $gl_func is declared without a macro], + gl_Symbol, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], +[@%:@undef $gl_func + (void) $gl_func;])], + [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) + AS_VAR_IF(gl_Symbol, [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + dnl shortcut - if the raw declaration exists, then set a cache + dnl variable to allow skipping any later AC_CHECK_DECL efforts + eval ac_cv_have_decl_$gl_func=yes]) + AS_VAR_POPDEF([gl_Symbol])dnl + done +]) diff --git a/gnulib-m4/wchar.m4 b/gnulib-m4/wchar_h.m4 index ce53a45..8cae82d 100644 --- a/gnulib-m4/wchar.m4 +++ b/gnulib-m4/wchar_h.m4 @@ -1,23 +1,30 @@ dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2010 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 Written by Eric Blake. -# wchar.m4 serial 25 +# wchar_h.m4 serial 33 AC_DEFUN([gl_WCHAR_H], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - AC_CACHE_CHECK([whether <wchar.h> is standalone], - [gl_cv_header_wchar_h_standalone], - [AC_COMPILE_IFELSE([[#include <wchar.h> -wchar_t w;]], - [gl_cv_header_wchar_h_standalone=yes], - [gl_cv_header_wchar_h_standalone=no])]) + AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) + dnl Prepare for creating substitute <wchar.h>. + dnl Check for <wchar.h> (missing in Linux uClibc when built without wide + dnl character support). + dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. + AC_CHECK_HEADERS_ONCE([wchar.h]) + gl_CHECK_NEXT_HEADERS([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then @@ -27,39 +34,82 @@ wchar_t w;]], fi AC_SUBST([HAVE_WINT_T]) - dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced. - AC_REQUIRE([gl_STDDEF_H]) - - if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then - WCHAR_H=wchar.h - fi + 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([[ +/* Some systems require additional headers. */ +#ifndef __GLIBC__ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +#endif +#include <wchar.h> + ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb + wcsrtombs wcsnrtombs wcwidth]) +]) - dnl Prepare for creating substitute <wchar.h>. - dnl Do it always: WCHAR_H may be empty here but can be set later. - dnl Check for <wchar.h> (missing in Linux uClibc when built without wide - dnl character support). - AC_CHECK_HEADERS_ONCE([wchar.h]) - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 +dnl Check whether <wchar.h> is usable at all. +AC_DEFUN([gl_WCHAR_H_INLINE_OK], +[ + dnl Test whether <wchar.h> suffers due to the transition from '__inline' to + dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022> + dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, + dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and + dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. + AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], + [gl_cv_header_wchar_h_correct_inline], + [gl_cv_header_wchar_h_correct_inline=yes + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[#define wcstod renamed_wcstod +#include <wchar.h> +extern int zero (void); +int main () { return zero(); } +]])]) + if AC_TRY_EVAL([ac_compile]); then + mv conftest.$ac_objext conftest1.$ac_objext + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[#define wcstod renamed_wcstod +#include <wchar.h> +int zero (void) { return 0; } +]])]) + if AC_TRY_EVAL([ac_compile]); then + mv conftest.$ac_objext conftest2.$ac_objext + if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then + : + else + gl_cv_header_wchar_h_correct_inline=no + fi + fi + fi + rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext + ]) + if test $gl_cv_header_wchar_h_correct_inline = no; then + AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). +This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in +C99 mode. You have four options: + - Add the flag -fgnu89-inline to CC and reconfigure, or + - Fix your include files, using parts of + <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or + - Use a gcc version older than 4.3, or + - Don't use the flags -std=c99 or -std=gnu99. +Configuration aborted.]) fi - AC_SUBST([HAVE_WCHAR_H]) - gl_CHECK_NEXT_HEADERS([wchar.h]) ]) dnl Unconditionally enables the replacement of <wchar.h>. AC_DEFUN([gl_REPLACE_WCHAR_H], [ - AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - WCHAR_H=wchar.h + dnl This is a no-op, because <wchar.h> is always overridden. + : ]) AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_WCHAR_H_DEFAULTS], @@ -99,5 +149,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) - WCHAR_H=''; AC_SUBST([WCHAR_H]) ]) diff --git a/gnulib-m4/wchar_t.m4 b/gnulib-m4/wchar_t.m4 index fb27a7f..ed804e6 100644 --- a/gnulib-m4/wchar_t.m4 +++ b/gnulib-m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 3 (gettext-0.18) -dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2010 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. diff --git a/gnulib-m4/wctob.m4 b/gnulib-m4/wctob.m4 index 39270c9..3af3cc7 100644 --- a/gnulib-m4/wctob.m4 +++ b/gnulib-m4/wctob.m4 @@ -1,5 +1,5 @@ -# wctob.m4 serial 4 -dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. +# wctob.m4 serial 5 +dnl Copyright (C) 2008-2010 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. @@ -17,6 +17,8 @@ AC_DEFUN([gl_FUNC_WCTOB], else dnl Solaris 9 has the wctob() function but it does not work. + dnl Cygwin 1.7.2 has the wctob() function but it clobbers caller-owned + dnl registers, see <http://cygwin.com/ml/cygwin/2010-05/msg00015.html>. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -27,14 +29,35 @@ AC_DEFUN([gl_FUNC_WCTOB], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on Solaris <= 9. - solaris2.[1-9] | solaris2.[1-9].*) + # Guess no on Solaris <= 9 and Cygwin. + solaris2.[1-9] | solaris2.[1-9].* | cygwin*) gl_cv_func_wctob_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_wctob_works="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR != none; then + case "$host_os" in + cygwin*) + AC_TRY_RUN([ +#include <locale.h> +#include <wchar.h> + +register long global __asm__ ("%ebx"); + +int main () +{ + setlocale (LC_ALL, "en_US.UTF-8"); + + global = 0x12345678; + if (wctob (0x00FC) != -1) + return 1; + if (global != 0x12345678) + return 2; + return 0; +}], [:], [gl_cv_func_wctob_works=no], [:]) + ;; + esac + if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then AC_TRY_RUN([ #include <locale.h> #include <string.h> diff --git a/gnulib-m4/wctype.m4 b/gnulib-m4/wctype_h.m4 index 6a1b6f0..3292451 100644 --- a/gnulib-m4/wctype.m4 +++ b/gnulib-m4/wctype_h.m4 @@ -1,8 +1,8 @@ -# wctype.m4 serial 2 +# wctype_h.m4 serial 6 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. -dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2010 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. @@ -12,6 +12,7 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_WCTYPE_H], [ AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([iswcntrl]) if test $ac_cv_func_iswcntrl = yes; then HAVE_ISWCNTRL=1 @@ -19,6 +20,13 @@ AC_DEFUN([gl_WCTYPE_H], HAVE_ISWCNTRL=0 fi AC_SUBST([HAVE_ISWCNTRL]) + AC_CHECK_FUNCS_ONCE([iswblank]) + if test $ac_cv_func_iswblank = yes; then + HAVE_ISWBLANK=1 + else + HAVE_ISWBLANK=0 + fi + AC_SUBST([HAVE_ISWBLANK]) AC_CHECK_HEADERS_ONCE([wctype.h]) AC_REQUIRE([AC_C_INLINE]) @@ -30,40 +38,34 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WINT_T]) - WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then dnl Linux libc5 has an iswprint function that returns 0 for all arguments. dnl The other functions are likely broken in the same way. AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], [ - AC_TRY_RUN([#include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> - #include <wctype.h> - int main () { return iswprint ('x') == 0; }], + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <stddef.h> + #include <stdio.h> + #include <time.h> + #include <wchar.h> + #include <wctype.h> + int main () { return iswprint ('x') == 0; }]])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], - [AC_TRY_COMPILE([#include <stdlib.h> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. - #endif], [], + #endif]], [])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) ]) ]) - if test $gl_cv_func_iswcntrl_works = yes; then - WCTYPE_H= - fi fi - dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, - dnl for the benefit of builds from non-distclean directories. gl_CHECK_NEXT_HEADERS([wctype.h]) HAVE_WCTYPE_H=1 else HAVE_WCTYPE_H=0 fi AC_SUBST([HAVE_WCTYPE_H]) - AC_SUBST([WCTYPE_H]) if test "$gl_cv_func_iswcntrl_works" = no; then REPLACE_ISWCNTRL=1 diff --git a/gnulib-m4/wcwidth.m4 b/gnulib-m4/wcwidth.m4 index 9cacb56..acceba5 100644 --- a/gnulib-m4/wcwidth.m4 +++ b/gnulib-m4/wcwidth.m4 @@ -1,5 +1,5 @@ -# wcwidth.m4 serial 15 -dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. +# wcwidth.m4 serial 16 +dnl Copyright (C) 2006-2010 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. @@ -34,9 +34,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH], HAVE_DECL_WCWIDTH=0 fi - if test $ac_cv_func_wcwidth = no; then - REPLACE_WCWIDTH=1 - else + if test $ac_cv_func_wcwidth = yes; then dnl On MacOS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. dnl This leads to bugs in 'ls' (coreutils). @@ -84,11 +82,13 @@ changequote([,])dnl *no) REPLACE_WCWIDTH=1 ;; esac fi - if test $REPLACE_WCWIDTH = 1; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1; then AC_LIBOBJ([wcwidth]) fi - - if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1 \ + || test $HAVE_DECL_WCWIDTH = 0; then gl_REPLACE_WCHAR_H fi + dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not + dnl have the wcwidth function, then it does not declare it. ]) diff --git a/gnulib-m4/wint_t.m4 b/gnulib-m4/wint_t.m4 index 47a4363..a6c7d15 100644 --- a/gnulib-m4/wint_t.m4 +++ b/gnulib-m4/wint_t.m4 @@ -1,5 +1,5 @@ # wint_t.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2010 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. diff --git a/gnulib-m4/xalloc.m4 b/gnulib-m4/xalloc.m4 index 837a948..83247fe 100644 --- a/gnulib-m4/xalloc.m4 +++ b/gnulib-m4/xalloc.m4 @@ -1,5 +1,6 @@ # xalloc.m4 serial 16 -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software +dnl 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. diff --git a/gnulib-m4/xsize.m4 b/gnulib-m4/xsize.m4 index 631893c..b653693 100644 --- a/gnulib-m4/xsize.m4 +++ b/gnulib-m4/xsize.m4 @@ -1,5 +1,5 @@ # xsize.m4 serial 4 -dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 2008-2010 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. diff --git a/gnulib-m4/yield.m4 b/gnulib-m4/yield.m4 new file mode 100644 index 0000000..7a543e4 --- /dev/null +++ b/gnulib-m4/yield.m4 @@ -0,0 +1,19 @@ +# yield.m4 serial 2 +dnl Copyright (C) 2005-2010 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_YIELD], +[ + AC_REQUIRE([gl_THREADLIB]) + dnl On some systems, sched_yield is in librt, rather than in libpthread. + YIELD_LIB= + if test $gl_threads_api = posix; then + dnl Solaris has sched_yield in librt, not in libpthread or libc. + AC_CHECK_LIB([rt], [sched_yield], [YIELD_LIB=-lrt], + [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. + AC_CHECK_LIB([posix4], [sched_yield], [YIELD_LIB=-lposix4])]) + fi + AC_SUBST([YIELD_LIB]) +]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 2c8da9d..ffbfae2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,5 @@ ## Makefile for the lib subdirectory of GNU libunistring. -## Copyright (C) 2009 Free Software Foundation, Inc. +## Copyright (C) 2009-2010 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 @@ -155,6 +155,20 @@ CLEANFILES += unistring/iconveh.h # unistring/version.h is public. nobase_nodist_include_HEADERS += unistring/version.h +# unistring/cdefs.h is not public, but is included by other header files. +nobase_nodist_include_HEADERS += unistring/cdefs.h +unistring/cdefs.h : unistring/cdefs.in.h + @MKDIR_P@ unistring + rm -f $@-t $@ + sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \ + < $(srcdir)/unistring/cdefs.in.h \ + > $@-t + mv $@-t $@ +BUILT_SOURCES += unistring/cdefs.h +MOSTLYCLEANFILES += unistring/cdefs.h-t +CLEANFILES += unistring/cdefs.h +EXTRA_DIST += unistring/cdefs.in.h + # unistring/woe32dll.h is not public, but is included by other header files. nobase_nodist_include_HEADERS += unistring/woe32dll.h @@ -288,7 +302,7 @@ AM_CPPFLAGS += -DDEPENDS_ON_LIBICONV=1 # Libtool's library version information for libunistring. # See the libtool documentation, section "Library interface versions". LTV_CURRENT=1 -LTV_REVISION=0 +LTV_REVISION=2 LTV_AGE=1 # How to build libunistring.la. diff --git a/lib/Makefile.gnulib b/lib/Makefile.gnulib index 735befa..3c3c6f5 100644 --- a/lib/Makefile.gnulib +++ b/lib/Makefile.gnulib @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -27,9 +27,10 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create <alloca.h> when the system # doesn't have one that works with the given compiler. alloca.h: alloca.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca.in.h; \ - } > $@-t + } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t @@ -37,6 +38,30 @@ EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt +## begin gnulib module arg-nonnull + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += arg-nonnull.h +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/arg-nonnull.h, except that it has the copyright header cut off. +arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t + +ARG_NONNULL_H=arg-nonnull.h + +EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h + +## end gnulib module arg-nonnull + ## begin gnulib module array-mergesort @@ -44,6 +69,30 @@ EXTRA_DIST += array-mergesort.h ## end gnulib module array-mergesort +## begin gnulib module c++defs + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += c++defs.h +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/c++defs.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += c++defs.h c++defs.h-t + +CXXDEFS_H=c++defs.h + +EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h + +## end gnulib module c++defs + ## begin gnulib module c-ctype libunistring_la_SOURCES += c-ctype.h c-ctype.c @@ -83,7 +132,7 @@ EXTRA_DIST += c-strcaseeq.h # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile - rm -f $@-t + $(AM_V_GEN)rm -f $@-t && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ echo '#define PREFIX "$(prefix)"'; \ echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ @@ -112,7 +161,7 @@ configmake.h: Makefile echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ echo '#define PKGLIBDIR "$(pkglibdir)"'; \ echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ - } | sed '/""/d' > $@-t + } | sed '/""/d' > $@-t && \ if test -f $@ && cmp $@-t $@ > /dev/null; then \ rm -f $@-t; \ else \ @@ -124,15 +173,6 @@ CLEANFILES += configmake.h configmake.h-t ## end gnulib module configmake -## begin gnulib module dup2 - - -EXTRA_DIST += dup2.c - -EXTRA_libunistring_la_SOURCES += dup2.c - -## end gnulib module dup2 - ## begin gnulib module errno BUILT_SOURCES += $(ERRNO_H) @@ -140,7 +180,7 @@ BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create <errno.h> when the system # doesn't have one that is POSIX compliant. errno.h: errno.in.h - rm -f $@-t $@ + $(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' \ @@ -152,7 +192,7 @@ errno.h: errno.in.h -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ < $(srcdir)/errno.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += errno.h errno.h-t @@ -167,13 +207,13 @@ BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. float.h: float.in.h - rm -f $@-t $@ + $(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_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ < $(srcdir)/float.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += float.h float.h-t @@ -205,15 +245,6 @@ EXTRA_DIST += fseterr.h stdio-impl.h ## end gnulib module fseterr -## begin gnulib module getpagesize - - -EXTRA_DIST += getpagesize.c - -EXTRA_libunistring_la_SOURCES += getpagesize.c - -## end gnulib module getpagesize - ## begin gnulib module gperf GPERF = gperf @@ -227,14 +258,14 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath ## end gnulib module havelib -## begin gnulib module iconv_open +## begin gnulib module iconv-h BUILT_SOURCES += $(ICONV_H) # We need the following in order to create <iconv.h> when the system # doesn't have one that works with the given compiler. -iconv.h: iconv.in.h - rm -f $@-t $@ +iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \ @@ -243,11 +274,20 @@ iconv.h: iconv.in.h -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ -e 's|@''REPLACE_ICONV_UTF''@|$(REPLACE_ICONV_UTF)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/iconv.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += iconv.h iconv.h-t +EXTRA_DIST += iconv.in.h + +## end gnulib module iconv-h + +## begin gnulib module iconv_open + iconv_open-aix.h: iconv_open-aix.gperf $(GPERF) -m 10 $(srcdir)/iconv_open-aix.gperf > $(srcdir)/iconv_open-aix.h-t mv $(srcdir)/iconv_open-aix.h-t $(srcdir)/iconv_open-aix.h @@ -260,12 +300,15 @@ iconv_open-irix.h: iconv_open-irix.gperf iconv_open-osf.h: iconv_open-osf.gperf $(GPERF) -m 10 $(srcdir)/iconv_open-osf.gperf > $(srcdir)/iconv_open-osf.h-t mv $(srcdir)/iconv_open-osf.h-t $(srcdir)/iconv_open-osf.h -BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h -MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t -MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h -EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h +iconv_open-solaris.h: iconv_open-solaris.gperf + $(GPERF) -m 10 $(srcdir)/iconv_open-solaris.gperf > $(srcdir)/iconv_open-solaris.h-t + mv $(srcdir)/iconv_open-solaris.h-t $(srcdir)/iconv_open-solaris.h +BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h +MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t iconv_open-solaris.h-t +MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h +EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h -EXTRA_DIST += iconv.in.h iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open.c +EXTRA_DIST += iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c EXTRA_libunistring_la_SOURCES += iconv_open.c @@ -298,14 +341,6 @@ EXTRA_libunistring_la_SOURCES += isnan.c isnanl.c ## end gnulib module isnanl-nolibm -## begin gnulib module link-warning - -LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h - -EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h - -## end gnulib module link-warning - ## begin gnulib module localcharset libunistring_la_SOURCES += localcharset.h localcharset.c @@ -364,14 +399,14 @@ uninstall-localcharset: all-local fi charset.alias: config.charset - rm -f t-$@ $@ - $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ + $(AM_V_GEN)rm -f t-$@ $@ && \ + $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \ mv t-$@ $@ SUFFIXES += .sed .sin .sin.sed: - rm -f t-$@ $@ - sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ + $(AM_V_GEN)rm -f t-$@ $@ && \ + sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \ mv t-$@ $@ CLEANFILES += charset.alias ref-add.sed ref-del.sed @@ -388,6 +423,12 @@ EXTRA_DIST += localename.h ## end gnulib module localename +## begin gnulib module lock + +libunistring_la_SOURCES += glthread/lock.h glthread/lock.c + +## end gnulib module lock + ## begin gnulib module malloc-posix @@ -411,14 +452,19 @@ BUILT_SOURCES += math.h # We need the following in order to create <math.h> when the system # doesn't have one that works with the given compiler. -math.h: math.in.h - rm -f $@-t $@ +math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \ + -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \ + -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \ + -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \ -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \ -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \ + -e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \ + -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \ -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \ -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \ -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ @@ -430,30 +476,52 @@ math.h: math.in.h -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \ -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \ -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ - -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ + -e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \ + -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \ -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \ -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \ -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \ -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ + -e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \ + -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \ + -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \ -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \ -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \ -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \ + -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ + -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \ + -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \ + -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \ + -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \ -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \ -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \ -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \ + -e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \ + -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \ + -e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \ + -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \ -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ + -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \ + -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ + -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \ + -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ + -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \ -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ + -e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \ + -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \ + -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \ -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ + -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \ @@ -472,9 +540,11 @@ math.h: math.in.h -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/math.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += math.h math.h-t @@ -601,10 +671,10 @@ BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create <stdbool.h> when the system # doesn't have one that works. stdbool.h: stdbool.in.h - rm -f $@-t $@ + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t @@ -619,7 +689,7 @@ BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create <stddef.h> when the system # doesn't have one that works with the given compiler. stddef.h: stddef.in.h - rm -f $@-t $@ + $(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' \ @@ -627,7 +697,7 @@ stddef.h: stddef.in.h -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stddef.h stddef.h-t @@ -642,7 +712,7 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create <stdint.h> when the system # doesn't have one that works with the given compiler. stdint.h: stdint.in.h - rm -f $@-t $@ + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -669,7 +739,7 @@ stdint.h: stdint.in.h -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ < $(srcdir)/stdint.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdint.h stdint.h-t @@ -683,36 +753,53 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create <stdlib.h> when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h - rm -f $@-t $@ +stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ - -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ - -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ - -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ + -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ + -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ + -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ + -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ + -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \ -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ + -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ + -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ + -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ - -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ + -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ + -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ + -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ + -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ + -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ @@ -720,15 +807,20 @@ stdlib.h: stdlib.in.h -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ + -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ - -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ + -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ + -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ - -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/stdlib.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t @@ -766,8 +858,8 @@ BUILT_SOURCES += string.h # We need the following in order to create <string.h> when the system # doesn't have one that works with the given compiler. -string.h: string.in.h - rm -f $@-t $@ +string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \ @@ -795,6 +887,7 @@ string.h: string.in.h -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ + -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ @@ -805,6 +898,9 @@ string.h: string.in.h -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + < $(srcdir)/string.in.h | \ + sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -813,26 +909,32 @@ string.h: string.in.h -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ - -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ - -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ + -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ + -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ < $(srcdir)/string.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += string.h string.h-t @@ -840,6 +942,23 @@ EXTRA_DIST += string.in.h ## end gnulib module string +## begin gnulib module strncat + + +EXTRA_DIST += strncat.c + +EXTRA_libunistring_la_SOURCES += strncat.c + +## end gnulib module strncat + +## begin gnulib module threadlib + +libunistring_la_SOURCES += glthread/threadlib.c + +EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath + +## end gnulib module threadlib + ## begin gnulib module unicase/base @@ -3008,8 +3127,8 @@ BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd.in.h - rm -f $@-t $@ +unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -3018,56 +3137,105 @@ unistd.h: unistd.in.h -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ + -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ + -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ + -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ + -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ + -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ + -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ + -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ + -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ + -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ + -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ + -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ + -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ + -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ + -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ + -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ + -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + < $(srcdir)/unistd.in.h | \ + sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ + -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ + -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ + -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ + -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ + -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ - -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ + -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ + -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ + -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ + -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ + -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ + -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ + -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ + -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ + -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ - -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ + -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ + -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ + -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ + -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ + -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ + -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ + -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ + -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ + -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/unistd.in.h; \ - } > $@-t + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += unistd.h unistd.h-t @@ -4576,20 +4744,64 @@ EXTRA_DIST += uniwidth/cjk.h ## end gnulib module uniwidth/width +## begin gnulib module unused-parameter + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += unused-parameter.h +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t + +UNUSED_PARAMETER_H=unused-parameter.h + +EXTRA_DIST += $(top_srcdir)/build-aux/unused-parameter.h + +## end gnulib module unused-parameter + ## begin gnulib module verify libunistring_la_SOURCES += verify.h ## end gnulib module verify +## begin gnulib module warn-on-use + +BUILT_SOURCES += warn-on-use.h +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t + +WARN_ON_USE_H=warn-on-use.h + +EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h + +## end gnulib module warn-on-use + ## begin gnulib module wchar -BUILT_SOURCES += $(WCHAR_H) +BUILT_SOURCES += wchar.h # We need the following in order to create <wchar.h> when the system # version does not work standalone. -wchar.h: wchar.in.h - rm -f $@-t $@ +wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \ @@ -4630,9 +4842,11 @@ wchar.h: wchar.in.h -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wchar.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t @@ -4642,22 +4856,25 @@ EXTRA_DIST += wchar.in.h ## begin gnulib module wctype -BUILT_SOURCES += $(WCTYPE_H) +BUILT_SOURCES += wctype.h # We need the following in order to create <wctype.h> when the system # doesn't have one that works with the given compiler. -wctype.h: wctype.in.h - rm -f $@-t $@ +wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wctype.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wctype.h wctype.h-t diff --git a/lib/Makefile.in b/lib/Makefile.in index e243d6b..6e97923 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,7 +15,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -59,17 +59,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/alloca.m4 \ $(top_srcdir)/gnulib-m4/codeset.m4 \ - $(top_srcdir)/gnulib-m4/dup2.m4 \ $(top_srcdir)/gnulib-m4/eealloc.m4 \ $(top_srcdir)/gnulib-m4/environ.m4 \ $(top_srcdir)/gnulib-m4/errno_h.m4 \ $(top_srcdir)/gnulib-m4/error.m4 \ - $(top_srcdir)/gnulib-m4/exitfail.m4 \ $(top_srcdir)/gnulib-m4/exponentd.m4 \ $(top_srcdir)/gnulib-m4/exponentf.m4 \ $(top_srcdir)/gnulib-m4/exponentl.m4 \ $(top_srcdir)/gnulib-m4/extensions.m4 \ - $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ $(top_srcdir)/gnulib-m4/float_h.m4 \ $(top_srcdir)/gnulib-m4/fpieee.m4 \ $(top_srcdir)/gnulib-m4/frexp.m4 \ @@ -101,6 +99,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/locale-zh.m4 \ $(top_srcdir)/gnulib-m4/locale_h.m4 \ $(top_srcdir)/gnulib-m4/localename.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ $(top_srcdir)/gnulib-m4/longlong.m4 \ $(top_srcdir)/gnulib-m4/malloc.m4 \ $(top_srcdir)/gnulib-m4/malloca.m4 \ @@ -113,13 +112,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/memchr.m4 \ $(top_srcdir)/gnulib-m4/minmax.m4 \ $(top_srcdir)/gnulib-m4/mmap-anon.m4 \ - $(top_srcdir)/gnulib-m4/mode_t.m4 \ $(top_srcdir)/gnulib-m4/multiarch.m4 \ $(top_srcdir)/gnulib-m4/nocrash.m4 \ - $(top_srcdir)/gnulib-m4/open.m4 \ $(top_srcdir)/gnulib-m4/printf-frexp.m4 \ $(top_srcdir)/gnulib-m4/printf-frexpl.m4 \ $(top_srcdir)/gnulib-m4/printf.m4 \ + $(top_srcdir)/gnulib-m4/putenv.m4 \ $(top_srcdir)/gnulib-m4/relocatable-lib.m4 \ $(top_srcdir)/gnulib-m4/setenv.m4 \ $(top_srcdir)/gnulib-m4/signbit.m4 \ @@ -131,16 +129,21 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/stdlib_h.m4 \ $(top_srcdir)/gnulib-m4/strerror.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/thread.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ $(top_srcdir)/gnulib-m4/unistd_h.m4 \ $(top_srcdir)/gnulib-m4/vasnprintf.m4 \ - $(top_srcdir)/gnulib-m4/wchar.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_h.m4 \ $(top_srcdir)/gnulib-m4/wchar_t.m4 \ $(top_srcdir)/gnulib-m4/wctob.m4 \ - $(top_srcdir)/gnulib-m4/wctype.m4 \ + $(top_srcdir)/gnulib-m4/wctype_h.m4 \ $(top_srcdir)/gnulib-m4/wcwidth.m4 \ $(top_srcdir)/gnulib-m4/wint_t.m4 \ $(top_srcdir)/gnulib-m4/xalloc.m4 \ - $(top_srcdir)/gnulib-m4/xsize.m4 $(top_srcdir)/m4/exported.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/yield.m4 $(top_srcdir)/m4/exported.m4 \ $(top_srcdir)/m4/init-package-version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ @@ -180,10 +183,11 @@ am__DEPENDENCIES_1 = @WOE32_TRUE@am__DEPENDENCIES_2 = libunistring.res.lo am__libunistring_la_SOURCES_DIST = c-ctype.h c-ctype.c c-strcase.h \ c-strcasecmp.c c-strncasecmp.c fseterr.c localcharset.h \ - localcharset.c localename.c malloca.c mbchar.c mbiter.h \ - mbsnlen.c memcmp2.c memxfrm.c minmax.h printf-frexp.c \ - printf-frexpl.c size_max.h striconveh.h striconveh.c \ - striconveha.h striconveha.c unicase/cased.c \ + localcharset.c localename.c glthread/lock.h glthread/lock.c \ + malloca.c mbchar.c mbiter.h mbsnlen.c memcmp2.c memxfrm.c \ + minmax.h printf-frexp.c printf-frexpl.c size_max.h \ + striconveh.h striconveh.c striconveha.h striconveha.c \ + glthread/threadlib.c unicase/cased.c \ unicase/empty-prefix-context.c unicase/empty-suffix-context.c \ unicase/ignorable.c unicase/locale-language.c \ unicase/special-casing.c unicase/tocasefold.c \ @@ -411,9 +415,10 @@ am__dirstamp = $(am__leading_dot)dirstamp @WOE32DLL_TRUE@am__objects_1 = ../woe32dll/unistring-exports.lo am_libunistring_la_OBJECTS = c-ctype.lo c-strcasecmp.lo \ c-strncasecmp.lo fseterr.lo localcharset.lo localename.lo \ - malloca.lo mbchar.lo mbsnlen.lo memcmp2.lo memxfrm.lo \ - printf-frexp.lo printf-frexpl.lo striconveh.lo striconveha.lo \ - unicase/cased.lo unicase/empty-prefix-context.lo \ + glthread/lock.lo malloca.lo mbchar.lo mbsnlen.lo memcmp2.lo \ + memxfrm.lo printf-frexp.lo printf-frexpl.lo striconveh.lo \ + striconveha.lo glthread/threadlib.lo unicase/cased.lo \ + unicase/empty-prefix-context.lo \ unicase/empty-suffix-context.lo unicase/ignorable.lo \ unicase/locale-language.lo unicase/special-casing.lo \ unicase/tocasefold.lo unicase/tolower.lo unicase/totitle.lo \ @@ -735,22 +740,31 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GLIBC21 = @GLIBC21@ GLOBAL_SYMBOL_PIPE = @GLOBAL_SYMBOL_PIPE@ +GNULIB_ACOSL = @GNULIB_ACOSL@ +GNULIB_ASINL = @GNULIB_ASINL@ +GNULIB_ATANL = @GNULIB_ATANL@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_BTOWC = @GNULIB_BTOWC@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ GNULIB_CEILF = @GNULIB_CEILF@ GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_COSL = @GNULIB_COSL@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_DUP3 = @GNULIB_DUP3@ +GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FLOORF = @GNULIB_FLOORF@ GNULIB_FLOORL = @GNULIB_FLOORL@ GNULIB_FREXP = @GNULIB_FREXP@ @@ -760,12 +774,15 @@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_ISINF = @GNULIB_ISINF@ GNULIB_ISNAN = @GNULIB_ISNAN@ @@ -775,9 +792,11 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ +GNULIB_LINKAT = @GNULIB_LINKAT@ +GNULIB_LOGB = @GNULIB_LOGB@ +GNULIB_LOGL = @GNULIB_LOGL@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MBRLEN = @GNULIB_MBRLEN@ GNULIB_MBRTOWC = @GNULIB_MBRTOWC@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ @@ -802,26 +821,37 @@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ +GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ +GNULIB_PIPE2 = @GNULIB_PIPE2@ +GNULIB_PREAD = @GNULIB_PREAD@ +GNULIB_PTSNAME = @GNULIB_PTSNAME@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_REALPATH = @GNULIB_REALPATH@ +GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_ROUND = @GNULIB_ROUND@ GNULIB_ROUNDF = @GNULIB_ROUNDF@ GNULIB_ROUNDL = @GNULIB_ROUNDL@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SINL = @GNULIB_SINL@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SQRTL = @GNULIB_SQRTL@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ @@ -833,12 +863,20 @@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_SYMLINK = @GNULIB_SYMLINK@ +GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ +GNULIB_TANL = @GNULIB_TANL@ GNULIB_TRUNC = @GNULIB_TRUNC@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNLINK = @GNULIB_UNLINK@ +GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ +GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ @@ -846,26 +884,41 @@ GNULIB_WCTOB = @GNULIB_WCTOB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ +HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ASINL = @HAVE_ASINL@ +HAVE_ATANL = @HAVE_ATANL@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COSL = @HAVE_COSL@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILF = @HAVE_DECL_CEILF@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORF = @HAVE_DECL_FLOORF@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGB = @HAVE_DECL_LOGB@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_ROUND = @HAVE_DECL_ROUND@ +HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ +HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -873,52 +926,77 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPL = @HAVE_EXPL@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ HAVE_GLOBAL_SYMBOL_PIPE = @HAVE_GLOBAL_SYMBOL_PIPE@ +HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ HAVE_ISNANL = @HAVE_ISNANL@ +HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LOGL = @HAVE_LOGL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ +HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ +HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ +HAVE_MKSTEMP = @HAVE_MKSTEMP@ +HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SINL = @HAVE_SINL@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ @@ -926,14 +1004,21 @@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TANL = @HAVE_TANL@ +HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ @@ -941,6 +1026,7 @@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HEXVERSION = @HEXVERSION@ ICONV_H = @ICONV_H@ @@ -956,27 +1042,32 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ LIBS = @LIBS@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LIBTHREAD = @LIBTHREAD@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ -LOCALE_H = @LOCALE_H@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NAMESPACING = @NAMESPACING@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -989,7 +1080,6 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -1022,17 +1112,21 @@ RANLIB = @RANLIB@ RC = @RC@ RELOCATABLE = @RELOCATABLE@ REPLACE_BTOWC = @REPLACE_BTOWC@ +REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CEILF = @REPLACE_CEILF@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FLOORF = @REPLACE_FLOORF@ REPLACE_FLOORL = @REPLACE_FLOORL@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_ICONV = @REPLACE_ICONV@ @@ -1044,6 +1138,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ @@ -1056,20 +1152,36 @@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_NAN = @REPLACE_NAN@ REPLACE_NULL = @REPLACE_NULL@ -REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_REALPATH = @REPLACE_REALPATH@ +REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ +REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_UNSETENV = @REPLACE_UNSETENV@ +REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ @@ -1086,14 +1198,13 @@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ TEXI2DVI = @TEXI2DVI@ +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ -VOID_UNSETENV = @VOID_UNSETENV@ -WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +YIELD_LIB = @YIELD_LIB@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -1121,6 +1232,7 @@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -1153,26 +1265,29 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects no-dependencies # Version information according to Woe32 conventions. -EXTRA_DIST = alloca.in.h array-mergesort.h c-strcaseeq.h dup2.c \ - errno.in.h float.in.h fpucw.h frexp.c frexpl.c fseterr.h \ - stdio-impl.h getpagesize.c \ - $(top_srcdir)/build-aux/config.rpath iconv_open-aix.h \ - iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h \ - iconv.in.h iconv_open-aix.gperf iconv_open-hpux.gperf \ - iconv_open-irix.gperf iconv_open-osf.gperf iconv_open.c \ - float+.h isnan.c isnand-nolibm.h isnand.c float+.h isnan.c \ - isnanf-nolibm.h isnanf.c float+.h isnan.c isnanl-nolibm.h \ - isnanl.c $(top_srcdir)/build-aux/link-warning.h config.charset \ - ref-add.sin ref-del.sin localename.h malloc.c malloca.h \ - malloca.valgrind math.in.h mbchar.h mbrtowc.c mbsinit.c \ - memchr.c memchr.valgrind memcmp2.h memxfrm.h printf-frexp.h \ - printf-frexp.c printf-frexpl.h relocatable.c relocatable.h \ - float+.h signbitd.c signbitf.c signbitl.c stdbool.in.h \ - stddef.in.h stdint.in.h stdlib.in.h streq.h iconveh.h \ - string.in.h unicase.h unicase/cased.h unicase/caseprop.h \ - unictype/bitmap.h unicase/caseprop.h unicase/ignorable.h \ - unictype/bitmap.h unicase/locale-languages.h \ - unicase/locale-languages.gperf unicase/special-casing-table.h \ +EXTRA_DIST = alloca.in.h $(top_srcdir)/build-aux/arg-nonnull.h \ + array-mergesort.h $(top_srcdir)/build-aux/c++defs.h \ + c-strcaseeq.h errno.in.h float.in.h fpucw.h frexp.c frexpl.c \ + fseterr.h stdio-impl.h $(top_srcdir)/build-aux/config.rpath \ + iconv.in.h iconv_open-aix.h iconv_open-hpux.h \ + iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h \ + iconv_open-aix.gperf iconv_open-hpux.gperf \ + iconv_open-irix.gperf iconv_open-osf.gperf \ + iconv_open-solaris.gperf iconv_open.c float+.h isnan.c \ + isnand-nolibm.h isnand.c float+.h isnan.c isnanf-nolibm.h \ + isnanf.c float+.h isnan.c isnanl-nolibm.h isnanl.c \ + config.charset ref-add.sin ref-del.sin localename.h malloc.c \ + malloca.h malloca.valgrind math.in.h mbchar.h mbrtowc.c \ + mbsinit.c memchr.c memchr.valgrind memcmp2.h memxfrm.h \ + printf-frexp.h printf-frexp.c printf-frexpl.h relocatable.c \ + relocatable.h float+.h signbitd.c signbitf.c signbitl.c \ + stdbool.in.h stddef.in.h stdint.in.h stdlib.in.h streq.h \ + iconveh.h string.in.h strncat.c \ + $(top_srcdir)/build-aux/config.rpath unicase.h unicase/cased.h \ + unicase/caseprop.h unictype/bitmap.h unicase/caseprop.h \ + unicase/ignorable.h unictype/bitmap.h \ + unicase/locale-languages.h unicase/locale-languages.gperf \ + unicase/special-casing-table.h \ unicase/special-casing-table.gperf unicase/special-casing.h \ unicase/casefold.h unicase/simple-mapping.h \ unicase/tocasefold.h unicase/simple-mapping.h \ @@ -1378,41 +1493,62 @@ EXTRA_DIST = alloca.in.h array-mergesort.h c-strcaseeq.h dup2.c \ unitypes.h uniwbrk.h uniwbrk/wbrktable.h \ uniwbrk/u-wordbreaks.h uniwbrk/u-wordbreaks.h \ uniwbrk/u-wordbreaks.h uniwbrk/wbrkprop.h localcharset.h \ - uniwidth.h uniwidth/cjk.h wchar.in.h wctype.in.h wcwidth.c \ - stdbool.mini.h stdint.mini.h libunistring.sym declared.sh \ - libunistring.rc -BUILT_SOURCES = $(ALLOCA_H) configmake.h $(ERRNO_H) $(FLOAT_H) \ - $(ICONV_H) iconv_open-aix.h iconv_open-hpux.h \ - iconv_open-irix.h iconv_open-osf.h math.h $(STDBOOL_H) \ - $(STDDEF_H) $(STDINT_H) stdlib.h string.h \ - unicase/locale-languages.h unicase/special-casing-table.h \ - unictype/pr_byname.h unictype/scripts_byname.h \ - uninorm/composition-table.h unistd.h $(WCHAR_H) $(WCTYPE_H) \ + uniwidth.h uniwidth/cjk.h \ + $(top_srcdir)/build-aux/unused-parameter.h \ + $(top_srcdir)/build-aux/warn-on-use.h wchar.in.h wctype.in.h \ + wcwidth.c stdbool.mini.h stdint.mini.h unistring/cdefs.in.h \ + libunistring.sym declared.sh libunistring.rc + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. +BUILT_SOURCES = $(ALLOCA_H) arg-nonnull.h c++defs.h configmake.h \ + $(ERRNO_H) $(FLOAT_H) $(ICONV_H) iconv_open-aix.h \ + iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h \ + iconv_open-solaris.h math.h $(STDBOOL_H) $(STDDEF_H) \ + $(STDINT_H) stdlib.h string.h unicase/locale-languages.h \ + unicase/special-casing-table.h unictype/pr_byname.h \ + unictype/scripts_byname.h uninorm/composition-table.h unistd.h \ + unused-parameter.h warn-on-use.h wchar.h wctype.h \ unistring/stdbool.h unistring/stdint.h \ - unistring/localcharset.h unistring/iconveh.h + unistring/localcharset.h unistring/iconveh.h unistring/cdefs.h # We distribute it because declared.sh relies on GNU sed. MOSTLYCLEANFILES = core *.stackdump core *.stackdump alloca.h \ - alloca.h-t errno.h errno.h-t float.h float.h-t iconv.h \ - iconv.h-t iconv_open-aix.h-t iconv_open-hpux.h-t \ - iconv_open-irix.h-t iconv_open-osf.h-t math.h math.h-t \ + alloca.h-t arg-nonnull.h arg-nonnull.h-t c++defs.h c++defs.h-t \ + errno.h errno.h-t float.h float.h-t iconv.h iconv.h-t \ + iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t \ + iconv_open-osf.h-t iconv_open-solaris.h-t math.h math.h-t \ stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \ stdlib.h stdlib.h-t string.h string.h-t \ unicase/locale-languages.h-t unicase/special-casing-table.h-t \ unictype/pr_byname.h-t unictype/scripts_byname.h-t \ - uninorm/composition-table.h-t unistd.h unistd.h-t wchar.h \ - wchar.h-t wctype.h wctype.h-t unistring/stdbool.h-t \ - unistring/stdint.h-t unistring/localcharset.h-t \ - unistring/iconveh.h-t libunistring.sym-t config.h config.h-t \ + uninorm/composition-table.h-t unistd.h unistd.h-t \ + unused-parameter.h unused-parameter.h-t warn-on-use.h \ + warn-on-use.h-t wchar.h wchar.h-t wctype.h wctype.h-t \ + unistring/stdbool.h-t unistring/stdint.h-t \ + unistring/localcharset.h-t unistring/iconveh.h-t \ + unistring/cdefs.h-t libunistring.sym-t config.h config.h-t \ $(am__append_4) CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \ ref-del.sed unistring/stdbool.h unistring/stdint.h \ - unistring/localcharset.h unistring/iconveh.h + unistring/localcharset.h unistring/iconveh.h unistring/cdefs.h DISTCLEANFILES = MAINTAINERCLEANFILES = iconv_open-aix.h iconv_open-hpux.h \ - iconv_open-irix.h iconv_open-osf.h unicase/locale-languages.h \ - unicase/special-casing-table.h unictype/pr_byname.h \ - unictype/scripts_byname.h uninorm/composition-table.h \ - libunistring.sym + iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h \ + unicase/locale-languages.h unicase/special-casing-table.h \ + unictype/pr_byname.h unictype/scripts_byname.h \ + uninorm/composition-table.h libunistring.sym SUFFIXES = .sed .sin lib_LTLIBRARIES = libunistring.la nobase_include_HEADERS = \ @@ -1442,10 +1578,11 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) \ # Additional source files. libunistring_la_SOURCES = c-ctype.h c-ctype.c c-strcase.h \ c-strcasecmp.c c-strncasecmp.c fseterr.c localcharset.h \ - localcharset.c localename.c malloca.c mbchar.c mbiter.h \ - mbsnlen.c memcmp2.c memxfrm.c minmax.h printf-frexp.c \ - printf-frexpl.c size_max.h striconveh.h striconveh.c \ - striconveha.h striconveha.c unicase/cased.c \ + localcharset.c localename.c glthread/lock.h glthread/lock.c \ + malloca.c mbchar.c mbiter.h mbsnlen.c memcmp2.c memxfrm.c \ + minmax.h printf-frexp.c printf-frexpl.c size_max.h \ + striconveh.h striconveh.c striconveha.h striconveha.c \ + glthread/threadlib.c unicase/cased.c \ unicase/empty-prefix-context.c unicase/empty-suffix-context.c \ unicase/ignorable.c unicase/locale-language.c \ unicase/special-casing.c unicase/tocasefold.c \ @@ -1671,23 +1808,26 @@ libunistring_la_SOURCES = c-ctype.h c-ctype.c c-strcase.h \ verify.h xsize.h version.c $(am__append_2) libunistring_la_LIBADD = $(gl_LTLIBOBJS) $(WOE32_LIBADD) libunistring_la_DEPENDENCIES = $(gl_LTLIBOBJS) $(WOE32_LIBADD) -EXTRA_libunistring_la_SOURCES = dup2.c frexp.c frexpl.c getpagesize.c \ - iconv_open.c isnan.c isnand.c isnan.c isnanf.c isnan.c \ - isnanl.c malloc.c mbrtowc.c mbsinit.c memchr.c printf-frexp.c \ - relocatable.c signbitd.c signbitf.c signbitl.c printf-args.c \ - printf-parse.c vasnprintf.c vasnprintf.c printf-parse.c \ +EXTRA_libunistring_la_SOURCES = frexp.c frexpl.c iconv_open.c isnan.c \ + isnand.c isnan.c isnanf.c isnan.c isnanl.c malloc.c mbrtowc.c \ + mbsinit.c memchr.c printf-frexp.c relocatable.c signbitd.c \ + signbitf.c signbitl.c strncat.c printf-args.c printf-parse.c \ vasnprintf.c vasnprintf.c printf-parse.c vasnprintf.c \ - vasnprintf.c printf-parse.c vasnprintf.c wcwidth.c + vasnprintf.c printf-parse.c vasnprintf.c vasnprintf.c \ + printf-parse.c vasnprintf.c wcwidth.c # How to build libunistring.la. libunistring_la_LDFLAGS = $(AM_LDFLAGS) $(am__append_1) \ $(am__append_3) -version-info \ $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) -rpath $(libdir) \ @INTL_MACOSX_LIBS@ -no-undefined +ARG_NONNULL_H = arg-nonnull.h +CXXDEFS_H = c++defs.h GPERF = gperf -LINK_WARNING_H = $(top_srcdir)/build-aux/link-warning.h charset_alias = $(DESTDIR)$(libdir)/charset.alias charset_tmp = $(DESTDIR)$(libdir)/charset.tmp +UNUSED_PARAMETER_H = unused-parameter.h +WARN_ON_USE_H = warn-on-use.h # The <stdbool.h> and <stdint.h> replacements that can be installed. @@ -1697,10 +1837,12 @@ charset_tmp = $(DESTDIR)$(libdir)/charset.tmp # unistring/version.h is public. +# unistring/cdefs.h is not public, but is included by other header files. + # unistring/woe32dll.h is not public, but is included by other header files. nobase_nodist_include_HEADERS = unistring/stdbool.h unistring/stdint.h \ unistring/localcharset.h unistring/iconveh.h \ - unistring/version.h unistring/woe32dll.h + unistring/version.h unistring/cdefs.h unistring/woe32dll.h # Directories that contain some CLEANFILES. CLEANDIRS = @@ -1729,7 +1871,7 @@ HEADERS_WITH_EXTERNS = \ # Libtool's library version information for libunistring. # See the libtool documentation, section "Library interface versions". LTV_CURRENT = 1 -LTV_REVISION = 0 +LTV_REVISION = 2 LTV_AGE = 1 all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -1799,6 +1941,11 @@ clean-libLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done +glthread/$(am__dirstamp): + @$(MKDIR_P) glthread + @: > glthread/$(am__dirstamp) +glthread/lock.lo: glthread/$(am__dirstamp) +glthread/threadlib.lo: glthread/$(am__dirstamp) unicase/$(am__dirstamp): @$(MKDIR_P) unicase @: > unicase/$(am__dirstamp) @@ -2320,6 +2467,10 @@ mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f ../woe32dll/unistring-exports.$(OBJEXT) -rm -f ../woe32dll/unistring-exports.lo + -rm -f glthread/lock.$(OBJEXT) + -rm -f glthread/lock.lo + -rm -f glthread/threadlib.$(OBJEXT) + -rm -f glthread/threadlib.lo -rm -f unicase/cased.$(OBJEXT) -rm -f unicase/cased.lo -rm -f unicase/empty-prefix-context.$(OBJEXT) @@ -3300,6 +3451,7 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -rm -rf ../woe32dll/.libs ../woe32dll/_libs + -rm -rf glthread/.libs glthread/_libs -rm -rf unicase/.libs unicase/_libs -rm -rf uniconv/.libs uniconv/_libs -rm -rf unictype/.libs unictype/_libs @@ -3472,6 +3624,7 @@ distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f ../woe32dll/$(am__dirstamp) + -rm -f glthread/$(am__dirstamp) -rm -f unicase/$(am__dirstamp) -rm -f uniconv/$(am__dirstamp) -rm -f unictype/$(am__dirstamp) @@ -3587,10 +3740,27 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-local \ # We need the following in order to create <alloca.h> when the system # doesn't have one that works with the given compiler. alloca.h: alloca.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca.in.h; \ - } > $@-t + } > $@-t && \ mv -f $@-t $@ +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/arg-nonnull.h, except that it has the copyright header cut off. +arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/c++defs.h \ + > $@-t && \ + mv $@-t $@ # Retrieve values of the variables through 'configure' followed by # 'make', not directly through 'configure', so that a user who @@ -3610,7 +3780,7 @@ alloca.h: alloca.in.h # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile - rm -f $@-t + $(AM_V_GEN)rm -f $@-t && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ echo '#define PREFIX "$(prefix)"'; \ echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ @@ -3639,7 +3809,7 @@ configmake.h: Makefile echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ echo '#define PKGLIBDIR "$(pkglibdir)"'; \ echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ - } | sed '/""/d' > $@-t + } | sed '/""/d' > $@-t && \ if test -f $@ && cmp $@-t $@ > /dev/null; then \ rm -f $@-t; \ else \ @@ -3649,7 +3819,7 @@ configmake.h: Makefile # We need the following in order to create <errno.h> when the system # doesn't have one that is POSIX compliant. errno.h: errno.in.h - rm -f $@-t $@ + $(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' \ @@ -3661,25 +3831,25 @@ errno.h: errno.in.h -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ < $(srcdir)/errno.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. float.h: float.in.h - rm -f $@-t $@ + $(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_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ < $(srcdir)/float.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <iconv.h> when the system # doesn't have one that works with the given compiler. -iconv.h: iconv.in.h - rm -f $@-t $@ +iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \ @@ -3688,8 +3858,11 @@ iconv.h: iconv.in.h -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ -e 's|@''REPLACE_ICONV_UTF''@|$(REPLACE_ICONV_UTF)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/iconv.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ iconv_open-aix.h: iconv_open-aix.gperf @@ -3704,6 +3877,9 @@ iconv_open-irix.h: iconv_open-irix.gperf iconv_open-osf.h: iconv_open-osf.gperf $(GPERF) -m 10 $(srcdir)/iconv_open-osf.gperf > $(srcdir)/iconv_open-osf.h-t mv $(srcdir)/iconv_open-osf.h-t $(srcdir)/iconv_open-osf.h +iconv_open-solaris.h: iconv_open-solaris.gperf + $(GPERF) -m 10 $(srcdir)/iconv_open-solaris.gperf > $(srcdir)/iconv_open-solaris.h-t + mv $(srcdir)/iconv_open-solaris.h-t $(srcdir)/iconv_open-solaris.h # We need the following in order to install a simple file in $(libdir) # which is shared with other installed packages. We use a list of referencing @@ -3756,24 +3932,29 @@ uninstall-localcharset: all-local fi charset.alias: config.charset - rm -f t-$@ $@ - $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ + $(AM_V_GEN)rm -f t-$@ $@ && \ + $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \ mv t-$@ $@ .sin.sed: - rm -f t-$@ $@ - sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ + $(AM_V_GEN)rm -f t-$@ $@ && \ + sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \ mv t-$@ $@ # We need the following in order to create <math.h> when the system # doesn't have one that works with the given compiler. -math.h: math.in.h - rm -f $@-t $@ +math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \ + -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \ + -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \ + -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \ -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \ -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \ + -e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \ + -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \ -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \ -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \ -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ @@ -3785,30 +3966,52 @@ math.h: math.in.h -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \ -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \ -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ - -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ + -e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \ + -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \ -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \ -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \ -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \ -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ + -e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \ + -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \ + -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \ -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \ -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \ -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \ + -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ + -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \ + -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \ + -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \ + -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \ -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \ -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \ -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \ + -e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \ + -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \ + -e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \ + -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \ -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ + -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \ + -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ + -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \ + -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ + -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \ -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ + -e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \ + -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \ + -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \ -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ + -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \ @@ -3827,24 +4030,26 @@ math.h: math.in.h -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/math.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <stdbool.h> when the system # doesn't have one that works. stdbool.h: stdbool.in.h - rm -f $@-t $@ + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <stddef.h> when the system # doesn't have one that works with the given compiler. stddef.h: stddef.in.h - rm -f $@-t $@ + $(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' \ @@ -3852,13 +4057,13 @@ stddef.h: stddef.in.h -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <stdint.h> when the system # doesn't have one that works with the given compiler. stdint.h: stdint.in.h - rm -f $@-t $@ + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -3885,41 +4090,58 @@ stdint.h: stdint.in.h -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ < $(srcdir)/stdint.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <stdlib.h> when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h - rm -f $@-t $@ +stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ - -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ - -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ - -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ + -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ + -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ + -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ + -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ + -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \ -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ + -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ + -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ + -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ - -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ + -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ + -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ + -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ + -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ + -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ @@ -3927,21 +4149,26 @@ stdlib.h: stdlib.in.h -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ + -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ - -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ + -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ + -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ - -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/stdlib.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <string.h> when the system # doesn't have one that works with the given compiler. -string.h: string.in.h - rm -f $@-t $@ +string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \ @@ -3969,6 +4196,7 @@ string.h: string.in.h -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ + -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ @@ -3979,6 +4207,9 @@ string.h: string.in.h -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + < $(srcdir)/string.in.h | \ + sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -3987,26 +4218,32 @@ string.h: string.in.h -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ - -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ - -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ + -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ + -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ < $(srcdir)/string.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ unicase/locale-languages.h: $(srcdir)/unicase/locale-languages.gperf @@ -4031,8 +4268,8 @@ uninorm/composition-table.h: $(srcdir)/uninorm/composition-table.gperf # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd.in.h - rm -f $@-t $@ +unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -4041,62 +4278,128 @@ unistd.h: unistd.in.h -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ + -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ + -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ + -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ + -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ + -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ + -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ + -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ + -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ + -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ + -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ + -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ + -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ + -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ + -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ + -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ + -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + < $(srcdir)/unistd.in.h | \ + sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ + -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ + -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ + -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ + -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ + -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ - -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ + -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ + -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ + -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ + -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ + -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ + -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ + -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ + -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ + -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ - -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ + -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ + -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ + -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ + -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ + -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ + -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ + -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ + -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ + -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/unistd.in.h; \ - } > $@-t + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ + mv $@-t $@ +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ mv $@-t $@ # We need the following in order to create <wchar.h> when the system # version does not work standalone. -wchar.h: wchar.in.h - rm -f $@-t $@ +wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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' \ @@ -4137,25 +4440,30 @@ wchar.h: wchar.in.h -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ - -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wchar.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ # We need the following in order to create <wctype.h> when the system # doesn't have one that works with the given compiler. -wctype.h: wctype.in.h - rm -f $@-t $@ +wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wctype.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ mostlyclean-local: mostlyclean-generic @@ -4237,6 +4545,13 @@ unistring/iconveh.h : iconveh.h rm -f $@-t $@ cp $(srcdir)/iconveh.h $@-t mv $@-t $@ +unistring/cdefs.h : unistring/cdefs.in.h + @MKDIR_P@ unistring + rm -f $@-t $@ + sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \ + < $(srcdir)/unistring/cdefs.in.h \ + > $@-t + mv $@-t $@ clean-local: clean-generic @for dir in '' $(CLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ diff --git a/lib/alloca.in.h b/lib/alloca.in.h index 3d4f88b..ee7aa9a 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -1,7 +1,7 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software - Foundation, Inc. + Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation, + Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/array-mergesort.h b/lib/array-mergesort.h index 3988d28..61bf728 100644 --- a/lib/array-mergesort.h +++ b/lib/array-mergesort.h @@ -1,5 +1,5 @@ /* Stable-sorting of an array using mergesort. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -47,40 +47,40 @@ merge (const ELEMENT *src1, size_t n1, for (;;) /* while (n1 > 0 && n2 > 0) */ { if (COMPARE (src1, src2) <= 0) - { - *dst++ = *src1++; - n1--; - if (n1 == 0) - break; - } + { + *dst++ = *src1++; + n1--; + if (n1 == 0) + break; + } else - { - *dst++ = *src2++; - n2--; - if (n2 == 0) - break; - } + { + *dst++ = *src2++; + n2--; + if (n2 == 0) + break; + } } /* Here n1 == 0 || n2 == 0 but also n1 > 0 || n2 > 0. */ if (n1 > 0) { if (dst != src1) - do - { - *dst++ = *src1++; - n1--; - } - while (n1 > 0); + do + { + *dst++ = *src1++; + n1--; + } + while (n1 > 0); } else /* n2 > 0 */ { if (dst != src2) - do - { - *dst++ = *src2++; - n2--; - } - while (n2 > 0); + do + { + *dst++ = *src2++; + n2--; + } + while (n2 > 0); } } @@ -101,79 +101,79 @@ merge_sort_fromto (const ELEMENT *src, ELEMENT *dst, size_t n, ELEMENT *tmp) case 2: /* Trivial case. */ if (COMPARE (&src[0], &src[1]) <= 0) - { - /* src[0] <= src[1] */ - dst[0] = src[0]; - dst[1] = src[1]; - } + { + /* src[0] <= src[1] */ + dst[0] = src[0]; + dst[1] = src[1]; + } else - { - dst[0] = src[1]; - dst[1] = src[0]; - } + { + dst[0] = src[1]; + dst[1] = src[0]; + } break; case 3: /* Simple case. */ if (COMPARE (&src[0], &src[1]) <= 0) - { - if (COMPARE (&src[1], &src[2]) <= 0) - { - /* src[0] <= src[1] <= src[2] */ - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - } - else if (COMPARE (&src[0], &src[2]) <= 0) - { - /* src[0] <= src[2] < src[1] */ - dst[0] = src[0]; - dst[1] = src[2]; - dst[2] = src[1]; - } - else - { - /* src[2] < src[0] <= src[1] */ - dst[0] = src[2]; - dst[1] = src[0]; - dst[2] = src[1]; - } - } + { + if (COMPARE (&src[1], &src[2]) <= 0) + { + /* src[0] <= src[1] <= src[2] */ + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + } + else if (COMPARE (&src[0], &src[2]) <= 0) + { + /* src[0] <= src[2] < src[1] */ + dst[0] = src[0]; + dst[1] = src[2]; + dst[2] = src[1]; + } + else + { + /* src[2] < src[0] <= src[1] */ + dst[0] = src[2]; + dst[1] = src[0]; + dst[2] = src[1]; + } + } else - { - if (COMPARE (&src[0], &src[2]) <= 0) - { - /* src[1] < src[0] <= src[2] */ - dst[0] = src[1]; - dst[1] = src[0]; - dst[2] = src[2]; - } - else if (COMPARE (&src[1], &src[2]) <= 0) - { - /* src[1] <= src[2] < src[0] */ - dst[0] = src[1]; - dst[1] = src[2]; - dst[2] = src[0]; - } - else - { - /* src[2] < src[1] < src[0] */ - dst[0] = src[2]; - dst[1] = src[1]; - dst[2] = src[0]; - } - } + { + if (COMPARE (&src[0], &src[2]) <= 0) + { + /* src[1] < src[0] <= src[2] */ + dst[0] = src[1]; + dst[1] = src[0]; + dst[2] = src[2]; + } + else if (COMPARE (&src[1], &src[2]) <= 0) + { + /* src[1] <= src[2] < src[0] */ + dst[0] = src[1]; + dst[1] = src[2]; + dst[2] = src[0]; + } + else + { + /* src[2] < src[1] < src[0] */ + dst[0] = src[2]; + dst[1] = src[1]; + dst[2] = src[0]; + } + } break; default: { - size_t n1 = n / 2; - size_t n2 = (n + 1) / 2; - /* Note: n1 + n2 = n, n1 <= n2. */ - /* Sort src[n1..n-1] into dst[n1..n-1], scratching tmp[0..n2/2-1]. */ - merge_sort_fromto (src + n1, dst + n1, n2, tmp); - /* Sort src[0..n1-1] into tmp[0..n1-1], scratching dst[0..n1-1]. */ - merge_sort_fromto (src, tmp, n1, dst); - /* Merge the two half results. */ - merge (tmp, n1, dst + n1, n2, dst); + size_t n1 = n / 2; + size_t n2 = (n + 1) / 2; + /* Note: n1 + n2 = n, n1 <= n2. */ + /* Sort src[n1..n-1] into dst[n1..n-1], scratching tmp[0..n2/2-1]. */ + merge_sort_fromto (src + n1, dst + n1, n2, tmp); + /* Sort src[0..n1-1] into tmp[0..n1-1], scratching dst[0..n1-1]. */ + merge_sort_fromto (src, tmp, n1, dst); + /* Merge the two half results. */ + merge (tmp, n1, dst + n1, n2, dst); } break; } @@ -193,77 +193,77 @@ merge_sort_inplace (ELEMENT *src, size_t n, ELEMENT *tmp) case 2: /* Trivial case. */ if (COMPARE (&src[0], &src[1]) <= 0) - { - /* src[0] <= src[1] */ - } + { + /* src[0] <= src[1] */ + } else - { - ELEMENT t = src[0]; - src[0] = src[1]; - src[1] = t; - } + { + ELEMENT t = src[0]; + src[0] = src[1]; + src[1] = t; + } break; case 3: /* Simple case. */ if (COMPARE (&src[0], &src[1]) <= 0) - { - if (COMPARE (&src[1], &src[2]) <= 0) - { - /* src[0] <= src[1] <= src[2] */ - } - else if (COMPARE (&src[0], &src[2]) <= 0) - { - /* src[0] <= src[2] < src[1] */ - ELEMENT t = src[1]; - src[1] = src[2]; - src[2] = t; - } - else - { - /* src[2] < src[0] <= src[1] */ - ELEMENT t = src[0]; - src[0] = src[2]; - src[2] = src[1]; - src[1] = t; - } - } + { + if (COMPARE (&src[1], &src[2]) <= 0) + { + /* src[0] <= src[1] <= src[2] */ + } + else if (COMPARE (&src[0], &src[2]) <= 0) + { + /* src[0] <= src[2] < src[1] */ + ELEMENT t = src[1]; + src[1] = src[2]; + src[2] = t; + } + else + { + /* src[2] < src[0] <= src[1] */ + ELEMENT t = src[0]; + src[0] = src[2]; + src[2] = src[1]; + src[1] = t; + } + } else - { - if (COMPARE (&src[0], &src[2]) <= 0) - { - /* src[1] < src[0] <= src[2] */ - ELEMENT t = src[0]; - src[0] = src[1]; - src[1] = t; - } - else if (COMPARE (&src[1], &src[2]) <= 0) - { - /* src[1] <= src[2] < src[0] */ - ELEMENT t = src[0]; - src[0] = src[1]; - src[1] = src[2]; - src[2] = t; - } - else - { - /* src[2] < src[1] < src[0] */ - ELEMENT t = src[0]; - src[0] = src[2]; - src[2] = t; - } - } + { + if (COMPARE (&src[0], &src[2]) <= 0) + { + /* src[1] < src[0] <= src[2] */ + ELEMENT t = src[0]; + src[0] = src[1]; + src[1] = t; + } + else if (COMPARE (&src[1], &src[2]) <= 0) + { + /* src[1] <= src[2] < src[0] */ + ELEMENT t = src[0]; + src[0] = src[1]; + src[1] = src[2]; + src[2] = t; + } + else + { + /* src[2] < src[1] < src[0] */ + ELEMENT t = src[0]; + src[0] = src[2]; + src[2] = t; + } + } break; default: { - size_t n1 = n / 2; - size_t n2 = (n + 1) / 2; - /* Note: n1 + n2 = n, n1 <= n2. */ - /* Sort src[n1..n-1], scratching tmp[0..n2-1]. */ - merge_sort_inplace (src + n1, n2, tmp); - /* Sort src[0..n1-1] into tmp[0..n1-1], scratching tmp[n1..2*n1-1]. */ - merge_sort_fromto (src, tmp, n1, tmp + n1); - /* Merge the two half results. */ - merge (tmp, n1, src + n1, n2, src); + size_t n1 = n / 2; + size_t n2 = (n + 1) / 2; + /* Note: n1 + n2 = n, n1 <= n2. */ + /* Sort src[n1..n-1], scratching tmp[0..n2-1]. */ + merge_sort_inplace (src + n1, n2, tmp); + /* Sort src[0..n1-1] into tmp[0..n1-1], scratching tmp[n1..2*n1-1]. */ + merge_sort_fromto (src, tmp, n1, tmp + n1); + /* Merge the two half results. */ + merge (tmp, n1, src + n1, n2, src); } break; } diff --git a/lib/c-ctype.c b/lib/c-ctype.c index e36a513..403adc2 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c @@ -1,6 +1,6 @@ /* Character handling in C locale. - Copyright 2000-2003, 2006 Free Software Foundation, Inc. + Copyright 2000-2003, 2006, 2009-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/c-ctype.h b/lib/c-ctype.h index d7b067e..00c0a26 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -5,7 +5,7 @@ <ctype.h> functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/c-strcase.h b/lib/c-strcase.h index 714a3c6..99e7faf 100644 --- a/lib/c-strcase.h +++ b/lib/c-strcase.h @@ -1,5 +1,6 @@ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2010 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c index a523898..bc3e76d 100644 --- a/lib/c-strcasecmp.c +++ b/lib/c-strcasecmp.c @@ -1,5 +1,5 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -40,7 +40,7 @@ c_strcasecmp (const char *s1, const char *s2) c2 = c_tolower (*p2); if (c1 == '\0') - break; + break; ++p1; ++p2; diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h index cd29b66..0af82f3 100644 --- a/lib/c-strcaseeq.h +++ b/lib/c-strcaseeq.h @@ -1,5 +1,5 @@ /* Optimized case-insensitive string comparison in C locale. - Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index c1496ca..01dbf39 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -1,5 +1,5 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -40,7 +40,7 @@ c_strncasecmp (const char *s1, const char *s2, size_t n) c2 = c_tolower (*p2); if (--n == 0 || c1 == '\0') - break; + break; ++p1; ++p2; diff --git a/lib/config.charset b/lib/config.charset index c1a7f5d..ae2efc4 100755..100644 --- a/lib/config.charset +++ b/lib/config.charset @@ -1,7 +1,7 @@ #! /bin/sh # Output a system dependent table of character encoding aliases. # -# Copyright (C) 2000-2004, 2006-2009 Free Software Foundation, Inc. +# Copyright (C) 2000-2004, 2006-2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -123,561 +123,561 @@ echo "# It was automatically generated from config.charset." # List of references, updated during installation: echo "# Packages using this file: " case "$os" in - linux-gnulibc1*) - # Linux libc5 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "C ASCII" - echo "POSIX ASCII" - for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \ - en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \ - en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \ - es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \ - et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \ - fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \ - it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \ - sv_FI sv_SE; do - echo "$l ISO-8859-1" - echo "$l.iso-8859-1 ISO-8859-1" - echo "$l.iso-8859-15 ISO-8859-15" - echo "$l.iso-8859-15@euro ISO-8859-15" - echo "$l@euro ISO-8859-15" - echo "$l.cp-437 CP437" - echo "$l.cp-850 CP850" - echo "$l.cp-1252 CP1252" - echo "$l.cp-1252@euro CP1252" - #echo "$l.atari-st ATARI-ST" # not a commonly used encoding - echo "$l.utf-8 UTF-8" - echo "$l.utf-8@euro UTF-8" - done - for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \ - sl_SI sr sr_CS sr_YU; do - echo "$l ISO-8859-2" - echo "$l.iso-8859-2 ISO-8859-2" - echo "$l.cp-852 CP852" - echo "$l.cp-1250 CP1250" - echo "$l.utf-8 UTF-8" - done - for l in mk mk_MK ru ru_RU; do - echo "$l ISO-8859-5" - echo "$l.iso-8859-5 ISO-8859-5" - echo "$l.koi8-r KOI8-R" - echo "$l.cp-866 CP866" - echo "$l.cp-1251 CP1251" - echo "$l.utf-8 UTF-8" - done - for l in ar ar_SA; do - echo "$l ISO-8859-6" - echo "$l.iso-8859-6 ISO-8859-6" - echo "$l.cp-864 CP864" - #echo "$l.cp-868 CP868" # not a commonly used encoding - echo "$l.cp-1256 CP1256" - echo "$l.utf-8 UTF-8" - done - for l in el el_GR gr gr_GR; do - echo "$l ISO-8859-7" - echo "$l.iso-8859-7 ISO-8859-7" - echo "$l.cp-869 CP869" - echo "$l.cp-1253 CP1253" - echo "$l.cp-1253@euro CP1253" - echo "$l.utf-8 UTF-8" - echo "$l.utf-8@euro UTF-8" - done - for l in he he_IL iw iw_IL; do - echo "$l ISO-8859-8" - echo "$l.iso-8859-8 ISO-8859-8" - echo "$l.cp-862 CP862" - echo "$l.cp-1255 CP1255" - echo "$l.utf-8 UTF-8" - done - for l in tr tr_TR; do - echo "$l ISO-8859-9" - echo "$l.iso-8859-9 ISO-8859-9" - echo "$l.cp-857 CP857" - echo "$l.cp-1254 CP1254" - echo "$l.utf-8 UTF-8" - done - for l in lt lt_LT lv lv_LV; do - #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name - echo "$l ISO-8859-13" - done - for l in ru_UA uk uk_UA; do - echo "$l KOI8-U" - done - for l in zh zh_CN; do - #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name - echo "$l GB2312" - done - for l in ja ja_JP ja_JP.EUC; do - echo "$l EUC-JP" - done - for l in ko ko_KR; do - echo "$l EUC-KR" - done - for l in th th_TH; do - echo "$l TIS-620" - done - for l in fa fa_IR; do - #echo "$l ISIRI-3342" # a broken encoding - echo "$l.utf-8 UTF-8" - done - ;; - linux* | *-gnu*) - # With glibc-2.1 or newer, we don't need any canonicalization, - # because glibc has iconv and both glibc and libiconv support all - # GNU canonical names directly. Therefore, the Makefile does not - # need to install the alias file at all. - # The following applies only to glibc-2.0.x and older libcs. - echo "ISO_646.IRV:1983 ASCII" - ;; - aix*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-6 ISO-8859-6" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "IBM-850 CP850" - echo "IBM-856 CP856" - echo "IBM-921 ISO-8859-13" - echo "IBM-922 CP922" - echo "IBM-932 CP932" - echo "IBM-943 CP943" - echo "IBM-1046 CP1046" - echo "IBM-1124 CP1124" - echo "IBM-1129 CP1129" - echo "IBM-1252 CP1252" - echo "IBM-eucCN GB2312" - echo "IBM-eucJP EUC-JP" - echo "IBM-eucKR EUC-KR" - echo "IBM-eucTW EUC-TW" - echo "big5 BIG5" - echo "GBK GBK" - echo "TIS-620 TIS-620" - echo "UTF-8 UTF-8" - ;; - hpux*) - echo "iso88591 ISO-8859-1" - echo "iso88592 ISO-8859-2" - echo "iso88595 ISO-8859-5" - echo "iso88596 ISO-8859-6" - echo "iso88597 ISO-8859-7" - echo "iso88598 ISO-8859-8" - echo "iso88599 ISO-8859-9" - echo "iso885915 ISO-8859-15" - echo "roman8 HP-ROMAN8" - echo "arabic8 HP-ARABIC8" - echo "greek8 HP-GREEK8" - echo "hebrew8 HP-HEBREW8" - echo "turkish8 HP-TURKISH8" - echo "kana8 HP-KANA8" - echo "tis620 TIS-620" - echo "big5 BIG5" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "hp15CN GB2312" - #echo "ccdc ?" # what is this? - echo "SJIS SHIFT_JIS" - echo "utf8 UTF-8" - ;; - irix*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-9 ISO-8859-9" - echo "eucCN GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - ;; - osf*) - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "cp850 CP850" - echo "big5 BIG5" - echo "dechanyu DEC-HANYU" - echo "dechanzi GB2312" - echo "deckanji DEC-KANJI" - echo "deckorean EUC-KR" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "GBK GBK" - echo "KSC5601 CP949" - echo "sdeckanji EUC-JP" - echo "SJIS SHIFT_JIS" - echo "TACTIS TIS-620" - echo "UTF-8 UTF-8" - ;; - solaris*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-3 ISO-8859-3" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-6 ISO-8859-6" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-8 ISO-8859-8" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-15 ISO-8859-15" - echo "koi8-r KOI8-R" - echo "ansi-1251 CP1251" - echo "BIG5 BIG5" - echo "Big5-HKSCS BIG5-HKSCS" - echo "gb2312 GB2312" - echo "GBK GBK" - echo "GB18030 GB18030" - echo "cns11643 EUC-TW" - echo "5601 EUC-KR" - echo "ko_KR.johap92 JOHAB" - echo "eucJP EUC-JP" - echo "PCK SHIFT_JIS" - echo "TIS620.2533 TIS-620" - #echo "sun_eu_greek ?" # what is this? - echo "UTF-8 UTF-8" - ;; - freebsd* | os2*) - # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just - # reuse FreeBSD's locale data for OS/2. - echo "C ASCII" - echo "US-ASCII ASCII" - for l in la_LN lt_LN; do - echo "$l.ASCII ASCII" - done - for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ - lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do - echo "$l.ISO_8859-1 ISO-8859-1" - echo "$l.DIS_8859-15 ISO-8859-15" - done - for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do - echo "$l.ISO_8859-2 ISO-8859-2" - done - for l in la_LN lt_LT; do - echo "$l.ISO_8859-4 ISO-8859-4" - done - for l in ru_RU ru_SU; do - echo "$l.KOI8-R KOI8-R" - echo "$l.ISO_8859-5 ISO-8859-5" - echo "$l.CP866 CP866" - done - echo "uk_UA.KOI8-U KOI8-U" - echo "zh_TW.BIG5 BIG5" - echo "zh_TW.Big5 BIG5" - echo "zh_CN.EUC GB2312" - echo "ja_JP.EUC EUC-JP" - echo "ja_JP.SJIS SHIFT_JIS" - echo "ja_JP.Shift_JIS SHIFT_JIS" - echo "ko_KR.EUC EUC-KR" - ;; - netbsd*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-13 ISO-8859-13" - echo "ISO8859-15 ISO-8859-15" - echo "eucCN GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "eucTW EUC-TW" - echo "BIG5 BIG5" - echo "SJIS SHIFT_JIS" - ;; - openbsd*) - echo "646 ASCII" - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-13 ISO-8859-13" - echo "ISO8859-15 ISO-8859-15" - ;; - darwin[56]*) - # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "C ASCII" - for l in en_AU en_CA en_GB en_US la_LN; do - echo "$l.US-ASCII ASCII" - done - for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \ - nl_NL no_NO pt_PT sv_SE; do - echo "$l ISO-8859-1" - echo "$l.ISO8859-1 ISO-8859-1" - echo "$l.ISO8859-15 ISO-8859-15" - done - for l in la_LN; do - echo "$l.ISO8859-1 ISO-8859-1" - echo "$l.ISO8859-15 ISO-8859-15" - done - for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do - echo "$l.ISO8859-2 ISO-8859-2" - done - for l in la_LN lt_LT; do - echo "$l.ISO8859-4 ISO-8859-4" - done - for l in ru_RU; do - echo "$l.KOI8-R KOI8-R" - echo "$l.ISO8859-5 ISO-8859-5" - echo "$l.CP866 CP866" - done - for l in bg_BG; do - echo "$l.CP1251 CP1251" - done - echo "uk_UA.KOI8-U KOI8-U" - echo "zh_TW.BIG5 BIG5" - echo "zh_TW.Big5 BIG5" - echo "zh_CN.EUC GB2312" - echo "ja_JP.EUC EUC-JP" - echo "ja_JP.SJIS SHIFT_JIS" - echo "ko_KR.EUC EUC-KR" - ;; - darwin*) - # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is - # useless: - # - It returns the empty string when LANG is set to a locale of the - # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 - # LC_CTYPE file. - # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by - # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. - # - The documentation says: - # "... all code that calls BSD system routines should ensure - # that the const *char parameters of these routines are in UTF-8 - # encoding. All BSD system functions expect their string - # parameters to be in UTF-8 encoding and nothing else." - # It also says - # "An additional caveat is that string parameters for files, - # paths, and other file-system entities must be in canonical - # UTF-8. In a canonical UTF-8 Unicode string, all decomposable - # characters are decomposed ..." - # but this is not true: You can pass non-decomposed UTF-8 strings - # to file system functions, and it is the OS which will convert - # them to decomposed UTF-8 before accessing the file system. - # - The Apple Terminal application displays UTF-8 by default. - # - However, other applications are free to use different encodings: - # - xterm uses ISO-8859-1 by default. - # - TextEdit uses MacRoman by default. - # We prefer UTF-8 over decomposed UTF-8-MAC because one should - # minimize the use of decomposed Unicode. Unfortunately, through the - # Darwin file system, decomposed UTF-8 strings are leaked into user - # space nevertheless. - # Then there are also the locales with encodings other than US-ASCII - # and UTF-8. These locales can be occasionally useful to users (e.g. - # when grepping through ISO-8859-1 encoded text files), when all their - # file names are in US-ASCII. - echo "ISO8859-1 ISO-8859-1" - echo "ISO8859-2 ISO-8859-2" - echo "ISO8859-4 ISO-8859-4" - echo "ISO8859-5 ISO-8859-5" - echo "ISO8859-7 ISO-8859-7" - echo "ISO8859-9 ISO-8859-9" - echo "ISO8859-13 ISO-8859-13" - echo "ISO8859-15 ISO-8859-15" - echo "KOI8-R KOI8-R" - echo "KOI8-U KOI8-U" - echo "CP866 CP866" - echo "CP949 CP949" - echo "CP1131 CP1131" - echo "CP1251 CP1251" - echo "eucCN GB2312" - echo "GB2312 GB2312" - echo "eucJP EUC-JP" - echo "eucKR EUC-KR" - echo "Big5 BIG5" - echo "Big5HKSCS BIG5-HKSCS" - echo "GBK GBK" - echo "GB18030 GB18030" - echo "SJIS SHIFT_JIS" - echo "ARMSCII-8 ARMSCII-8" - echo "PT154 PT154" - #echo "ISCII-DEV ?" - echo "* UTF-8" - ;; - beos* | haiku*) - # BeOS and Haiku have a single locale, and it has UTF-8 encoding. - echo "* UTF-8" - ;; - msdosdjgpp*) - # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore - # localcharset.c falls back to using the full locale name - # from the environment variables. - echo "#" - echo "# The encodings given here may not all be correct." - echo "# If you find that the encoding given for your language and" - echo "# country is not the one your DOS machine actually uses, just" - echo "# correct it in this file, and send a mail to" - echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>" - echo "# and Bruno Haible <bruno@clisp.org>." - echo "#" - echo "C ASCII" - # ISO-8859-1 languages - echo "ca CP850" - echo "ca_ES CP850" - echo "da CP865" # not CP850 ?? - echo "da_DK CP865" # not CP850 ?? - echo "de CP850" - echo "de_AT CP850" - echo "de_CH CP850" - echo "de_DE CP850" - echo "en CP850" - echo "en_AU CP850" # not CP437 ?? - echo "en_CA CP850" - echo "en_GB CP850" - echo "en_NZ CP437" - echo "en_US CP437" - echo "en_ZA CP850" # not CP437 ?? - echo "es CP850" - echo "es_AR CP850" - echo "es_BO CP850" - echo "es_CL CP850" - echo "es_CO CP850" - echo "es_CR CP850" - echo "es_CU CP850" - echo "es_DO CP850" - echo "es_EC CP850" - echo "es_ES CP850" - echo "es_GT CP850" - echo "es_HN CP850" - echo "es_MX CP850" - echo "es_NI CP850" - echo "es_PA CP850" - echo "es_PY CP850" - echo "es_PE CP850" - echo "es_SV CP850" - echo "es_UY CP850" - echo "es_VE CP850" - echo "et CP850" - echo "et_EE CP850" - echo "eu CP850" - echo "eu_ES CP850" - echo "fi CP850" - echo "fi_FI CP850" - echo "fr CP850" - echo "fr_BE CP850" - echo "fr_CA CP850" - echo "fr_CH CP850" - echo "fr_FR CP850" - echo "ga CP850" - echo "ga_IE CP850" - echo "gd CP850" - echo "gd_GB CP850" - echo "gl CP850" - echo "gl_ES CP850" - echo "id CP850" # not CP437 ?? - echo "id_ID CP850" # not CP437 ?? - echo "is CP861" # not CP850 ?? - echo "is_IS CP861" # not CP850 ?? - echo "it CP850" - echo "it_CH CP850" - echo "it_IT CP850" - echo "lt CP775" - echo "lt_LT CP775" - echo "lv CP775" - echo "lv_LV CP775" - echo "nb CP865" # not CP850 ?? - echo "nb_NO CP865" # not CP850 ?? - echo "nl CP850" - echo "nl_BE CP850" - echo "nl_NL CP850" - echo "nn CP865" # not CP850 ?? - echo "nn_NO CP865" # not CP850 ?? - echo "no CP865" # not CP850 ?? - echo "no_NO CP865" # not CP850 ?? - echo "pt CP850" - echo "pt_BR CP850" - echo "pt_PT CP850" - echo "sv CP850" - echo "sv_SE CP850" - # ISO-8859-2 languages - echo "cs CP852" - echo "cs_CZ CP852" - echo "hr CP852" - echo "hr_HR CP852" - echo "hu CP852" - echo "hu_HU CP852" - echo "pl CP852" - echo "pl_PL CP852" - echo "ro CP852" - echo "ro_RO CP852" - echo "sk CP852" - echo "sk_SK CP852" - echo "sl CP852" - echo "sl_SI CP852" - echo "sq CP852" - echo "sq_AL CP852" - echo "sr CP852" # CP852 or CP866 or CP855 ?? - echo "sr_CS CP852" # CP852 or CP866 or CP855 ?? - echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? - # ISO-8859-3 languages - echo "mt CP850" - echo "mt_MT CP850" - # ISO-8859-5 languages - echo "be CP866" - echo "be_BE CP866" - echo "bg CP866" # not CP855 ?? - echo "bg_BG CP866" # not CP855 ?? - echo "mk CP866" # not CP855 ?? - echo "mk_MK CP866" # not CP855 ?? - echo "ru CP866" - echo "ru_RU CP866" - echo "uk CP1125" - echo "uk_UA CP1125" - # ISO-8859-6 languages - echo "ar CP864" - echo "ar_AE CP864" - echo "ar_DZ CP864" - echo "ar_EG CP864" - echo "ar_IQ CP864" - echo "ar_IR CP864" - echo "ar_JO CP864" - echo "ar_KW CP864" - echo "ar_MA CP864" - echo "ar_OM CP864" - echo "ar_QA CP864" - echo "ar_SA CP864" - echo "ar_SY CP864" - # ISO-8859-7 languages - echo "el CP869" - echo "el_GR CP869" - # ISO-8859-8 languages - echo "he CP862" - echo "he_IL CP862" - # ISO-8859-9 languages - echo "tr CP857" - echo "tr_TR CP857" - # Japanese - echo "ja CP932" - echo "ja_JP CP932" - # Chinese - echo "zh_CN GBK" - echo "zh_TW CP950" # not CP938 ?? - # Korean - echo "kr CP949" # not CP934 ?? - echo "kr_KR CP949" # not CP934 ?? - # Thai - echo "th CP874" - echo "th_TH CP874" - # Other - echo "eo CP850" - echo "eo_EO CP850" - ;; + linux-gnulibc1*) + # Linux libc5 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "C ASCII" + echo "POSIX ASCII" + for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \ + en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \ + en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \ + es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \ + et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \ + fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \ + it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \ + sv_FI sv_SE; do + echo "$l ISO-8859-1" + echo "$l.iso-8859-1 ISO-8859-1" + echo "$l.iso-8859-15 ISO-8859-15" + echo "$l.iso-8859-15@euro ISO-8859-15" + echo "$l@euro ISO-8859-15" + echo "$l.cp-437 CP437" + echo "$l.cp-850 CP850" + echo "$l.cp-1252 CP1252" + echo "$l.cp-1252@euro CP1252" + #echo "$l.atari-st ATARI-ST" # not a commonly used encoding + echo "$l.utf-8 UTF-8" + echo "$l.utf-8@euro UTF-8" + done + for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \ + sl_SI sr sr_CS sr_YU; do + echo "$l ISO-8859-2" + echo "$l.iso-8859-2 ISO-8859-2" + echo "$l.cp-852 CP852" + echo "$l.cp-1250 CP1250" + echo "$l.utf-8 UTF-8" + done + for l in mk mk_MK ru ru_RU; do + echo "$l ISO-8859-5" + echo "$l.iso-8859-5 ISO-8859-5" + echo "$l.koi8-r KOI8-R" + echo "$l.cp-866 CP866" + echo "$l.cp-1251 CP1251" + echo "$l.utf-8 UTF-8" + done + for l in ar ar_SA; do + echo "$l ISO-8859-6" + echo "$l.iso-8859-6 ISO-8859-6" + echo "$l.cp-864 CP864" + #echo "$l.cp-868 CP868" # not a commonly used encoding + echo "$l.cp-1256 CP1256" + echo "$l.utf-8 UTF-8" + done + for l in el el_GR gr gr_GR; do + echo "$l ISO-8859-7" + echo "$l.iso-8859-7 ISO-8859-7" + echo "$l.cp-869 CP869" + echo "$l.cp-1253 CP1253" + echo "$l.cp-1253@euro CP1253" + echo "$l.utf-8 UTF-8" + echo "$l.utf-8@euro UTF-8" + done + for l in he he_IL iw iw_IL; do + echo "$l ISO-8859-8" + echo "$l.iso-8859-8 ISO-8859-8" + echo "$l.cp-862 CP862" + echo "$l.cp-1255 CP1255" + echo "$l.utf-8 UTF-8" + done + for l in tr tr_TR; do + echo "$l ISO-8859-9" + echo "$l.iso-8859-9 ISO-8859-9" + echo "$l.cp-857 CP857" + echo "$l.cp-1254 CP1254" + echo "$l.utf-8 UTF-8" + done + for l in lt lt_LT lv lv_LV; do + #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name + echo "$l ISO-8859-13" + done + for l in ru_UA uk uk_UA; do + echo "$l KOI8-U" + done + for l in zh zh_CN; do + #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name + echo "$l GB2312" + done + for l in ja ja_JP ja_JP.EUC; do + echo "$l EUC-JP" + done + for l in ko ko_KR; do + echo "$l EUC-KR" + done + for l in th th_TH; do + echo "$l TIS-620" + done + for l in fa fa_IR; do + #echo "$l ISIRI-3342" # a broken encoding + echo "$l.utf-8 UTF-8" + done + ;; + linux* | *-gnu*) + # With glibc-2.1 or newer, we don't need any canonicalization, + # because glibc has iconv and both glibc and libiconv support all + # GNU canonical names directly. Therefore, the Makefile does not + # need to install the alias file at all. + # The following applies only to glibc-2.0.x and older libcs. + echo "ISO_646.IRV:1983 ASCII" + ;; + aix*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-6 ISO-8859-6" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "IBM-850 CP850" + echo "IBM-856 CP856" + echo "IBM-921 ISO-8859-13" + echo "IBM-922 CP922" + echo "IBM-932 CP932" + echo "IBM-943 CP943" + echo "IBM-1046 CP1046" + echo "IBM-1124 CP1124" + echo "IBM-1129 CP1129" + echo "IBM-1252 CP1252" + echo "IBM-eucCN GB2312" + echo "IBM-eucJP EUC-JP" + echo "IBM-eucKR EUC-KR" + echo "IBM-eucTW EUC-TW" + echo "big5 BIG5" + echo "GBK GBK" + echo "TIS-620 TIS-620" + echo "UTF-8 UTF-8" + ;; + hpux*) + echo "iso88591 ISO-8859-1" + echo "iso88592 ISO-8859-2" + echo "iso88595 ISO-8859-5" + echo "iso88596 ISO-8859-6" + echo "iso88597 ISO-8859-7" + echo "iso88598 ISO-8859-8" + echo "iso88599 ISO-8859-9" + echo "iso885915 ISO-8859-15" + echo "roman8 HP-ROMAN8" + echo "arabic8 HP-ARABIC8" + echo "greek8 HP-GREEK8" + echo "hebrew8 HP-HEBREW8" + echo "turkish8 HP-TURKISH8" + echo "kana8 HP-KANA8" + echo "tis620 TIS-620" + echo "big5 BIG5" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "hp15CN GB2312" + #echo "ccdc ?" # what is this? + echo "SJIS SHIFT_JIS" + echo "utf8 UTF-8" + ;; + irix*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-9 ISO-8859-9" + echo "eucCN GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + ;; + osf*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "cp850 CP850" + echo "big5 BIG5" + echo "dechanyu DEC-HANYU" + echo "dechanzi GB2312" + echo "deckanji DEC-KANJI" + echo "deckorean EUC-KR" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "GBK GBK" + echo "KSC5601 CP949" + echo "sdeckanji EUC-JP" + echo "SJIS SHIFT_JIS" + echo "TACTIS TIS-620" + echo "UTF-8 UTF-8" + ;; + solaris*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-3 ISO-8859-3" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-6 ISO-8859-6" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "koi8-r KOI8-R" + echo "ansi-1251 CP1251" + echo "BIG5 BIG5" + echo "Big5-HKSCS BIG5-HKSCS" + echo "gb2312 GB2312" + echo "GBK GBK" + echo "GB18030 GB18030" + echo "cns11643 EUC-TW" + echo "5601 EUC-KR" + echo "ko_KR.johap92 JOHAB" + echo "eucJP EUC-JP" + echo "PCK SHIFT_JIS" + echo "TIS620.2533 TIS-620" + #echo "sun_eu_greek ?" # what is this? + echo "UTF-8 UTF-8" + ;; + freebsd* | os2*) + # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just + # reuse FreeBSD's locale data for OS/2. + echo "C ASCII" + echo "US-ASCII ASCII" + for l in la_LN lt_LN; do + echo "$l.ASCII ASCII" + done + for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ + lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do + echo "$l.ISO_8859-1 ISO-8859-1" + echo "$l.DIS_8859-15 ISO-8859-15" + done + for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do + echo "$l.ISO_8859-2 ISO-8859-2" + done + for l in la_LN lt_LT; do + echo "$l.ISO_8859-4 ISO-8859-4" + done + for l in ru_RU ru_SU; do + echo "$l.KOI8-R KOI8-R" + echo "$l.ISO_8859-5 ISO-8859-5" + echo "$l.CP866 CP866" + done + echo "uk_UA.KOI8-U KOI8-U" + echo "zh_TW.BIG5 BIG5" + echo "zh_TW.Big5 BIG5" + echo "zh_CN.EUC GB2312" + echo "ja_JP.EUC EUC-JP" + echo "ja_JP.SJIS SHIFT_JIS" + echo "ja_JP.Shift_JIS SHIFT_JIS" + echo "ko_KR.EUC EUC-KR" + ;; + netbsd*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-13 ISO-8859-13" + echo "ISO8859-15 ISO-8859-15" + echo "eucCN GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "BIG5 BIG5" + echo "SJIS SHIFT_JIS" + ;; + openbsd*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-13 ISO-8859-13" + echo "ISO8859-15 ISO-8859-15" + ;; + darwin[56]*) + # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "C ASCII" + for l in en_AU en_CA en_GB en_US la_LN; do + echo "$l.US-ASCII ASCII" + done + for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \ + nl_NL no_NO pt_PT sv_SE; do + echo "$l ISO-8859-1" + echo "$l.ISO8859-1 ISO-8859-1" + echo "$l.ISO8859-15 ISO-8859-15" + done + for l in la_LN; do + echo "$l.ISO8859-1 ISO-8859-1" + echo "$l.ISO8859-15 ISO-8859-15" + done + for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do + echo "$l.ISO8859-2 ISO-8859-2" + done + for l in la_LN lt_LT; do + echo "$l.ISO8859-4 ISO-8859-4" + done + for l in ru_RU; do + echo "$l.KOI8-R KOI8-R" + echo "$l.ISO8859-5 ISO-8859-5" + echo "$l.CP866 CP866" + done + for l in bg_BG; do + echo "$l.CP1251 CP1251" + done + echo "uk_UA.KOI8-U KOI8-U" + echo "zh_TW.BIG5 BIG5" + echo "zh_TW.Big5 BIG5" + echo "zh_CN.EUC GB2312" + echo "ja_JP.EUC EUC-JP" + echo "ja_JP.SJIS SHIFT_JIS" + echo "ko_KR.EUC EUC-KR" + ;; + darwin*) + # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is + # useless: + # - It returns the empty string when LANG is set to a locale of the + # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 + # LC_CTYPE file. + # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by + # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. + # - The documentation says: + # "... all code that calls BSD system routines should ensure + # that the const *char parameters of these routines are in UTF-8 + # encoding. All BSD system functions expect their string + # parameters to be in UTF-8 encoding and nothing else." + # It also says + # "An additional caveat is that string parameters for files, + # paths, and other file-system entities must be in canonical + # UTF-8. In a canonical UTF-8 Unicode string, all decomposable + # characters are decomposed ..." + # but this is not true: You can pass non-decomposed UTF-8 strings + # to file system functions, and it is the OS which will convert + # them to decomposed UTF-8 before accessing the file system. + # - The Apple Terminal application displays UTF-8 by default. + # - However, other applications are free to use different encodings: + # - xterm uses ISO-8859-1 by default. + # - TextEdit uses MacRoman by default. + # We prefer UTF-8 over decomposed UTF-8-MAC because one should + # minimize the use of decomposed Unicode. Unfortunately, through the + # Darwin file system, decomposed UTF-8 strings are leaked into user + # space nevertheless. + # Then there are also the locales with encodings other than US-ASCII + # and UTF-8. These locales can be occasionally useful to users (e.g. + # when grepping through ISO-8859-1 encoded text files), when all their + # file names are in US-ASCII. + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-13 ISO-8859-13" + echo "ISO8859-15 ISO-8859-15" + echo "KOI8-R KOI8-R" + echo "KOI8-U KOI8-U" + echo "CP866 CP866" + echo "CP949 CP949" + echo "CP1131 CP1131" + echo "CP1251 CP1251" + echo "eucCN GB2312" + echo "GB2312 GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "Big5 BIG5" + echo "Big5HKSCS BIG5-HKSCS" + echo "GBK GBK" + echo "GB18030 GB18030" + echo "SJIS SHIFT_JIS" + echo "ARMSCII-8 ARMSCII-8" + echo "PT154 PT154" + #echo "ISCII-DEV ?" + echo "* UTF-8" + ;; + beos* | haiku*) + # BeOS and Haiku have a single locale, and it has UTF-8 encoding. + echo "* UTF-8" + ;; + msdosdjgpp*) + # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "#" + echo "# The encodings given here may not all be correct." + echo "# If you find that the encoding given for your language and" + echo "# country is not the one your DOS machine actually uses, just" + echo "# correct it in this file, and send a mail to" + echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>" + echo "# and Bruno Haible <bruno@clisp.org>." + echo "#" + echo "C ASCII" + # ISO-8859-1 languages + echo "ca CP850" + echo "ca_ES CP850" + echo "da CP865" # not CP850 ?? + echo "da_DK CP865" # not CP850 ?? + echo "de CP850" + echo "de_AT CP850" + echo "de_CH CP850" + echo "de_DE CP850" + echo "en CP850" + echo "en_AU CP850" # not CP437 ?? + echo "en_CA CP850" + echo "en_GB CP850" + echo "en_NZ CP437" + echo "en_US CP437" + echo "en_ZA CP850" # not CP437 ?? + echo "es CP850" + echo "es_AR CP850" + echo "es_BO CP850" + echo "es_CL CP850" + echo "es_CO CP850" + echo "es_CR CP850" + echo "es_CU CP850" + echo "es_DO CP850" + echo "es_EC CP850" + echo "es_ES CP850" + echo "es_GT CP850" + echo "es_HN CP850" + echo "es_MX CP850" + echo "es_NI CP850" + echo "es_PA CP850" + echo "es_PY CP850" + echo "es_PE CP850" + echo "es_SV CP850" + echo "es_UY CP850" + echo "es_VE CP850" + echo "et CP850" + echo "et_EE CP850" + echo "eu CP850" + echo "eu_ES CP850" + echo "fi CP850" + echo "fi_FI CP850" + echo "fr CP850" + echo "fr_BE CP850" + echo "fr_CA CP850" + echo "fr_CH CP850" + echo "fr_FR CP850" + echo "ga CP850" + echo "ga_IE CP850" + echo "gd CP850" + echo "gd_GB CP850" + echo "gl CP850" + echo "gl_ES CP850" + echo "id CP850" # not CP437 ?? + echo "id_ID CP850" # not CP437 ?? + echo "is CP861" # not CP850 ?? + echo "is_IS CP861" # not CP850 ?? + echo "it CP850" + echo "it_CH CP850" + echo "it_IT CP850" + echo "lt CP775" + echo "lt_LT CP775" + echo "lv CP775" + echo "lv_LV CP775" + echo "nb CP865" # not CP850 ?? + echo "nb_NO CP865" # not CP850 ?? + echo "nl CP850" + echo "nl_BE CP850" + echo "nl_NL CP850" + echo "nn CP865" # not CP850 ?? + echo "nn_NO CP865" # not CP850 ?? + echo "no CP865" # not CP850 ?? + echo "no_NO CP865" # not CP850 ?? + echo "pt CP850" + echo "pt_BR CP850" + echo "pt_PT CP850" + echo "sv CP850" + echo "sv_SE CP850" + # ISO-8859-2 languages + echo "cs CP852" + echo "cs_CZ CP852" + echo "hr CP852" + echo "hr_HR CP852" + echo "hu CP852" + echo "hu_HU CP852" + echo "pl CP852" + echo "pl_PL CP852" + echo "ro CP852" + echo "ro_RO CP852" + echo "sk CP852" + echo "sk_SK CP852" + echo "sl CP852" + echo "sl_SI CP852" + echo "sq CP852" + echo "sq_AL CP852" + echo "sr CP852" # CP852 or CP866 or CP855 ?? + echo "sr_CS CP852" # CP852 or CP866 or CP855 ?? + echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? + # ISO-8859-3 languages + echo "mt CP850" + echo "mt_MT CP850" + # ISO-8859-5 languages + echo "be CP866" + echo "be_BE CP866" + echo "bg CP866" # not CP855 ?? + echo "bg_BG CP866" # not CP855 ?? + echo "mk CP866" # not CP855 ?? + echo "mk_MK CP866" # not CP855 ?? + echo "ru CP866" + echo "ru_RU CP866" + echo "uk CP1125" + echo "uk_UA CP1125" + # ISO-8859-6 languages + echo "ar CP864" + echo "ar_AE CP864" + echo "ar_DZ CP864" + echo "ar_EG CP864" + echo "ar_IQ CP864" + echo "ar_IR CP864" + echo "ar_JO CP864" + echo "ar_KW CP864" + echo "ar_MA CP864" + echo "ar_OM CP864" + echo "ar_QA CP864" + echo "ar_SA CP864" + echo "ar_SY CP864" + # ISO-8859-7 languages + echo "el CP869" + echo "el_GR CP869" + # ISO-8859-8 languages + echo "he CP862" + echo "he_IL CP862" + # ISO-8859-9 languages + echo "tr CP857" + echo "tr_TR CP857" + # Japanese + echo "ja CP932" + echo "ja_JP CP932" + # Chinese + echo "zh_CN GBK" + echo "zh_TW CP950" # not CP938 ?? + # Korean + echo "kr CP949" # not CP934 ?? + echo "kr_KR CP949" # not CP934 ?? + # Thai + echo "th CP874" + echo "th_TH CP874" + # Other + echo "eo CP850" + echo "eo_EO CP850" + ;; esac diff --git a/lib/dup2.c b/lib/dup2.c deleted file mode 100644 index a7d3cfd..0000000 --- a/lib/dup2.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Duplicate an open file descriptor to a specified file descriptor. - - Copyright (C) 1999, 2004, 2005, 2006, 2007, 2009 Free Software - Foundation, Inc. - - This program 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 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 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 <http://www.gnu.org/licenses/>. */ - -/* written by Paul Eggert */ - -#include <config.h> - -/* Specification. */ -#include <unistd.h> - -#include <errno.h> -#include <fcntl.h> - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Get declarations of the Win32 API functions. */ -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -#endif - -#if REPLACE_DUP2 - -# undef dup2 - -int -rpl_dup2 (int fd, int desired_fd) -{ - int result; -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, - dup2 (fd, fd) returns 0, but all further attempts to use fd in - future dup2 calls will hang. */ - if (fd == desired_fd) - { - if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE) - { - errno = EBADF; - return -1; - } - return fd; - } -# endif - result = dup2 (fd, desired_fd); - if (result == 0) - result = desired_fd; - return result; -} - -#else /* !REPLACE_DUP2 */ - -/* On older platforms, dup2 did not exist. */ - -# ifndef F_DUPFD -static int -dupfd (int fd, int desired_fd) -{ - int duplicated_fd = dup (fd); - if (duplicated_fd < 0 || duplicated_fd == desired_fd) - return duplicated_fd; - else - { - int r = dupfd (fd, desired_fd); - int e = errno; - close (duplicated_fd); - errno = e; - return r; - } -} -# endif - -int -dup2 (int fd, int desired_fd) -{ - if (fd == desired_fd) - return fd; - close (desired_fd); -# ifdef F_DUPFD - return fcntl (fd, F_DUPFD, desired_fd); -# else - return dupfd (fd, desired_fd); -# endif -} -#endif /* !REPLACE_DUP2 */ diff --git a/lib/errno.in.h b/lib/errno.in.h index a9b81d5..0e6fb7f 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -1,6 +1,6 @@ /* A POSIX-like <errno.h>. - Copyright (C) 2008-2009 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/float+.h b/lib/float+.h index 2288e3d..956eb28 100644 --- a/lib/float+.h +++ b/lib/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software; you can redistribute it and/or modify diff --git a/lib/float.in.h b/lib/float.in.h index 63d55f8..ad99af3 100644 --- a/lib/float.in.h +++ b/lib/float.in.h @@ -1,6 +1,6 @@ /* A correct <float.h>. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/fpucw.h b/lib/fpucw.h index 4bd0081..dbbe363 100644 --- a/lib/fpucw.h +++ b/lib/fpucw.h @@ -1,5 +1,5 @@ /* Manipulating the FPU control word. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify @@ -70,19 +70,19 @@ typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */ # define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */ # define GET_FPUCW() \ - ({ fpucw_t _cw; \ - __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \ - _cw; \ + ({ fpucw_t _cw; \ + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \ + _cw; \ }) # define SET_FPUCW(word) \ - (void)({ fpucw_t _ncw = (word); \ - __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \ + (void)({ fpucw_t _ncw = (word); \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \ }) # define DECL_LONG_DOUBLE_ROUNDING \ fpucw_t oldcw; # define BEGIN_LONG_DOUBLE_ROUNDING() \ - (void)(oldcw = GET_FPUCW (), \ + (void)(oldcw = GET_FPUCW (), \ SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED)) # define END_LONG_DOUBLE_ROUNDING() \ SET_FPUCW (oldcw) diff --git a/lib/frexp.c b/lib/frexp.c index 8c72660..5828d62 100644 --- a/lib/frexp.c +++ b/lib/frexp.c @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -85,73 +85,73 @@ FUNC (DOUBLE x, int *expptr) exponent = 0; if (x >= L_(1.0)) { - /* A positive exponent. */ - DOUBLE pow2_i; /* = pow2[i] */ - DOUBLE powh_i; /* = powh[i] */ - - /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, - x * 2^exponent = argument, x >= 1.0. */ - for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); - ; - i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) - { - if (x >= pow2_i) - { - exponent += (1 << i); - x *= powh_i; - } - else - break; - - pow2[i] = pow2_i; - powh[i] = powh_i; - } - /* Avoid making x too small, as it could become a denormalized - number and thus lose precision. */ - while (i > 0 && x < pow2[i - 1]) - { - i--; - powh_i = powh[i]; - } - exponent += (1 << i); - x *= powh_i; - /* Here 2^-2^i <= x < 1.0. */ + /* A positive exponent. */ + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x >= 1.0. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (x >= pow2_i) + { + exponent += (1 << i); + x *= powh_i; + } + else + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + /* Avoid making x too small, as it could become a denormalized + number and thus lose precision. */ + while (i > 0 && x < pow2[i - 1]) + { + i--; + powh_i = powh[i]; + } + exponent += (1 << i); + x *= powh_i; + /* Here 2^-2^i <= x < 1.0. */ } else { - /* A negative or zero exponent. */ - DOUBLE pow2_i; /* = pow2[i] */ - DOUBLE powh_i; /* = powh[i] */ - - /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, - x * 2^exponent = argument, x < 1.0. */ - for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); - ; - i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) - { - if (x < powh_i) - { - exponent -= (1 << i); - x *= pow2_i; - } - else - break; - - pow2[i] = pow2_i; - powh[i] = powh_i; - } - /* Here 2^-2^i <= x < 1.0. */ + /* A negative or zero exponent. */ + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x < 1.0. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (x < powh_i) + { + exponent -= (1 << i); + x *= pow2_i; + } + else + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + /* Here 2^-2^i <= x < 1.0. */ } /* Invariants: x * 2^exponent = argument, and 2^-2^i <= x < 1.0. */ while (i > 0) { - i--; - if (x < powh[i]) - { - exponent -= (1 << i); - x *= pow2[i]; - } + i--; + if (x < powh[i]) + { + exponent -= (1 << i); + x *= pow2[i]; + } } /* Here 0.5 <= x < 1.0. */ } diff --git a/lib/frexpl.c b/lib/frexpl.c index 08f489c..9cf9bf6 100644 --- a/lib/frexpl.c +++ b/lib/frexpl.c @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/fseterr.c b/lib/fseterr.c index 6c31eeb..359b86e 100644 --- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -1,5 +1,5 @@ /* Set the error indicator of a stream. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -63,8 +63,8 @@ fseterr (FILE *fp) fputc ('\0', fp); /* This should set the error indicator. */ fflush (fp); /* Or this. */ if (dup2 (fd2, fd) < 0) - /* Whee... we botched the stream and now cannot restore it! */ - abort (); + /* Whee... we botched the stream and now cannot restore it! */ + abort (); close (fd2); } errno = saved_errno; diff --git a/lib/fseterr.h b/lib/fseterr.h index 0adadc3..7c1d34d 100644 --- a/lib/fseterr.h +++ b/lib/fseterr.h @@ -1,5 +1,5 @@ /* Set the error indicator of a stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c new file mode 100644 index 0000000..2f4de9f --- /dev/null +++ b/lib/glthread/lock.c @@ -0,0 +1,1058 @@ +/* Locking in multithreaded situations. + Copyright (C) 2005-2010 Free Software Foundation, Inc. + + This program 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, 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 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, + gthr-win32.h. */ + +#include <config.h> + +#include "glthread/lock.h" + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +# if HAVE_PTHREAD_RWLOCK + +# if !defined PTHREAD_RWLOCK_INITIALIZER + +int +glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_rwlock_init (&lock->rwlock, NULL); + if (err != 0) + return err; + lock->initialized = 1; + return 0; +} + +int +glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) +{ + if (!lock->initialized) + { + int err; + + err = pthread_mutex_lock (&lock->guard); + if (err != 0) + return err; + if (!lock->initialized) + { + err = glthread_rwlock_init_multithreaded (lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->guard); + return err; + } + } + err = pthread_mutex_unlock (&lock->guard); + if (err != 0) + return err; + } + return pthread_rwlock_rdlock (&lock->rwlock); +} + +int +glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) +{ + if (!lock->initialized) + { + int err; + + err = pthread_mutex_lock (&lock->guard); + if (err != 0) + return err; + if (!lock->initialized) + { + err = glthread_rwlock_init_multithreaded (lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->guard); + return err; + } + } + err = pthread_mutex_unlock (&lock->guard); + if (err != 0) + return err; + } + return pthread_rwlock_wrlock (&lock->rwlock); +} + +int +glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) +{ + if (!lock->initialized) + return EINVAL; + return pthread_rwlock_unlock (&lock->rwlock); +} + +int +glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) +{ + int err; + + if (!lock->initialized) + return EINVAL; + err = pthread_rwlock_destroy (&lock->rwlock); + if (err != 0) + return err; + lock->initialized = 0; + return 0; +} + +# endif + +# else + +int +glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_init (&lock->lock, NULL); + if (err != 0) + return err; + err = pthread_cond_init (&lock->waiting_readers, NULL); + if (err != 0) + return err; + err = pthread_cond_init (&lock->waiting_writers, NULL); + if (err != 0) + return err; + lock->waiting_writers_count = 0; + lock->runcount = 0; + return 0; +} + +int +glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + /* Test whether only readers are currently running, and whether the runcount + field will not overflow. */ + /* POSIX says: "It is implementation-defined whether the calling thread + acquires the lock when a writer does not hold the lock and there are + writers blocked on the lock." Let's say, no: give the writers a higher + priority. */ + while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + err = pthread_cond_wait (&lock->waiting_readers, &lock->lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->lock); + return err; + } + } + lock->runcount++; + return pthread_mutex_unlock (&lock->lock); +} + +int +glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + /* Test whether no readers or writers are currently running. */ + while (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + lock->waiting_writers_count++; + err = pthread_cond_wait (&lock->waiting_writers, &lock->lock); + if (err != 0) + { + lock->waiting_writers_count--; + pthread_mutex_unlock (&lock->lock); + return err; + } + lock->waiting_writers_count--; + } + lock->runcount--; /* runcount becomes -1 */ + return pthread_mutex_unlock (&lock->lock); +} + +int +glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + { + pthread_mutex_unlock (&lock->lock); + return EINVAL; + } + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + pthread_mutex_unlock (&lock->lock); + return EINVAL; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers_count > 0) + { + /* Wake up one of the waiting writers. */ + err = pthread_cond_signal (&lock->waiting_writers); + if (err != 0) + { + pthread_mutex_unlock (&lock->lock); + return err; + } + } + else + { + /* Wake up all waiting readers. */ + err = pthread_cond_broadcast (&lock->waiting_readers); + if (err != 0) + { + pthread_mutex_unlock (&lock->lock); + return err; + } + } + } + return pthread_mutex_unlock (&lock->lock); +} + +int +glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_destroy (&lock->lock); + if (err != 0) + return err; + err = pthread_cond_destroy (&lock->waiting_readers); + if (err != 0) + return err; + err = pthread_cond_destroy (&lock->waiting_writers); + if (err != 0) + return err; + return 0; +} + +# endif + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +# if HAVE_PTHREAD_MUTEX_RECURSIVE + +# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + pthread_mutexattr_t attributes; + int err; + + err = pthread_mutexattr_init (&attributes); + if (err != 0) + return err; + err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutex_init (lock, &attributes); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutexattr_destroy (&attributes); + if (err != 0) + return err; + return 0; +} + +# else + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + pthread_mutexattr_t attributes; + int err; + + err = pthread_mutexattr_init (&attributes); + if (err != 0) + return err; + err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutex_init (&lock->recmutex, &attributes); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutexattr_destroy (&attributes); + if (err != 0) + return err; + lock->initialized = 1; + return 0; +} + +int +glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) +{ + if (!lock->initialized) + { + int err; + + err = pthread_mutex_lock (&lock->guard); + if (err != 0) + return err; + if (!lock->initialized) + { + err = glthread_recursive_lock_init_multithreaded (lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->guard); + return err; + } + } + err = pthread_mutex_unlock (&lock->guard); + if (err != 0) + return err; + } + return pthread_mutex_lock (&lock->recmutex); +} + +int +glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) +{ + if (!lock->initialized) + return EINVAL; + return pthread_mutex_unlock (&lock->recmutex); +} + +int +glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) +{ + int err; + + if (!lock->initialized) + return EINVAL; + err = pthread_mutex_destroy (&lock->recmutex); + if (err != 0) + return err; + lock->initialized = 0; + return 0; +} + +# endif + +# else + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + int err; + + err = pthread_mutex_init (&lock->mutex, NULL); + if (err != 0) + return err; + lock->owner = (pthread_t) 0; + lock->depth = 0; + return 0; +} + +int +glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) +{ + pthread_t self = pthread_self (); + if (lock->owner != self) + { + int err; + + err = pthread_mutex_lock (&lock->mutex); + if (err != 0) + return err; + lock->owner = self; + } + if (++(lock->depth) == 0) /* wraparound? */ + { + lock->depth--; + return EAGAIN; + } + return 0; +} + +int +glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) +{ + if (lock->owner != pthread_self ()) + return EPERM; + if (lock->depth == 0) + return EINVAL; + if (--(lock->depth) == 0) + { + lock->owner = (pthread_t) 0; + return pthread_mutex_unlock (&lock->mutex); + } + else + return 0; +} + +int +glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) +{ + if (lock->owner != (pthread_t) 0) + return EBUSY; + return pthread_mutex_destroy (&lock->mutex); +} + +# endif + +/* -------------------------- gl_once_t datatype -------------------------- */ + +static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; + +int +glthread_once_singlethreaded (pthread_once_t *once_control) +{ + /* We don't know whether pthread_once_t is an integer type, a floating-point + type, a pointer type, or a structure type. */ + char *firstbyte = (char *)once_control; + if (*firstbyte == *(const char *)&fresh_once) + { + /* First time use of once_control. Invert the first byte. */ + *firstbyte = ~ *(const char *)&fresh_once; + return 1; + } + else + return 0; +} + +#endif + +/* ========================================================================= */ + +#if USE_PTH_THREADS + +/* Use the GNU Pth threads library. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +/* -------------------------- gl_once_t datatype -------------------------- */ + +static void +glthread_once_call (void *arg) +{ + void (**gl_once_temp_addr) (void) = (void (**) (void)) arg; + void (*initfunction) (void) = *gl_once_temp_addr; + initfunction (); +} + +int +glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void)) +{ + void (*temp) (void) = initfunction; + return (!pth_once (once_control, glthread_once_call, &temp) ? errno : 0); +} + +int +glthread_once_singlethreaded (pth_once_t *once_control) +{ + /* We know that pth_once_t is an integer type. */ + if (*once_control == PTH_ONCE_INIT) + { + /* First time use of once_control. Invert the marker. */ + *once_control = ~ PTH_ONCE_INIT; + return 1; + } + else + return 0; +} + +#endif + +/* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* Use the old Solaris threads library. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + int err; + + err = mutex_init (&lock->mutex, USYNC_THREAD, NULL); + if (err != 0) + return err; + lock->owner = (thread_t) 0; + lock->depth = 0; + return 0; +} + +int +glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) +{ + thread_t self = thr_self (); + if (lock->owner != self) + { + int err; + + err = mutex_lock (&lock->mutex); + if (err != 0) + return err; + lock->owner = self; + } + if (++(lock->depth) == 0) /* wraparound? */ + { + lock->depth--; + return EAGAIN; + } + return 0; +} + +int +glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) +{ + if (lock->owner != thr_self ()) + return EPERM; + if (lock->depth == 0) + return EINVAL; + if (--(lock->depth) == 0) + { + lock->owner = (thread_t) 0; + return mutex_unlock (&lock->mutex); + } + else + return 0; +} + +int +glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) +{ + if (lock->owner != (thread_t) 0) + return EBUSY; + return mutex_destroy (&lock->mutex); +} + +/* -------------------------- gl_once_t datatype -------------------------- */ + +int +glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void)) +{ + if (!once_control->inited) + { + int err; + + /* Use the mutex to guarantee that if another thread is already calling + the initfunction, this thread waits until it's finished. */ + err = mutex_lock (&once_control->mutex); + if (err != 0) + return err; + if (!once_control->inited) + { + once_control->inited = 1; + initfunction (); + } + return mutex_unlock (&once_control->mutex); + } + else + return 0; +} + +int +glthread_once_singlethreaded (gl_once_t *once_control) +{ + /* We know that gl_once_t contains an integer type. */ + if (!once_control->inited) + { + /* First time use of once_control. Invert the marker. */ + once_control->inited = ~ 0; + return 1; + } + else + return 0; +} + +#endif + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +void +glthread_lock_init_func (gl_lock_t *lock) +{ + InitializeCriticalSection (&lock->lock); + lock->guard.done = 1; +} + +int +glthread_lock_lock_func (gl_lock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glthread_lock_init (lock); + else + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + EnterCriticalSection (&lock->lock); + return 0; +} + +int +glthread_lock_unlock_func (gl_lock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glthread_lock_destroy_func (gl_lock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + DeleteCriticalSection (&lock->lock); + lock->guard.done = 0; + return 0; +} + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +/* In this file, the waitqueues are implemented as circular arrays. */ +#define gl_waitqueue_t gl_carray_waitqueue_t + +static inline void +gl_waitqueue_init (gl_waitqueue_t *wq) +{ + wq->array = NULL; + wq->count = 0; + wq->alloc = 0; + wq->offset = 0; +} + +/* Enqueues the current thread, represented by an event, in a wait queue. + Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */ +static HANDLE +gl_waitqueue_add (gl_waitqueue_t *wq) +{ + HANDLE event; + unsigned int index; + + if (wq->count == wq->alloc) + { + unsigned int new_alloc = 2 * wq->alloc + 1; + HANDLE *new_array = + (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); + if (new_array == NULL) + /* No more memory. */ + return INVALID_HANDLE_VALUE; + /* Now is a good opportunity to rotate the array so that its contents + starts at offset 0. */ + if (wq->offset > 0) + { + unsigned int old_count = wq->count; + unsigned int old_alloc = wq->alloc; + unsigned int old_offset = wq->offset; + unsigned int i; + if (old_offset + old_count > old_alloc) + { + unsigned int limit = old_offset + old_count - old_alloc; + for (i = 0; i < limit; i++) + new_array[old_alloc + i] = new_array[i]; + } + for (i = 0; i < old_count; i++) + new_array[i] = new_array[old_offset + i]; + wq->offset = 0; + } + wq->array = new_array; + wq->alloc = new_alloc; + } + /* Whether the created event is a manual-reset one or an auto-reset one, + does not matter, since we will wait on it only once. */ + event = CreateEvent (NULL, TRUE, FALSE, NULL); + if (event == INVALID_HANDLE_VALUE) + /* No way to allocate an event. */ + return INVALID_HANDLE_VALUE; + index = wq->offset + wq->count; + if (index >= wq->alloc) + index -= wq->alloc; + wq->array[index] = event; + wq->count++; + return event; +} + +/* Notifies the first thread from a wait queue and dequeues it. */ +static inline void +gl_waitqueue_notify_first (gl_waitqueue_t *wq) +{ + SetEvent (wq->array[wq->offset + 0]); + wq->offset++; + wq->count--; + if (wq->count == 0 || wq->offset == wq->alloc) + wq->offset = 0; +} + +/* Notifies all threads from a wait queue and dequeues them all. */ +static inline void +gl_waitqueue_notify_all (gl_waitqueue_t *wq) +{ + unsigned int i; + + for (i = 0; i < wq->count; i++) + { + unsigned int index = wq->offset + i; + if (index >= wq->alloc) + index -= wq->alloc; + SetEvent (wq->array[index]); + } + wq->count = 0; + wq->offset = 0; +} + +void +glthread_rwlock_init_func (gl_rwlock_t *lock) +{ + InitializeCriticalSection (&lock->lock); + gl_waitqueue_init (&lock->waiting_readers); + gl_waitqueue_init (&lock->waiting_writers); + lock->runcount = 0; + lock->guard.done = 1; +} + +int +glthread_rwlock_rdlock_func (gl_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glthread_rwlock_init (lock); + else + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + EnterCriticalSection (&lock->lock); + /* Test whether only readers are currently running, and whether the runcount + field will not overflow. */ + if (!(lock->runcount + 1 > 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + HANDLE event = gl_waitqueue_add (&lock->waiting_readers); + if (event != INVALID_HANDLE_VALUE) + { + DWORD result; + LeaveCriticalSection (&lock->lock); + /* Wait until another thread signals this event. */ + result = WaitForSingleObject (event, INFINITE); + if (result == WAIT_FAILED || result == WAIT_TIMEOUT) + abort (); + CloseHandle (event); + /* The thread which signalled the event already did the bookkeeping: + removed us from the waiting_readers, incremented lock->runcount. */ + if (!(lock->runcount > 0)) + abort (); + return 0; + } + else + { + /* Allocation failure. Weird. */ + do + { + LeaveCriticalSection (&lock->lock); + Sleep (1); + EnterCriticalSection (&lock->lock); + } + while (!(lock->runcount + 1 > 0)); + } + } + lock->runcount++; + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glthread_rwlock_wrlock_func (gl_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glthread_rwlock_init (lock); + else + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + EnterCriticalSection (&lock->lock); + /* Test whether no readers or writers are currently running. */ + if (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + HANDLE event = gl_waitqueue_add (&lock->waiting_writers); + if (event != INVALID_HANDLE_VALUE) + { + DWORD result; + LeaveCriticalSection (&lock->lock); + /* Wait until another thread signals this event. */ + result = WaitForSingleObject (event, INFINITE); + if (result == WAIT_FAILED || result == WAIT_TIMEOUT) + abort (); + CloseHandle (event); + /* The thread which signalled the event already did the bookkeeping: + removed us from the waiting_writers, set lock->runcount = -1. */ + if (!(lock->runcount == -1)) + abort (); + return 0; + } + else + { + /* Allocation failure. Weird. */ + do + { + LeaveCriticalSection (&lock->lock); + Sleep (1); + EnterCriticalSection (&lock->lock); + } + while (!(lock->runcount == 0)); + } + } + lock->runcount--; /* runcount becomes -1 */ + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glthread_rwlock_unlock_func (gl_rwlock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + EnterCriticalSection (&lock->lock); + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + abort (); + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + LeaveCriticalSection (&lock->lock); + return EPERM; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers.count > 0) + { + /* Wake up one of the waiting writers. */ + lock->runcount--; + gl_waitqueue_notify_first (&lock->waiting_writers); + } + else + { + /* Wake up all waiting readers. */ + lock->runcount += lock->waiting_readers.count; + gl_waitqueue_notify_all (&lock->waiting_readers); + } + } + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glthread_rwlock_destroy_func (gl_rwlock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + if (lock->runcount != 0) + return EBUSY; + DeleteCriticalSection (&lock->lock); + if (lock->waiting_readers.array != NULL) + free (lock->waiting_readers.array); + if (lock->waiting_writers.array != NULL) + free (lock->waiting_writers.array); + lock->guard.done = 0; + return 0; +} + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +void +glthread_recursive_lock_init_func (gl_recursive_lock_t *lock) +{ + lock->owner = 0; + lock->depth = 0; + InitializeCriticalSection (&lock->lock); + lock->guard.done = 1; +} + +int +glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glthread_recursive_lock_init (lock); + else + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + { + DWORD self = GetCurrentThreadId (); + if (lock->owner != self) + { + EnterCriticalSection (&lock->lock); + lock->owner = self; + } + if (++(lock->depth) == 0) /* wraparound? */ + { + lock->depth--; + return EAGAIN; + } + } + return 0; +} + +int +glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock) +{ + if (lock->owner != GetCurrentThreadId ()) + return EPERM; + if (lock->depth == 0) + return EINVAL; + if (--(lock->depth) == 0) + { + lock->owner = 0; + LeaveCriticalSection (&lock->lock); + } + return 0; +} + +int +glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock) +{ + if (lock->owner != 0) + return EBUSY; + DeleteCriticalSection (&lock->lock); + lock->guard.done = 0; + return 0; +} + +/* -------------------------- gl_once_t datatype -------------------------- */ + +void +glthread_once_func (gl_once_t *once_control, void (*initfunction) (void)) +{ + if (once_control->inited <= 0) + { + if (InterlockedIncrement (&once_control->started) == 0) + { + /* This thread is the first one to come to this once_control. */ + InitializeCriticalSection (&once_control->lock); + EnterCriticalSection (&once_control->lock); + once_control->inited = 0; + initfunction (); + once_control->inited = 1; + LeaveCriticalSection (&once_control->lock); + } + else + { + /* Undo last operation. */ + InterlockedDecrement (&once_control->started); + /* Some other thread has already started the initialization. + Yield the CPU while waiting for the other thread to finish + initializing and taking the lock. */ + while (once_control->inited < 0) + Sleep (0); + if (once_control->inited <= 0) + { + /* Take the lock. This blocks until the other thread has + finished calling the initfunction. */ + EnterCriticalSection (&once_control->lock); + LeaveCriticalSection (&once_control->lock); + if (!(once_control->inited > 0)) + abort (); + } + } + } +} + +#endif + +/* ========================================================================= */ diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h new file mode 100644 index 0000000..47ce773 --- /dev/null +++ b/lib/glthread/lock.h @@ -0,0 +1,927 @@ +/* Locking in multithreaded situations. + Copyright (C) 2005-2010 Free Software Foundation, Inc. + + This program 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, 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 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, + gthr-win32.h. */ + +/* This file contains locking primitives for use with a given thread library. + It does not contain primitives for creating threads or for other + synchronization primitives. + + Normal (non-recursive) locks: + Type: gl_lock_t + Declaration: gl_lock_define(extern, name) + Initializer: gl_lock_define_initialized(, name) + Initialization: gl_lock_init (name); + Taking the lock: gl_lock_lock (name); + Releasing the lock: gl_lock_unlock (name); + De-initialization: gl_lock_destroy (name); + Equivalent functions with control of error handling: + Initialization: err = glthread_lock_init (&name); + Taking the lock: err = glthread_lock_lock (&name); + Releasing the lock: err = glthread_lock_unlock (&name); + De-initialization: err = glthread_lock_destroy (&name); + + Read-Write (non-recursive) locks: + Type: gl_rwlock_t + Declaration: gl_rwlock_define(extern, name) + Initializer: gl_rwlock_define_initialized(, name) + Initialization: gl_rwlock_init (name); + Taking the lock: gl_rwlock_rdlock (name); + gl_rwlock_wrlock (name); + Releasing the lock: gl_rwlock_unlock (name); + De-initialization: gl_rwlock_destroy (name); + Equivalent functions with control of error handling: + Initialization: err = glthread_rwlock_init (&name); + Taking the lock: err = glthread_rwlock_rdlock (&name); + err = glthread_rwlock_wrlock (&name); + Releasing the lock: err = glthread_rwlock_unlock (&name); + De-initialization: err = glthread_rwlock_destroy (&name); + + Recursive locks: + Type: gl_recursive_lock_t + Declaration: gl_recursive_lock_define(extern, name) + Initializer: gl_recursive_lock_define_initialized(, name) + Initialization: gl_recursive_lock_init (name); + Taking the lock: gl_recursive_lock_lock (name); + Releasing the lock: gl_recursive_lock_unlock (name); + De-initialization: gl_recursive_lock_destroy (name); + Equivalent functions with control of error handling: + Initialization: err = glthread_recursive_lock_init (&name); + Taking the lock: err = glthread_recursive_lock_lock (&name); + Releasing the lock: err = glthread_recursive_lock_unlock (&name); + De-initialization: err = glthread_recursive_lock_destroy (&name); + + Once-only execution: + Type: gl_once_t + Initializer: gl_once_define(extern, name) + Execution: gl_once (name, initfunction); + Equivalent functions with control of error handling: + Execution: err = glthread_once (&name, initfunction); +*/ + + +#ifndef _LOCK_H +#define _LOCK_H + +#include <errno.h> +#include <stdlib.h> + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include <pthread.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_mutex_init +# pragma weak pthread_mutex_lock +# pragma weak pthread_mutex_unlock +# pragma weak pthread_mutex_destroy +# pragma weak pthread_rwlock_init +# pragma weak pthread_rwlock_rdlock +# pragma weak pthread_rwlock_wrlock +# pragma weak pthread_rwlock_unlock +# pragma weak pthread_rwlock_destroy +# pragma weak pthread_once +# pragma weak pthread_cond_init +# pragma weak pthread_cond_wait +# pragma weak pthread_cond_signal +# pragma weak pthread_cond_broadcast +# pragma weak pthread_cond_destroy +# pragma weak pthread_mutexattr_init +# pragma weak pthread_mutexattr_settype +# pragma weak pthread_mutexattr_destroy +# ifndef pthread_self +# pragma weak pthread_self +# endif + +# if !PTHREAD_IN_USE_DETECTION_HARD +# pragma weak pthread_cancel +# define pthread_in_use() (pthread_cancel != NULL) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef pthread_mutex_t gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer; +# define gl_lock_initializer \ + PTHREAD_MUTEX_INITIALIZER +# define glthread_lock_init(LOCK) \ + (pthread_in_use () ? pthread_mutex_init (LOCK, NULL) : 0) +# define glthread_lock_lock(LOCK) \ + (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0) +# define glthread_lock_unlock(LOCK) \ + (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0) +# define glthread_lock_destroy(LOCK) \ + (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +# if HAVE_PTHREAD_RWLOCK + +# ifdef PTHREAD_RWLOCK_INITIALIZER + +typedef pthread_rwlock_t gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + PTHREAD_RWLOCK_INITIALIZER +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pthread_in_use () ? pthread_rwlock_wrlock (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pthread_in_use () ? pthread_rwlock_unlock (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (pthread_in_use () ? pthread_rwlock_destroy (LOCK) : 0) + +# else + +typedef struct + { + int initialized; + pthread_mutex_t guard; /* protects the initialization */ + pthread_rwlock_t rwlock; /* read-write lock */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + { 0, PTHREAD_MUTEX_INITIALIZER } +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) +extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); + +# endif + +# else + +typedef struct + { + pthread_mutex_t lock; /* protects the remaining fields */ + pthread_cond_t waiting_readers; /* waiting readers */ + pthread_cond_t waiting_writers; /* waiting writers */ + unsigned int waiting_writers_count; /* number of waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) +extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); + +# endif + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +# if HAVE_PTHREAD_MUTEX_RECURSIVE + +# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + +typedef pthread_mutex_t gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer; +# ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER +# define gl_recursive_lock_initializer \ + PTHREAD_RECURSIVE_MUTEX_INITIALIZER +# else +# define gl_recursive_lock_initializer \ + PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +# endif +# define glthread_recursive_lock_init(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); + +# else + +typedef struct + { + pthread_mutex_t recmutex; /* recursive mutex */ + pthread_mutex_t guard; /* protects the initialization */ + int initialized; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 } +# define glthread_recursive_lock_init(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); + +# endif + +# else + +/* Old versions of POSIX threads on Solaris did not have recursive locks. + We have to implement them ourselves. */ + +typedef struct + { + pthread_mutex_t mutex; + pthread_t owner; + unsigned long depth; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 } +# define glthread_recursive_lock_init(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); + +# endif + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef pthread_once_t gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (pthread_in_use () \ + ? pthread_once (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +extern int glthread_once_singlethreaded (pthread_once_t *once_control); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_PTH_THREADS + +/* Use the GNU Pth threads library. */ + +# include <pth.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if USE_PTH_THREADS_WEAK + +/* Use weak references to the GNU Pth threads library. */ + +# pragma weak pth_mutex_init +# pragma weak pth_mutex_acquire +# pragma weak pth_mutex_release +# pragma weak pth_rwlock_init +# pragma weak pth_rwlock_acquire +# pragma weak pth_rwlock_release +# pragma weak pth_once + +# pragma weak pth_cancel +# define pth_in_use() (pth_cancel != NULL) + +# else + +# define pth_in_use() 1 + +# endif + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef pth_mutex_t gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS pth_mutex_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pth_mutex_t NAME = gl_lock_initializer; +# define gl_lock_initializer \ + PTH_MUTEX_INIT +# define glthread_lock_init(LOCK) \ + (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0) +# define glthread_lock_lock(LOCK) \ + (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0) +# define glthread_lock_unlock(LOCK) \ + (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0) +# define glthread_lock_destroy(LOCK) \ + ((void)(LOCK), 0) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef pth_rwlock_t gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS pth_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + PTH_RWLOCK_INIT +# define glthread_rwlock_init(LOCK) \ + (pth_in_use () && !pth_rwlock_init (LOCK) ? errno : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RD, 0, NULL) ? errno : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RW, 0, NULL) ? errno : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pth_in_use () && !pth_rwlock_release (LOCK) ? errno : 0) +# define glthread_rwlock_destroy(LOCK) \ + ((void)(LOCK), 0) + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +/* In Pth, mutexes are recursive by default. */ +typedef pth_mutex_t gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS pth_mutex_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + PTH_MUTEX_INIT +# define glthread_recursive_lock_init(LOCK) \ + (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + ((void)(LOCK), 0) + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef pth_once_t gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (pth_in_use () \ + ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +extern int glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void)); +extern int glthread_once_singlethreaded (pth_once_t *once_control); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* Use the old Solaris threads library. */ + +# include <thread.h> +# include <synch.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if USE_SOLARIS_THREADS_WEAK + +/* Use weak references to the old Solaris threads library. */ + +# pragma weak mutex_init +# pragma weak mutex_lock +# pragma weak mutex_unlock +# pragma weak mutex_destroy +# pragma weak rwlock_init +# pragma weak rw_rdlock +# pragma weak rw_wrlock +# pragma weak rw_unlock +# pragma weak rwlock_destroy +# pragma weak thr_self + +# pragma weak thr_suspend +# define thread_in_use() (thr_suspend != NULL) + +# else + +# define thread_in_use() 1 + +# endif + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef mutex_t gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS mutex_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS mutex_t NAME = gl_lock_initializer; +# define gl_lock_initializer \ + DEFAULTMUTEX +# define glthread_lock_init(LOCK) \ + (thread_in_use () ? mutex_init (LOCK, USYNC_THREAD, NULL) : 0) +# define glthread_lock_lock(LOCK) \ + (thread_in_use () ? mutex_lock (LOCK) : 0) +# define glthread_lock_unlock(LOCK) \ + (thread_in_use () ? mutex_unlock (LOCK) : 0) +# define glthread_lock_destroy(LOCK) \ + (thread_in_use () ? mutex_destroy (LOCK) : 0) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef rwlock_t gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + DEFAULTRWLOCK +# define glthread_rwlock_init(LOCK) \ + (thread_in_use () ? rwlock_init (LOCK, USYNC_THREAD, NULL) : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (thread_in_use () ? rw_rdlock (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (thread_in_use () ? rw_wrlock (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (thread_in_use () ? rw_unlock (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (thread_in_use () ? rwlock_destroy (LOCK) : 0) + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +/* Old Solaris threads did not have recursive locks. + We have to implement them ourselves. */ + +typedef struct + { + mutex_t mutex; + thread_t owner; + unsigned long depth; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + { DEFAULTMUTEX, (thread_t) 0, 0 } +# define glthread_recursive_lock_init(LOCK) \ + (thread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (thread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (thread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (thread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef struct + { + volatile int inited; + mutex_t mutex; + } + gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX }; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (thread_in_use () \ + ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +extern int glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void)); +extern int glthread_once_singlethreaded (gl_once_t *once_control); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +# include <windows.h> + +# ifdef __cplusplus +extern "C" { +# endif + +/* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex, + Semaphore types, because + - we need only to synchronize inside a single process (address space), + not inter-process locking, + - we don't need to support trylock operations. (TryEnterCriticalSection + does not work on Windows 95/98/ME. Packages that need trylock usually + define their own mutex type.) */ + +/* There is no way to statically initialize a CRITICAL_SECTION. It needs + to be done lazily, once only. For this we need spinlocks. */ + +typedef struct { volatile int done; volatile long started; } gl_spinlock_t; + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef struct + { + gl_spinlock_t guard; /* protects the initialization */ + CRITICAL_SECTION lock; + } + gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_lock_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_lock_t NAME = gl_lock_initializer; +# define gl_lock_initializer \ + { { 0, -1 } } +# define glthread_lock_init(LOCK) \ + (glthread_lock_init_func (LOCK), 0) +# define glthread_lock_lock(LOCK) \ + glthread_lock_lock_func (LOCK) +# define glthread_lock_unlock(LOCK) \ + glthread_lock_unlock_func (LOCK) +# define glthread_lock_destroy(LOCK) \ + glthread_lock_destroy_func (LOCK) +extern void glthread_lock_init_func (gl_lock_t *lock); +extern int glthread_lock_lock_func (gl_lock_t *lock); +extern int glthread_lock_unlock_func (gl_lock_t *lock); +extern int glthread_lock_destroy_func (gl_lock_t *lock); + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +/* It is impossible to implement read-write locks using plain locks, without + introducing an extra thread dedicated to managing read-write locks. + Therefore here we need to use the low-level Event type. */ + +typedef struct + { + HANDLE *array; /* array of waiting threads, each represented by an event */ + unsigned int count; /* number of waiting threads */ + unsigned int alloc; /* length of allocated array */ + unsigned int offset; /* index of first waiting thread in array */ + } + gl_carray_waitqueue_t; +typedef struct + { + gl_spinlock_t guard; /* protects the initialization */ + CRITICAL_SECTION lock; /* protects the remaining fields */ + gl_carray_waitqueue_t waiting_readers; /* waiting readers */ + gl_carray_waitqueue_t waiting_writers; /* waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + { { 0, -1 } } +# define glthread_rwlock_init(LOCK) \ + (glthread_rwlock_init_func (LOCK), 0) +# define glthread_rwlock_rdlock(LOCK) \ + glthread_rwlock_rdlock_func (LOCK) +# define glthread_rwlock_wrlock(LOCK) \ + glthread_rwlock_wrlock_func (LOCK) +# define glthread_rwlock_unlock(LOCK) \ + glthread_rwlock_unlock_func (LOCK) +# define glthread_rwlock_destroy(LOCK) \ + glthread_rwlock_destroy_func (LOCK) +extern void glthread_rwlock_init_func (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock_func (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock_func (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock_func (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy_func (gl_rwlock_t *lock); + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +/* The Win32 documentation says that CRITICAL_SECTION already implements a + recursive lock. But we need not rely on it: It's easy to implement a + recursive lock without this assumption. */ + +typedef struct + { + gl_spinlock_t guard; /* protects the initialization */ + DWORD owner; + unsigned long depth; + CRITICAL_SECTION lock; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + { { 0, -1 }, 0, 0 } +# define glthread_recursive_lock_init(LOCK) \ + (glthread_recursive_lock_init_func (LOCK), 0) +# define glthread_recursive_lock_lock(LOCK) \ + glthread_recursive_lock_lock_func (LOCK) +# define glthread_recursive_lock_unlock(LOCK) \ + glthread_recursive_lock_unlock_func (LOCK) +# define glthread_recursive_lock_destroy(LOCK) \ + glthread_recursive_lock_destroy_func (LOCK) +extern void glthread_recursive_lock_init_func (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock); + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef struct + { + volatile int inited; + volatile long started; + CRITICAL_SECTION lock; + } + gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = { -1, -1 }; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (glthread_once_func (ONCE_CONTROL, INITFUNCTION), 0) +extern void glthread_once_func (gl_once_t *once_control, void (*initfunction) (void)); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef int gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) +# define gl_lock_define_initialized(STORAGECLASS, NAME) +# define glthread_lock_init(NAME) 0 +# define glthread_lock_lock(NAME) 0 +# define glthread_lock_unlock(NAME) 0 +# define glthread_lock_destroy(NAME) 0 + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef int gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) +# define glthread_rwlock_init(NAME) 0 +# define glthread_rwlock_rdlock(NAME) 0 +# define glthread_rwlock_wrlock(NAME) 0 +# define glthread_rwlock_unlock(NAME) 0 +# define glthread_rwlock_destroy(NAME) 0 + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +typedef int gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) +# define glthread_recursive_lock_init(NAME) 0 +# define glthread_recursive_lock_lock(NAME) 0 +# define glthread_recursive_lock_unlock(NAME) 0 +# define glthread_recursive_lock_destroy(NAME) 0 + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef int gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = 0; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0) + +#endif + +/* ========================================================================= */ + +/* Macros with built-in error handling. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +#define gl_lock_init(NAME) \ + do \ + { \ + if (glthread_lock_init (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_lock_lock(NAME) \ + do \ + { \ + if (glthread_lock_lock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_lock_unlock(NAME) \ + do \ + { \ + if (glthread_lock_unlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_lock_destroy(NAME) \ + do \ + { \ + if (glthread_lock_destroy (&NAME)) \ + abort (); \ + } \ + while (0) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +#define gl_rwlock_init(NAME) \ + do \ + { \ + if (glthread_rwlock_init (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_rdlock(NAME) \ + do \ + { \ + if (glthread_rwlock_rdlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_wrlock(NAME) \ + do \ + { \ + if (glthread_rwlock_wrlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_unlock(NAME) \ + do \ + { \ + if (glthread_rwlock_unlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_destroy(NAME) \ + do \ + { \ + if (glthread_rwlock_destroy (&NAME)) \ + abort (); \ + } \ + while (0) + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +#define gl_recursive_lock_init(NAME) \ + do \ + { \ + if (glthread_recursive_lock_init (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_recursive_lock_lock(NAME) \ + do \ + { \ + if (glthread_recursive_lock_lock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_recursive_lock_unlock(NAME) \ + do \ + { \ + if (glthread_recursive_lock_unlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_recursive_lock_destroy(NAME) \ + do \ + { \ + if (glthread_recursive_lock_destroy (&NAME)) \ + abort (); \ + } \ + while (0) + +/* -------------------------- gl_once_t datatype -------------------------- */ + +#define gl_once(NAME, INITFUNCTION) \ + do \ + { \ + if (glthread_once (&NAME, INITFUNCTION)) \ + abort (); \ + } \ + while (0) + +/* ========================================================================= */ + +#endif /* _LOCK_H */ diff --git a/lib/glthread/threadlib.c b/lib/glthread/threadlib.c new file mode 100644 index 0000000..8cb1bb2 --- /dev/null +++ b/lib/glthread/threadlib.c @@ -0,0 +1,74 @@ +/* Multithreading primitives. + Copyright (C) 2005-2010 Free Software Foundation, Inc. + + This program 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, 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 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. */ + +#include <config.h> + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include <pthread.h> +# include <stdlib.h> + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The function to be executed by a dummy thread. */ +static void * +dummy_thread_func (void *arg) +{ + return arg; +} + +int +glthread_in_use (void) +{ + static int tested; + static int result; /* 1: linked with -lpthread, 0: only with libc */ + + if (!tested) + { + pthread_t thread; + + if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0) + /* Thread creation failed. */ + result = 0; + else + { + /* Thread creation works. */ + void *retval; + if (pthread_join (thread, &retval) != 0) + abort (); + result = 1; + } + tested = 1; + } + return result; +} + +# endif + +#endif + +/* ========================================================================= */ + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; diff --git a/lib/iconv.in.h b/lib/iconv.in.h index 915dce2..5512c60 100644 --- a/lib/iconv.in.h +++ b/lib/iconv.in.h @@ -1,6 +1,6 @@ /* A GNU-like <iconv.h>. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -28,17 +28,29 @@ #ifndef _GL_ICONV_H #define _GL_ICONV_H -#ifdef __cplusplus -extern "C" { -#endif +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ #if @REPLACE_ICONV_OPEN@ /* An iconv_open wrapper that supports the IANA standardized encoding names ("ISO-8859-1" etc.) as far as possible. */ -# define iconv_open rpl_iconv_open -extern iconv_t iconv_open (const char *tocode, const char *fromcode); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iconv_open rpl_iconv_open +# endif +_GL_FUNCDECL_RPL (iconv_open, iconv_t, + (const char *tocode, const char *fromcode) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (iconv_open, iconv_t, + (const char *tocode, const char *fromcode)); +#else +_GL_CXXALIAS_SYS (iconv_open, iconv_t, + (const char *tocode, const char *fromcode)); #endif +_GL_CXXALIASWARN (iconv_open); #if @REPLACE_ICONV_UTF@ /* Special constants for supporting UTF-{16,32}{BE,LE} encodings. @@ -54,18 +66,36 @@ extern iconv_t iconv_open (const char *tocode, const char *fromcode); #endif #if @REPLACE_ICONV@ -# define iconv rpl_iconv -extern size_t iconv (iconv_t cd, - @ICONV_CONST@ char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); -# define iconv_close rpl_iconv_close -extern int iconv_close (iconv_t cd); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iconv rpl_iconv +# endif +_GL_FUNCDECL_RPL (iconv, size_t, + (iconv_t cd, + @ICONV_CONST@ char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft)); +_GL_CXXALIAS_RPL (iconv, size_t, + (iconv_t cd, + @ICONV_CONST@ char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft)); +#else +_GL_CXXALIAS_SYS (iconv, size_t, + (iconv_t cd, + @ICONV_CONST@ char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft)); #endif +_GL_CXXALIASWARN (iconv); - -#ifdef __cplusplus -} +#if @REPLACE_ICONV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iconv_close rpl_iconv_close +# endif +_GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd)); +_GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd)); +#else +_GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd)); #endif +_GL_CXXALIASWARN (iconv_close); + #endif /* _GL_ICONV_H */ #endif /* _GL_ICONV_H */ diff --git a/lib/iconv_open-solaris.gperf b/lib/iconv_open-solaris.gperf new file mode 100644 index 0000000..7d7da38 --- /dev/null +++ b/lib/iconv_open-solaris.gperf @@ -0,0 +1,30 @@ +struct mapping { int standard_name; const char vendor_name[10 + 1]; }; +%struct-type +%language=ANSI-C +%define slot-name standard_name +%define hash-function-name mapping_hash +%define lookup-function-name mapping_lookup +%readonly-tables +%global-table +%define word-array-name mappings +%pic +%% +# On Solaris 10, look in the "iconv -l" output. Some aliases are advertised but +# not actually supported by the iconv() function and by the 'iconv' program. +# For example: +# $ echo abc | iconv -f 646 -t ISO-8859-1 +# Not supported 646 to ISO-8859-1 +# $ echo abc | iconv -f 646 -t ISO8859-1 +$ abc +ASCII, "646" +ISO-8859-1, "ISO8859-1" +ISO-8859-2, "ISO8859-2" +ISO-8859-3, "ISO8859-3" +ISO-8859-4, "ISO8859-4" +ISO-8859-5, "ISO8859-5" +ISO-8859-6, "ISO8859-6" +ISO-8859-7, "ISO8859-7" +ISO-8859-8, "ISO8859-8" +ISO-8859-9, "ISO8859-9" +ISO-8859-15, "ISO8859-15" +CP1251, "ansi-1251" diff --git a/lib/iconv_open-solaris.h b/lib/iconv_open-solaris.h new file mode 100644 index 0000000..630cde1 --- /dev/null +++ b/lib/iconv_open-solaris.h @@ -0,0 +1,190 @@ +/* ANSI-C code produced by gperf version 3.0.4 */ +/* Command-line: gperf -m 10 ./iconv_open-solaris.gperf */ +/* Computed positions: -k'10' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + +#line 1 "./iconv_open-solaris.gperf" +struct mapping { int standard_name; const char vendor_name[10 + 1]; }; + +#define TOTAL_KEYWORDS 13 +#define MIN_WORD_LENGTH 5 +#define MAX_WORD_LENGTH 11 +#define MIN_HASH_VALUE 5 +#define MAX_HASH_VALUE 19 +/* maximum key range = 15, duplicates = 0 */ + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static unsigned int +mapping_hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, + 9, 8, 7, 6, 5, 4, 3, 2, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[9]]; + /*FALLTHROUGH*/ + case 9: + case 8: + case 7: + case 6: + case 5: + break; + } + return hval; +} + +struct stringpool_t + { + char stringpool_str5[sizeof("ASCII")]; + char stringpool_str6[sizeof("CP1251")]; + char stringpool_str7[sizeof("$ abc")]; + char stringpool_str10[sizeof("ISO-8859-1")]; + char stringpool_str11[sizeof("ISO-8859-15")]; + char stringpool_str12[sizeof("ISO-8859-9")]; + char stringpool_str13[sizeof("ISO-8859-8")]; + char stringpool_str14[sizeof("ISO-8859-7")]; + char stringpool_str15[sizeof("ISO-8859-6")]; + char stringpool_str16[sizeof("ISO-8859-5")]; + char stringpool_str17[sizeof("ISO-8859-4")]; + char stringpool_str18[sizeof("ISO-8859-3")]; + char stringpool_str19[sizeof("ISO-8859-2")]; + }; +static const struct stringpool_t stringpool_contents = + { + "ASCII", + "CP1251", + "$ abc", + "ISO-8859-1", + "ISO-8859-15", + "ISO-8859-9", + "ISO-8859-8", + "ISO-8859-7", + "ISO-8859-6", + "ISO-8859-5", + "ISO-8859-4", + "ISO-8859-3", + "ISO-8859-2" + }; +#define stringpool ((const char *) &stringpool_contents) + +static const struct mapping mappings[] = + { + {-1}, {-1}, {-1}, {-1}, {-1}, +#line 19 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str5, "646"}, +#line 30 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str6, "ansi-1251"}, +#line 18 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str7}, + {-1}, {-1}, +#line 20 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-1"}, +#line 29 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"}, +#line 28 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-9"}, +#line 27 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-8"}, +#line 26 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"}, +#line 25 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-6"}, +#line 24 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str16, "ISO8859-5"}, +#line 23 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-4"}, +#line 22 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-3"}, +#line 21 "./iconv_open-solaris.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-2"} + }; + +#ifdef __GNUC__ +__inline +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif +#endif +const struct mapping * +mapping_lookup (register const char *str, register unsigned int len) +{ + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = mapping_hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + register int o = mappings[key].standard_name; + if (o >= 0) + { + register const char *s = o + stringpool; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &mappings[key]; + } + } + } + return 0; +} diff --git a/lib/iconv_open.c b/lib/iconv_open.c index 3d873ac..1d1c053 100644 --- a/lib/iconv_open.c +++ b/lib/iconv_open.c @@ -1,5 +1,5 @@ /* Character set conversion. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -36,6 +36,7 @@ #define ICONV_FLAVOR_HPUX "iconv_open-hpux.h" #define ICONV_FLAVOR_IRIX "iconv_open-irix.h" #define ICONV_FLAVOR_OSF "iconv_open-osf.h" +#define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h" #ifdef ICONV_FLAVOR # include ICONV_FLAVOR @@ -66,33 +67,33 @@ rpl_iconv_open (const char *tocode, const char *fromcode) && fromcode[3] == '-') { if (c_toupper (tocode[0]) == 'U' - && c_toupper (tocode[1]) == 'T' - && c_toupper (tocode[2]) == 'F' - && tocode[3] == '-') - { - if (strcmp (fromcode + 4, "8") == 0) - { - if (c_strcasecmp (tocode + 4, "16BE") == 0) - return _ICONV_UTF8_UTF16BE; - if (c_strcasecmp (tocode + 4, "16LE") == 0) - return _ICONV_UTF8_UTF16LE; - if (c_strcasecmp (tocode + 4, "32BE") == 0) - return _ICONV_UTF8_UTF32BE; - if (c_strcasecmp (tocode + 4, "32LE") == 0) - return _ICONV_UTF8_UTF32LE; - } - else if (strcmp (tocode + 4, "8") == 0) - { - if (c_strcasecmp (fromcode + 4, "16BE") == 0) - return _ICONV_UTF16BE_UTF8; - if (c_strcasecmp (fromcode + 4, "16LE") == 0) - return _ICONV_UTF16LE_UTF8; - if (c_strcasecmp (fromcode + 4, "32BE") == 0) - return _ICONV_UTF32BE_UTF8; - if (c_strcasecmp (fromcode + 4, "32LE") == 0) - return _ICONV_UTF32LE_UTF8; - } - } + && c_toupper (tocode[1]) == 'T' + && c_toupper (tocode[2]) == 'F' + && tocode[3] == '-') + { + if (strcmp (fromcode + 4, "8") == 0) + { + if (c_strcasecmp (tocode + 4, "16BE") == 0) + return _ICONV_UTF8_UTF16BE; + if (c_strcasecmp (tocode + 4, "16LE") == 0) + return _ICONV_UTF8_UTF16LE; + if (c_strcasecmp (tocode + 4, "32BE") == 0) + return _ICONV_UTF8_UTF32BE; + if (c_strcasecmp (tocode + 4, "32LE") == 0) + return _ICONV_UTF8_UTF32LE; + } + else if (strcmp (tocode + 4, "8") == 0) + { + if (c_strcasecmp (fromcode + 4, "16BE") == 0) + return _ICONV_UTF16BE_UTF8; + if (c_strcasecmp (fromcode + 4, "16LE") == 0) + return _ICONV_UTF16LE_UTF8; + if (c_strcasecmp (fromcode + 4, "32BE") == 0) + return _ICONV_UTF32BE_UTF8; + if (c_strcasecmp (fromcode + 4, "32LE") == 0) + return _ICONV_UTF32LE_UTF8; + } + } } #endif @@ -115,20 +116,20 @@ rpl_iconv_open (const char *tocode, const char *fromcode) /* Convert the encodings to upper case, because 1. in the arguments of iconv_open() on AIX, HP-UX, and OSF/1 the case - matters, + matters, 2. it makes searching in the table faster. */ { const char *p = fromcode; char *q = fromcode_upper; while ((*q = c_toupper (*p)) != '\0') { - p++; - q++; - if (q == &fromcode_upper[SIZEOF (fromcode_upper)]) - { - errno = EINVAL; - return (iconv_t)(-1); - } + p++; + q++; + if (q == &fromcode_upper[SIZEOF (fromcode_upper)]) + { + errno = EINVAL; + return (iconv_t)(-1); + } } fromcode_upper_end = q; } @@ -138,13 +139,13 @@ rpl_iconv_open (const char *tocode, const char *fromcode) char *q = tocode_upper; while ((*q = c_toupper (*p)) != '\0') { - p++; - q++; - if (q == &tocode_upper[SIZEOF (tocode_upper)]) - { - errno = EINVAL; - return (iconv_t)(-1); - } + p++; + q++; + if (q == &tocode_upper[SIZEOF (tocode_upper)]) + { + errno = EINVAL; + return (iconv_t)(-1); + } } tocode_upper_end = q; } diff --git a/lib/iconveh.h b/lib/iconveh.h index 06cda52..da15126 100644 --- a/lib/iconveh.h +++ b/lib/iconveh.h @@ -1,5 +1,5 @@ /* Character set conversion handler type. - Copyright (C) 2001-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible. This program is free software: you can redistribute it and/or modify @@ -27,9 +27,9 @@ extern "C" { /* Handling of unconvertible characters. */ enum iconv_ilseq_handler { - iconveh_error, /* return and set errno = EILSEQ */ - iconveh_question_mark, /* use one '?' per unconvertible character */ - iconveh_escape_sequence /* use escape sequence \uxxxx or \Uxxxxxxxx */ + iconveh_error, /* return and set errno = EILSEQ */ + iconveh_question_mark, /* use one '?' per unconvertible character */ + iconveh_escape_sequence /* use escape sequence \uxxxx or \Uxxxxxxxx */ }; diff --git a/lib/isnan.c b/lib/isnan.c index f24f576..a59dea7 100644 --- a/lib/isnan.c +++ b/lib/isnan.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -18,6 +18,18 @@ #include <config.h> +/* Specification. */ +#ifdef USE_LONG_DOUBLE +/* Specification found in math.h or isnanl-nolibm.h. */ +extern int rpl_isnanl (long double x); +#elif ! defined USE_FLOAT +/* Specification found in math.h or isnand-nolibm.h. */ +extern int rpl_isnand (double x); +#else /* defined USE_FLOAT */ +/* Specification found in math.h or isnanf-nolibm.h. */ +extern int rpl_isnanf (float x); +#endif + #include <float.h> #include <string.h> @@ -128,10 +140,10 @@ FUNC (DOUBLE x) -Infinity, which have the same exponent. */ m.value = x; if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD]) - & (EXP_MASK << EXPBIT0_BIT)) - == 0) + & (EXP_MASK << EXPBIT0_BIT)) + == 0) return (memcmp (&m.value, &plus_inf, SIZE) != 0 - && memcmp (&m.value, &minus_inf, SIZE) != 0); + && memcmp (&m.value, &minus_inf, SIZE) != 0); else return 0; } diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h index 0a1c6ab..cc1d476 100644 --- a/lib/isnand-nolibm.h +++ b/lib/isnand-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/isnand.c b/lib/isnand.c index d5220cb..f7a1565 100644 --- a/lib/isnand.c +++ b/lib/isnand.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/isnanf-nolibm.h b/lib/isnanf-nolibm.h index cb2263e..5e29207 100644 --- a/lib/isnanf-nolibm.h +++ b/lib/isnanf-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/isnanf.c b/lib/isnanf.c index 6e39706..a352fdb 100644 --- a/lib/isnanf.c +++ b/lib/isnanf.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/isnanl-nolibm.h b/lib/isnanl-nolibm.h index 7fd46f8..e89a7fe 100644 --- a/lib/isnanl-nolibm.h +++ b/lib/isnanl-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/isnanl.c b/lib/isnanl.c index b7d899b..b45fef0 100644 --- a/lib/isnanl.c +++ b/lib/isnanl.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/libunistring.rc b/lib/libunistring.rc index f1b51af..e86f978 100644 --- a/lib/libunistring.rc +++ b/lib/libunistring.rc @@ -19,12 +19,12 @@ BEGIN BEGIN BLOCK "04090000" /* Lang = US English, Charset = ASCII */ BEGIN - VALUE "Comments", "This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 or later. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>\0" + VALUE "Comments", "This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 or later. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>\0" VALUE "CompanyName", "Free Software Foundation\0" - VALUE "FileDescription", "LGPLed libunistring for Windows NT/2000/XP/Vista and Windows 95/98/ME\0" + VALUE "FileDescription", "LGPLed libunistring for Windows NT/2000/XP/Vista/7 and Windows 95/98/ME\0" VALUE "FileVersion", PACKAGE_VERSION_STRING "\0" VALUE "InternalName", "unistring.dll\0" - VALUE "LegalCopyright", "Copyright (C) 2001-2009\0" + VALUE "LegalCopyright", "Copyright (C) 2001-2010\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "unistring.dll\0" VALUE "ProductName", "libunistring: Unicode string library\0" diff --git a/lib/localcharset.c b/lib/localcharset.c index 93da170..29de23d 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -23,6 +23,7 @@ /* Specification. */ #include "localcharset.h" +#include <fcntl.h> #include <stddef.h> #include <stdio.h> #include <string.h> @@ -44,6 +45,7 @@ #endif #if !defined WIN32_NATIVE +# include <unistd.h> # if HAVE_LANGINFO_CODESET # include <langinfo.h> # else @@ -75,6 +77,11 @@ # include "configmake.h" #endif +/* Define O_NOFOLLOW to 0 on platforms where it does not exist. */ +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') @@ -117,192 +124,219 @@ get_charset_aliases (void) if (cp == NULL) { #if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) - FILE *fp; const char *dir; const char *base = "charset.alias"; char *file_name; /* Make it possible to override the charset.alias location. This is - necessary for running the testsuite before "make install". */ + necessary for running the testsuite before "make install". */ dir = getenv ("CHARSETALIASDIR"); if (dir == NULL || dir[0] == '\0') - dir = relocate (LIBDIR); + dir = relocate (LIBDIR); /* Concatenate dir and base into freshly allocated file_name. */ { - size_t dir_len = strlen (dir); - size_t base_len = strlen (base); - int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); - file_name = (char *) malloc (dir_len + add_slash + base_len + 1); - if (file_name != NULL) - { - memcpy (file_name, dir, dir_len); - if (add_slash) - file_name[dir_len] = DIRECTORY_SEPARATOR; - memcpy (file_name + dir_len + add_slash, base, base_len + 1); - } + size_t dir_len = strlen (dir); + size_t base_len = strlen (base); + int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); + file_name = (char *) malloc (dir_len + add_slash + base_len + 1); + if (file_name != NULL) + { + memcpy (file_name, dir, dir_len); + if (add_slash) + file_name[dir_len] = DIRECTORY_SEPARATOR; + memcpy (file_name + dir_len + add_slash, base, base_len + 1); + } } - if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL) - /* Out of memory or file not found, treat it as empty. */ - cp = ""; + if (file_name == NULL) + /* Out of memory. Treat the file as empty. */ + cp = ""; else - { - /* Parse the file's contents. */ - char *res_ptr = NULL; - size_t res_size = 0; - - for (;;) - { - int c; - char buf1[50+1]; - char buf2[50+1]; - size_t l1, l2; - char *old_res_ptr; - - c = getc (fp); - if (c == EOF) - break; - if (c == '\n' || c == ' ' || c == '\t') - continue; - if (c == '#') - { - /* Skip comment, to end of line. */ - do - c = getc (fp); - while (!(c == EOF || c == '\n')); - if (c == EOF) - break; - continue; - } - ungetc (c, fp); - if (fscanf (fp, "%50s %50s", buf1, buf2) < 2) - break; - l1 = strlen (buf1); - l2 = strlen (buf2); - old_res_ptr = res_ptr; - if (res_size == 0) - { - res_size = l1 + 1 + l2 + 1; - res_ptr = (char *) malloc (res_size + 1); - } - else - { - res_size += l1 + 1 + l2 + 1; - res_ptr = (char *) realloc (res_ptr, res_size + 1); - } - if (res_ptr == NULL) - { - /* Out of memory. */ - res_size = 0; - if (old_res_ptr != NULL) - free (old_res_ptr); - break; - } - strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); - strcpy (res_ptr + res_size - (l2 + 1), buf2); - } - fclose (fp); - if (res_size == 0) - cp = ""; - else - { - *(res_ptr + res_size) = '\0'; - cp = res_ptr; - } - } - - if (file_name != NULL) - free (file_name); + { + int fd; + + /* Open the file. Reject symbolic links on platforms that support + O_NOFOLLOW. This is a security feature. Without it, an attacker + could retrieve parts of the contents (namely, the tail of the + first line that starts with "* ") of an arbitrary file by placing + a symbolic link to that file under the name "charset.alias" in + some writable directory and defining the environment variable + CHARSETALIASDIR to point to that directory. */ + fd = open (file_name, + O_RDONLY | (HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0)); + if (fd < 0) + /* File not found. Treat it as empty. */ + cp = ""; + else + { + FILE *fp; + + fp = fdopen (fd, "r"); + if (fp == NULL) + { + /* Out of memory. Treat the file as empty. */ + close (fd); + cp = ""; + } + else + { + /* Parse the file's contents. */ + char *res_ptr = NULL; + size_t res_size = 0; + + for (;;) + { + int c; + char buf1[50+1]; + char buf2[50+1]; + size_t l1, l2; + char *old_res_ptr; + + c = getc (fp); + if (c == EOF) + break; + if (c == '\n' || c == ' ' || c == '\t') + continue; + if (c == '#') + { + /* Skip comment, to end of line. */ + do + c = getc (fp); + while (!(c == EOF || c == '\n')); + if (c == EOF) + break; + continue; + } + ungetc (c, fp); + if (fscanf (fp, "%50s %50s", buf1, buf2) < 2) + break; + l1 = strlen (buf1); + l2 = strlen (buf2); + old_res_ptr = res_ptr; + if (res_size == 0) + { + res_size = l1 + 1 + l2 + 1; + res_ptr = (char *) malloc (res_size + 1); + } + else + { + res_size += l1 + 1 + l2 + 1; + res_ptr = (char *) realloc (res_ptr, res_size + 1); + } + if (res_ptr == NULL) + { + /* Out of memory. */ + res_size = 0; + if (old_res_ptr != NULL) + free (old_res_ptr); + break; + } + strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); + strcpy (res_ptr + res_size - (l2 + 1), buf2); + } + fclose (fp); + if (res_size == 0) + cp = ""; + else + { + *(res_ptr + res_size) = '\0'; + cp = res_ptr; + } + } + } + + free (file_name); + } #else # if defined DARWIN7 /* To avoid the trouble of installing a file that is shared by many - GNU packages -- many packaging systems have problems with this --, - simply inline the aliases here. */ + GNU packages -- many packaging systems have problems with this --, + simply inline the aliases here. */ cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" - "ISO8859-2" "\0" "ISO-8859-2" "\0" - "ISO8859-4" "\0" "ISO-8859-4" "\0" - "ISO8859-5" "\0" "ISO-8859-5" "\0" - "ISO8859-7" "\0" "ISO-8859-7" "\0" - "ISO8859-9" "\0" "ISO-8859-9" "\0" - "ISO8859-13" "\0" "ISO-8859-13" "\0" - "ISO8859-15" "\0" "ISO-8859-15" "\0" - "KOI8-R" "\0" "KOI8-R" "\0" - "KOI8-U" "\0" "KOI8-U" "\0" - "CP866" "\0" "CP866" "\0" - "CP949" "\0" "CP949" "\0" - "CP1131" "\0" "CP1131" "\0" - "CP1251" "\0" "CP1251" "\0" - "eucCN" "\0" "GB2312" "\0" - "GB2312" "\0" "GB2312" "\0" - "eucJP" "\0" "EUC-JP" "\0" - "eucKR" "\0" "EUC-KR" "\0" - "Big5" "\0" "BIG5" "\0" - "Big5HKSCS" "\0" "BIG5-HKSCS" "\0" - "GBK" "\0" "GBK" "\0" - "GB18030" "\0" "GB18030" "\0" - "SJIS" "\0" "SHIFT_JIS" "\0" - "ARMSCII-8" "\0" "ARMSCII-8" "\0" - "PT154" "\0" "PT154" "\0" - /*"ISCII-DEV" "\0" "?" "\0"*/ - "*" "\0" "UTF-8" "\0"; + "ISO8859-2" "\0" "ISO-8859-2" "\0" + "ISO8859-4" "\0" "ISO-8859-4" "\0" + "ISO8859-5" "\0" "ISO-8859-5" "\0" + "ISO8859-7" "\0" "ISO-8859-7" "\0" + "ISO8859-9" "\0" "ISO-8859-9" "\0" + "ISO8859-13" "\0" "ISO-8859-13" "\0" + "ISO8859-15" "\0" "ISO-8859-15" "\0" + "KOI8-R" "\0" "KOI8-R" "\0" + "KOI8-U" "\0" "KOI8-U" "\0" + "CP866" "\0" "CP866" "\0" + "CP949" "\0" "CP949" "\0" + "CP1131" "\0" "CP1131" "\0" + "CP1251" "\0" "CP1251" "\0" + "eucCN" "\0" "GB2312" "\0" + "GB2312" "\0" "GB2312" "\0" + "eucJP" "\0" "EUC-JP" "\0" + "eucKR" "\0" "EUC-KR" "\0" + "Big5" "\0" "BIG5" "\0" + "Big5HKSCS" "\0" "BIG5-HKSCS" "\0" + "GBK" "\0" "GBK" "\0" + "GB18030" "\0" "GB18030" "\0" + "SJIS" "\0" "SHIFT_JIS" "\0" + "ARMSCII-8" "\0" "ARMSCII-8" "\0" + "PT154" "\0" "PT154" "\0" + /*"ISCII-DEV" "\0" "?" "\0"*/ + "*" "\0" "UTF-8" "\0"; # endif # if defined VMS /* To avoid the troubles of an extra file charset.alias_vms in the - sources of many GNU packages, simply inline the aliases here. */ + sources of many GNU packages, simply inline the aliases here. */ /* The list of encodings is taken from the OpenVMS 7.3-1 documentation - "Compaq C Run-Time Library Reference Manual for OpenVMS systems" - section 10.7 "Handling Different Character Sets". */ + "Compaq C Run-Time Library Reference Manual for OpenVMS systems" + section 10.7 "Handling Different Character Sets". */ cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" - "ISO8859-2" "\0" "ISO-8859-2" "\0" - "ISO8859-5" "\0" "ISO-8859-5" "\0" - "ISO8859-7" "\0" "ISO-8859-7" "\0" - "ISO8859-8" "\0" "ISO-8859-8" "\0" - "ISO8859-9" "\0" "ISO-8859-9" "\0" - /* Japanese */ - "eucJP" "\0" "EUC-JP" "\0" - "SJIS" "\0" "SHIFT_JIS" "\0" - "DECKANJI" "\0" "DEC-KANJI" "\0" - "SDECKANJI" "\0" "EUC-JP" "\0" - /* Chinese */ - "eucTW" "\0" "EUC-TW" "\0" - "DECHANYU" "\0" "DEC-HANYU" "\0" - "DECHANZI" "\0" "GB2312" "\0" - /* Korean */ - "DECKOREAN" "\0" "EUC-KR" "\0"; + "ISO8859-2" "\0" "ISO-8859-2" "\0" + "ISO8859-5" "\0" "ISO-8859-5" "\0" + "ISO8859-7" "\0" "ISO-8859-7" "\0" + "ISO8859-8" "\0" "ISO-8859-8" "\0" + "ISO8859-9" "\0" "ISO-8859-9" "\0" + /* Japanese */ + "eucJP" "\0" "EUC-JP" "\0" + "SJIS" "\0" "SHIFT_JIS" "\0" + "DECKANJI" "\0" "DEC-KANJI" "\0" + "SDECKANJI" "\0" "EUC-JP" "\0" + /* Chinese */ + "eucTW" "\0" "EUC-TW" "\0" + "DECHANYU" "\0" "DEC-HANYU" "\0" + "DECHANZI" "\0" "GB2312" "\0" + /* Korean */ + "DECKOREAN" "\0" "EUC-KR" "\0"; # endif # if defined WIN32_NATIVE || defined __CYGWIN__ /* To avoid the troubles of installing a separate file in the same - directory as the DLL and of retrieving the DLL's directory at - runtime, simply inline the aliases here. */ + directory as the DLL and of retrieving the DLL's directory at + runtime, simply inline the aliases here. */ cp = "CP936" "\0" "GBK" "\0" - "CP1361" "\0" "JOHAB" "\0" - "CP20127" "\0" "ASCII" "\0" - "CP20866" "\0" "KOI8-R" "\0" - "CP20936" "\0" "GB2312" "\0" - "CP21866" "\0" "KOI8-RU" "\0" - "CP28591" "\0" "ISO-8859-1" "\0" - "CP28592" "\0" "ISO-8859-2" "\0" - "CP28593" "\0" "ISO-8859-3" "\0" - "CP28594" "\0" "ISO-8859-4" "\0" - "CP28595" "\0" "ISO-8859-5" "\0" - "CP28596" "\0" "ISO-8859-6" "\0" - "CP28597" "\0" "ISO-8859-7" "\0" - "CP28598" "\0" "ISO-8859-8" "\0" - "CP28599" "\0" "ISO-8859-9" "\0" - "CP28605" "\0" "ISO-8859-15" "\0" - "CP38598" "\0" "ISO-8859-8" "\0" - "CP51932" "\0" "EUC-JP" "\0" - "CP51936" "\0" "GB2312" "\0" - "CP51949" "\0" "EUC-KR" "\0" - "CP51950" "\0" "EUC-TW" "\0" - "CP54936" "\0" "GB18030" "\0" - "CP65001" "\0" "UTF-8" "\0"; + "CP1361" "\0" "JOHAB" "\0" + "CP20127" "\0" "ASCII" "\0" + "CP20866" "\0" "KOI8-R" "\0" + "CP20936" "\0" "GB2312" "\0" + "CP21866" "\0" "KOI8-RU" "\0" + "CP28591" "\0" "ISO-8859-1" "\0" + "CP28592" "\0" "ISO-8859-2" "\0" + "CP28593" "\0" "ISO-8859-3" "\0" + "CP28594" "\0" "ISO-8859-4" "\0" + "CP28595" "\0" "ISO-8859-5" "\0" + "CP28596" "\0" "ISO-8859-6" "\0" + "CP28597" "\0" "ISO-8859-7" "\0" + "CP28598" "\0" "ISO-8859-8" "\0" + "CP28599" "\0" "ISO-8859-9" "\0" + "CP28605" "\0" "ISO-8859-15" "\0" + "CP38598" "\0" "ISO-8859-8" "\0" + "CP51932" "\0" "EUC-JP" "\0" + "CP51936" "\0" "GB2312" "\0" + "CP51949" "\0" "EUC-KR" "\0" + "CP51950" "\0" "EUC-TW" "\0" + "CP54936" "\0" "GB18030" "\0" + "CP65001" "\0" "UTF-8" "\0"; # endif #endif @@ -335,7 +369,7 @@ locale_charset (void) codeset = nl_langinfo (CODESET); # ifdef __CYGWIN__ - /* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always + /* Cygwin 1.5.x does not have locales. nl_langinfo (CODESET) always returns "US-ASCII". As long as this is not fixed, return the suffix of the locale name from the environment variables (if present) or the codepage as a number. */ @@ -346,36 +380,46 @@ locale_charset (void) locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_CTYPE"); - if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); - } + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } if (locale != NULL && locale[0] != '\0') - { - /* If the locale name contains an encoding after the dot, return - it. */ - const char *dot = strchr (locale, '.'); - - if (dot != NULL) - { - const char *modifier; - - dot++; - /* Look for the possible @... trailer and remove it, if any. */ - modifier = strchr (dot, '@'); - if (modifier == NULL) - return dot; - if (modifier - dot < sizeof (buf)) - { - memcpy (buf, dot, modifier - dot); - buf [modifier - dot] = '\0'; - return buf; - } - } - } - - /* Woe32 has a function returning the locale's codepage as a number. */ + { + /* If the locale name contains an encoding after the dot, return + it. */ + const char *dot = strchr (locale, '.'); + + if (dot != NULL) + { + const char *modifier; + + dot++; + /* Look for the possible @... trailer and remove it, if any. */ + modifier = strchr (dot, '@'); + if (modifier == NULL) + return dot; + if (modifier - dot < sizeof (buf)) + { + memcpy (buf, dot, modifier - dot); + buf [modifier - dot] = '\0'; + return buf; + } + } + } + + /* Woe32 has a function returning the locale's codepage as a number: + GetACP(). This encoding is used by Cygwin, unless the user has set + the environment variable CYGWIN=codepage:oem (which very few people + do). + Output directed to console windows needs to be converted (to + GetOEMCP() if the console is using a raster font, or to + GetConsoleOutputCP() if it is using a TrueType font). Cygwin does + this conversion transparently (see winsup/cygwin/fhandler_console.cc), + converting to GetConsoleOutputCP(). This leads to correct results, + except when SetConsoleOutputCP has been called and a raster font is + in use. */ sprintf (buf, "CP%u", GetACP ()); codeset = buf; } @@ -397,11 +441,11 @@ locale_charset (void) { locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_CTYPE"); - if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); - } + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } } /* On some old systems, one used to set locale = "iso8859_1". On others, @@ -415,7 +459,13 @@ locale_charset (void) static char buf[2 + 10 + 1]; - /* Woe32 has a function returning the locale's codepage as a number. */ + /* Woe32 has a function returning the locale's codepage as a number: + GetACP(). + When the output goes to a console window, it needs to be provided in + GetOEMCP() encoding if the console is using a raster font, or in + GetConsoleOutputCP() encoding if it is using a TrueType font. + But in GUI programs and for output sent to files and pipes, GetACP() + encoding is the best bet. */ sprintf (buf, "CP%u", GetACP ()); codeset = buf; @@ -433,7 +483,7 @@ locale_charset (void) { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); + locale = getenv ("LANG"); } if (locale != NULL && locale[0] != '\0') { @@ -441,21 +491,21 @@ locale_charset (void) const char *dot = strchr (locale, '.'); if (dot != NULL) - { - const char *modifier; - - dot++; - /* Look for the possible @... trailer and remove it, if any. */ - modifier = strchr (dot, '@'); - if (modifier == NULL) - return dot; - if (modifier - dot < sizeof (buf)) - { - memcpy (buf, dot, modifier - dot); - buf [modifier - dot] = '\0'; - return buf; - } - } + { + const char *modifier; + + dot++; + /* Look for the possible @... trailer and remove it, if any. */ + modifier = strchr (dot, '@'); + if (modifier == NULL) + return dot; + if (modifier - dot < sizeof (buf)) + { + memcpy (buf, dot, modifier - dot); + buf [modifier - dot] = '\0'; + return buf; + } + } /* Resolve through the charset.alias file. */ codeset = locale; @@ -464,12 +514,12 @@ locale_charset (void) { /* OS/2 has a function returning the locale's codepage as a number. */ if (DosQueryCp (sizeof (cp), cp, &cplen)) - codeset = ""; + codeset = ""; else - { - sprintf (buf, "CP%u", cp[0]); - codeset = buf; - } + { + sprintf (buf, "CP%u", cp[0]); + codeset = buf; + } } #endif @@ -483,10 +533,10 @@ locale_charset (void) *aliases != '\0'; aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) if (strcmp (codeset, aliases) == 0 - || (aliases[0] == '*' && aliases[1] == '\0')) + || (aliases[0] == '*' && aliases[1] == '\0')) { - codeset = aliases + strlen (aliases) + 1; - break; + codeset = aliases + strlen (aliases) + 1; + break; } /* Don't return an empty string. GNU libc and GNU libiconv interpret diff --git a/lib/localcharset.h b/lib/localcharset.h index 1772a50..c18f492 100644 --- a/lib/localcharset.h +++ b/lib/localcharset.h @@ -1,5 +1,5 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2010 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify diff --git a/lib/localename.c b/lib/localename.c index 9f4c181..ea646c5 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -1,5 +1,5 @@ /* Determine name of the currently selected locale. - Copyright (C) 1995-1999, 2000-2008 Free Software Foundation, Inc. + Copyright (C) 1995-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -29,11 +29,24 @@ # include "localename.h" #endif +#include <limits.h> +#include <stddef.h> #include <stdlib.h> #include <locale.h> +#include <string.h> + +#if HAVE_USELOCALE +/* MacOS X 10.5 defines the locale_t type in <xlocale.h>. */ +# if defined __APPLE__ && defined __MACH__ +# include <xlocale.h> +# endif +# include <langinfo.h> +# if !defined IN_LIBINTL +# include "glthread/lock.h" +# endif +#endif #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE -# include <string.h> # include <CoreFoundation/CFString.h> # if HAVE_CFLOCALECOPYCURRENT # include <CoreFoundation/CFLocale.h> @@ -46,7 +59,7 @@ # define WIN32_NATIVE #endif -#ifdef WIN32_NATIVE +#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */ # define WIN32_LEAN_AND_MEAN # include <windows.h> /* List of language codes, sorted by value: @@ -72,7 +85,7 @@ 0x14 LANG_NORWEGIAN 0x15 LANG_POLISH 0x16 LANG_PORTUGUESE - 0x17 LANG_RHAETO_ROMANCE + 0x17 LANG_ROMANSH 0x18 LANG_ROMANIAN 0x19 LANG_RUSSIAN 0x1a LANG_CROATIAN == LANG_SERBIAN @@ -108,7 +121,7 @@ 0x38 LANG_FAEROESE 0x39 LANG_HINDI 0x3a LANG_MALTESE - 0x3b LANG_SAAMI + 0x3b LANG_SAMI 0x3c LANG_GAELIC 0x3d LANG_YIDDISH 0x3e LANG_MALAY @@ -156,6 +169,9 @@ 0x68 LANG_HAUSA 0x69 LANG_IBIBIO 0x6a LANG_YORUBA + 0x6d LANG_BASHKIR + 0x6e LANG_LUXEMBOURGISH + 0x6f LANG_GREENLANDIC 0x70 LANG_IGBO 0x71 LANG_KANURI 0x72 LANG_OROMO @@ -166,6 +182,18 @@ 0x77 LANG_SOMALI 0x78 LANG_YI 0x79 LANG_PAPIAMENTU + 0x7a LANG_MAPUDUNGUN + 0x7c LANG_MOHAWK + 0x7e LANG_BRETON + 0x82 LANG_OCCITAN + 0x83 LANG_CORSICAN + 0x84 LANG_ALSATIAN + 0x85 LANG_YAKUT + 0x86 LANG_KICHE + 0x87 LANG_KINYARWANDA + 0x88 LANG_WOLOF + 0x8c LANG_DARI + 0x91 LANG_SCOTTISH_GAELIC */ /* Mingw headers don't have latest language and sublanguage codes. */ # ifndef LANG_AFRIKAANS @@ -174,6 +202,9 @@ # ifndef LANG_ALBANIAN # define LANG_ALBANIAN 0x1c # endif +# ifndef LANG_ALSATIAN +# define LANG_ALSATIAN 0x84 +# endif # ifndef LANG_AMHARIC # define LANG_AMHARIC 0x5e # endif @@ -189,6 +220,9 @@ # ifndef LANG_AZERI # define LANG_AZERI 0x2c # endif +# ifndef LANG_BASHKIR +# define LANG_BASHKIR 0x6d +# endif # ifndef LANG_BASQUE # define LANG_BASQUE 0x2d # endif @@ -198,6 +232,9 @@ # ifndef LANG_BENGALI # define LANG_BENGALI 0x45 # endif +# ifndef LANG_BRETON +# define LANG_BRETON 0x7e +# endif # ifndef LANG_BURMESE # define LANG_BURMESE 0x55 # endif @@ -210,6 +247,12 @@ # ifndef LANG_CHEROKEE # define LANG_CHEROKEE 0x5c # endif +# ifndef LANG_CORSICAN +# define LANG_CORSICAN 0x83 +# endif +# ifndef LANG_DARI +# define LANG_DARI 0x8c +# endif # ifndef LANG_DIVEHI # define LANG_DIVEHI 0x65 # endif @@ -240,6 +283,9 @@ # ifndef LANG_GEORGIAN # define LANG_GEORGIAN 0x37 # endif +# ifndef LANG_GREENLANDIC +# define LANG_GREENLANDIC 0x6f +# endif # ifndef LANG_GUARANI # define LANG_GUARANI 0x74 # endif @@ -282,6 +328,12 @@ # ifndef LANG_KAZAK # define LANG_KAZAK 0x3f # endif +# ifndef LANG_KICHE +# define LANG_KICHE 0x86 +# endif +# ifndef LANG_KINYARWANDA +# define LANG_KINYARWANDA 0x87 +# endif # ifndef LANG_KONKANI # define LANG_KONKANI 0x57 # endif @@ -300,6 +352,9 @@ # ifndef LANG_LITHUANIAN # define LANG_LITHUANIAN 0x27 # endif +# ifndef LANG_LUXEMBOURGISH +# define LANG_LUXEMBOURGISH 0x6e +# endif # ifndef LANG_MACEDONIAN # define LANG_MACEDONIAN 0x2f # endif @@ -318,15 +373,24 @@ # ifndef LANG_MAORI # define LANG_MAORI 0x81 # endif +# ifndef LANG_MAPUDUNGUN +# define LANG_MAPUDUNGUN 0x7a +# endif # ifndef LANG_MARATHI # define LANG_MARATHI 0x4e # endif +# ifndef LANG_MOHAWK +# define LANG_MOHAWK 0x7c +# endif # ifndef LANG_MONGOLIAN # define LANG_MONGOLIAN 0x50 # endif # ifndef LANG_NEPALI # define LANG_NEPALI 0x61 # endif +# ifndef LANG_OCCITAN +# define LANG_OCCITAN 0x82 +# endif # ifndef LANG_ORIYA # define LANG_ORIYA 0x48 # endif @@ -345,15 +409,18 @@ # ifndef LANG_QUECHUA # define LANG_QUECHUA 0x6b # endif -# ifndef LANG_RHAETO_ROMANCE -# define LANG_RHAETO_ROMANCE 0x17 +# ifndef LANG_ROMANSH +# define LANG_ROMANSH 0x17 # endif -# ifndef LANG_SAAMI -# define LANG_SAAMI 0x3b +# ifndef LANG_SAMI +# define LANG_SAMI 0x3b # endif # ifndef LANG_SANSKRIT # define LANG_SANSKRIT 0x4f # endif +# ifndef LANG_SCOTTISH_GAELIC +# define LANG_SCOTTISH_GAELIC 0x91 +# endif # ifndef LANG_SERBIAN # define LANG_SERBIAN 0x1a # endif @@ -441,9 +508,15 @@ # ifndef LANG_WELSH # define LANG_WELSH 0x52 # endif +# ifndef LANG_WOLOF +# define LANG_WOLOF 0x88 +# endif # ifndef LANG_XHOSA # define LANG_XHOSA 0x34 # endif +# ifndef LANG_YAKUT +# define LANG_YAKUT 0x85 +# endif # ifndef LANG_YI # define LANG_YI 0x78 # endif @@ -456,6 +529,18 @@ # ifndef LANG_ZULU # define LANG_ZULU 0x35 # endif +# ifndef SUBLANG_AFRIKAANS_SOUTH_AFRICA +# define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01 +# endif +# ifndef SUBLANG_ALBANIAN_ALBANIA +# define SUBLANG_ALBANIAN_ALBANIA 0x01 +# endif +# ifndef SUBLANG_ALSATIAN_FRANCE +# define SUBLANG_ALSATIAN_FRANCE 0x01 +# endif +# ifndef SUBLANG_AMHARIC_ETHIOPIA +# define SUBLANG_AMHARIC_ETHIOPIA 0x01 +# endif # ifndef SUBLANG_ARABIC_SAUDI_ARABIA # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 # endif @@ -504,12 +589,27 @@ # ifndef SUBLANG_ARABIC_QATAR # define SUBLANG_ARABIC_QATAR 0x10 # endif +# ifndef SUBLANG_ARMENIAN_ARMENIA +# define SUBLANG_ARMENIAN_ARMENIA 0x01 +# endif +# ifndef SUBLANG_ASSAMESE_INDIA +# define SUBLANG_ASSAMESE_INDIA 0x01 +# endif # ifndef SUBLANG_AZERI_LATIN # define SUBLANG_AZERI_LATIN 0x01 # endif # ifndef SUBLANG_AZERI_CYRILLIC # define SUBLANG_AZERI_CYRILLIC 0x02 # endif +# ifndef SUBLANG_BASHKIR_RUSSIA +# define SUBLANG_BASHKIR_RUSSIA 0x01 +# endif +# ifndef SUBLANG_BASQUE_BASQUE +# define SUBLANG_BASQUE_BASQUE 0x01 +# endif +# ifndef SUBLANG_BELARUSIAN_BELARUS +# define SUBLANG_BELARUSIAN_BELARUS 0x01 +# endif # ifndef SUBLANG_BENGALI_INDIA # define SUBLANG_BENGALI_INDIA 0x01 # endif @@ -522,6 +622,21 @@ # ifndef SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC # define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 # endif +# ifndef SUBLANG_BRETON_FRANCE +# define SUBLANG_BRETON_FRANCE 0x01 +# endif +# ifndef SUBLANG_BULGARIAN_BULGARIA +# define SUBLANG_BULGARIAN_BULGARIA 0x01 +# endif +# ifndef SUBLANG_CAMBODIAN_CAMBODIA +# define SUBLANG_CAMBODIAN_CAMBODIA 0x01 +# endif +# ifndef SUBLANG_CATALAN_SPAIN +# define SUBLANG_CATALAN_SPAIN 0x01 +# endif +# ifndef SUBLANG_CORSICAN_FRANCE +# define SUBLANG_CORSICAN_FRANCE 0x01 +# endif # ifndef SUBLANG_CROATIAN_CROATIA # define SUBLANG_CROATIAN_CROATIA 0x01 # endif @@ -531,6 +646,21 @@ # ifndef SUBLANG_CHINESE_MACAU # define SUBLANG_CHINESE_MACAU 0x05 # endif +# ifndef SUBLANG_CZECH_CZECH_REPUBLIC +# define SUBLANG_CZECH_CZECH_REPUBLIC 0x01 +# endif +# ifndef SUBLANG_DANISH_DENMARK +# define SUBLANG_DANISH_DENMARK 0x01 +# endif +# ifndef SUBLANG_DARI_AFGHANISTAN +# define SUBLANG_DARI_AFGHANISTAN 0x01 +# endif +# ifndef SUBLANG_DIVEHI_MALDIVES +# define SUBLANG_DIVEHI_MALDIVES 0x01 +# endif +# ifndef SUBLANG_DUTCH_SURINAM +# define SUBLANG_DUTCH_SURINAM 0x03 +# endif # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 # endif @@ -567,6 +697,18 @@ # ifndef SUBLANG_ENGLISH_SINGAPORE # define SUBLANG_ENGLISH_SINGAPORE 0x12 # endif +# ifndef SUBLANG_ESTONIAN_ESTONIA +# define SUBLANG_ESTONIAN_ESTONIA 0x01 +# endif +# ifndef SUBLANG_FAEROESE_FAROE_ISLANDS +# define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01 +# endif +# ifndef SUBLANG_FARSI_IRAN +# define SUBLANG_FARSI_IRAN 0x01 +# endif +# ifndef SUBLANG_FINNISH_FINLAND +# define SUBLANG_FINNISH_FINLAND 0x01 +# endif # ifndef SUBLANG_FRENCH_LUXEMBOURG # define SUBLANG_FRENCH_LUXEMBOURG 0x05 # endif @@ -600,30 +742,147 @@ # ifndef SUBLANG_FRENCH_HAITI # define SUBLANG_FRENCH_HAITI 0x0f # endif +# ifndef SUBLANG_FRISIAN_NETHERLANDS +# define SUBLANG_FRISIAN_NETHERLANDS 0x01 +# endif +# ifndef SUBLANG_GALICIAN_SPAIN +# define SUBLANG_GALICIAN_SPAIN 0x01 +# endif +# ifndef SUBLANG_GEORGIAN_GEORGIA +# define SUBLANG_GEORGIAN_GEORGIA 0x01 +# endif # ifndef SUBLANG_GERMAN_LUXEMBOURG # define SUBLANG_GERMAN_LUXEMBOURG 0x04 # endif # ifndef SUBLANG_GERMAN_LIECHTENSTEIN # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 # endif +# ifndef SUBLANG_GREEK_GREECE +# define SUBLANG_GREEK_GREECE 0x01 +# endif +# ifndef SUBLANG_GREENLANDIC_GREENLAND +# define SUBLANG_GREENLANDIC_GREENLAND 0x01 +# endif +# ifndef SUBLANG_GUJARATI_INDIA +# define SUBLANG_GUJARATI_INDIA 0x01 +# endif +# ifndef SUBLANG_HAUSA_NIGERIA_LATIN +# define SUBLANG_HAUSA_NIGERIA_LATIN 0x01 +# endif +# ifndef SUBLANG_HEBREW_ISRAEL +# define SUBLANG_HEBREW_ISRAEL 0x01 +# endif +# ifndef SUBLANG_HINDI_INDIA +# define SUBLANG_HINDI_INDIA 0x01 +# endif +# ifndef SUBLANG_HUNGARIAN_HUNGARY +# define SUBLANG_HUNGARIAN_HUNGARY 0x01 +# endif +# ifndef SUBLANG_ICELANDIC_ICELAND +# define SUBLANG_ICELANDIC_ICELAND 0x01 +# endif +# ifndef SUBLANG_IGBO_NIGERIA +# define SUBLANG_IGBO_NIGERIA 0x01 +# endif +# ifndef SUBLANG_INDONESIAN_INDONESIA +# define SUBLANG_INDONESIAN_INDONESIA 0x01 +# endif +# ifndef SUBLANG_INUKTITUT_CANADA +# define SUBLANG_INUKTITUT_CANADA 0x01 +# endif +# undef SUBLANG_INUKTITUT_CANADA_LATIN +# define SUBLANG_INUKTITUT_CANADA_LATIN 0x02 +# undef SUBLANG_IRISH_IRELAND +# define SUBLANG_IRISH_IRELAND 0x02 +# ifndef SUBLANG_JAPANESE_JAPAN +# define SUBLANG_JAPANESE_JAPAN 0x01 +# endif +# ifndef SUBLANG_KANNADA_INDIA +# define SUBLANG_KANNADA_INDIA 0x01 +# endif # ifndef SUBLANG_KASHMIRI_INDIA # define SUBLANG_KASHMIRI_INDIA 0x02 # endif +# ifndef SUBLANG_KAZAK_KAZAKHSTAN +# define SUBLANG_KAZAK_KAZAKHSTAN 0x01 +# endif +# ifndef SUBLANG_KICHE_GUATEMALA +# define SUBLANG_KICHE_GUATEMALA 0x01 +# endif +# ifndef SUBLANG_KINYARWANDA_RWANDA +# define SUBLANG_KINYARWANDA_RWANDA 0x01 +# endif +# ifndef SUBLANG_KONKANI_INDIA +# define SUBLANG_KONKANI_INDIA 0x01 +# endif +# ifndef SUBLANG_KYRGYZ_KYRGYZSTAN +# define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01 +# endif +# ifndef SUBLANG_LAO_LAOS +# define SUBLANG_LAO_LAOS 0x01 +# endif +# ifndef SUBLANG_LATVIAN_LATVIA +# define SUBLANG_LATVIAN_LATVIA 0x01 +# endif +# ifndef SUBLANG_LITHUANIAN_LITHUANIA +# define SUBLANG_LITHUANIAN_LITHUANIA 0x01 +# endif +# undef SUBLANG_LOWER_SORBIAN_GERMANY +# define SUBLANG_LOWER_SORBIAN_GERMANY 0x02 +# ifndef SUBLANG_LUXEMBOURGISH_LUXEMBOURG +# define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01 +# endif +# ifndef SUBLANG_MACEDONIAN_MACEDONIA +# define SUBLANG_MACEDONIAN_MACEDONIA 0x01 +# endif # ifndef SUBLANG_MALAY_MALAYSIA # define SUBLANG_MALAY_MALAYSIA 0x01 # endif # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 # endif +# ifndef SUBLANG_MALAYALAM_INDIA +# define SUBLANG_MALAYALAM_INDIA 0x01 +# endif +# ifndef SUBLANG_MALTESE_MALTA +# define SUBLANG_MALTESE_MALTA 0x01 +# endif +# ifndef SUBLANG_MAORI_NEW_ZEALAND +# define SUBLANG_MAORI_NEW_ZEALAND 0x01 +# endif +# ifndef SUBLANG_MAPUDUNGUN_CHILE +# define SUBLANG_MAPUDUNGUN_CHILE 0x01 +# endif +# ifndef SUBLANG_MARATHI_INDIA +# define SUBLANG_MARATHI_INDIA 0x01 +# endif +# ifndef SUBLANG_MOHAWK_CANADA +# define SUBLANG_MOHAWK_CANADA 0x01 +# endif # ifndef SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA # define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01 # endif # ifndef SUBLANG_MONGOLIAN_PRC # define SUBLANG_MONGOLIAN_PRC 0x02 # endif +# ifndef SUBLANG_NEPALI_NEPAL +# define SUBLANG_NEPALI_NEPAL 0x01 +# endif # ifndef SUBLANG_NEPALI_INDIA # define SUBLANG_NEPALI_INDIA 0x02 # endif +# ifndef SUBLANG_OCCITAN_FRANCE +# define SUBLANG_OCCITAN_FRANCE 0x01 +# endif +# ifndef SUBLANG_ORIYA_INDIA +# define SUBLANG_ORIYA_INDIA 0x01 +# endif +# ifndef SUBLANG_PASHTO_AFGHANISTAN +# define SUBLANG_PASHTO_AFGHANISTAN 0x01 +# endif +# ifndef SUBLANG_POLISH_POLAND +# define SUBLANG_POLISH_POLAND 0x01 +# endif # ifndef SUBLANG_PUNJABI_INDIA # define SUBLANG_PUNJABI_INDIA 0x01 # endif @@ -645,12 +904,43 @@ # ifndef SUBLANG_ROMANIAN_MOLDOVA # define SUBLANG_ROMANIAN_MOLDOVA 0x02 # endif +# ifndef SUBLANG_ROMANSH_SWITZERLAND +# define SUBLANG_ROMANSH_SWITZERLAND 0x01 +# endif # ifndef SUBLANG_RUSSIAN_RUSSIA # define SUBLANG_RUSSIAN_RUSSIA 0x01 # endif # ifndef SUBLANG_RUSSIAN_MOLDAVIA # define SUBLANG_RUSSIAN_MOLDAVIA 0x02 # endif +# ifndef SUBLANG_SAMI_NORTHERN_NORWAY +# define SUBLANG_SAMI_NORTHERN_NORWAY 0x01 +# endif +# ifndef SUBLANG_SAMI_NORTHERN_SWEDEN +# define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02 +# endif +# ifndef SUBLANG_SAMI_NORTHERN_FINLAND +# define SUBLANG_SAMI_NORTHERN_FINLAND 0x03 +# endif +# ifndef SUBLANG_SAMI_LULE_NORWAY +# define SUBLANG_SAMI_LULE_NORWAY 0x04 +# endif +# ifndef SUBLANG_SAMI_LULE_SWEDEN +# define SUBLANG_SAMI_LULE_SWEDEN 0x05 +# endif +# ifndef SUBLANG_SAMI_SOUTHERN_NORWAY +# define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06 +# endif +# ifndef SUBLANG_SAMI_SOUTHERN_SWEDEN +# define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07 +# endif +# undef SUBLANG_SAMI_SKOLT_FINLAND +# define SUBLANG_SAMI_SKOLT_FINLAND 0x08 +# undef SUBLANG_SAMI_INARI_FINLAND +# define SUBLANG_SAMI_INARI_FINLAND 0x09 +# ifndef SUBLANG_SANSKRIT_INDIA +# define SUBLANG_SANSKRIT_INDIA 0x01 +# endif # ifndef SUBLANG_SERBIAN_LATIN # define SUBLANG_SERBIAN_LATIN 0x02 # endif @@ -665,6 +955,18 @@ # ifndef SUBLANG_SINDHI_AFGHANISTAN # define SUBLANG_SINDHI_AFGHANISTAN 0x02 # endif +# ifndef SUBLANG_SINHALESE_SRI_LANKA +# define SUBLANG_SINHALESE_SRI_LANKA 0x01 +# endif +# ifndef SUBLANG_SLOVAK_SLOVAKIA +# define SUBLANG_SLOVAK_SLOVAKIA 0x01 +# endif +# ifndef SUBLANG_SLOVENIAN_SLOVENIA +# define SUBLANG_SLOVENIAN_SLOVENIA 0x01 +# endif +# ifndef SUBLANG_SOTHO_SOUTH_AFRICA +# define SUBLANG_SOTHO_SOUTH_AFRICA 0x01 +# endif # ifndef SUBLANG_SPANISH_GUATEMALA # define SUBLANG_SPANISH_GUATEMALA 0x04 # endif @@ -719,15 +1021,42 @@ # ifndef SUBLANG_SPANISH_US # define SUBLANG_SPANISH_US 0x15 # endif +# ifndef SUBLANG_SWAHILI_KENYA +# define SUBLANG_SWAHILI_KENYA 0x01 +# endif +# ifndef SUBLANG_SWEDISH_SWEDEN +# define SUBLANG_SWEDISH_SWEDEN 0x01 +# endif # ifndef SUBLANG_SWEDISH_FINLAND # define SUBLANG_SWEDISH_FINLAND 0x02 # endif +# ifndef SUBLANG_SYRIAC_SYRIA +# define SUBLANG_SYRIAC_SYRIA 0x01 +# endif +# ifndef SUBLANG_TAGALOG_PHILIPPINES +# define SUBLANG_TAGALOG_PHILIPPINES 0x01 +# endif +# ifndef SUBLANG_TAJIK_TAJIKISTAN +# define SUBLANG_TAJIK_TAJIKISTAN 0x01 +# endif # ifndef SUBLANG_TAMAZIGHT_ARABIC # define SUBLANG_TAMAZIGHT_ARABIC 0x01 # endif # ifndef SUBLANG_TAMAZIGHT_ALGERIA_LATIN # define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 # endif +# ifndef SUBLANG_TAMIL_INDIA +# define SUBLANG_TAMIL_INDIA 0x01 +# endif +# ifndef SUBLANG_TATAR_RUSSIA +# define SUBLANG_TATAR_RUSSIA 0x01 +# endif +# ifndef SUBLANG_TELUGU_INDIA +# define SUBLANG_TELUGU_INDIA 0x01 +# endif +# ifndef SUBLANG_THAI_THAILAND +# define SUBLANG_THAI_THAILAND 0x01 +# endif # ifndef SUBLANG_TIBETAN_PRC # define SUBLANG_TIBETAN_PRC 0x01 # endif @@ -739,9 +1068,24 @@ # ifndef SUBLANG_TIGRINYA_ERITREA # define SUBLANG_TIGRINYA_ERITREA 0x02 # endif +# ifndef SUBLANG_TSWANA_SOUTH_AFRICA +# define SUBLANG_TSWANA_SOUTH_AFRICA 0x01 +# endif +# ifndef SUBLANG_TURKISH_TURKEY +# define SUBLANG_TURKISH_TURKEY 0x01 +# endif +# ifndef SUBLANG_TURKMEN_TURKMENISTAN +# define SUBLANG_TURKMEN_TURKMENISTAN 0x01 +# endif # ifndef SUBLANG_UIGHUR_PRC # define SUBLANG_UIGHUR_PRC 0x01 # endif +# ifndef SUBLANG_UKRAINIAN_UKRAINE +# define SUBLANG_UKRAINIAN_UKRAINE 0x01 +# endif +# ifndef SUBLANG_UPPER_SORBIAN_GERMANY +# define SUBLANG_UPPER_SORBIAN_GERMANY 0x01 +# endif # ifndef SUBLANG_URDU_PAKISTAN # define SUBLANG_URDU_PAKISTAN 0x01 # endif @@ -754,6 +1098,30 @@ # ifndef SUBLANG_UZBEK_CYRILLIC # define SUBLANG_UZBEK_CYRILLIC 0x02 # endif +# ifndef SUBLANG_VIETNAMESE_VIETNAM +# define SUBLANG_VIETNAMESE_VIETNAM 0x01 +# endif +# ifndef SUBLANG_WELSH_UNITED_KINGDOM +# define SUBLANG_WELSH_UNITED_KINGDOM 0x01 +# endif +# ifndef SUBLANG_WOLOF_SENEGAL +# define SUBLANG_WOLOF_SENEGAL 0x01 +# endif +# ifndef SUBLANG_XHOSA_SOUTH_AFRICA +# define SUBLANG_XHOSA_SOUTH_AFRICA 0x01 +# endif +# ifndef SUBLANG_YAKUT_RUSSIA +# define SUBLANG_YAKUT_RUSSIA 0x01 +# endif +# ifndef SUBLANG_YI_PRC +# define SUBLANG_YI_PRC 0x01 +# endif +# ifndef SUBLANG_YORUBA_NIGERIA +# define SUBLANG_YORUBA_NIGERIA 0x01 +# endif +# ifndef SUBLANG_ZULU_SOUTH_AFRICA +# define SUBLANG_ZULU_SOUTH_AFRICA 0x01 +# endif /* GetLocaleInfoA operations. */ # ifndef LOCALE_SNAME # define LOCALE_SNAME 0x5c @@ -784,7 +1152,7 @@ gl_locale_name_canonicalize (char *name) MacOS X 10.3.8 function CFLocaleCreateCanonicalLocaleIdentifierFromString(). */ typedef struct { const char legacy[21+1]; const char unixy[5+1]; } - legacy_entry; + legacy_entry; static const legacy_entry legacy_table[] = { { "Afrikaans", "af" }, { "Albanian", "sq" }, @@ -922,7 +1290,7 @@ gl_locale_name_canonicalize (char *name) /* Convert new-style locale names with language tags (ISO 639 and ISO 15924) to Unix (ISO 639 and ISO 3166) names. */ typedef struct { const char langtag[7+1]; const char unixy[12+1]; } - langtag_entry; + langtag_entry; static const langtag_entry langtag_table[] = { /* MacOS X has "az-Arab", "az-Cyrl", "az-Latn". The default script for az on Unix is Latin. */ @@ -952,7 +1320,7 @@ gl_locale_name_canonicalize (char *name) /* Convert script names (ISO 15924) to Unix conventions. See http://www.unicode.org/iso15924/iso15924-codes.html */ typedef struct { const char script[4+1]; const char unixy[9+1]; } - script_entry; + script_entry; static const script_entry script_table[] = { { "Arab", "arabic" }, { "Cyrl", "cyrillic" }, @@ -966,21 +1334,21 @@ gl_locale_name_canonicalize (char *name) i1 = 0; i2 = sizeof (legacy_table) / sizeof (legacy_entry); while (i2 - i1 > 1) - { - /* At this point we know that if name occurs in legacy_table, - its index must be >= i1 and < i2. */ - unsigned int i = (i1 + i2) >> 1; - const legacy_entry *p = &legacy_table[i]; - if (strcmp (name, p->legacy) < 0) - i2 = i; - else - i1 = i; - } + { + /* At this point we know that if name occurs in legacy_table, + its index must be >= i1 and < i2. */ + unsigned int i = (i1 + i2) >> 1; + const legacy_entry *p = &legacy_table[i]; + if (strcmp (name, p->legacy) < 0) + i2 = i; + else + i1 = i; + } if (strcmp (name, legacy_table[i1].legacy) == 0) - { - strcpy (name, legacy_table[i1].unixy); - return; - } + { + strcpy (name, legacy_table[i1].unixy); + return; + } } /* Step 2: Convert using langtag_table and script_table. */ @@ -990,41 +1358,41 @@ gl_locale_name_canonicalize (char *name) i1 = 0; i2 = sizeof (langtag_table) / sizeof (langtag_entry); while (i2 - i1 > 1) - { - /* At this point we know that if name occurs in langtag_table, - its index must be >= i1 and < i2. */ - unsigned int i = (i1 + i2) >> 1; - const langtag_entry *p = &langtag_table[i]; - if (strcmp (name, p->langtag) < 0) - i2 = i; - else - i1 = i; - } + { + /* At this point we know that if name occurs in langtag_table, + its index must be >= i1 and < i2. */ + unsigned int i = (i1 + i2) >> 1; + const langtag_entry *p = &langtag_table[i]; + if (strcmp (name, p->langtag) < 0) + i2 = i; + else + i1 = i; + } if (strcmp (name, langtag_table[i1].langtag) == 0) - { - strcpy (name, langtag_table[i1].unixy); - return; - } + { + strcpy (name, langtag_table[i1].unixy); + return; + } i1 = 0; i2 = sizeof (script_table) / sizeof (script_entry); while (i2 - i1 > 1) - { - /* At this point we know that if (name + 3) occurs in script_table, - its index must be >= i1 and < i2. */ - unsigned int i = (i1 + i2) >> 1; - const script_entry *p = &script_table[i]; - if (strcmp (name + 3, p->script) < 0) - i2 = i; - else - i1 = i; - } + { + /* At this point we know that if (name + 3) occurs in script_table, + its index must be >= i1 and < i2. */ + unsigned int i = (i1 + i2) >> 1; + const script_entry *p = &script_table[i]; + if (strcmp (name + 3, p->script) < 0) + i2 = i; + else + i1 = i; + } if (strcmp (name + 3, script_table[i1].script) == 0) - { - name[2] = '@'; - strcpy (name + 3, script_table[i1].unixy); - return; - } + { + name[2] = '@'; + strcpy (name + 3, script_table[i1].unixy); + return; + } } /* Step 3: Convert new-style dash to Unix underscore. */ @@ -1032,14 +1400,14 @@ gl_locale_name_canonicalize (char *name) char *p; for (p = name; *p != '\0'; p++) if (*p == '-') - *p = '_'; + *p = '_'; } } #endif -#ifdef WIN32_NATIVE +#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */ /* Canonicalize a Win32 native locale name to a Unix locale name. NAME is a sufficiently large buffer. @@ -1058,19 +1426,19 @@ gl_locale_name_canonicalize (char *name) for (p = name; *p != '\0'; p++) if (*p == '-') { - *p = '_'; - p++; - for (; *p != '\0'; p++) - { - if (*p >= 'a' && *p <= 'z') - *p += 'A' - 'a'; - if (*p == '-') - { - *p = '\0'; - return; - } - } - return; + *p = '_'; + p++; + for (; *p != '\0'; p++) + { + if (*p >= 'a' && *p <= 'z') + *p += 'A' - 'a'; + if (*p == '-') + { + *p = '\0'; + return; + } + } + return; } } @@ -1087,15 +1455,15 @@ gl_locale_name_from_win32_LANGID (LANGID langid) static char namebuf[256]; /* Query the system's notion of locale name. - On Windows95/98/ME, GetLocaleInfoA returns some incorrect results. - But we don't need to support systems that are so old. */ + On Windows95/98/ME, GetLocaleInfoA returns some incorrect results. + But we don't need to support systems that are so old. */ if (GetLocaleInfoA (MAKELCID (langid, SORT_DEFAULT), LOCALE_SNAME, - namebuf, sizeof (namebuf) - 1)) - { - /* Convert it to a Unix locale name. */ - gl_locale_name_canonicalize (namebuf); - return namebuf; - } + namebuf, sizeof (namebuf) - 1)) + { + /* Convert it to a Unix locale name. */ + gl_locale_name_canonicalize (namebuf); + return namebuf; + } } /* Internet Explorer has an LCID to RFC3066 name mapping stored in HKEY_CLASSES_ROOT\Mime\Database\Rfc1766. But we better don't use that @@ -1115,426 +1483,1008 @@ gl_locale_name_from_win32_LANGID (LANGID langid) For details about languages, see http://www.ethnologue.com/ . */ switch (primary) { - case LANG_AFRIKAANS: return "af_ZA"; - case LANG_ALBANIAN: return "sq_AL"; - case LANG_AMHARIC: return "am_ET"; + case LANG_AFRIKAANS: + switch (sub) + { + case SUBLANG_AFRIKAANS_SOUTH_AFRICA: return "af_ZA"; + } + return "af"; + case LANG_ALBANIAN: + switch (sub) + { + case SUBLANG_ALBANIAN_ALBANIA: return "sq_AL"; + } + return "sq"; + case LANG_ALSATIAN: + switch (sub) + { + case SUBLANG_ALSATIAN_FRANCE: return "gsw_FR"; + } + return "gsw"; + case LANG_AMHARIC: + switch (sub) + { + case SUBLANG_AMHARIC_ETHIOPIA: return "am_ET"; + } + return "am"; case LANG_ARABIC: - switch (sub) - { - case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA"; - case SUBLANG_ARABIC_IRAQ: return "ar_IQ"; - case SUBLANG_ARABIC_EGYPT: return "ar_EG"; - case SUBLANG_ARABIC_LIBYA: return "ar_LY"; - case SUBLANG_ARABIC_ALGERIA: return "ar_DZ"; - case SUBLANG_ARABIC_MOROCCO: return "ar_MA"; - case SUBLANG_ARABIC_TUNISIA: return "ar_TN"; - case SUBLANG_ARABIC_OMAN: return "ar_OM"; - case SUBLANG_ARABIC_YEMEN: return "ar_YE"; - case SUBLANG_ARABIC_SYRIA: return "ar_SY"; - case SUBLANG_ARABIC_JORDAN: return "ar_JO"; - case SUBLANG_ARABIC_LEBANON: return "ar_LB"; - case SUBLANG_ARABIC_KUWAIT: return "ar_KW"; - case SUBLANG_ARABIC_UAE: return "ar_AE"; - case SUBLANG_ARABIC_BAHRAIN: return "ar_BH"; - case SUBLANG_ARABIC_QATAR: return "ar_QA"; - } - return "ar"; - case LANG_ARMENIAN: return "hy_AM"; - case LANG_ASSAMESE: return "as_IN"; + switch (sub) + { + case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA"; + case SUBLANG_ARABIC_IRAQ: return "ar_IQ"; + case SUBLANG_ARABIC_EGYPT: return "ar_EG"; + case SUBLANG_ARABIC_LIBYA: return "ar_LY"; + case SUBLANG_ARABIC_ALGERIA: return "ar_DZ"; + case SUBLANG_ARABIC_MOROCCO: return "ar_MA"; + case SUBLANG_ARABIC_TUNISIA: return "ar_TN"; + case SUBLANG_ARABIC_OMAN: return "ar_OM"; + case SUBLANG_ARABIC_YEMEN: return "ar_YE"; + case SUBLANG_ARABIC_SYRIA: return "ar_SY"; + case SUBLANG_ARABIC_JORDAN: return "ar_JO"; + case SUBLANG_ARABIC_LEBANON: return "ar_LB"; + case SUBLANG_ARABIC_KUWAIT: return "ar_KW"; + case SUBLANG_ARABIC_UAE: return "ar_AE"; + case SUBLANG_ARABIC_BAHRAIN: return "ar_BH"; + case SUBLANG_ARABIC_QATAR: return "ar_QA"; + } + return "ar"; + case LANG_ARMENIAN: + switch (sub) + { + case SUBLANG_ARMENIAN_ARMENIA: return "hy_AM"; + } + return "hy"; + case LANG_ASSAMESE: + switch (sub) + { + case SUBLANG_ASSAMESE_INDIA: return "as_IN"; + } + return "as"; case LANG_AZERI: - switch (sub) - { - /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ - case SUBLANG_AZERI_LATIN: return "az_AZ@latin"; - case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic"; - } - return "az"; + switch (sub) + { + /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ + case 0x1e: return "az@latin"; + case SUBLANG_AZERI_LATIN: return "az_AZ@latin"; + case 0x1d: return "az@cyrillic"; + case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic"; + } + return "az"; + case LANG_BASHKIR: + switch (sub) + { + case SUBLANG_BASHKIR_RUSSIA: return "ba_RU"; + } + return "ba"; case LANG_BASQUE: - switch (sub) - { - case SUBLANG_DEFAULT: return "eu_ES"; - } - return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ - case LANG_BELARUSIAN: return "be_BY"; + switch (sub) + { + case SUBLANG_BASQUE_BASQUE: return "eu_ES"; + } + return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ + case LANG_BELARUSIAN: + switch (sub) + { + case SUBLANG_BELARUSIAN_BELARUS: return "be_BY"; + } + return "be"; case LANG_BENGALI: - switch (sub) - { - case SUBLANG_BENGALI_INDIA: return "bn_IN"; - case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; - } - return "bn"; - case LANG_BULGARIAN: return "bg_BG"; - case LANG_BURMESE: return "my_MM"; - case LANG_CAMBODIAN: return "km_KH"; - case LANG_CATALAN: return "ca_ES"; - case LANG_CHEROKEE: return "chr_US"; + switch (sub) + { + case SUBLANG_BENGALI_INDIA: return "bn_IN"; + case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; + } + return "bn"; + case LANG_BRETON: + switch (sub) + { + case SUBLANG_BRETON_FRANCE: return "br_FR"; + } + return "br"; + case LANG_BULGARIAN: + switch (sub) + { + case SUBLANG_BULGARIAN_BULGARIA: return "bg_BG"; + } + return "bg"; + case LANG_BURMESE: + switch (sub) + { + case SUBLANG_DEFAULT: return "my_MM"; + } + return "my"; + case LANG_CAMBODIAN: + switch (sub) + { + case SUBLANG_CAMBODIAN_CAMBODIA: return "km_KH"; + } + return "km"; + case LANG_CATALAN: + switch (sub) + { + case SUBLANG_CATALAN_SPAIN: return "ca_ES"; + } + return "ca"; + case LANG_CHEROKEE: + switch (sub) + { + case SUBLANG_DEFAULT: return "chr_US"; + } + return "chr"; case LANG_CHINESE: - switch (sub) - { - case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW"; - case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN"; - case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; - case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; - case SUBLANG_CHINESE_MACAU: return "zh_MO"; - } - return "zh"; - case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN - * What used to be called Serbo-Croatian - * should really now be two separate - * languages because of political reasons. - * (Says tml, who knows nothing about Serbian - * or Croatian.) - * (I can feel those flames coming already.) - */ - switch (sub) - { - case SUBLANG_CROATIAN_CROATIA: return "hr_HR"; - case SUBLANG_SERBIAN_LATIN: return "sr_CS"; - case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic"; - case SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: return "hr_BA"; - case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: return "bs_BA"; - case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: return "bs_BA@cyrillic"; - } - return "hr"; - case LANG_CZECH: return "cs_CZ"; - case LANG_DANISH: return "da_DK"; - case LANG_DIVEHI: return "dv_MV"; + switch (sub) + { + case SUBLANG_CHINESE_TRADITIONAL: case 0x1f: return "zh_TW"; + case SUBLANG_CHINESE_SIMPLIFIED: case 0x00: return "zh_CN"; + case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; /* traditional */ + case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; /* simplified */ + case SUBLANG_CHINESE_MACAU: return "zh_MO"; /* traditional */ + } + return "zh"; + case LANG_CORSICAN: + switch (sub) + { + case SUBLANG_CORSICAN_FRANCE: return "co_FR"; + } + return "co"; + case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN + * What used to be called Serbo-Croatian + * should really now be two separate + * languages because of political reasons. + * (Says tml, who knows nothing about Serbian + * or Croatian.) + * (I can feel those flames coming already.) + */ + switch (sub) + { + /* Croatian */ + case 0x00: return "hr"; + case SUBLANG_CROATIAN_CROATIA: return "hr_HR"; + case SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: return "hr_BA"; + /* Serbian */ + case 0x1f: return "sr"; + case 0x1c: return "sr"; /* latin */ + case SUBLANG_SERBIAN_LATIN: return "sr_CS"; /* latin */ + case 0x09: return "sr_RS"; /* latin */ + case 0x0b: return "sr_ME"; /* latin */ + case 0x06: return "sr_BA"; /* latin */ + case 0x1b: return "sr@cyrillic"; + case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic"; + case 0x0a: return "sr_RS@cyrillic"; + case 0x0c: return "sr_ME@cyrillic"; + case 0x07: return "sr_BA@cyrillic"; + /* Bosnian */ + case 0x1e: return "bs"; + case 0x1a: return "bs"; /* latin */ + case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: return "bs_BA"; /* latin */ + case 0x19: return "bs@cyrillic"; + case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: return "bs_BA@cyrillic"; + } + return "hr"; + case LANG_CZECH: + switch (sub) + { + case SUBLANG_CZECH_CZECH_REPUBLIC: return "cs_CZ"; + } + return "cs"; + case LANG_DANISH: + switch (sub) + { + case SUBLANG_DANISH_DENMARK: return "da_DK"; + } + return "da"; + case LANG_DARI: + /* FIXME: Adjust this when such locales appear on Unix. */ + switch (sub) + { + case SUBLANG_DARI_AFGHANISTAN: return "prs_AF"; + } + return "prs"; + case LANG_DIVEHI: + switch (sub) + { + case SUBLANG_DIVEHI_MALDIVES: return "dv_MV"; + } + return "dv"; case LANG_DUTCH: - switch (sub) - { - case SUBLANG_DUTCH: return "nl_NL"; - case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE"; - } - return "nl"; - case LANG_EDO: return "bin_NG"; + switch (sub) + { + case SUBLANG_DUTCH: return "nl_NL"; + case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE"; + case SUBLANG_DUTCH_SURINAM: return "nl_SR"; + } + return "nl"; + case LANG_EDO: + switch (sub) + { + case SUBLANG_DEFAULT: return "bin_NG"; + } + return "bin"; case LANG_ENGLISH: - switch (sub) - { - /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought - * English was the language spoken in England. - * Oh well. - */ - case SUBLANG_ENGLISH_US: return "en_US"; - case SUBLANG_ENGLISH_UK: return "en_GB"; - case SUBLANG_ENGLISH_AUS: return "en_AU"; - case SUBLANG_ENGLISH_CAN: return "en_CA"; - case SUBLANG_ENGLISH_NZ: return "en_NZ"; - case SUBLANG_ENGLISH_EIRE: return "en_IE"; - case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA"; - case SUBLANG_ENGLISH_JAMAICA: return "en_JM"; - case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */ - case SUBLANG_ENGLISH_BELIZE: return "en_BZ"; - case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; - case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; - case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; - case SUBLANG_ENGLISH_INDONESIA: return "en_ID"; - case SUBLANG_ENGLISH_HONGKONG: return "en_HK"; - case SUBLANG_ENGLISH_INDIA: return "en_IN"; - case SUBLANG_ENGLISH_MALAYSIA: return "en_MY"; - case SUBLANG_ENGLISH_SINGAPORE: return "en_SG"; - } - return "en"; - case LANG_ESTONIAN: return "et_EE"; - case LANG_FAEROESE: return "fo_FO"; - case LANG_FARSI: return "fa_IR"; - case LANG_FINNISH: return "fi_FI"; + switch (sub) + { + /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought + * English was the language spoken in England. + * Oh well. + */ + case SUBLANG_ENGLISH_US: return "en_US"; + case SUBLANG_ENGLISH_UK: return "en_GB"; + case SUBLANG_ENGLISH_AUS: return "en_AU"; + case SUBLANG_ENGLISH_CAN: return "en_CA"; + case SUBLANG_ENGLISH_NZ: return "en_NZ"; + case SUBLANG_ENGLISH_EIRE: return "en_IE"; + case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA"; + case SUBLANG_ENGLISH_JAMAICA: return "en_JM"; + case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */ + case SUBLANG_ENGLISH_BELIZE: return "en_BZ"; + case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; + case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; + case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; + case SUBLANG_ENGLISH_INDONESIA: return "en_ID"; + case SUBLANG_ENGLISH_HONGKONG: return "en_HK"; + case SUBLANG_ENGLISH_INDIA: return "en_IN"; + case SUBLANG_ENGLISH_MALAYSIA: return "en_MY"; + case SUBLANG_ENGLISH_SINGAPORE: return "en_SG"; + } + return "en"; + case LANG_ESTONIAN: + switch (sub) + { + case SUBLANG_ESTONIAN_ESTONIA: return "et_EE"; + } + return "et"; + case LANG_FAEROESE: + switch (sub) + { + case SUBLANG_FAEROESE_FAROE_ISLANDS: return "fo_FO"; + } + return "fo"; + case LANG_FARSI: + switch (sub) + { + case SUBLANG_FARSI_IRAN: return "fa_IR"; + } + return "fa"; + case LANG_FINNISH: + switch (sub) + { + case SUBLANG_FINNISH_FINLAND: return "fi_FI"; + } + return "fi"; case LANG_FRENCH: - switch (sub) - { - case SUBLANG_FRENCH: return "fr_FR"; - case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE"; - case SUBLANG_FRENCH_CANADIAN: return "fr_CA"; - case SUBLANG_FRENCH_SWISS: return "fr_CH"; - case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; - case SUBLANG_FRENCH_MONACO: return "fr_MC"; - case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */ - case SUBLANG_FRENCH_REUNION: return "fr_RE"; - case SUBLANG_FRENCH_CONGO: return "fr_CG"; - case SUBLANG_FRENCH_SENEGAL: return "fr_SN"; - case SUBLANG_FRENCH_CAMEROON: return "fr_CM"; - case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI"; - case SUBLANG_FRENCH_MALI: return "fr_ML"; - case SUBLANG_FRENCH_MOROCCO: return "fr_MA"; - case SUBLANG_FRENCH_HAITI: return "fr_HT"; - } - return "fr"; - case LANG_FRISIAN: return "fy_NL"; + switch (sub) + { + case SUBLANG_FRENCH: return "fr_FR"; + case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE"; + case SUBLANG_FRENCH_CANADIAN: return "fr_CA"; + case SUBLANG_FRENCH_SWISS: return "fr_CH"; + case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; + case SUBLANG_FRENCH_MONACO: return "fr_MC"; + case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */ + case SUBLANG_FRENCH_REUNION: return "fr_RE"; + case SUBLANG_FRENCH_CONGO: return "fr_CG"; + case SUBLANG_FRENCH_SENEGAL: return "fr_SN"; + case SUBLANG_FRENCH_CAMEROON: return "fr_CM"; + case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI"; + case SUBLANG_FRENCH_MALI: return "fr_ML"; + case SUBLANG_FRENCH_MOROCCO: return "fr_MA"; + case SUBLANG_FRENCH_HAITI: return "fr_HT"; + } + return "fr"; + case LANG_FRISIAN: + switch (sub) + { + case SUBLANG_FRISIAN_NETHERLANDS: return "fy_NL"; + } + return "fy"; case LANG_FULFULDE: - /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */ - return "ff_NG"; + /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */ + switch (sub) + { + case SUBLANG_DEFAULT: return "ff_NG"; + } + return "ff"; case LANG_GAELIC: - switch (sub) - { - case 0x01: /* SCOTTISH */ return "gd_GB"; - case 0x02: /* IRISH */ return "ga_IE"; - } - return "C"; - case LANG_GALICIAN: return "gl_ES"; - case LANG_GEORGIAN: return "ka_GE"; + switch (sub) + { + case 0x01: /* SCOTTISH */ + /* old, superseded by LANG_SCOTTISH_GAELIC */ + return "gd_GB"; + case SUBLANG_IRISH_IRELAND: return "ga_IE"; + } + return "ga"; + case LANG_GALICIAN: + switch (sub) + { + case SUBLANG_GALICIAN_SPAIN: return "gl_ES"; + } + return "gl"; + case LANG_GEORGIAN: + switch (sub) + { + case SUBLANG_GEORGIAN_GEORGIA: return "ka_GE"; + } + return "ka"; case LANG_GERMAN: - switch (sub) - { - case SUBLANG_GERMAN: return "de_DE"; - case SUBLANG_GERMAN_SWISS: return "de_CH"; - case SUBLANG_GERMAN_AUSTRIAN: return "de_AT"; - case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU"; - case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI"; - } - return "de"; - case LANG_GREEK: return "el_GR"; - case LANG_GUARANI: return "gn_PY"; - case LANG_GUJARATI: return "gu_IN"; - case LANG_HAUSA: return "ha_NG"; + switch (sub) + { + case SUBLANG_GERMAN: return "de_DE"; + case SUBLANG_GERMAN_SWISS: return "de_CH"; + case SUBLANG_GERMAN_AUSTRIAN: return "de_AT"; + case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU"; + case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI"; + } + return "de"; + case LANG_GREEK: + switch (sub) + { + case SUBLANG_GREEK_GREECE: return "el_GR"; + } + return "el"; + case LANG_GREENLANDIC: + switch (sub) + { + case SUBLANG_GREENLANDIC_GREENLAND: return "kl_GL"; + } + return "kl"; + case LANG_GUARANI: + switch (sub) + { + case SUBLANG_DEFAULT: return "gn_PY"; + } + return "gn"; + case LANG_GUJARATI: + switch (sub) + { + case SUBLANG_GUJARATI_INDIA: return "gu_IN"; + } + return "gu"; + case LANG_HAUSA: + switch (sub) + { + case 0x1f: return "ha"; + case SUBLANG_HAUSA_NIGERIA_LATIN: return "ha_NG"; + } + return "ha"; case LANG_HAWAIIAN: - /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers) - or Hawaii Creole English ("cpe_US", 600000 speakers)? */ - return "cpe_US"; - case LANG_HEBREW: return "he_IL"; - case LANG_HINDI: return "hi_IN"; - case LANG_HUNGARIAN: return "hu_HU"; - case LANG_IBIBIO: return "nic_NG"; - case LANG_ICELANDIC: return "is_IS"; - case LANG_IGBO: return "ig_NG"; - case LANG_INDONESIAN: return "id_ID"; - case LANG_INUKTITUT: return "iu_CA"; + /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers) + or Hawaii Creole English ("cpe_US", 600000 speakers)? */ + switch (sub) + { + case SUBLANG_DEFAULT: return "cpe_US"; + } + return "cpe"; + case LANG_HEBREW: + switch (sub) + { + case SUBLANG_HEBREW_ISRAEL: return "he_IL"; + } + return "he"; + case LANG_HINDI: + switch (sub) + { + case SUBLANG_HINDI_INDIA: return "hi_IN"; + } + return "hi"; + case LANG_HUNGARIAN: + switch (sub) + { + case SUBLANG_HUNGARIAN_HUNGARY: return "hu_HU"; + } + return "hu"; + case LANG_IBIBIO: + switch (sub) + { + case SUBLANG_DEFAULT: return "nic_NG"; + } + return "nic"; + case LANG_ICELANDIC: + switch (sub) + { + case SUBLANG_ICELANDIC_ICELAND: return "is_IS"; + } + return "is"; + case LANG_IGBO: + switch (sub) + { + case SUBLANG_IGBO_NIGERIA: return "ig_NG"; + } + return "ig"; + case LANG_INDONESIAN: + switch (sub) + { + case SUBLANG_INDONESIAN_INDONESIA: return "id_ID"; + } + return "id"; + case LANG_INUKTITUT: + switch (sub) + { + case 0x1e: return "iu"; /* syllabic */ + case SUBLANG_INUKTITUT_CANADA: return "iu_CA"; /* syllabic */ + case 0x1f: return "iu@latin"; + case SUBLANG_INUKTITUT_CANADA_LATIN: return "iu_CA@latin"; + } + return "iu"; case LANG_ITALIAN: - switch (sub) - { - case SUBLANG_ITALIAN: return "it_IT"; - case SUBLANG_ITALIAN_SWISS: return "it_CH"; - } - return "it"; - case LANG_JAPANESE: return "ja_JP"; - case LANG_KANNADA: return "kn_IN"; - case LANG_KANURI: return "kr_NG"; + switch (sub) + { + case SUBLANG_ITALIAN: return "it_IT"; + case SUBLANG_ITALIAN_SWISS: return "it_CH"; + } + return "it"; + case LANG_JAPANESE: + switch (sub) + { + case SUBLANG_JAPANESE_JAPAN: return "ja_JP"; + } + return "ja"; + case LANG_KANNADA: + switch (sub) + { + case SUBLANG_KANNADA_INDIA: return "kn_IN"; + } + return "kn"; + case LANG_KANURI: + switch (sub) + { + case SUBLANG_DEFAULT: return "kr_NG"; + } + return "kr"; case LANG_KASHMIRI: - switch (sub) - { - case SUBLANG_DEFAULT: return "ks_PK"; - case SUBLANG_KASHMIRI_INDIA: return "ks_IN"; - } - return "ks"; - case LANG_KAZAK: return "kk_KZ"; + switch (sub) + { + case SUBLANG_DEFAULT: return "ks_PK"; + case SUBLANG_KASHMIRI_INDIA: return "ks_IN"; + } + return "ks"; + case LANG_KAZAK: + switch (sub) + { + case SUBLANG_KAZAK_KAZAKHSTAN: return "kk_KZ"; + } + return "kk"; + case LANG_KICHE: + /* FIXME: Adjust this when such locales appear on Unix. */ + switch (sub) + { + case SUBLANG_KICHE_GUATEMALA: return "qut_GT"; + } + return "qut"; + case LANG_KINYARWANDA: + switch (sub) + { + case SUBLANG_KINYARWANDA_RWANDA: return "rw_RW"; + } + return "rw"; case LANG_KONKANI: - /* FIXME: Adjust this when such locales appear on Unix. */ - return "kok_IN"; - case LANG_KOREAN: return "ko_KR"; - case LANG_KYRGYZ: return "ky_KG"; - case LANG_LAO: return "lo_LA"; - case LANG_LATIN: return "la_VA"; - case LANG_LATVIAN: return "lv_LV"; - case LANG_LITHUANIAN: return "lt_LT"; - case LANG_MACEDONIAN: return "mk_MK"; + /* FIXME: Adjust this when such locales appear on Unix. */ + switch (sub) + { + case SUBLANG_KONKANI_INDIA: return "kok_IN"; + } + return "kok"; + case LANG_KOREAN: + switch (sub) + { + case SUBLANG_DEFAULT: return "ko_KR"; + } + return "ko"; + case LANG_KYRGYZ: + switch (sub) + { + case SUBLANG_KYRGYZ_KYRGYZSTAN: return "ky_KG"; + } + return "ky"; + case LANG_LAO: + switch (sub) + { + case SUBLANG_LAO_LAOS: return "lo_LA"; + } + return "lo"; + case LANG_LATIN: + switch (sub) + { + case SUBLANG_DEFAULT: return "la_VA"; + } + return "la"; + case LANG_LATVIAN: + switch (sub) + { + case SUBLANG_LATVIAN_LATVIA: return "lv_LV"; + } + return "lv"; + case LANG_LITHUANIAN: + switch (sub) + { + case SUBLANG_LITHUANIAN_LITHUANIA: return "lt_LT"; + } + return "lt"; + case LANG_LUXEMBOURGISH: + switch (sub) + { + case SUBLANG_LUXEMBOURGISH_LUXEMBOURG: return "lb_LU"; + } + return "lb"; + case LANG_MACEDONIAN: + switch (sub) + { + case SUBLANG_MACEDONIAN_MACEDONIA: return "mk_MK"; + } + return "mk"; case LANG_MALAY: - switch (sub) - { - case SUBLANG_MALAY_MALAYSIA: return "ms_MY"; - case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN"; - } - return "ms"; - case LANG_MALAYALAM: return "ml_IN"; - case LANG_MALTESE: return "mt_MT"; + switch (sub) + { + case SUBLANG_MALAY_MALAYSIA: return "ms_MY"; + case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN"; + } + return "ms"; + case LANG_MALAYALAM: + switch (sub) + { + case SUBLANG_MALAYALAM_INDIA: return "ml_IN"; + } + return "ml"; + case LANG_MALTESE: + switch (sub) + { + case SUBLANG_MALTESE_MALTA: return "mt_MT"; + } + return "mt"; case LANG_MANIPURI: - /* FIXME: Adjust this when such locales appear on Unix. */ - return "mni_IN"; - case LANG_MAORI: return "mi_NZ"; - case LANG_MARATHI: return "mr_IN"; + /* FIXME: Adjust this when such locales appear on Unix. */ + switch (sub) + { + case SUBLANG_DEFAULT: return "mni_IN"; + } + return "mni"; + case LANG_MAORI: + switch (sub) + { + case SUBLANG_MAORI_NEW_ZEALAND: return "mi_NZ"; + } + return "mi"; + case LANG_MAPUDUNGUN: + switch (sub) + { + case SUBLANG_MAPUDUNGUN_CHILE: return "arn_CL"; + } + return "arn"; + case LANG_MARATHI: + switch (sub) + { + case SUBLANG_MARATHI_INDIA: return "mr_IN"; + } + return "mr"; + case LANG_MOHAWK: + switch (sub) + { + case SUBLANG_MOHAWK_CANADA: return "moh_CA"; + } + return "moh"; case LANG_MONGOLIAN: - switch (sub) - { - case SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: return "mn_MN"; - case SUBLANG_MONGOLIAN_PRC: return "mn_CN"; - } - return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */ + switch (sub) + { + case SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: case 0x1e: return "mn_MN"; + case SUBLANG_MONGOLIAN_PRC: case 0x1f: return "mn_CN"; + } + return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */ case LANG_NEPALI: - switch (sub) - { - case SUBLANG_DEFAULT: return "ne_NP"; - case SUBLANG_NEPALI_INDIA: return "ne_IN"; - } - return "ne"; + switch (sub) + { + case SUBLANG_NEPALI_NEPAL: return "ne_NP"; + case SUBLANG_NEPALI_INDIA: return "ne_IN"; + } + return "ne"; case LANG_NORWEGIAN: - switch (sub) - { - case SUBLANG_NORWEGIAN_BOKMAL: return "nb_NO"; - case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO"; - } - return "no"; - case LANG_ORIYA: return "or_IN"; - case LANG_OROMO: return "om_ET"; - case LANG_PAPIAMENTU: return "pap_AN"; + switch (sub) + { + case 0x1f: return "nb"; + case SUBLANG_NORWEGIAN_BOKMAL: return "nb_NO"; + case 0x1e: return "nn"; + case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO"; + } + return "no"; + case LANG_OCCITAN: + switch (sub) + { + case SUBLANG_OCCITAN_FRANCE: return "oc_FR"; + } + return "oc"; + case LANG_ORIYA: + switch (sub) + { + case SUBLANG_ORIYA_INDIA: return "or_IN"; + } + return "or"; + case LANG_OROMO: + switch (sub) + { + case SUBLANG_DEFAULT: return "om_ET"; + } + return "om"; + case LANG_PAPIAMENTU: + switch (sub) + { + case SUBLANG_DEFAULT: return "pap_AN"; + } + return "pap"; case LANG_PASHTO: - return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ - case LANG_POLISH: return "pl_PL"; + switch (sub) + { + case SUBLANG_PASHTO_AFGHANISTAN: return "ps_AF"; + } + return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ + case LANG_POLISH: + switch (sub) + { + case SUBLANG_POLISH_POLAND: return "pl_PL"; + } + return "pl"; case LANG_PORTUGUESE: - switch (sub) - { - case SUBLANG_PORTUGUESE: return "pt_PT"; - /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. - Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ - case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; - } - return "pt"; + switch (sub) + { + /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. + Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ + case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; + case SUBLANG_PORTUGUESE: return "pt_PT"; + } + return "pt"; case LANG_PUNJABI: - switch (sub) - { - case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ - case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ - } - return "pa"; + switch (sub) + { + case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ + case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ + } + return "pa"; case LANG_QUECHUA: - switch (sub) - { - case SUBLANG_QUECHUA_BOLIVIA: return "qu_BO"; - case SUBLANG_QUECHUA_ECUADOR: return "qu_EC"; - case SUBLANG_QUECHUA_PERU: return "qu_PE"; - } - return "qu"; - case LANG_RHAETO_ROMANCE: return "rm_CH"; + /* Note: Microsoft uses the non-ISO language code "quz". */ + switch (sub) + { + case SUBLANG_QUECHUA_BOLIVIA: return "qu_BO"; + case SUBLANG_QUECHUA_ECUADOR: return "qu_EC"; + case SUBLANG_QUECHUA_PERU: return "qu_PE"; + } + return "qu"; case LANG_ROMANIAN: - switch (sub) - { - case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; - case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; - } - return "ro"; + switch (sub) + { + case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; + case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; + } + return "ro"; + case LANG_ROMANSH: + switch (sub) + { + case SUBLANG_ROMANSH_SWITZERLAND: return "rm_CH"; + } + return "rm"; case LANG_RUSSIAN: - switch (sub) - { - case SUBLANG_RUSSIAN_RUSSIA: return "ru_RU"; - case SUBLANG_RUSSIAN_MOLDAVIA: return "ru_MD"; - } - return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ - case LANG_SAAMI: /* actually Northern Sami */ return "se_NO"; - case LANG_SANSKRIT: return "sa_IN"; + switch (sub) + { + case SUBLANG_RUSSIAN_RUSSIA: return "ru_RU"; + case SUBLANG_RUSSIAN_MOLDAVIA: return "ru_MD"; + } + return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ + case LANG_SAMI: + switch (sub) + { + /* Northern Sami */ + case 0x00: return "se"; + case SUBLANG_SAMI_NORTHERN_NORWAY: return "se_NO"; + case SUBLANG_SAMI_NORTHERN_SWEDEN: return "se_SE"; + case SUBLANG_SAMI_NORTHERN_FINLAND: return "se_FI"; + /* Lule Sami */ + case 0x1f: return "smj"; + case SUBLANG_SAMI_LULE_NORWAY: return "smj_NO"; + case SUBLANG_SAMI_LULE_SWEDEN: return "smj_SE"; + /* Southern Sami */ + case 0x1e: return "sma"; + case SUBLANG_SAMI_SOUTHERN_NORWAY: return "sma_NO"; + case SUBLANG_SAMI_SOUTHERN_SWEDEN: return "sma_SE"; + /* Skolt Sami */ + case 0x1d: return "sms"; + case SUBLANG_SAMI_SKOLT_FINLAND: return "sms_FI"; + /* Inari Sami */ + case 0x1c: return "smn"; + case SUBLANG_SAMI_INARI_FINLAND: return "smn_FI"; + } + return "se"; /* or "smi"? */ + case LANG_SANSKRIT: + switch (sub) + { + case SUBLANG_SANSKRIT_INDIA: return "sa_IN"; + } + return "sa"; + case LANG_SCOTTISH_GAELIC: + switch (sub) + { + case SUBLANG_DEFAULT: return "gd_GB"; + } + return "gd"; case LANG_SINDHI: - switch (sub) - { - case SUBLANG_SINDHI_INDIA: return "sd_IN"; - case SUBLANG_SINDHI_PAKISTAN: return "sd_PK"; - /*case SUBLANG_SINDHI_AFGHANISTAN: return "sd_AF";*/ - } - return "sd"; - case LANG_SINHALESE: return "si_LK"; - case LANG_SLOVAK: return "sk_SK"; - case LANG_SLOVENIAN: return "sl_SI"; - case LANG_SOMALI: return "so_SO"; + switch (sub) + { + case SUBLANG_SINDHI_INDIA: return "sd_IN"; + case SUBLANG_SINDHI_PAKISTAN: return "sd_PK"; + /*case SUBLANG_SINDHI_AFGHANISTAN: return "sd_AF";*/ + } + return "sd"; + case LANG_SINHALESE: + switch (sub) + { + case SUBLANG_SINHALESE_SRI_LANKA: return "si_LK"; + } + return "si"; + case LANG_SLOVAK: + switch (sub) + { + case SUBLANG_SLOVAK_SLOVAKIA: return "sk_SK"; + } + return "sk"; + case LANG_SLOVENIAN: + switch (sub) + { + case SUBLANG_SLOVENIAN_SLOVENIA: return "sl_SI"; + } + return "sl"; + case LANG_SOMALI: + switch (sub) + { + case SUBLANG_DEFAULT: return "so_SO"; + } + return "so"; case LANG_SORBIAN: - /* FIXME: Adjust this when such locales appear on Unix. */ - return "wen_DE"; + /* FIXME: Adjust this when such locales appear on Unix. */ + switch (sub) + { + /* Upper Sorbian */ + case 0x00: return "hsb"; + case SUBLANG_UPPER_SORBIAN_GERMANY: return "hsb_DE"; + /* Lower Sorbian */ + case 0x1f: return "dsb"; + case SUBLANG_LOWER_SORBIAN_GERMANY: return "dsb_DE"; + } + return "wen"; case LANG_SOTHO: - /* <http://www.microsoft.com/globaldev/reference/lcid-all.mspx> calls - it "Sepedi"; according to - <http://www.ethnologue.com/show_language.asp?code=nso> - <http://www.ethnologue.com/show_language.asp?code=sot> - it's the same as Northern Sotho. */ - return "nso_ZA"; + /* <http://www.microsoft.com/globaldev/reference/lcid-all.mspx> calls + it "Sepedi"; according to + <http://www.ethnologue.com/show_language.asp?code=nso> + <http://www.ethnologue.com/show_language.asp?code=sot> + it's the same as Northern Sotho. */ + switch (sub) + { + case SUBLANG_SOTHO_SOUTH_AFRICA: return "nso_ZA"; + } + return "nso"; case LANG_SPANISH: - switch (sub) - { - case SUBLANG_SPANISH: return "es_ES"; - case SUBLANG_SPANISH_MEXICAN: return "es_MX"; - case SUBLANG_SPANISH_MODERN: - return "es_ES@modern"; /* not seen on Unix */ - case SUBLANG_SPANISH_GUATEMALA: return "es_GT"; - case SUBLANG_SPANISH_COSTA_RICA: return "es_CR"; - case SUBLANG_SPANISH_PANAMA: return "es_PA"; - case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO"; - case SUBLANG_SPANISH_VENEZUELA: return "es_VE"; - case SUBLANG_SPANISH_COLOMBIA: return "es_CO"; - case SUBLANG_SPANISH_PERU: return "es_PE"; - case SUBLANG_SPANISH_ARGENTINA: return "es_AR"; - case SUBLANG_SPANISH_ECUADOR: return "es_EC"; - case SUBLANG_SPANISH_CHILE: return "es_CL"; - case SUBLANG_SPANISH_URUGUAY: return "es_UY"; - case SUBLANG_SPANISH_PARAGUAY: return "es_PY"; - case SUBLANG_SPANISH_BOLIVIA: return "es_BO"; - case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV"; - case SUBLANG_SPANISH_HONDURAS: return "es_HN"; - case SUBLANG_SPANISH_NICARAGUA: return "es_NI"; - case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; - case SUBLANG_SPANISH_US: return "es_US"; - } - return "es"; - case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ - case LANG_SWAHILI: return "sw_KE"; + switch (sub) + { + case SUBLANG_SPANISH: return "es_ES"; + case SUBLANG_SPANISH_MEXICAN: return "es_MX"; + case SUBLANG_SPANISH_MODERN: + return "es_ES@modern"; /* not seen on Unix */ + case SUBLANG_SPANISH_GUATEMALA: return "es_GT"; + case SUBLANG_SPANISH_COSTA_RICA: return "es_CR"; + case SUBLANG_SPANISH_PANAMA: return "es_PA"; + case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO"; + case SUBLANG_SPANISH_VENEZUELA: return "es_VE"; + case SUBLANG_SPANISH_COLOMBIA: return "es_CO"; + case SUBLANG_SPANISH_PERU: return "es_PE"; + case SUBLANG_SPANISH_ARGENTINA: return "es_AR"; + case SUBLANG_SPANISH_ECUADOR: return "es_EC"; + case SUBLANG_SPANISH_CHILE: return "es_CL"; + case SUBLANG_SPANISH_URUGUAY: return "es_UY"; + case SUBLANG_SPANISH_PARAGUAY: return "es_PY"; + case SUBLANG_SPANISH_BOLIVIA: return "es_BO"; + case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV"; + case SUBLANG_SPANISH_HONDURAS: return "es_HN"; + case SUBLANG_SPANISH_NICARAGUA: return "es_NI"; + case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; + case SUBLANG_SPANISH_US: return "es_US"; + } + return "es"; + case LANG_SUTU: + switch (sub) + { + case SUBLANG_DEFAULT: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ + } + return "bnt"; + case LANG_SWAHILI: + switch (sub) + { + case SUBLANG_SWAHILI_KENYA: return "sw_KE"; + } + return "sw"; case LANG_SWEDISH: - switch (sub) - { - case SUBLANG_DEFAULT: return "sv_SE"; - case SUBLANG_SWEDISH_FINLAND: return "sv_FI"; - } - return "sv"; - case LANG_SYRIAC: return "syr_TR"; /* An extinct language. */ - case LANG_TAGALOG: return "tl_PH"; - case LANG_TAJIK: return "tg_TJ"; + switch (sub) + { + case SUBLANG_SWEDISH_SWEDEN: return "sv_SE"; + case SUBLANG_SWEDISH_FINLAND: return "sv_FI"; + } + return "sv"; + case LANG_SYRIAC: + switch (sub) + { + case SUBLANG_SYRIAC_SYRIA: return "syr_SY"; /* An extinct language. */ + } + return "syr"; + case LANG_TAGALOG: + switch (sub) + { + case SUBLANG_TAGALOG_PHILIPPINES: return "tl_PH"; /* or "fil_PH"? */ + } + return "tl"; /* or "fil"? */ + case LANG_TAJIK: + switch (sub) + { + case 0x1f: return "tg"; + case SUBLANG_TAJIK_TAJIKISTAN: return "tg_TJ"; + } + return "tg"; case LANG_TAMAZIGHT: - switch (sub) - { - /* FIXME: Adjust this when Tamazight locales appear on Unix. */ - case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic"; - case SUBLANG_TAMAZIGHT_ALGERIA_LATIN: return "ber_DZ@latin"; - } - return "ber_MA"; + /* Note: Microsoft uses the non-ISO language code "tmz". */ + switch (sub) + { + /* FIXME: Adjust this when Tamazight locales appear on Unix. */ + case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic"; + case 0x1f: return "ber@latin"; + case SUBLANG_TAMAZIGHT_ALGERIA_LATIN: return "ber_DZ@latin"; + } + return "ber"; case LANG_TAMIL: - switch (sub) - { - case SUBLANG_DEFAULT: return "ta_IN"; - } - return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */ - case LANG_TATAR: return "tt_RU"; - case LANG_TELUGU: return "te_IN"; - case LANG_THAI: return "th_TH"; + switch (sub) + { + case SUBLANG_TAMIL_INDIA: return "ta_IN"; + } + return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */ + case LANG_TATAR: + switch (sub) + { + case SUBLANG_TATAR_RUSSIA: return "tt_RU"; + } + return "tt"; + case LANG_TELUGU: + switch (sub) + { + case SUBLANG_TELUGU_INDIA: return "te_IN"; + } + return "te"; + case LANG_THAI: + switch (sub) + { + case SUBLANG_THAI_THAILAND: return "th_TH"; + } + return "th"; case LANG_TIBETAN: - switch (sub) - { - case SUBLANG_TIBETAN_PRC: - /* Most Tibetans would not like "bo_CN". But Tibet does not yet - have a country code of its own. */ - return "bo"; - case SUBLANG_TIBETAN_BHUTAN: return "bo_BT"; - } - return "bo"; + switch (sub) + { + case SUBLANG_TIBETAN_PRC: + /* Most Tibetans would not like "bo_CN". But Tibet does not yet + have a country code of its own. */ + return "bo"; + case SUBLANG_TIBETAN_BHUTAN: return "bo_BT"; + } + return "bo"; case LANG_TIGRINYA: - switch (sub) - { - case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET"; - case SUBLANG_TIGRINYA_ERITREA: return "ti_ER"; - } - return "ti"; - case LANG_TSONGA: return "ts_ZA"; - case LANG_TSWANA: return "tn_BW"; - case LANG_TURKISH: return "tr_TR"; - case LANG_TURKMEN: return "tk_TM"; + switch (sub) + { + case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET"; + case SUBLANG_TIGRINYA_ERITREA: return "ti_ER"; + } + return "ti"; + case LANG_TSONGA: + switch (sub) + { + case SUBLANG_DEFAULT: return "ts_ZA"; + } + return "ts"; + case LANG_TSWANA: + /* Spoken in South Africa, Botswana. */ + switch (sub) + { + case SUBLANG_TSWANA_SOUTH_AFRICA: return "tn_ZA"; + } + return "tn"; + case LANG_TURKISH: + switch (sub) + { + case SUBLANG_TURKISH_TURKEY: return "tr_TR"; + } + return "tr"; + case LANG_TURKMEN: + switch (sub) + { + case SUBLANG_TURKMEN_TURKMENISTAN: return "tk_TM"; + } + return "tk"; case LANG_UIGHUR: - switch (sub) - { - case SUBLANG_UIGHUR_PRC: return "ug_CN"; - } - return "ug"; - case LANG_UKRAINIAN: return "uk_UA"; + switch (sub) + { + case SUBLANG_UIGHUR_PRC: return "ug_CN"; + } + return "ug"; + case LANG_UKRAINIAN: + switch (sub) + { + case SUBLANG_UKRAINIAN_UKRAINE: return "uk_UA"; + } + return "uk"; case LANG_URDU: - switch (sub) - { - case SUBLANG_URDU_PAKISTAN: return "ur_PK"; - case SUBLANG_URDU_INDIA: return "ur_IN"; - } - return "ur"; + switch (sub) + { + case SUBLANG_URDU_PAKISTAN: return "ur_PK"; + case SUBLANG_URDU_INDIA: return "ur_IN"; + } + return "ur"; case LANG_UZBEK: - switch (sub) - { - case SUBLANG_UZBEK_LATIN: return "uz_UZ"; - case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic"; - } - return "uz"; - case LANG_VENDA: return "ve_ZA"; - case LANG_VIETNAMESE: return "vi_VN"; - case LANG_WELSH: return "cy_GB"; - case LANG_XHOSA: return "xh_ZA"; - case LANG_YI: return "sit_CN"; - case LANG_YIDDISH: return "yi_IL"; - case LANG_YORUBA: return "yo_NG"; - case LANG_ZULU: return "zu_ZA"; + switch (sub) + { + case 0x1f: return "uz"; + case SUBLANG_UZBEK_LATIN: return "uz_UZ"; + case 0x1e: return "uz@cyrillic"; + case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic"; + } + return "uz"; + case LANG_VENDA: + switch (sub) + { + case SUBLANG_DEFAULT: return "ve_ZA"; + } + return "ve"; + case LANG_VIETNAMESE: + switch (sub) + { + case SUBLANG_VIETNAMESE_VIETNAM: return "vi_VN"; + } + return "vi"; + case LANG_WELSH: + switch (sub) + { + case SUBLANG_WELSH_UNITED_KINGDOM: return "cy_GB"; + } + return "cy"; + case LANG_WOLOF: + switch (sub) + { + case SUBLANG_WOLOF_SENEGAL: return "wo_SN"; + } + return "wo"; + case LANG_XHOSA: + switch (sub) + { + case SUBLANG_XHOSA_SOUTH_AFRICA: return "xh_ZA"; + } + return "xh"; + case LANG_YAKUT: + switch (sub) + { + case SUBLANG_YAKUT_RUSSIA: return "sah_RU"; + } + return "sah"; + case LANG_YI: + switch (sub) + { + case SUBLANG_YI_PRC: return "ii_CN"; + } + return "ii"; + case LANG_YIDDISH: + switch (sub) + { + case SUBLANG_DEFAULT: return "yi_IL"; + } + return "yi"; + case LANG_YORUBA: + switch (sub) + { + case SUBLANG_YORUBA_NIGERIA: return "yo_NG"; + } + return "yo"; + case LANG_ZULU: + switch (sub) + { + case SUBLANG_ZULU_SOUTH_AFRICA: return "zu_ZA"; + } + return "zu"; default: return "C"; } } @@ -1557,6 +2507,264 @@ gl_locale_name_from_win32_LCID (LCID lcid) #endif +#if HAVE_USELOCALE /* glibc or MacOS X */ + +/* Simple hash set of strings. We don't want to drag in lots of hash table + code here. */ + +# define SIZE_BITS (sizeof (size_t) * CHAR_BIT) + +/* A hash function for NUL-terminated char* strings using + the method described by Bruno Haible. + See http://www.haible.de/bruno/hashfunc.html. */ +static size_t +string_hash (const void *x) +{ + const char *s = (const char *) x; + size_t h = 0; + + for (; *s; s++) + h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); + + return h; +} + +/* A hash table of fixed size. Multiple threads can access it read-only + simultaneously, but only one thread can insert into it at the same time. */ + +/* A node in a hash bucket collision list. */ +struct hash_node + { + struct hash_node * volatile next; + char contents[100]; /* has variable size */ + }; + +# define HASH_TABLE_SIZE 257 +static struct hash_node * volatile struniq_hash_table[HASH_TABLE_SIZE] + /* = { NULL, ..., NULL } */; + +/* This lock protects the struniq_hash_table against multiple simultaneous + insertions. */ +gl_lock_define_initialized(static, struniq_lock) + +/* Store a copy of the given string in a string pool with indefinite extent. + Return a pointer to this copy. */ +static const char * +struniq (const char *string) +{ + size_t hashcode = string_hash (string); + size_t slot = hashcode % HASH_TABLE_SIZE; + size_t size; + struct hash_node *new_node; + struct hash_node *p; + for (p = struniq_hash_table[slot]; p != NULL; p = p->next) + if (strcmp (p->contents, string) == 0) + return p->contents; + size = strlen (string) + 1; + new_node = + (struct hash_node *) + malloc (offsetof (struct hash_node, contents[0]) + size); + if (new_node == NULL) + /* Out of memory. Return a statically allocated string. */ + return "C"; + memcpy (new_node->contents, string, size); + /* Lock while inserting new_node. */ + gl_lock_lock (struniq_lock); + /* Check whether another thread already added the string while we were + waiting on the lock. */ + for (p = struniq_hash_table[slot]; p != NULL; p = p->next) + if (strcmp (p->contents, string) == 0) + { + free (new_node); + new_node = p; + goto done; + } + /* Really insert new_node into the hash table. Fill new_node entirely first, + because other threads may be iterating over the linked list. */ + new_node->next = struniq_hash_table[slot]; + struniq_hash_table[slot] = new_node; + done: + /* Unlock after new_node is inserted. */ + gl_lock_unlock (struniq_lock); + return new_node->contents; +} + +#endif + + +#if defined IN_LIBINTL || HAVE_USELOCALE + +/* Like gl_locale_name_thread, except that the result is not in storage of + indefinite extent. */ +# if !defined IN_LIBINTL +static +# endif +const char * +gl_locale_name_thread_unsafe (int category, const char *categoryname) +{ +# if HAVE_USELOCALE + { + locale_t thread_locale = uselocale (NULL); + if (thread_locale != LC_GLOBAL_LOCALE) + { +# if __GLIBC__ >= 2 + /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in + glibc < 2.12. + See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */ + const char *name = + nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1))); + if (name[0] == '\0') + /* Fallback code for glibc < 2.4, which did not implement + nl_langinfo (_NL_LOCALE_NAME (category)). */ + name = thread_locale->__names[category]; + return name; +# endif +# if defined __APPLE__ && defined __MACH__ /* MacOS X */ + /* The locale name is found deep in an undocumented data structure. + Since it's stored in a buffer of size 32 and newlocale() rejects + locale names of length > 31, we can assume that it is NUL terminated + in this buffer. But we need to make a copy of the locale name, of + indefinite extent. */ + struct _xlocale_part1_v0 /* used in MacOS X 10.5 */ + { + int32_t __refcount; + void (*__free_extra)(void *); + __darwin_mbstate_t __mbs[10]; + int64_t __magic; + }; + struct _xlocale_part1_v1 /* used in MacOS X >= 10.6.0 */ + { + int32_t __refcount; + void (*__free_extra)(void *); + __darwin_mbstate_t __mbs[10]; + /*pthread_lock_t*/ int __lock; + int64_t __magic; + }; + struct _xlocale_part2 + { + int64_t __magic; + unsigned char __collate_load_error; + unsigned char __collate_substitute_nontrivial; + unsigned char _messages_using_locale; + unsigned char _monetary_using_locale; + unsigned char _numeric_using_locale; + unsigned char _time_using_locale; + unsigned char __mlocale_changed; + unsigned char __nlocale_changed; + unsigned char __numeric_fp_cvt; + struct __xlocale_st_collate *__lc_collate; + struct __xlocale_st_runelocale *__lc_ctype; + struct __xlocale_st_messages *__lc_messages; + struct __xlocale_st_monetary *__lc_monetary; + struct __xlocale_st_numeric *__lc_numeric; + struct _xlocale *__lc_numeric_loc; + struct __xlocale_st_time *__lc_time; + /* more */ + }; + struct __xlocale_st_collate + { + int32_t __refcount; + void (*__free_extra)(void *); + char __encoding[32]; + /* more */ + }; + struct __xlocale_st_runelocale + { + int32_t __refcount; + void (*__free_extra)(void *); + char __ctype_encoding[32]; + /* more */ + }; + struct __xlocale_st_messages + { + int32_t __refcount; + void (*__free_extra)(void *); + char *_messages_locale_buf; + /* more */ + }; + struct __xlocale_st_monetary + { + int32_t __refcount; + void (*__free_extra)(void *); + char *_monetary_locale_buf; + /* more */ + }; + struct __xlocale_st_numeric { + int32_t __refcount; + void (*__free_extra)(void *); + char *_numeric_locale_buf; + /* more */ + }; + struct __xlocale_st_time { + int32_t __refcount; + void (*__free_extra)(void *); + char *_time_locale_buf; + /* more */ + }; + struct _xlocale_part2 *tlp; + if (((struct _xlocale_part1_v0 *) thread_locale)->__magic + == 0x786C6F63616C6530LL) + /* MacOS X 10.5 */ + tlp = + (struct _xlocale_part2 *) + &((struct _xlocale_part1_v0 *) thread_locale)->__magic; + else if (((struct _xlocale_part1_v1 *) thread_locale)->__magic + == 0x786C6F63616C6530LL) + /* MacOS X >= 10.6.0 */ + tlp = + (struct _xlocale_part2 *) + &((struct _xlocale_part1_v1 *) thread_locale)->__magic; + else + /* Unsupported version of MacOS X: The internals of 'struct _xlocale' + have changed again. */ + return ""; + switch (category) + { + case LC_CTYPE: + return tlp->__lc_ctype->__ctype_encoding; + case LC_NUMERIC: + return tlp->_numeric_using_locale + ? tlp->__lc_numeric->_numeric_locale_buf + : "C"; + case LC_TIME: + return tlp->_time_using_locale + ? tlp->__lc_time->_time_locale_buf + : "C"; + case LC_COLLATE: + return !tlp->__collate_load_error + ? tlp->__lc_collate->__encoding + : "C"; + case LC_MONETARY: + return tlp->_monetary_using_locale + ? tlp->__lc_monetary->_monetary_locale_buf + : "C"; + case LC_MESSAGES: + return tlp->_messages_using_locale + ? tlp->__lc_messages->_messages_locale_buf + : "C"; + default: /* We shouldn't get here. */ + return ""; + } +# endif + } + } +# endif + return NULL; +} + +#endif + +const char * +gl_locale_name_thread (int category, const char *categoryname) +{ +#if HAVE_USELOCALE + const char *name = gl_locale_name_thread_unsafe (category, categoryname); + if (name != NULL) + return struniq (name); +#endif + return NULL; +} + /* XPG3 defines the result of 'setlocale (category, NULL)' as: "Directs 'setlocale()' to query 'category' and return the current setting of 'local'." @@ -1567,12 +2775,6 @@ gl_locale_name_from_win32_LCID (LCID lcid) # define HAVE_LOCALE_NULL #endif -/* Determine the current locale's name, and canonicalize it into XPG syntax - language[_territory][.codeset][@modifier] - The codeset part in the result is not reliable; the locale_charset() - should be used for codeset information instead. - The result must not be freed; it is statically allocated. */ - const char * gl_locale_name_posix (int category, const char *categoryname) { @@ -1581,6 +2783,30 @@ gl_locale_name_posix (int category, const char *categoryname) #if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL return setlocale (category, NULL); #else + /* On other systems we ignore what setlocale reports and instead look at the + environment variables directly. This is necessary + 1. on systems which have a facility for customizing the default locale + (MacOS X, native Windows, Cygwin) and where the system's setlocale() + function ignores this default locale (MacOS X, Cygwin), in two cases: + a. when the user missed to use the setlocale() override from libintl + (for example by not including <libintl.h>), + b. when setlocale supports only the "C" locale, such as on Cygwin + 1.5.x. In this case even the override from libintl cannot help. + 2. on all systems where setlocale supports only the "C" locale. */ + /* Strictly speaking, it is a POSIX violation to look at the environment + variables regardless whether setlocale has been called or not. POSIX + says: + "For C-language programs, the POSIX locale shall be the + default locale when the setlocale() function is not called." + But we assume that all programs that use internationalized APIs call + setlocale (LC_ALL, ""). */ + return gl_locale_name_environ (category, categoryname); +#endif +} + +const char * +gl_locale_name_environ (int category, const char *categoryname) +{ const char *retval; /* Setting of LC_ALL overrides all other. */ @@ -1594,10 +2820,21 @@ gl_locale_name_posix (int category, const char *categoryname) /* Last possibility is the LANG environment variable. */ retval = getenv ("LANG"); if (retval != NULL && retval[0] != '\0') - return retval; + { +#if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE + /* MacOS X 10.2 or newer. + Ignore invalid LANG value set by the Terminal application. */ + if (strcmp (retval, "UTF-8") != 0) +#endif +#if defined __CYGWIN__ + /* Cygwin. + Ignore dummy LANG value set by ~/.profile. */ + if (strcmp (retval, "C.UTF-8") != 0) +#endif + return retval; + } return NULL; -#endif } const char * @@ -1610,9 +2847,28 @@ gl_locale_name_default (void) implementation-defined locale. Some implementations may provide facilities for local installation administrators to set the default locale, customizing it for each location. POSIX:2001 does not require - such a facility. */ + such a facility. -#if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE || defined(WIN32_NATIVE)) + The systems with such a facility are MacOS X and Windows: They provide a + GUI that allows the user to choose a locale. + - On MacOS X, by default, none of LC_* or LANG are set. Starting with + MacOS X 10.4 or 10.5, LANG is set for processes launched by the + 'Terminal' application (but sometimes to an incorrect value "UTF-8"). + When no environment variable is set, setlocale (LC_ALL, "") uses the + "C" locale. + - On native Windows, by default, none of LC_* or LANG are set. + When no environment variable is set, setlocale (LC_ALL, "") uses the + locale chosen by the user. + - On Cygwin 1.5.x, by default, none of LC_* or LANG are set. + When no environment variable is set, setlocale (LC_ALL, "") uses the + "C" locale. + - On Cygwin 1.7, by default, LANG is set to "C.UTF-8" when the default + ~/.profile is executed. + When no environment variable is set, setlocale (LC_ALL, "") uses the + "C.UTF-8" locale, which operates in the same way as the "C" locale. + */ + +#if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE || defined WIN32_NATIVE || defined __CYGWIN__) /* The system does not have a way of setting the locale, other than the POSIX specified environment variables. We use C as default locale. */ @@ -1633,40 +2889,41 @@ gl_locale_name_default (void) if (cached_localename == NULL) { - char namebuf[256]; + char namebuf[256]; # if HAVE_CFLOCALECOPYCURRENT /* MacOS X 10.3 or newer */ - CFLocaleRef locale = CFLocaleCopyCurrent (); - CFStringRef name = CFLocaleGetIdentifier (locale); - - if (CFStringGetCString (name, namebuf, sizeof(namebuf), - kCFStringEncodingASCII)) - { - gl_locale_name_canonicalize (namebuf); - cached_localename = strdup (namebuf); - } - CFRelease (locale); + CFLocaleRef locale = CFLocaleCopyCurrent (); + CFStringRef name = CFLocaleGetIdentifier (locale); + + if (CFStringGetCString (name, namebuf, sizeof (namebuf), + kCFStringEncodingASCII)) + { + gl_locale_name_canonicalize (namebuf); + cached_localename = strdup (namebuf); + } + CFRelease (locale); # elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ - CFTypeRef value = - CFPreferencesCopyAppValue (CFSTR ("AppleLocale"), - kCFPreferencesCurrentApplication); - if (value != NULL - && CFGetTypeID (value) == CFStringGetTypeID () - && CFStringGetCString ((CFStringRef)value, namebuf, sizeof(namebuf), - kCFStringEncodingASCII)) - { - gl_locale_name_canonicalize (namebuf); - cached_localename = strdup (namebuf); - } + CFTypeRef value = + CFPreferencesCopyAppValue (CFSTR ("AppleLocale"), + kCFPreferencesCurrentApplication); + if (value != NULL + && CFGetTypeID (value) == CFStringGetTypeID () + && CFStringGetCString ((CFStringRef)value, + namebuf, sizeof (namebuf), + kCFStringEncodingASCII)) + { + gl_locale_name_canonicalize (namebuf); + cached_localename = strdup (namebuf); + } # endif - if (cached_localename == NULL) - cached_localename = "C"; + if (cached_localename == NULL) + cached_localename = "C"; } return cached_localename; } # endif -# if defined(WIN32_NATIVE) /* WIN32, not Cygwin */ +# if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */ { LCID lcid; @@ -1679,11 +2936,21 @@ gl_locale_name_default (void) #endif } +/* Determine the current locale's name, and canonicalize it into XPG syntax + language[_territory][.codeset][@modifier] + The codeset part in the result is not reliable; the locale_charset() + should be used for codeset information instead. + The result must not be freed; it is statically allocated. */ + const char * gl_locale_name (int category, const char *categoryname) { const char *retval; + retval = gl_locale_name_thread (category, categoryname); + if (retval != NULL) + return retval; + retval = gl_locale_name_posix (category, categoryname); if (retval != NULL) return retval; diff --git a/lib/localename.h b/lib/localename.h index f633ad8..bb7caee 100644 --- a/lib/localename.h +++ b/lib/localename.h @@ -1,5 +1,5 @@ /* Determine name of the currently selected locale. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -25,9 +25,9 @@ extern "C" { /* Determine the current locale's name. - It considers both the POSIX notion of locale name (see function - gl_locale_name_posix) and the system notion of locale name (see function - gl_locale_name_default). + It considers both the POSIX notion of locale name (see functions + gl_locale_name_thread and gl_locale_name_posix) and the system notion + of locale name (see function gl_locale_name_default). CATEGORY is a locale category abbreviation, as defined in <locale.h>, but not LC_ALL. E.g. LC_MESSAGES. CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES". @@ -38,8 +38,21 @@ extern "C" { The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name (int category, const char *categoryname); -/* Determine the current locale's name, as specified by setlocale() calls - or by environment variables. +/* Determine the current per-thread locale's name, as specified by uselocale() + calls. + CATEGORY is a locale category abbreviation, as defined in <locale.h>, + but not LC_ALL. E.g. LC_MESSAGES. + CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES". + Return the locale category's name, canonicalized into XPG syntax + language[_territory][.codeset][@modifier] + or NULL if no locale has been specified for the current thread. + The codeset part in the result is not reliable; the locale_charset() + should be used for codeset information instead. + The result must not be freed; it is statically allocated. */ +extern const char * gl_locale_name_thread (int category, const char *categoryname); + +/* Determine the thread-independent current locale's name, as specified by + setlocale() calls or by environment variables. CATEGORY is a locale category abbreviation, as defined in <locale.h>, but not LC_ALL. E.g. LC_MESSAGES. CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES". @@ -52,10 +65,17 @@ extern const char * gl_locale_name (int category, const char *categoryname); The result must not be freed; it is statically allocated. */ extern const char * gl_locale_name_posix (int category, const char *categoryname); +/* Determine the default locale's name, as specified by environment + variables. + Return the locale category's name, or NULL if no locale has been specified + by environment variables. + The result must not be freed; it is statically allocated. */ +extern const char * gl_locale_name_environ (int category, const char *categoryname); + /* Determine the default locale's name. This is the current locale's name, - if not specified by setlocale() calls or by environment variables. This - locale name is usually determined by systems settings that the user can - manipulate through a GUI. + if not specified by uselocale() calls, by setlocale() calls, or by + environment variables. This locale name is usually determined by systems + settings that the user can manipulate through a GUI. Quoting POSIX:2001: "All implementations shall define a locale as the default locale, diff --git a/lib/malloc.c b/lib/malloc.c index 9111c7a..614320c 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997, 1998, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/malloca.c b/lib/malloca.c index 7905e61..39baa5e 100644 --- a/lib/malloca.c +++ b/lib/malloca.c @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify @@ -74,21 +74,21 @@ mmalloca (size_t n) char *p = (char *) malloc (nplus); if (p != NULL) - { - size_t slot; + { + size_t slot; - p += HEADER_SIZE; + p += HEADER_SIZE; - /* Put a magic number into the indicator word. */ - ((int *) p)[-1] = MAGIC_NUMBER; + /* Put a magic number into the indicator word. */ + ((int *) p)[-1] = MAGIC_NUMBER; - /* Enter p into the hash table. */ - slot = (unsigned long) p % HASH_TABLE_SIZE; - ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot]; - mmalloca_results[slot] = p; + /* Enter p into the hash table. */ + slot = (unsigned long) p % HASH_TABLE_SIZE; + ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot]; + mmalloca_results[slot] = p; - return p; - } + return p; + } } /* Out of memory. */ return NULL; @@ -109,28 +109,28 @@ freea (void *p) if (p != NULL) { /* Attempt to quickly distinguish the mmalloca() result - which has - a magic indicator word - and the alloca() result - which has an - uninitialized indicator word. It is for this test that sa_increment - additional bytes are allocated in the alloca() case. */ + a magic indicator word - and the alloca() result - which has an + uninitialized indicator word. It is for this test that sa_increment + additional bytes are allocated in the alloca() case. */ if (((int *) p)[-1] == MAGIC_NUMBER) - { - /* Looks like a mmalloca() result. To see whether it really is one, - perform a lookup in the hash table. */ - size_t slot = (unsigned long) p % HASH_TABLE_SIZE; - void **chain = &mmalloca_results[slot]; - for (; *chain != NULL;) - { - if (*chain == p) - { - /* Found it. Remove it from the hash table and free it. */ - char *p_begin = (char *) p - HEADER_SIZE; - *chain = ((struct header *) p_begin)->next; - free (p_begin); - return; - } - chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next; - } - } + { + /* Looks like a mmalloca() result. To see whether it really is one, + perform a lookup in the hash table. */ + size_t slot = (unsigned long) p % HASH_TABLE_SIZE; + void **chain = &mmalloca_results[slot]; + for (; *chain != NULL;) + { + if (*chain == p) + { + /* Found it. Remove it from the hash table and free it. */ + char *p_begin = (char *) p - HEADER_SIZE; + *chain = ((struct header *) p_begin)->next; + free (p_begin); + return; + } + chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next; + } + } /* At this point, we know it was not a mmalloca() result. */ } } diff --git a/lib/malloca.h b/lib/malloca.h index 7d92b0a..e39d0f4 100644 --- a/lib/malloca.h +++ b/lib/malloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ extern "C" { the function returns. Upon failure, it returns NULL. */ #if HAVE_ALLOCA # define malloca(N) \ - ((N) < 4032 - sa_increment \ + ((N) < 4032 - sa_increment \ ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ : mmalloca (N)) #else @@ -122,10 +122,10 @@ enum sa_alignment_longdouble = sa_alignof (long double), sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) #if HAVE_LONG_LONG_INT - | (sa_alignment_longlong - 1) + | (sa_alignment_longlong - 1) #endif - | (sa_alignment_longdouble - 1) - ) + 1, + | (sa_alignment_longdouble - 1) + ) + 1, /* The increment that guarantees room for a magic word must be >= sizeof (int) and a multiple of sa_alignment_max. */ sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max diff --git a/lib/math.in.h b/lib/math.in.h index d494051..c0b2f34 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -1,6 +1,6 @@ /* A GNU-like <math.h>. - Copyright (C) 2002-2003, 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -28,12 +28,42 @@ #define _GL_MATH_H -/* The definition of GL_LINK_WARNING is copied here. */ - - -#ifdef __cplusplus -extern "C" { -#endif +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Helper macros to define a portability warning for the + classification macro FUNC called with VALUE. POSIX declares the + classification macros with an argument of real-floating (that is, + one of float, double, or long double). */ +#define _GL_WARN_REAL_FLOATING_DECL(func) \ +static inline int \ +rpl_ ## func ## f (float f) \ +{ \ + return func (f); \ +} \ +static inline int \ +rpl_ ## func ## d (double d) \ +{ \ + return func (d); \ +} \ +static inline int \ +rpl_ ## func ## l (long double l) \ +{ \ + return func (l); \ +} \ +_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \ + "use gnulib module " #func " for portability"); \ +_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \ + "use gnulib module " #func " for portability"); \ +_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \ + "use gnulib module " #func " for portability") +#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \ + (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \ + : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \ + : rpl_ ## func ## l (value)) /* POSIX allows platforms that don't support NAN. But all major @@ -64,6 +94,7 @@ _NaN () # define HUGE_VAL (1.0 / 0.0) #endif + /* Write x as x = mantissa * 2^exp where @@ -73,130 +104,198 @@ _NaN () Store exp in *EXPPTR and return mantissa. */ #if @GNULIB_FREXP@ # if @REPLACE_FREXP@ -# define frexp rpl_frexp -extern double frexp (double x, int *expptr); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define frexp rpl_frexp +# endif +_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr)); +# else +_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr)); # endif +_GL_CXXALIASWARN (frexp); #elif defined GNULIB_POSIXCHECK # undef frexp -# define frexp(x,e) \ - (GL_LINK_WARNING ("frexp is unportable - " \ - "use gnulib module frexp for portability"), \ - frexp (x, e)) +/* Assume frexp is always declared. */ +_GL_WARN_ON_USE (frexp, "frexp is unportable - " + "use gnulib module frexp for portability"); #endif -#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@ -extern long double acosl (long double x); +#if @GNULIB_LOGB@ +# if !@HAVE_DECL_LOGB@ +_GL_EXTERN_C double logb (double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef logb +# if HAVE_RAW_DECL_LOGB +_GL_WARN_ON_USE (logb, "logb is unportable - " + "use gnulib module logb for portability"); +# endif #endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK + + +#if @GNULIB_ACOSL@ +# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@ +_GL_FUNCDECL_SYS (acosl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (acosl, long double, (long double x)); +_GL_CXXALIASWARN (acosl); +#elif defined GNULIB_POSIXCHECK # undef acosl -# define acosl(x) \ - (GL_LINK_WARNING ("acosl is unportable - " \ - "use gnulib module mathl for portability"), \ - acosl (x)) +# if HAVE_RAW_DECL_ACOSL +_GL_WARN_ON_USE (acosl, "acosl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@ -extern long double asinl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_ASINL@ +# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@ +_GL_FUNCDECL_SYS (asinl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (asinl, long double, (long double x)); +_GL_CXXALIASWARN (asinl); +#elif defined GNULIB_POSIXCHECK # undef asinl -# define asinl(x) \ - (GL_LINK_WARNING ("asinl is unportable - " \ - "use gnulib module mathl for portability"), \ - asinl (x)) +# if HAVE_RAW_DECL_ASINL +_GL_WARN_ON_USE (asinl, "asinl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@ -extern long double atanl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_ATANL@ +# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@ +_GL_FUNCDECL_SYS (atanl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (atanl, long double, (long double x)); +_GL_CXXALIASWARN (atanl); +#elif defined GNULIB_POSIXCHECK # undef atanl -# define atanl(x) \ - (GL_LINK_WARNING ("atanl is unportable - " \ - "use gnulib module mathl for portability"), \ - atanl (x)) +# if HAVE_RAW_DECL_ATANL +_GL_WARN_ON_USE (atanl, "atanl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif #if @GNULIB_CEILF@ # if @REPLACE_CEILF@ -# define ceilf rpl_ceilf -extern float ceilf (float x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ceilf rpl_ceilf +# endif +_GL_FUNCDECL_RPL (ceilf, float, (float x)); +_GL_CXXALIAS_RPL (ceilf, float, (float x)); +# else +# if !@HAVE_DECL_CEILF@ +_GL_FUNCDECL_SYS (ceilf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (ceilf, float, (float x)); # endif +_GL_CXXALIASWARN (ceilf); #elif defined GNULIB_POSIXCHECK # undef ceilf -# define ceilf(x) \ - (GL_LINK_WARNING ("ceilf is unportable - " \ - "use gnulib module ceilf for portability"), \ - ceilf (x)) +# if HAVE_RAW_DECL_CEILF +_GL_WARN_ON_USE (ceilf, "ceilf is unportable - " + "use gnulib module ceilf for portability"); +# endif #endif #if @GNULIB_CEILL@ # if @REPLACE_CEILL@ -# define ceill rpl_ceill -extern long double ceill (long double x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ceill rpl_ceill +# endif +_GL_FUNCDECL_RPL (ceill, long double, (long double x)); +_GL_CXXALIAS_RPL (ceill, long double, (long double x)); +# else +# if !@HAVE_DECL_CEILL@ +_GL_FUNCDECL_SYS (ceill, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (ceill, long double, (long double x)); # endif +_GL_CXXALIASWARN (ceill); #elif defined GNULIB_POSIXCHECK # undef ceill -# define ceill(x) \ - (GL_LINK_WARNING ("ceill is unportable - " \ - "use gnulib module ceill for portability"), \ - ceill (x)) +# if HAVE_RAW_DECL_CEILL +_GL_WARN_ON_USE (ceill, "ceill is unportable - " + "use gnulib module ceill for portability"); +# endif #endif -#if @GNULIB_MATHL@ || (!@HAVE_DECL_COSL@ && !defined cosl) -# undef cosl -extern long double cosl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_COSL@ +# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@ +_GL_FUNCDECL_SYS (cosl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (cosl, long double, (long double x)); +_GL_CXXALIASWARN (cosl); +#elif defined GNULIB_POSIXCHECK # undef cosl -# define cosl(x) \ - (GL_LINK_WARNING ("cosl is unportable - " \ - "use gnulib module mathl for portability"), \ - cosl (x)) +# if HAVE_RAW_DECL_COSL +_GL_WARN_ON_USE (cosl, "cosl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@ -extern long double expl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_EXPL@ +# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ +_GL_FUNCDECL_SYS (expl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (expl, long double, (long double x)); +_GL_CXXALIASWARN (expl); +#elif defined GNULIB_POSIXCHECK # undef expl -# define expl(x) \ - (GL_LINK_WARNING ("expl is unportable - " \ - "use gnulib module mathl for portability"), \ - expl (x)) +# if HAVE_RAW_DECL_EXPL +_GL_WARN_ON_USE (expl, "expl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif #if @GNULIB_FLOORF@ # if @REPLACE_FLOORF@ -# define floorf rpl_floorf -extern float floorf (float x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define floorf rpl_floorf +# endif +_GL_FUNCDECL_RPL (floorf, float, (float x)); +_GL_CXXALIAS_RPL (floorf, float, (float x)); +#else +# if !@HAVE_DECL_FLOORF@ +_GL_FUNCDECL_SYS (floorf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (floorf, float, (float x)); # endif +_GL_CXXALIASWARN (floorf); #elif defined GNULIB_POSIXCHECK # undef floorf -# define floorf(x) \ - (GL_LINK_WARNING ("floorf is unportable - " \ - "use gnulib module floorf for portability"), \ - floorf (x)) +# if HAVE_RAW_DECL_FLOORF +_GL_WARN_ON_USE (floorf, "floorf is unportable - " + "use gnulib module floorf for portability"); +# endif #endif #if @GNULIB_FLOORL@ # if @REPLACE_FLOORL@ -# define floorl rpl_floorl -extern long double floorl (long double x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define floorl rpl_floorl +# endif +_GL_FUNCDECL_RPL (floorl, long double, (long double x)); +_GL_CXXALIAS_RPL (floorl, long double, (long double x)); +# else +# if !@HAVE_DECL_FLOORL@ +_GL_FUNCDECL_SYS (floorl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (floorl, long double, (long double x)); # endif +_GL_CXXALIASWARN (floorl); #elif defined GNULIB_POSIXCHECK # undef floorl -# define floorl(x) \ - (GL_LINK_WARNING ("floorl is unportable - " \ - "use gnulib module floorl for portability"), \ - floorl (x)) +# if HAVE_RAW_DECL_FLOORL +_GL_WARN_ON_USE (floorl, "floorl is unportable - " + "use gnulib module floorl for portability"); +# endif #endif @@ -208,175 +307,247 @@ extern long double floorl (long double x); If x is infinite or NaN: mantissa = x, exp unspecified. Store exp in *EXPPTR and return mantissa. */ #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ -# define frexpl rpl_frexpl +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define frexpl rpl_frexpl +# endif +_GL_FUNCDECL_RPL (frexpl, long double, + (long double x, int *expptr) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr)); +#else +# if !@HAVE_DECL_FREXPL@ +_GL_FUNCDECL_SYS (frexpl, long double, + (long double x, int *expptr) _GL_ARG_NONNULL ((2))); +# endif +# if @GNULIB_FREXPL@ +_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr)); +# endif #endif -#if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@ -extern long double frexpl (long double x, int *expptr); +#if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@) +_GL_CXXALIASWARN (frexpl); #endif #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK # undef frexpl -# define frexpl(x,e) \ - (GL_LINK_WARNING ("frexpl is unportable - " \ - "use gnulib module frexpl for portability"), \ - frexpl (x, e)) +# if HAVE_RAW_DECL_FREXPL +_GL_WARN_ON_USE (frexpl, "frexpl is unportable - " + "use gnulib module frexpl for portability"); +# endif #endif /* Return x * 2^exp. */ #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ -# define ldexpl rpl_ldexpl +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ldexpl rpl_ldexpl +# endif +_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp)); +_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp)); +#else +# if !@HAVE_DECL_LDEXPL@ +_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp)); +# endif +# if @GNULIB_LDEXPL@ +_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp)); +# endif #endif -#if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || !@HAVE_DECL_LDEXPL@ -extern long double ldexpl (long double x, int exp); +#if @GNULIB_LDEXPL@ +_GL_CXXALIASWARN (ldexpl); #endif #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK # undef ldexpl -# define ldexpl(x,e) \ - (GL_LINK_WARNING ("ldexpl is unportable - " \ - "use gnulib module ldexpl for portability"), \ - ldexpl (x, e)) +# if HAVE_RAW_DECL_LDEXPL +_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - " + "use gnulib module ldexpl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || (!@HAVE_DECL_LOGL@ && !defined logl) -# undef logl -extern long double logl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_LOGL@ +# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@ +_GL_FUNCDECL_SYS (logl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (logl, long double, (long double x)); +_GL_CXXALIASWARN (logl); +#elif defined GNULIB_POSIXCHECK # undef logl -# define logl(x) \ - (GL_LINK_WARNING ("logl is unportable - " \ - "use gnulib module mathl for portability"), \ - logl (x)) +# if HAVE_RAW_DECL_LOGL +_GL_WARN_ON_USE (logl, "logl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif #if @GNULIB_ROUNDF@ # if @REPLACE_ROUNDF@ -# undef roundf -# define roundf rpl_roundf -extern float roundf (float x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef roundf +# define roundf rpl_roundf +# endif +_GL_FUNCDECL_RPL (roundf, float, (float x)); +_GL_CXXALIAS_RPL (roundf, float, (float x)); +# else +# if !@HAVE_DECL_ROUNDF@ +_GL_FUNCDECL_SYS (roundf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (roundf, float, (float x)); # endif +_GL_CXXALIASWARN (roundf); #elif defined GNULIB_POSIXCHECK # undef roundf -# define roundf(x) \ - (GL_LINK_WARNING ("roundf is unportable - " \ - "use gnulib module roundf for portability"), \ - roundf (x)) +# if HAVE_RAW_DECL_ROUNDF +_GL_WARN_ON_USE (roundf, "roundf is unportable - " + "use gnulib module roundf for portability"); +# endif #endif #if @GNULIB_ROUND@ # if @REPLACE_ROUND@ -# undef round -# define round rpl_round -extern double round (double x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef round +# define round rpl_round +# endif +_GL_FUNCDECL_RPL (round, double, (double x)); +_GL_CXXALIAS_RPL (round, double, (double x)); +# else +# if !@HAVE_DECL_ROUND@ +_GL_FUNCDECL_SYS (round, double, (double x)); +# endif +_GL_CXXALIAS_SYS (round, double, (double x)); # endif +_GL_CXXALIASWARN (round); #elif defined GNULIB_POSIXCHECK # undef round -# define round(x) \ - (GL_LINK_WARNING ("round is unportable - " \ - "use gnulib module round for portability"), \ - round (x)) +# if HAVE_RAW_DECL_ROUND +_GL_WARN_ON_USE (round, "round is unportable - " + "use gnulib module round for portability"); +# endif #endif #if @GNULIB_ROUNDL@ # if @REPLACE_ROUNDL@ -# undef roundl -# define roundl rpl_roundl -extern long double roundl (long double x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef roundl +# define roundl rpl_roundl +# endif +_GL_FUNCDECL_RPL (roundl, long double, (long double x)); +_GL_CXXALIAS_RPL (roundl, long double, (long double x)); +# else +# if !@HAVE_DECL_ROUNDL@ +_GL_FUNCDECL_SYS (roundl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (roundl, long double, (long double x)); # endif +_GL_CXXALIASWARN (roundl); #elif defined GNULIB_POSIXCHECK # undef roundl -# define roundl(x) \ - (GL_LINK_WARNING ("roundl is unportable - " \ - "use gnulib module roundl for portability"), \ - roundl (x)) +# if HAVE_RAW_DECL_ROUNDL +_GL_WARN_ON_USE (roundl, "roundl is unportable - " + "use gnulib module roundl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || (!@HAVE_DECL_SINL@ && !defined sinl) -# undef sinl -extern long double sinl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_SINL@ +# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@ +_GL_FUNCDECL_SYS (sinl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (sinl, long double, (long double x)); +_GL_CXXALIASWARN (sinl); +#elif defined GNULIB_POSIXCHECK # undef sinl -# define sinl(x) \ - (GL_LINK_WARNING ("sinl is unportable - " \ - "use gnulib module mathl for portability"), \ - sinl (x)) +# if HAVE_RAW_DECL_SINL +_GL_WARN_ON_USE (sinl, "sinl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@ -extern long double sqrtl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_SQRTL@ +# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ +_GL_FUNCDECL_SYS (sqrtl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (sqrtl, long double, (long double x)); +_GL_CXXALIASWARN (sqrtl); +#elif defined GNULIB_POSIXCHECK # undef sqrtl -# define sqrtl(x) \ - (GL_LINK_WARNING ("sqrtl is unportable - " \ - "use gnulib module mathl for portability"), \ - sqrtl (x)) +# if HAVE_RAW_DECL_SQRTL +_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif -#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@ -extern long double tanl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +#if @GNULIB_TANL@ +# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@ +_GL_FUNCDECL_SYS (tanl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (tanl, long double, (long double x)); +_GL_CXXALIASWARN (tanl); +#elif defined GNULIB_POSIXCHECK # undef tanl -# define tanl(x) \ - (GL_LINK_WARNING ("tanl is unportable - " \ - "use gnulib module mathl for portability"), \ - tanl (x)) +# if HAVE_RAW_DECL_TANL +_GL_WARN_ON_USE (tanl, "tanl is unportable - " + "use gnulib module mathl for portability"); +# endif #endif #if @GNULIB_TRUNCF@ # if !@HAVE_DECL_TRUNCF@ -# define truncf rpl_truncf -extern float truncf (float x); +_GL_FUNCDECL_SYS (truncf, float, (float x)); # endif +_GL_CXXALIAS_SYS (truncf, float, (float x)); +_GL_CXXALIASWARN (truncf); #elif defined GNULIB_POSIXCHECK # undef truncf -# define truncf(x) \ - (GL_LINK_WARNING ("truncf is unportable - " \ - "use gnulib module truncf for portability"), \ - truncf (x)) +# if HAVE_RAW_DECL_TRUNCF +_GL_WARN_ON_USE (truncf, "truncf is unportable - " + "use gnulib module truncf for portability"); +# endif #endif #if @GNULIB_TRUNC@ # if !@HAVE_DECL_TRUNC@ -# define trunc rpl_trunc -extern double trunc (double x); +_GL_FUNCDECL_SYS (trunc, double, (double x)); # endif +_GL_CXXALIAS_SYS (trunc, double, (double x)); +_GL_CXXALIASWARN (trunc); #elif defined GNULIB_POSIXCHECK # undef trunc -# define trunc(x) \ - (GL_LINK_WARNING ("trunc is unportable - " \ - "use gnulib module trunc for portability"), \ - trunc (x)) +# if HAVE_RAW_DECL_TRUNC +_GL_WARN_ON_USE (trunc, "trunc is unportable - " + "use gnulib module trunc for portability"); +# endif #endif #if @GNULIB_TRUNCL@ # if @REPLACE_TRUNCL@ -# undef truncl -# define truncl rpl_truncl -extern long double truncl (long double x); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef truncl +# define truncl rpl_truncl +# endif +_GL_FUNCDECL_RPL (truncl, long double, (long double x)); +_GL_CXXALIAS_RPL (truncl, long double, (long double x)); +# else +# if !@HAVE_DECL_TRUNCL@ +_GL_FUNCDECL_SYS (truncl, long double, (long double x)); +# endif +_GL_CXXALIAS_SYS (truncl, long double, (long double x)); # endif +_GL_CXXALIASWARN (truncl); #elif defined GNULIB_POSIXCHECK # undef truncl -# define truncl(x) \ - (GL_LINK_WARNING ("truncl is unportable - " \ - "use gnulib module truncl for portability"), \ - truncl (x)) +# if HAVE_RAW_DECL_TRUNCL +_GL_WARN_ON_USE (truncl, "truncl is unportable - " + "use gnulib module truncl for portability"); +# endif #endif #if @GNULIB_ISFINITE@ # if @REPLACE_ISFINITE@ -extern int gl_isfinitef (float x); -extern int gl_isfinited (double x); -extern int gl_isfinitel (long double x); +_GL_EXTERN_C int gl_isfinitef (float x); +_GL_EXTERN_C int gl_isfinited (double x); +_GL_EXTERN_C int gl_isfinitel (long double x); # undef isfinite # define isfinite(x) \ (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \ @@ -384,15 +555,19 @@ extern int gl_isfinitel (long double x); gl_isfinitef (x)) # endif #elif defined GNULIB_POSIXCHECK - /* How to override a macro? */ +# if defined isfinite +_GL_WARN_REAL_FLOATING_DECL (isfinite); +# undef isfinite +# define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x) +# endif #endif #if @GNULIB_ISINF@ # if @REPLACE_ISINF@ -extern int gl_isinff (float x); -extern int gl_isinfd (double x); -extern int gl_isinfl (long double x); +_GL_EXTERN_C int gl_isinff (float x); +_GL_EXTERN_C int gl_isinfd (double x); +_GL_EXTERN_C int gl_isinfl (long double x); # undef isinf # define isinf(x) \ (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \ @@ -400,7 +575,11 @@ extern int gl_isinfl (long double x); gl_isinff (x)) # endif #elif defined GNULIB_POSIXCHECK - /* How to override a macro? */ +# if defined isinf +_GL_WARN_REAL_FLOATING_DECL (isinf); +# undef isinf +# define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x) +# endif #endif @@ -409,7 +588,6 @@ extern int gl_isinfl (long double x); # if @HAVE_ISNANF@ /* The original <math.h> included above provides a declaration of isnan macro or (older) isnanf function. */ -# include <math.h> # if __GNUC__ >= 4 /* GCC 4.0 and newer provides three built-ins for isnan. */ # undef isnanf @@ -422,7 +600,7 @@ extern int gl_isinfl (long double x); /* Test whether X is a NaN. */ # undef isnanf # define isnanf rpl_isnanf -extern int isnanf (float x); +_GL_EXTERN_C int isnanf (float x); # endif #endif @@ -432,7 +610,6 @@ extern int isnanf (float x); to 'double' numbers earlier but now is a type-generic macro. */ # if @HAVE_ISNAND@ /* The original <math.h> included above provides a declaration of isnan macro. */ -# include <math.h> # if __GNUC__ >= 4 /* GCC 4.0 and newer provides three built-ins for isnan. */ # undef isnand @@ -445,7 +622,7 @@ extern int isnanf (float x); /* Test whether X is a NaN. */ # undef isnand # define isnand rpl_isnand -extern int isnand (double x); +_GL_EXTERN_C int isnand (double x); # endif #endif @@ -453,7 +630,6 @@ extern int isnand (double x); /* Test for NaN for 'long double' numbers. */ # if @HAVE_ISNANL@ /* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */ -# include <math.h> # if __GNUC__ >= 4 /* GCC 4.0 and newer provides three built-ins for isnan. */ # undef isnanl @@ -466,7 +642,7 @@ extern int isnand (double x); /* Test whether X is a NaN. */ # undef isnanl # define isnanl rpl_isnanl -extern int isnanl (long double x); +_GL_EXTERN_C int isnanl (long double x); # endif #endif @@ -480,19 +656,19 @@ extern int isnanl (long double x); # if @HAVE_ISNANF@ && __GNUC__ >= 4 # define gl_isnan_f(x) __builtin_isnan ((float)(x)) # else -extern int rpl_isnanf (float x); +_GL_EXTERN_C int rpl_isnanf (float x); # define gl_isnan_f(x) rpl_isnanf (x) # endif # if @HAVE_ISNAND@ && __GNUC__ >= 4 # define gl_isnan_d(x) __builtin_isnan ((double)(x)) # else -extern int rpl_isnand (double x); +_GL_EXTERN_C int rpl_isnand (double x); # define gl_isnan_d(x) rpl_isnand (x) # endif # if @HAVE_ISNANL@ && __GNUC__ >= 4 # define gl_isnan_l(x) __builtin_isnan ((long double)(x)) # else -extern int rpl_isnanl (long double x); +_GL_EXTERN_C int rpl_isnanl (long double x); # define gl_isnan_l(x) rpl_isnanl (x) # endif # undef isnan @@ -502,7 +678,11 @@ extern int rpl_isnanl (long double x); gl_isnan_f (x)) # endif #elif defined GNULIB_POSIXCHECK - /* How to override a macro? */ +# if defined isnan +_GL_WARN_REAL_FLOATING_DECL (isnan); +# undef isnan +# define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x) +# endif #endif @@ -517,38 +697,38 @@ extern int rpl_isnanl (long double x); # endif # if @REPLACE_SIGNBIT@ # undef signbit -extern int gl_signbitf (float arg); -extern int gl_signbitd (double arg); -extern int gl_signbitl (long double arg); +_GL_EXTERN_C int gl_signbitf (float arg); +_GL_EXTERN_C int gl_signbitd (double arg); +_GL_EXTERN_C int gl_signbitl (long double arg); # if __GNUC__ >= 2 && !__STRICT_ANSI__ # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf # define gl_signbitf_OPTIMIZED_MACRO # define gl_signbitf(arg) \ - ({ union { float _value; \ + ({ union { float _value; \ unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ - } _m; \ - _m._value = (arg); \ - (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ + } _m; \ + _m._value = (arg); \ + (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ }) # endif # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd # define gl_signbitd_OPTIMIZED_MACRO # define gl_signbitd(arg) \ - ({ union { double _value; \ + ({ union { double _value; \ unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ - } _m; \ - _m._value = (arg); \ - (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ + } _m; \ + _m._value = (arg); \ + (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ }) # endif # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl # define gl_signbitl_OPTIMIZED_MACRO # define gl_signbitl(arg) \ - ({ union { long double _value; \ + ({ union { long double _value; \ unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ - } _m; \ - _m._value = (arg); \ - (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ + } _m; \ + _m._value = (arg); \ + (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ }) # endif # endif @@ -558,13 +738,13 @@ extern int gl_signbitl (long double arg); gl_signbitf (x)) # endif #elif defined GNULIB_POSIXCHECK - /* How to override a macro? */ +# if defined signbit +_GL_WARN_REAL_FLOATING_DECL (signbit); +# undef signbit +# define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x) +# endif #endif -#ifdef __cplusplus -} -#endif - #endif /* _GL_MATH_H */ #endif /* _GL_MATH_H */ diff --git a/lib/mbchar.c b/lib/mbchar.c index 0851d8a..da91056 100644 --- a/lib/mbchar.c +++ b/lib/mbchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2006, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -25,10 +25,10 @@ /* Bit table of characters in the ISO C "basic character set". */ const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] = { - 0x00001a00, /* '\t' '\v' '\f' */ - 0xffffffef, /* ' '...'#' '%'...'?' */ - 0xfffffffe, /* 'A'...'Z' '[' '\\' ']' '^' '_' */ - 0x7ffffffe /* 'a'...'z' '{' '|' '}' '~' */ + 0x00001a00, /* '\t' '\v' '\f' */ + 0xffffffef, /* ' '...'#' '%'...'?' */ + 0xfffffffe, /* 'A'...'Z' '[' '\\' ']' '^' '_' */ + 0x7ffffffe /* 'a'...'z' '{' '|' '}' '~' */ /* The remaining bits are 0. */ }; diff --git a/lib/mbchar.h b/lib/mbchar.h index e184dd0..f9f52b9 100644 --- a/lib/mbchar.h +++ b/lib/mbchar.h @@ -1,5 +1,5 @@ /* Multibyte character data type. - Copyright (C) 2001, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 2001, 2005-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -114,31 +114,31 @@ Here are the function prototypes of the macros. - extern const char * mb_ptr (const mbchar_t mbc); - extern size_t mb_len (const mbchar_t mbc); - extern bool mb_iseq (const mbchar_t mbc, char sc); - extern bool mb_isnul (const mbchar_t mbc); - extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2); - extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2); - extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2); - extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2); - extern bool mb_isalnum (const mbchar_t mbc); - extern bool mb_isalpha (const mbchar_t mbc); - extern bool mb_isascii (const mbchar_t mbc); - extern bool mb_isblank (const mbchar_t mbc); - extern bool mb_iscntrl (const mbchar_t mbc); - extern bool mb_isdigit (const mbchar_t mbc); - extern bool mb_isgraph (const mbchar_t mbc); - extern bool mb_islower (const mbchar_t mbc); - extern bool mb_isprint (const mbchar_t mbc); - extern bool mb_ispunct (const mbchar_t mbc); - extern bool mb_isspace (const mbchar_t mbc); - extern bool mb_isupper (const mbchar_t mbc); - extern bool mb_isxdigit (const mbchar_t mbc); - extern int mb_width (const mbchar_t mbc); - extern void mb_putc (const mbchar_t mbc, FILE *stream); + extern const char * mb_ptr (const mbchar_t mbc); + extern size_t mb_len (const mbchar_t mbc); + extern bool mb_iseq (const mbchar_t mbc, char sc); + extern bool mb_isnul (const mbchar_t mbc); + extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2); + extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2); + extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2); + extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2); + extern bool mb_isalnum (const mbchar_t mbc); + extern bool mb_isalpha (const mbchar_t mbc); + extern bool mb_isascii (const mbchar_t mbc); + extern bool mb_isblank (const mbchar_t mbc); + extern bool mb_iscntrl (const mbchar_t mbc); + extern bool mb_isdigit (const mbchar_t mbc); + extern bool mb_isgraph (const mbchar_t mbc); + extern bool mb_islower (const mbchar_t mbc); + extern bool mb_isprint (const mbchar_t mbc); + extern bool mb_ispunct (const mbchar_t mbc); + extern bool mb_isspace (const mbchar_t mbc); + extern bool mb_isupper (const mbchar_t mbc); + extern bool mb_isxdigit (const mbchar_t mbc); + extern int mb_width (const mbchar_t mbc); + extern void mb_putc (const mbchar_t mbc, FILE *stream); extern void mb_setascii (mbchar_t *new, char sc); - extern void mb_copy (mbchar_t *new, const mbchar_t *old); + extern void mb_copy (mbchar_t *new, const mbchar_t *old); */ #ifndef _MBCHAR_H @@ -160,10 +160,10 @@ struct mbchar { - const char *ptr; /* pointer to current character */ - size_t bytes; /* number of bytes of current character, > 0 */ - bool wc_valid; /* true if wc is a valid wide character */ - wchar_t wc; /* if wc_valid: the current character */ + const char *ptr; /* pointer to current character */ + size_t bytes; /* number of bytes of current character, > 0 */ + bool wc_valid; /* true if wc is a valid wide character */ + wchar_t wc; /* if wc_valid: the current character */ char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */ }; @@ -180,38 +180,38 @@ typedef struct mbchar mbchar_t; #define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc)) #define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0) #define mb_cmp(mbc1, mbc2) \ - ((mbc1).wc_valid \ - ? ((mbc2).wc_valid \ - ? (int) (mbc1).wc - (int) (mbc2).wc \ - : -1) \ - : ((mbc2).wc_valid \ - ? 1 \ - : (mbc1).bytes == (mbc2).bytes \ - ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ - : (mbc1).bytes < (mbc2).bytes \ + ((mbc1).wc_valid \ + ? ((mbc2).wc_valid \ + ? (int) (mbc1).wc - (int) (mbc2).wc \ + : -1) \ + : ((mbc2).wc_valid \ + ? 1 \ + : (mbc1).bytes == (mbc2).bytes \ + ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ + : (mbc1).bytes < (mbc2).bytes \ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) #define mb_casecmp(mbc1, mbc2) \ - ((mbc1).wc_valid \ - ? ((mbc2).wc_valid \ - ? (int) towlower ((mbc1).wc) - (int) towlower ((mbc2).wc) \ - : -1) \ - : ((mbc2).wc_valid \ - ? 1 \ - : (mbc1).bytes == (mbc2).bytes \ - ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ - : (mbc1).bytes < (mbc2).bytes \ + ((mbc1).wc_valid \ + ? ((mbc2).wc_valid \ + ? (int) towlower ((mbc1).wc) - (int) towlower ((mbc2).wc) \ + : -1) \ + : ((mbc2).wc_valid \ + ? 1 \ + : (mbc1).bytes == (mbc2).bytes \ + ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ + : (mbc1).bytes < (mbc2).bytes \ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) #define mb_equal(mbc1, mbc2) \ - ((mbc1).wc_valid && (mbc2).wc_valid \ - ? (mbc1).wc == (mbc2).wc \ - : (mbc1).bytes == (mbc2).bytes \ + ((mbc1).wc_valid && (mbc2).wc_valid \ + ? (mbc1).wc == (mbc2).wc \ + : (mbc1).bytes == (mbc2).bytes \ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) #define mb_caseequal(mbc1, mbc2) \ - ((mbc1).wc_valid && (mbc2).wc_valid \ - ? towlower ((mbc1).wc) == towlower ((mbc2).wc) \ - : (mbc1).bytes == (mbc2).bytes \ + ((mbc1).wc_valid && (mbc2).wc_valid \ + ? towlower ((mbc1).wc) == towlower ((mbc2).wc) \ + : (mbc1).bytes == (mbc2).bytes \ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) /* <ctype.h>, <wctype.h> classification. */ @@ -308,7 +308,7 @@ static inline bool is_basic (char c) { return (is_basic_table [(unsigned char) c >> 5] >> ((unsigned char) c & 31)) - & 1; + & 1; } #else diff --git a/lib/mbiter.h b/lib/mbiter.h index a4782d4..8f443b5 100644 --- a/lib/mbiter.h +++ b/lib/mbiter.h @@ -1,5 +1,5 @@ /* Iterating through multibyte strings: macros for multi-byte encodings. - Copyright (C) 2001, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -69,14 +69,14 @@ Here are the function prototypes of the macros. - extern void mbi_init (mbi_iterator_t iter, - const char *startptr, size_t length); - extern bool mbi_avail (mbi_iterator_t iter); - extern void mbi_advance (mbi_iterator_t iter); - extern mbchar_t mbi_cur (mbi_iterator_t iter); - extern const char * mbi_cur_ptr (mbi_iterator_t iter); - extern void mbi_reloc (mbi_iterator_t iter, ptrdiff_t ptrdiff); - extern void mbi_copy (mbi_iterator_t *new, const mbi_iterator_t *old); + extern void mbi_init (mbi_iterator_t iter, + const char *startptr, size_t length); + extern bool mbi_avail (mbi_iterator_t iter); + extern void mbi_advance (mbi_iterator_t iter); + extern mbchar_t mbi_cur (mbi_iterator_t iter); + extern const char * mbi_cur_ptr (mbi_iterator_t iter); + extern void mbi_reloc (mbi_iterator_t iter, ptrdiff_t ptrdiff); + extern void mbi_copy (mbi_iterator_t *new, const mbi_iterator_t *old); */ #ifndef _MBITER_H @@ -99,17 +99,17 @@ struct mbiter_multi { - const char *limit; /* pointer to end of string */ - bool in_shift; /* true if next byte may not be interpreted as ASCII */ - mbstate_t state; /* if in_shift: current shift state */ - bool next_done; /* true if mbi_avail has already filled the following */ - struct mbchar cur; /* the current character: - const char *cur.ptr pointer to current character - The following are only valid after mbi_avail. - size_t cur.bytes number of bytes of current character - bool cur.wc_valid true if wc is a valid wide character - wchar_t cur.wc if wc_valid: the current character - */ + const char *limit; /* pointer to end of string */ + bool in_shift; /* true if next byte may not be interpreted as ASCII */ + mbstate_t state; /* if in_shift: current shift state */ + bool next_done; /* true if mbi_avail has already filled the following */ + struct mbchar cur; /* the current character: + const char *cur.ptr pointer to current character + The following are only valid after mbi_avail. + size_t cur.bytes number of bytes of current character + bool cur.wc_valid true if wc is a valid wide character + wchar_t cur.wc if wc_valid: the current character + */ }; static inline void @@ -123,8 +123,8 @@ mbiter_multi_next (struct mbiter_multi *iter) if (is_basic (*iter->cur.ptr)) { /* These characters are part of the basic character set. ISO C 99 - guarantees that their wide character code is identical to their - char code. */ + guarantees that their wide character code is identical to their + char code. */ iter->cur.bytes = 1; iter->cur.wc = *iter->cur.ptr; iter->cur.wc_valid = true; @@ -135,39 +135,39 @@ mbiter_multi_next (struct mbiter_multi *iter) iter->in_shift = true; with_shift: iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr, - iter->limit - iter->cur.ptr, &iter->state); + iter->limit - iter->cur.ptr, &iter->state); if (iter->cur.bytes == (size_t) -1) - { - /* An invalid multibyte sequence was encountered. */ - iter->cur.bytes = 1; - iter->cur.wc_valid = false; - /* Whether to set iter->in_shift = false and reset iter->state - or not is not very important; the string is bogus anyway. */ - } + { + /* An invalid multibyte sequence was encountered. */ + iter->cur.bytes = 1; + iter->cur.wc_valid = false; + /* Whether to set iter->in_shift = false and reset iter->state + or not is not very important; the string is bogus anyway. */ + } else if (iter->cur.bytes == (size_t) -2) - { - /* An incomplete multibyte character at the end. */ - iter->cur.bytes = iter->limit - iter->cur.ptr; - iter->cur.wc_valid = false; - /* Whether to set iter->in_shift = false and reset iter->state - or not is not important; the string end is reached anyway. */ - } + { + /* An incomplete multibyte character at the end. */ + iter->cur.bytes = iter->limit - iter->cur.ptr; + iter->cur.wc_valid = false; + /* Whether to set iter->in_shift = false and reset iter->state + or not is not important; the string end is reached anyway. */ + } else - { - if (iter->cur.bytes == 0) - { - /* A null wide character was encountered. */ - iter->cur.bytes = 1; - assert (*iter->cur.ptr == '\0'); - assert (iter->cur.wc == 0); - } - iter->cur.wc_valid = true; - - /* When in the initial state, we can go back treating ASCII - characters more quickly. */ - if (mbsinit (&iter->state)) - iter->in_shift = false; - } + { + if (iter->cur.bytes == 0) + { + /* A null wide character was encountered. */ + iter->cur.bytes = 1; + assert (*iter->cur.ptr == '\0'); + assert (iter->cur.wc == 0); + } + iter->cur.wc_valid = true; + + /* When in the initial state, we can go back treating ASCII + characters more quickly. */ + if (mbsinit (&iter->state)) + iter->in_shift = false; + } } iter->next_done = true; } diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index 7b528e8..31f229c 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2009 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -63,30 +63,30 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) switch (nstate) { case 0: - p = s; - m = n; - break; + p = s; + m = n; + break; case 3: - buf[2] = pstate[3]; - /*FALLTHROUGH*/ + buf[2] = pstate[3]; + /*FALLTHROUGH*/ case 2: - buf[1] = pstate[2]; - /*FALLTHROUGH*/ + buf[1] = pstate[2]; + /*FALLTHROUGH*/ case 1: - buf[0] = pstate[1]; - p = buf; - m = nstate; - buf[m++] = s[0]; - if (n >= 2 && m < 4) - { - buf[m++] = s[1]; - if (n >= 3 && m < 4) - buf[m++] = s[2]; - } - break; + buf[0] = pstate[1]; + p = buf; + m = nstate; + buf[m++] = s[0]; + if (n >= 2 && m < 4) + { + buf[m++] = s[1]; + if (n >= 3 && m < 4) + buf[m++] = s[2]; + } + break; default: - errno = EINVAL; - return (size_t)(-1); + errno = EINVAL; + return (size_t)(-1); } /* Here m > 0. */ @@ -99,208 +99,208 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) int res = mbtowc (pwc, p, m); if (res >= 0) - { - if (pwc != NULL && ((*pwc == 0) != (res == 0))) - abort (); - if (nstate >= (res > 0 ? res : 1)) - abort (); - res -= nstate; - pstate[0] = 0; - return res; - } + { + if (pwc != NULL && ((*pwc == 0) != (res == 0))) + abort (); + if (nstate >= (res > 0 ? res : 1)) + abort (); + res -= nstate; + pstate[0] = 0; + return res; + } /* mbtowc does not distinguish between invalid and incomplete multibyte - sequences. But mbrtowc needs to make this distinction. - There are two possible approaches: - - Use iconv() and its return value. - - Use built-in knowledge about the possible encodings. - Given the low quality of implementation of iconv() on the systems that - lack mbrtowc(), we use the second approach. - The possible encodings are: - - 8-bit encodings, - - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, - - UTF-8. - Use specialized code for each. */ + sequences. But mbrtowc needs to make this distinction. + There are two possible approaches: + - Use iconv() and its return value. + - Use built-in knowledge about the possible encodings. + Given the low quality of implementation of iconv() on the systems that + lack mbrtowc(), we use the second approach. + The possible encodings are: + - 8-bit encodings, + - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, + - UTF-8. + Use specialized code for each. */ if (m >= 4 || m >= MB_CUR_MAX) - goto invalid; + goto invalid; /* Here MB_CUR_MAX > 1 and 0 < m < 4. */ { - const char *encoding = locale_charset (); - - if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) - { - /* Cf. unistr/u8-mblen.c. */ - unsigned char c = (unsigned char) p[0]; - - if (c >= 0xc2) - { - if (c < 0xe0) - { - if (m == 1) - goto incomplete; - } - else if (c < 0xf0) - { - if (m == 1) - goto incomplete; - if (m == 2) - { - unsigned char c2 = (unsigned char) p[1]; - - if ((c2 ^ 0x80) < 0x40 - && (c >= 0xe1 || c2 >= 0xa0) - && (c != 0xed || c2 < 0xa0)) - goto incomplete; - } - } - else if (c <= 0xf4) - { - if (m == 1) - goto incomplete; - else /* m == 2 || m == 3 */ - { - unsigned char c2 = (unsigned char) p[1]; - - if ((c2 ^ 0x80) < 0x40 - && (c >= 0xf1 || c2 >= 0x90) - && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) - { - if (m == 2) - goto incomplete; - else /* m == 3 */ - { - unsigned char c3 = (unsigned char) p[2]; - - if ((c3 ^ 0x80) < 0x40) - goto incomplete; - } - } - } - } - } - goto invalid; - } - - /* As a reference for this code, you can use the GNU libiconv - implementation. Look for uses of the RET_TOOFEW macro. */ - - if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; - - if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) - goto incomplete; - } - if (m == 2) - { - unsigned char c = (unsigned char) p[0]; - - if (c == 0x8f) - { - unsigned char c2 = (unsigned char) p[1]; - - if (c2 >= 0xa1 && c2 < 0xff) - goto incomplete; - } - } - goto invalid; - } - if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) - || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) - || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; - - if (c >= 0xa1 && c < 0xff) - goto incomplete; - } - goto invalid; - } - if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; - - if ((c >= 0xa1 && c < 0xff) || c == 0x8e) - goto incomplete; - } - else /* m == 2 || m == 3 */ - { - unsigned char c = (unsigned char) p[0]; - - if (c == 0x8e) - goto incomplete; - } - goto invalid; - } - if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; - - if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) - goto incomplete; - } - else /* m == 2 || m == 3 */ - { - unsigned char c = (unsigned char) p[0]; - - if (c >= 0x90 && c <= 0xe3) - { - unsigned char c2 = (unsigned char) p[1]; - - if (c2 >= 0x30 && c2 <= 0x39) - { - if (m == 2) - goto incomplete; - else /* m == 3 */ - { - unsigned char c3 = (unsigned char) p[2]; - - if (c3 >= 0x81 && c3 <= 0xfe) - goto incomplete; - } - } - } - } - goto invalid; - } - if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) - { - if (m == 1) - { - unsigned char c = (unsigned char) p[0]; - - if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) - || (c >= 0xf0 && c <= 0xf9)) - goto incomplete; - } - goto invalid; - } - - /* An unknown multibyte encoding. */ - goto incomplete; + const char *encoding = locale_charset (); + + if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + { + /* Cf. unistr/u8-mblen.c. */ + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xc2) + { + if (c < 0xe0) + { + if (m == 1) + goto incomplete; + } + else if (c < 0xf0) + { + if (m == 1) + goto incomplete; + if (m == 2) + { + unsigned char c2 = (unsigned char) p[1]; + + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xe1 || c2 >= 0xa0) + && (c != 0xed || c2 < 0xa0)) + goto incomplete; + } + } + else if (c <= 0xf4) + { + if (m == 1) + goto incomplete; + else /* m == 2 || m == 3 */ + { + unsigned char c2 = (unsigned char) p[1]; + + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xf1 || c2 >= 0x90) + && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if ((c3 ^ 0x80) < 0x40) + goto incomplete; + } + } + } + } + } + goto invalid; + } + + /* As a reference for this code, you can use the GNU libiconv + implementation. Look for uses of the RET_TOOFEW macro. */ + + if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) + goto incomplete; + } + if (m == 2) + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8f) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0xa1 && c2 < 0xff) + goto incomplete; + } + } + goto invalid; + } + if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xa1 && c < 0xff) + goto incomplete; + } + goto invalid; + } + if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8e) + goto incomplete; + } + goto invalid; + } + if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0x90 && c <= 0xe3) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0x30 && c2 <= 0x39) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if (c3 >= 0x81 && c3 <= 0xfe) + goto incomplete; + } + } + } + } + goto invalid; + } + if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) + || (c >= 0xf0 && c <= 0xf9)) + goto incomplete; + } + goto invalid; + } + + /* An unknown multibyte encoding. */ + goto incomplete; } incomplete: { - size_t k = nstate; - /* Here 0 <= k < m < 4. */ - pstate[++k] = s[0]; - if (k < m) - { - pstate[++k] = s[1]; - if (k < m) - pstate[++k] = s[2]; - } - if (k != m) - abort (); + size_t k = nstate; + /* Here 0 <= k < m < 4. */ + pstate[++k] = s[0]; + if (k < m) + { + pstate[++k] = s[1]; + if (k < m) + pstate[++k] = s[2]; + } + if (k != m) + abort (); } pstate[0] = m; return (size_t)(-2); @@ -341,25 +341,25 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) if (!mbsinit (ps)) { - /* Parse the rest of the multibyte character byte for byte. */ - size_t count = 0; - for (; n > 0; s++, n--) - { - wchar_t wc; - size_t ret = mbrtowc (&wc, s, 1, ps); - - if (ret == (size_t)(-1)) - return (size_t)(-1); - count++; - if (ret != (size_t)(-2)) - { - /* The multibyte character has been completed. */ - if (pwc != NULL) - *pwc = wc; - return (wc == 0 ? 0 : count); - } - } - return (size_t)(-2); + /* Parse the rest of the multibyte character byte for byte. */ + size_t count = 0; + for (; n > 0; s++, n--) + { + wchar_t wc; + size_t ret = mbrtowc (&wc, s, 1, ps); + + if (ret == (size_t)(-1)) + return (size_t)(-1); + count++; + if (ret != (size_t)(-2)) + { + /* The multibyte character has been completed. */ + if (pwc != NULL) + *pwc = wc; + return (wc == 0 ? 0 : count); + } + } + return (size_t)(-2); } } # endif @@ -371,10 +371,10 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) if (ret != (size_t)(-1) && ret != (size_t)(-2)) { - if (pwc != NULL) - *pwc = wc; - if (wc == 0) - ret = 0; + if (pwc != NULL) + *pwc = wc; + if (wc == 0) + ret = 0; } return ret; } diff --git a/lib/mbsinit.c b/lib/mbsinit.c index 7495794..811e39b 100644 --- a/lib/mbsinit.c +++ b/lib/mbsinit.c @@ -1,5 +1,5 @@ /* Test for initial conversion state. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify diff --git a/lib/mbsnlen.c b/lib/mbsnlen.c index 5ed5556..3db4eb6 100644 --- a/lib/mbsnlen.c +++ b/lib/mbsnlen.c @@ -1,5 +1,5 @@ /* Counting the multibyte characters in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify @@ -36,7 +36,7 @@ mbsnlen (const char *string, size_t len) count = 0; for (mbi_init (iter, string, len); mbi_avail (iter); mbi_advance (iter)) - count++; + count++; return count; } diff --git a/lib/memchr.c b/lib/memchr.c index 3ea1d5b..1e897cd 100644 --- a/lib/memchr.c +++ b/lib/memchr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006, 2008 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -97,15 +97,15 @@ __memchr (void const *s, int c_in, size_t n) repeated_one |= repeated_one << 31 << 1; repeated_c |= repeated_c << 31 << 1; if (8 < sizeof (longword)) - { - size_t i; - - for (i = 64; i < sizeof (longword) * 8; i *= 2) - { - repeated_one |= repeated_one << i; - repeated_c |= repeated_c << i; - } - } + { + size_t i; + + for (i = 64; i < sizeof (longword) * 8; i *= 2) + { + repeated_one |= repeated_one << i; + repeated_c |= repeated_c << i; + } + } } /* Instead of the traditional loop which tests each byte, we will test a @@ -144,8 +144,8 @@ __memchr (void const *s, int c_in, size_t n) longword longword1 = *longword_ptr ^ repeated_c; if ((((longword1 - repeated_one) & ~longword1) - & (repeated_one << 7)) != 0) - break; + & (repeated_one << 7)) != 0) + break; longword_ptr++; n -= sizeof (longword); } @@ -162,7 +162,7 @@ __memchr (void const *s, int c_in, size_t n) for (; n > 0; --n, ++char_ptr) { if (*char_ptr == c) - return (void *) char_ptr; + return (void *) char_ptr; } return NULL; diff --git a/lib/memcmp2.c b/lib/memcmp2.c index 7f8f604..a042948 100644 --- a/lib/memcmp2.c +++ b/lib/memcmp2.c @@ -1,5 +1,5 @@ /* Compare two memory areas with possibly different lengths. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -28,9 +28,9 @@ memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2) if (cmp == 0) { if (n1 < n2) - cmp = -1; + cmp = -1; else if (n1 > n2) - cmp = 1; + cmp = 1; } return cmp; } diff --git a/lib/memcmp2.h b/lib/memcmp2.h index f323055..c00e141 100644 --- a/lib/memcmp2.h +++ b/lib/memcmp2.h @@ -1,5 +1,5 @@ /* Compare two memory areas with possibly different lengths. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/memxfrm.c b/lib/memxfrm.c index dc6eda1..a1c6cf8 100644 --- a/lib/memxfrm.c +++ b/lib/memxfrm.c @@ -1,5 +1,5 @@ /* Locale dependent memory area transformation for comparison. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -45,7 +45,7 @@ memxfrm (char *s, size_t n, char *resultbuf, size_t *lengthp) allocated = (n > 0 ? n : 1); result = (char *) malloc (allocated); if (result == NULL) - goto out_of_memory_2; + goto out_of_memory_2; } length = 0; @@ -63,44 +63,44 @@ memxfrm (char *s, size_t n, char *resultbuf, size_t *lengthp) p = s; for (;;) { - /* Search next NUL byte. */ - const char *q = p + strlen (p); - - for (;;) - { - size_t k; - - errno = 0; - k = strxfrm (result + length, p, allocated - length); - if (errno != 0) - goto fail; - if (k >= allocated - length) - { - /* Grow the result buffer. */ - char *new_result; - - allocated = 2 * allocated; - if (allocated < 64) - allocated = 64; - if (result == resultbuf) - new_result = (char *) malloc (allocated); - else - new_result = (char *) realloc (result, allocated); - if (new_result == NULL) - goto out_of_memory_1; - result = new_result; - } - else - { - length += k; - break; - } - } - - p = q + 1; - if (p == p_end) - break; - result[length] = '\0'; + /* Search next NUL byte. */ + const char *q = p + strlen (p); + + for (;;) + { + size_t k; + + errno = 0; + k = strxfrm (result + length, p, allocated - length); + if (errno != 0) + goto fail; + if (k >= allocated - length) + { + /* Grow the result buffer. */ + char *new_result; + + allocated = 2 * allocated; + if (allocated < 64) + allocated = 64; + if (result == resultbuf) + new_result = (char *) malloc (allocated); + else + new_result = (char *) realloc (result, allocated); + if (new_result == NULL) + goto out_of_memory_1; + result = new_result; + } + else + { + length += k; + break; + } + } + + p = q + 1; + if (p == p_end) + break; + result[length] = '\0'; length++; } } @@ -110,7 +110,7 @@ memxfrm (char *s, size_t n, char *resultbuf, size_t *lengthp) { char *memory = (char *) realloc (result, length > 0 ? length : 1); if (memory != NULL) - result = memory; + result = memory; } s[n] = orig_sentinel; diff --git a/lib/memxfrm.h b/lib/memxfrm.h index d78900a..8b7284a 100644 --- a/lib/memxfrm.h +++ b/lib/memxfrm.h @@ -1,5 +1,5 @@ /* Locale dependent memory area transformation for comparison. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/minmax.h b/lib/minmax.h index 4cafb2f..d8ba983 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -1,5 +1,6 @@ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009, 2010 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/printf-args.c b/lib/printf-args.c index c31d204..597bba9 100644 --- a/lib/printf-args.c +++ b/lib/printf-args.c @@ -1,5 +1,6 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -42,146 +43,146 @@ PRINTF_FETCHARGS (va_list args, arguments *a) switch (ap->type) { case TYPE_SCHAR: - ap->a.a_schar = va_arg (args, /*signed char*/ int); - break; + ap->a.a_schar = va_arg (args, /*signed char*/ int); + break; case TYPE_UCHAR: - ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); - break; + ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); + break; case TYPE_SHORT: - ap->a.a_short = va_arg (args, /*short*/ int); - break; + ap->a.a_short = va_arg (args, /*short*/ int); + break; case TYPE_USHORT: - ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); - break; + ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); + break; case TYPE_INT: - ap->a.a_int = va_arg (args, int); - break; + ap->a.a_int = va_arg (args, int); + break; case TYPE_UINT: - ap->a.a_uint = va_arg (args, unsigned int); - break; + ap->a.a_uint = va_arg (args, unsigned int); + break; case TYPE_LONGINT: - ap->a.a_longint = va_arg (args, long int); - break; + ap->a.a_longint = va_arg (args, long int); + break; case TYPE_ULONGINT: - ap->a.a_ulongint = va_arg (args, unsigned long int); - break; + ap->a.a_ulongint = va_arg (args, unsigned long int); + break; #if HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: - ap->a.a_longlongint = va_arg (args, long long int); - break; + ap->a.a_longlongint = va_arg (args, long long int); + break; case TYPE_ULONGLONGINT: - ap->a.a_ulonglongint = va_arg (args, unsigned long long int); - break; + ap->a.a_ulonglongint = va_arg (args, unsigned long long int); + break; #endif case TYPE_DOUBLE: - ap->a.a_double = va_arg (args, double); - break; + ap->a.a_double = va_arg (args, double); + break; case TYPE_LONGDOUBLE: - ap->a.a_longdouble = va_arg (args, long double); - break; + ap->a.a_longdouble = va_arg (args, long double); + break; case TYPE_CHAR: - ap->a.a_char = va_arg (args, int); - break; + ap->a.a_char = va_arg (args, int); + break; #if HAVE_WINT_T case TYPE_WIDE_CHAR: - /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by - default argument promotions", this is not the case in mingw32, - where wint_t is 'unsigned short'. */ - ap->a.a_wide_char = - (sizeof (wint_t) < sizeof (int) - ? va_arg (args, int) - : va_arg (args, wint_t)); - break; + /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by + default argument promotions", this is not the case in mingw32, + where wint_t is 'unsigned short'. */ + ap->a.a_wide_char = + (sizeof (wint_t) < sizeof (int) + ? (wint_t) va_arg (args, int) + : va_arg (args, wint_t)); + break; #endif case TYPE_STRING: - ap->a.a_string = va_arg (args, const char *); - /* A null pointer is an invalid argument for "%s", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_string == NULL) - ap->a.a_string = "(NULL)"; - break; + ap->a.a_string = va_arg (args, const char *); + /* A null pointer is an invalid argument for "%s", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_string == NULL) + ap->a.a_string = "(NULL)"; + break; #if HAVE_WCHAR_T case TYPE_WIDE_STRING: - ap->a.a_wide_string = va_arg (args, const wchar_t *); - /* A null pointer is an invalid argument for "%ls", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_wide_string == NULL) - { - static const wchar_t wide_null_string[] = - { - (wchar_t)'(', - (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', - (wchar_t)')', - (wchar_t)0 - }; - ap->a.a_wide_string = wide_null_string; - } - break; + ap->a.a_wide_string = va_arg (args, const wchar_t *); + /* A null pointer is an invalid argument for "%ls", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_wide_string == NULL) + { + static const wchar_t wide_null_string[] = + { + (wchar_t)'(', + (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', + (wchar_t)')', + (wchar_t)0 + }; + ap->a.a_wide_string = wide_null_string; + } + break; #endif case TYPE_POINTER: - ap->a.a_pointer = va_arg (args, void *); - break; + ap->a.a_pointer = va_arg (args, void *); + break; case TYPE_COUNT_SCHAR_POINTER: - ap->a.a_count_schar_pointer = va_arg (args, signed char *); - break; + ap->a.a_count_schar_pointer = va_arg (args, signed char *); + break; case TYPE_COUNT_SHORT_POINTER: - ap->a.a_count_short_pointer = va_arg (args, short *); - break; + ap->a.a_count_short_pointer = va_arg (args, short *); + break; case TYPE_COUNT_INT_POINTER: - ap->a.a_count_int_pointer = va_arg (args, int *); - break; + ap->a.a_count_int_pointer = va_arg (args, int *); + break; case TYPE_COUNT_LONGINT_POINTER: - ap->a.a_count_longint_pointer = va_arg (args, long int *); - break; + ap->a.a_count_longint_pointer = va_arg (args, long int *); + break; #if HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: - ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); - break; + ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); + break; #endif #if ENABLE_UNISTDIO /* The unistdio extensions. */ case TYPE_U8_STRING: - ap->a.a_u8_string = va_arg (args, const uint8_t *); - /* A null pointer is an invalid argument for "%U", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_u8_string == NULL) - { - static const uint8_t u8_null_string[] = - { '(', 'N', 'U', 'L', 'L', ')', 0 }; - ap->a.a_u8_string = u8_null_string; - } - break; + ap->a.a_u8_string = va_arg (args, const uint8_t *); + /* A null pointer is an invalid argument for "%U", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_u8_string == NULL) + { + static const uint8_t u8_null_string[] = + { '(', 'N', 'U', 'L', 'L', ')', 0 }; + ap->a.a_u8_string = u8_null_string; + } + break; case TYPE_U16_STRING: - ap->a.a_u16_string = va_arg (args, const uint16_t *); - /* A null pointer is an invalid argument for "%lU", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_u16_string == NULL) - { - static const uint16_t u16_null_string[] = - { '(', 'N', 'U', 'L', 'L', ')', 0 }; - ap->a.a_u16_string = u16_null_string; - } - break; + ap->a.a_u16_string = va_arg (args, const uint16_t *); + /* A null pointer is an invalid argument for "%lU", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_u16_string == NULL) + { + static const uint16_t u16_null_string[] = + { '(', 'N', 'U', 'L', 'L', ')', 0 }; + ap->a.a_u16_string = u16_null_string; + } + break; case TYPE_U32_STRING: - ap->a.a_u32_string = va_arg (args, const uint32_t *); - /* A null pointer is an invalid argument for "%llU", but in practice - it occurs quite frequently in printf statements that produce - debug output. Use a fallback in this case. */ - if (ap->a.a_u32_string == NULL) - { - static const uint32_t u32_null_string[] = - { '(', 'N', 'U', 'L', 'L', ')', 0 }; - ap->a.a_u32_string = u32_null_string; - } - break; + ap->a.a_u32_string = va_arg (args, const uint32_t *); + /* A null pointer is an invalid argument for "%llU", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_u32_string == NULL) + { + static const uint32_t u32_null_string[] = + { '(', 'N', 'U', 'L', 'L', ')', 0 }; + ap->a.a_u32_string = u32_null_string; + } + break; #endif default: - /* Unknown type. */ - return -1; + /* Unknown type. */ + return -1; } return 0; } diff --git a/lib/printf-args.h b/lib/printf-args.h index 4c68f11..d76352d 100644 --- a/lib/printf-args.h +++ b/lib/printf-args.h @@ -1,5 +1,6 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -93,42 +94,42 @@ typedef struct arg_type type; union { - signed char a_schar; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long int a_longint; - unsigned long int a_ulongint; + signed char a_schar; + unsigned char a_uchar; + short a_short; + unsigned short a_ushort; + int a_int; + unsigned int a_uint; + long int a_longint; + unsigned long int a_ulongint; #if HAVE_LONG_LONG_INT - long long int a_longlongint; - unsigned long long int a_ulonglongint; + long long int a_longlongint; + unsigned long long int a_ulonglongint; #endif - float a_float; - double a_double; - long double a_longdouble; - int a_char; + float a_float; + double a_double; + long double a_longdouble; + int a_char; #if HAVE_WINT_T - wint_t a_wide_char; + wint_t a_wide_char; #endif - const char* a_string; + const char* a_string; #if HAVE_WCHAR_T - const wchar_t* a_wide_string; + const wchar_t* a_wide_string; #endif - void* a_pointer; - signed char * a_count_schar_pointer; - short * a_count_short_pointer; - int * a_count_int_pointer; - long int * a_count_longint_pointer; + void* a_pointer; + signed char * a_count_schar_pointer; + short * a_count_short_pointer; + int * a_count_int_pointer; + long int * a_count_longint_pointer; #if HAVE_LONG_LONG_INT - long long int * a_count_longlongint_pointer; + long long int * a_count_longlongint_pointer; #endif #if ENABLE_UNISTDIO /* The unistdio extensions. */ - const uint8_t * a_u8_string; - const uint16_t * a_u16_string; - const uint32_t * a_u32_string; + const uint8_t * a_u8_string; + const uint16_t * a_u16_string; + const uint32_t * a_u32_string; #endif } a; diff --git a/lib/printf-frexp.c b/lib/printf-frexp.c index 014c853..cf6efdb 100644 --- a/lib/printf-frexp.c +++ b/lib/printf-frexp.c @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -92,76 +92,76 @@ FUNC (DOUBLE x, int *expptr) exponent = 0; if (x >= L_(1.0)) { - /* A nonnegative exponent. */ - { - DOUBLE pow2_i; /* = pow2[i] */ - DOUBLE powh_i; /* = powh[i] */ - - /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, - x * 2^exponent = argument, x >= 1.0. */ - for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); - ; - i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) - { - if (x >= pow2_i) - { - exponent += (1 << i); - x *= powh_i; - } - else - break; - - pow2[i] = pow2_i; - powh[i] = powh_i; - } - } - /* Here 1.0 <= x < 2^2^i. */ + /* A nonnegative exponent. */ + { + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x >= 1.0. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (x >= pow2_i) + { + exponent += (1 << i); + x *= powh_i; + } + else + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + } + /* Here 1.0 <= x < 2^2^i. */ } else { - /* A negative exponent. */ - { - DOUBLE pow2_i; /* = pow2[i] */ - DOUBLE powh_i; /* = powh[i] */ - - /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, - x * 2^exponent = argument, x < 1.0, exponent >= MIN_EXP - 1. */ - for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); - ; - i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) - { - if (exponent - (1 << i) < MIN_EXP - 1) - break; - - exponent -= (1 << i); - x *= pow2_i; - if (x >= L_(1.0)) - break; - - pow2[i] = pow2_i; - powh[i] = powh_i; - } - } - /* Here either x < 1.0 and exponent - 2^i < MIN_EXP - 1 <= exponent, - or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ - - if (x < L_(1.0)) - /* Invariants: x * 2^exponent = argument, x < 1.0 and - exponent - 2^i < MIN_EXP - 1 <= exponent. */ - while (i > 0) - { - i--; - if (exponent - (1 << i) >= MIN_EXP - 1) - { - exponent -= (1 << i); - x *= pow2[i]; - if (x >= L_(1.0)) - break; - } - } - - /* Here either x < 1.0 and exponent = MIN_EXP - 1, - or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ + /* A negative exponent. */ + { + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x < 1.0, exponent >= MIN_EXP - 1. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (exponent - (1 << i) < MIN_EXP - 1) + break; + + exponent -= (1 << i); + x *= pow2_i; + if (x >= L_(1.0)) + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + } + /* Here either x < 1.0 and exponent - 2^i < MIN_EXP - 1 <= exponent, + or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ + + if (x < L_(1.0)) + /* Invariants: x * 2^exponent = argument, x < 1.0 and + exponent - 2^i < MIN_EXP - 1 <= exponent. */ + while (i > 0) + { + i--; + if (exponent - (1 << i) >= MIN_EXP - 1) + { + exponent -= (1 << i); + x *= pow2[i]; + if (x >= L_(1.0)) + break; + } + } + + /* Here either x < 1.0 and exponent = MIN_EXP - 1, + or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ } /* Invariants: x * 2^exponent = argument, and @@ -169,12 +169,12 @@ FUNC (DOUBLE x, int *expptr) or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ while (i > 0) { - i--; - if (x >= pow2[i]) - { - exponent += (1 << i); - x *= powh[i]; - } + i--; + if (x >= pow2[i]) + { + exponent += (1 << i); + x *= powh[i]; + } } /* Here either x < 1.0 and exponent = MIN_EXP - 1, or 1.0 <= x < 2.0 and exponent >= MIN_EXP - 1. */ diff --git a/lib/printf-frexp.h b/lib/printf-frexp.h index 197898d..1cbb096 100644 --- a/lib/printf-frexp.h +++ b/lib/printf-frexp.h @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/printf-frexpl.c b/lib/printf-frexpl.c index 864b215..6ee1e9b 100644 --- a/lib/printf-frexpl.c +++ b/lib/printf-frexpl.c @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/printf-frexpl.h b/lib/printf-frexpl.h index 718093d..4783bbb 100644 --- a/lib/printf-frexpl.h +++ b/lib/printf-frexpl.h @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/printf-parse.c b/lib/printf-parse.c index 85c454b..d88ddf3 100644 --- a/lib/printf-parse.c +++ b/lib/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -80,10 +80,10 @@ STATIC int PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) { - const CHAR_T *cp = format; /* pointer into format */ - size_t arg_posn = 0; /* number of regular arguments consumed */ - size_t d_allocated; /* allocated elements of d->dir */ - size_t a_allocated; /* allocated elements of a->arg */ + const CHAR_T *cp = format; /* pointer into format */ + size_t arg_posn = 0; /* number of regular arguments consumed */ + size_t d_allocated; /* allocated elements of d->dir */ + size_t a_allocated; /* allocated elements of a->arg */ size_t max_width_length = 0; size_t max_precision_length = 0; @@ -99,501 +99,501 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) a->arg = NULL; #define REGISTER_ARG(_index_,_type_) \ - { \ - size_t n = (_index_); \ - if (n >= a_allocated) \ - { \ - size_t memory_size; \ - argument *memory; \ - \ - a_allocated = xtimes (a_allocated, 2); \ - if (a_allocated <= n) \ - a_allocated = xsum (n, 1); \ - memory_size = xtimes (a_allocated, sizeof (argument)); \ - if (size_overflow_p (memory_size)) \ - /* Overflow, would lead to out of memory. */ \ - goto out_of_memory; \ - memory = (argument *) (a->arg \ - ? realloc (a->arg, memory_size) \ - : malloc (memory_size)); \ - if (memory == NULL) \ - /* Out of memory. */ \ - goto out_of_memory; \ - a->arg = memory; \ - } \ - while (a->count <= n) \ - a->arg[a->count++].type = TYPE_NONE; \ - if (a->arg[n].type == TYPE_NONE) \ - a->arg[n].type = (_type_); \ - else if (a->arg[n].type != (_type_)) \ - /* Ambiguous type for positional argument. */ \ - goto error; \ + { \ + size_t n = (_index_); \ + if (n >= a_allocated) \ + { \ + size_t memory_size; \ + argument *memory; \ + \ + a_allocated = xtimes (a_allocated, 2); \ + if (a_allocated <= n) \ + a_allocated = xsum (n, 1); \ + memory_size = xtimes (a_allocated, sizeof (argument)); \ + if (size_overflow_p (memory_size)) \ + /* Overflow, would lead to out of memory. */ \ + goto out_of_memory; \ + memory = (argument *) (a->arg \ + ? realloc (a->arg, memory_size) \ + : malloc (memory_size)); \ + if (memory == NULL) \ + /* Out of memory. */ \ + goto out_of_memory; \ + a->arg = memory; \ + } \ + while (a->count <= n) \ + a->arg[a->count++].type = TYPE_NONE; \ + if (a->arg[n].type == TYPE_NONE) \ + a->arg[n].type = (_type_); \ + else if (a->arg[n].type != (_type_)) \ + /* Ambiguous type for positional argument. */ \ + goto error; \ } while (*cp != '\0') { CHAR_T c = *cp++; if (c == '%') - { - size_t arg_index = ARG_NONE; - DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ - - /* Initialize the next directive. */ - dp->dir_start = cp - 1; - dp->flags = 0; - dp->width_start = NULL; - dp->width_end = NULL; - dp->width_arg_index = ARG_NONE; - dp->precision_start = NULL; - dp->precision_end = NULL; - dp->precision_arg_index = ARG_NONE; - dp->arg_index = ARG_NONE; - - /* Test for positional argument. */ - if (*cp >= '0' && *cp <= '9') - { - const CHAR_T *np; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - ; - if (*np == '$') - { - size_t n = 0; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - n = xsum (xtimes (n, 10), *np - '0'); - if (n == 0) - /* Positional argument 0. */ - goto error; - if (size_overflow_p (n)) - /* n too large, would lead to out of memory later. */ - goto error; - arg_index = n - 1; - cp = np + 1; - } - } - - /* Read the flags. */ - for (;;) - { - if (*cp == '\'') - { - dp->flags |= FLAG_GROUP; - cp++; - } - else if (*cp == '-') - { - dp->flags |= FLAG_LEFT; - cp++; - } - else if (*cp == '+') - { - dp->flags |= FLAG_SHOWSIGN; - cp++; - } - else if (*cp == ' ') - { - dp->flags |= FLAG_SPACE; - cp++; - } - else if (*cp == '#') - { - dp->flags |= FLAG_ALT; - cp++; - } - else if (*cp == '0') - { - dp->flags |= FLAG_ZERO; - cp++; - } - else - break; - } - - /* Parse the field width. */ - if (*cp == '*') - { - dp->width_start = cp; - cp++; - dp->width_end = cp; - if (max_width_length < 1) - max_width_length = 1; - - /* Test for positional argument. */ - if (*cp >= '0' && *cp <= '9') - { - const CHAR_T *np; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - ; - if (*np == '$') - { - size_t n = 0; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - n = xsum (xtimes (n, 10), *np - '0'); - if (n == 0) - /* Positional argument 0. */ - goto error; - if (size_overflow_p (n)) - /* n too large, would lead to out of memory later. */ - goto error; - dp->width_arg_index = n - 1; - cp = np + 1; - } - } - if (dp->width_arg_index == ARG_NONE) - { - dp->width_arg_index = arg_posn++; - if (dp->width_arg_index == ARG_NONE) - /* arg_posn wrapped around. */ - goto error; - } - REGISTER_ARG (dp->width_arg_index, TYPE_INT); - } - else if (*cp >= '0' && *cp <= '9') - { - size_t width_length; - - dp->width_start = cp; - for (; *cp >= '0' && *cp <= '9'; cp++) - ; - dp->width_end = cp; - width_length = dp->width_end - dp->width_start; - if (max_width_length < width_length) - max_width_length = width_length; - } - - /* Parse the precision. */ - if (*cp == '.') - { - cp++; - if (*cp == '*') - { - dp->precision_start = cp - 1; - cp++; - dp->precision_end = cp; - if (max_precision_length < 2) - max_precision_length = 2; - - /* Test for positional argument. */ - if (*cp >= '0' && *cp <= '9') - { - const CHAR_T *np; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - ; - if (*np == '$') - { - size_t n = 0; - - for (np = cp; *np >= '0' && *np <= '9'; np++) - n = xsum (xtimes (n, 10), *np - '0'); - if (n == 0) - /* Positional argument 0. */ - goto error; - if (size_overflow_p (n)) - /* n too large, would lead to out of memory - later. */ - goto error; - dp->precision_arg_index = n - 1; - cp = np + 1; - } - } - if (dp->precision_arg_index == ARG_NONE) - { - dp->precision_arg_index = arg_posn++; - if (dp->precision_arg_index == ARG_NONE) - /* arg_posn wrapped around. */ - goto error; - } - REGISTER_ARG (dp->precision_arg_index, TYPE_INT); - } - else - { - size_t precision_length; - - dp->precision_start = cp - 1; - for (; *cp >= '0' && *cp <= '9'; cp++) - ; - dp->precision_end = cp; - precision_length = dp->precision_end - dp->precision_start; - if (max_precision_length < precision_length) - max_precision_length = precision_length; - } - } - - { - arg_type type; - - /* Parse argument type/size specifiers. */ - { - int flags = 0; - - for (;;) - { - if (*cp == 'h') - { - flags |= (1 << (flags & 1)); - cp++; - } - else if (*cp == 'L') - { - flags |= 4; - cp++; - } - else if (*cp == 'l') - { - flags += 8; - cp++; - } - else if (*cp == 'j') - { - if (sizeof (intmax_t) > sizeof (long)) - { - /* intmax_t = long long */ - flags += 16; - } - else if (sizeof (intmax_t) > sizeof (int)) - { - /* intmax_t = long */ - flags += 8; - } - cp++; - } - else if (*cp == 'z' || *cp == 'Z') - { - /* 'z' is standardized in ISO C 99, but glibc uses 'Z' - because the warning facility in gcc-2.95.2 understands - only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ - if (sizeof (size_t) > sizeof (long)) - { - /* size_t = long long */ - flags += 16; - } - else if (sizeof (size_t) > sizeof (int)) - { - /* size_t = long */ - flags += 8; - } - cp++; - } - else if (*cp == 't') - { - if (sizeof (ptrdiff_t) > sizeof (long)) - { - /* ptrdiff_t = long long */ - flags += 16; - } - else if (sizeof (ptrdiff_t) > sizeof (int)) - { - /* ptrdiff_t = long */ - flags += 8; - } - cp++; - } + { + size_t arg_index = ARG_NONE; + DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ + + /* Initialize the next directive. */ + dp->dir_start = cp - 1; + dp->flags = 0; + dp->width_start = NULL; + dp->width_end = NULL; + dp->width_arg_index = ARG_NONE; + dp->precision_start = NULL; + dp->precision_end = NULL; + dp->precision_arg_index = ARG_NONE; + dp->arg_index = ARG_NONE; + + /* Test for positional argument. */ + if (*cp >= '0' && *cp <= '9') + { + const CHAR_T *np; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + ; + if (*np == '$') + { + size_t n = 0; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + n = xsum (xtimes (n, 10), *np - '0'); + if (n == 0) + /* Positional argument 0. */ + goto error; + if (size_overflow_p (n)) + /* n too large, would lead to out of memory later. */ + goto error; + arg_index = n - 1; + cp = np + 1; + } + } + + /* Read the flags. */ + for (;;) + { + if (*cp == '\'') + { + dp->flags |= FLAG_GROUP; + cp++; + } + else if (*cp == '-') + { + dp->flags |= FLAG_LEFT; + cp++; + } + else if (*cp == '+') + { + dp->flags |= FLAG_SHOWSIGN; + cp++; + } + else if (*cp == ' ') + { + dp->flags |= FLAG_SPACE; + cp++; + } + else if (*cp == '#') + { + dp->flags |= FLAG_ALT; + cp++; + } + else if (*cp == '0') + { + dp->flags |= FLAG_ZERO; + cp++; + } + else + break; + } + + /* Parse the field width. */ + if (*cp == '*') + { + dp->width_start = cp; + cp++; + dp->width_end = cp; + if (max_width_length < 1) + max_width_length = 1; + + /* Test for positional argument. */ + if (*cp >= '0' && *cp <= '9') + { + const CHAR_T *np; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + ; + if (*np == '$') + { + size_t n = 0; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + n = xsum (xtimes (n, 10), *np - '0'); + if (n == 0) + /* Positional argument 0. */ + goto error; + if (size_overflow_p (n)) + /* n too large, would lead to out of memory later. */ + goto error; + dp->width_arg_index = n - 1; + cp = np + 1; + } + } + if (dp->width_arg_index == ARG_NONE) + { + dp->width_arg_index = arg_posn++; + if (dp->width_arg_index == ARG_NONE) + /* arg_posn wrapped around. */ + goto error; + } + REGISTER_ARG (dp->width_arg_index, TYPE_INT); + } + else if (*cp >= '0' && *cp <= '9') + { + size_t width_length; + + dp->width_start = cp; + for (; *cp >= '0' && *cp <= '9'; cp++) + ; + dp->width_end = cp; + width_length = dp->width_end - dp->width_start; + if (max_width_length < width_length) + max_width_length = width_length; + } + + /* Parse the precision. */ + if (*cp == '.') + { + cp++; + if (*cp == '*') + { + dp->precision_start = cp - 1; + cp++; + dp->precision_end = cp; + if (max_precision_length < 2) + max_precision_length = 2; + + /* Test for positional argument. */ + if (*cp >= '0' && *cp <= '9') + { + const CHAR_T *np; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + ; + if (*np == '$') + { + size_t n = 0; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + n = xsum (xtimes (n, 10), *np - '0'); + if (n == 0) + /* Positional argument 0. */ + goto error; + if (size_overflow_p (n)) + /* n too large, would lead to out of memory + later. */ + goto error; + dp->precision_arg_index = n - 1; + cp = np + 1; + } + } + if (dp->precision_arg_index == ARG_NONE) + { + dp->precision_arg_index = arg_posn++; + if (dp->precision_arg_index == ARG_NONE) + /* arg_posn wrapped around. */ + goto error; + } + REGISTER_ARG (dp->precision_arg_index, TYPE_INT); + } + else + { + size_t precision_length; + + dp->precision_start = cp - 1; + for (; *cp >= '0' && *cp <= '9'; cp++) + ; + dp->precision_end = cp; + precision_length = dp->precision_end - dp->precision_start; + if (max_precision_length < precision_length) + max_precision_length = precision_length; + } + } + + { + arg_type type; + + /* Parse argument type/size specifiers. */ + { + int flags = 0; + + for (;;) + { + if (*cp == 'h') + { + flags |= (1 << (flags & 1)); + cp++; + } + else if (*cp == 'L') + { + flags |= 4; + cp++; + } + else if (*cp == 'l') + { + flags += 8; + cp++; + } + else if (*cp == 'j') + { + if (sizeof (intmax_t) > sizeof (long)) + { + /* intmax_t = long long */ + flags += 16; + } + else if (sizeof (intmax_t) > sizeof (int)) + { + /* intmax_t = long */ + flags += 8; + } + cp++; + } + else if (*cp == 'z' || *cp == 'Z') + { + /* 'z' is standardized in ISO C 99, but glibc uses 'Z' + because the warning facility in gcc-2.95.2 understands + only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ + if (sizeof (size_t) > sizeof (long)) + { + /* size_t = long long */ + flags += 16; + } + else if (sizeof (size_t) > sizeof (int)) + { + /* size_t = long */ + flags += 8; + } + cp++; + } + else if (*cp == 't') + { + if (sizeof (ptrdiff_t) > sizeof (long)) + { + /* ptrdiff_t = long long */ + flags += 16; + } + else if (sizeof (ptrdiff_t) > sizeof (int)) + { + /* ptrdiff_t = long */ + flags += 8; + } + cp++; + } #if defined __APPLE__ && defined __MACH__ - /* On MacOS X 10.3, PRIdMAX is defined as "qd". - We cannot change it to "lld" because PRIdMAX must also - be understood by the system's printf routines. */ - else if (*cp == 'q') - { - if (64 / 8 > sizeof (long)) - { - /* int64_t = long long */ - flags += 16; - } - else - { - /* int64_t = long */ - flags += 8; - } - cp++; - } + /* On MacOS X 10.3, PRIdMAX is defined as "qd". + We cannot change it to "lld" because PRIdMAX must also + be understood by the system's printf routines. */ + else if (*cp == 'q') + { + if (64 / 8 > sizeof (long)) + { + /* int64_t = long long */ + flags += 16; + } + else + { + /* int64_t = long */ + flags += 8; + } + cp++; + } #endif #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On native Win32, PRIdMAX is defined as "I64d". - We cannot change it to "lld" because PRIdMAX must also - be understood by the system's printf routines. */ - else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') - { - if (64 / 8 > sizeof (long)) - { - /* __int64 = long long */ - flags += 16; - } - else - { - /* __int64 = long */ - flags += 8; - } - cp += 3; - } + /* On native Win32, PRIdMAX is defined as "I64d". + We cannot change it to "lld" because PRIdMAX must also + be understood by the system's printf routines. */ + else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') + { + if (64 / 8 > sizeof (long)) + { + /* __int64 = long long */ + flags += 16; + } + else + { + /* __int64 = long */ + flags += 8; + } + cp += 3; + } #endif - else - break; - } - - /* Read the conversion character. */ - c = *cp++; - switch (c) - { - case 'd': case 'i': + else + break; + } + + /* Read the conversion character. */ + c = *cp++; + switch (c) + { + case 'd': case 'i': #if HAVE_LONG_LONG_INT - /* If 'long long' exists and is larger than 'long': */ - if (flags >= 16 || (flags & 4)) - type = TYPE_LONGLONGINT; - else + /* If 'long long' exists and is larger than 'long': */ + if (flags >= 16 || (flags & 4)) + type = TYPE_LONGLONGINT; + else #endif - /* If 'long long' exists and is the same as 'long', we parse - "lld" into TYPE_LONGINT. */ - if (flags >= 8) - type = TYPE_LONGINT; - else if (flags & 2) - type = TYPE_SCHAR; - else if (flags & 1) - type = TYPE_SHORT; - else - type = TYPE_INT; - break; - case 'o': case 'u': case 'x': case 'X': + /* If 'long long' exists and is the same as 'long', we parse + "lld" into TYPE_LONGINT. */ + if (flags >= 8) + type = TYPE_LONGINT; + else if (flags & 2) + type = TYPE_SCHAR; + else if (flags & 1) + type = TYPE_SHORT; + else + type = TYPE_INT; + break; + case 'o': case 'u': case 'x': case 'X': #if HAVE_LONG_LONG_INT - /* If 'long long' exists and is larger than 'long': */ - if (flags >= 16 || (flags & 4)) - type = TYPE_ULONGLONGINT; - else + /* If 'long long' exists and is larger than 'long': */ + if (flags >= 16 || (flags & 4)) + type = TYPE_ULONGLONGINT; + else #endif - /* If 'unsigned long long' exists and is the same as - 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ - if (flags >= 8) - type = TYPE_ULONGINT; - else if (flags & 2) - type = TYPE_UCHAR; - else if (flags & 1) - type = TYPE_USHORT; - else - type = TYPE_UINT; - break; - case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': - case 'a': case 'A': - if (flags >= 16 || (flags & 4)) - type = TYPE_LONGDOUBLE; - else - type = TYPE_DOUBLE; - break; - case 'c': - if (flags >= 8) + /* If 'unsigned long long' exists and is the same as + 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ + if (flags >= 8) + type = TYPE_ULONGINT; + else if (flags & 2) + type = TYPE_UCHAR; + else if (flags & 1) + type = TYPE_USHORT; + else + type = TYPE_UINT; + break; + case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': + case 'a': case 'A': + if (flags >= 16 || (flags & 4)) + type = TYPE_LONGDOUBLE; + else + type = TYPE_DOUBLE; + break; + case 'c': + if (flags >= 8) #if HAVE_WINT_T - type = TYPE_WIDE_CHAR; + type = TYPE_WIDE_CHAR; #else - goto error; + goto error; #endif - else - type = TYPE_CHAR; - break; + else + type = TYPE_CHAR; + break; #if HAVE_WINT_T - case 'C': - type = TYPE_WIDE_CHAR; - c = 'c'; - break; + case 'C': + type = TYPE_WIDE_CHAR; + c = 'c'; + break; #endif - case 's': - if (flags >= 8) + case 's': + if (flags >= 8) #if HAVE_WCHAR_T - type = TYPE_WIDE_STRING; + type = TYPE_WIDE_STRING; #else - goto error; + goto error; #endif - else - type = TYPE_STRING; - break; + else + type = TYPE_STRING; + break; #if HAVE_WCHAR_T - case 'S': - type = TYPE_WIDE_STRING; - c = 's'; - break; + case 'S': + type = TYPE_WIDE_STRING; + c = 's'; + break; #endif - case 'p': - type = TYPE_POINTER; - break; - case 'n': + case 'p': + type = TYPE_POINTER; + break; + case 'n': #if HAVE_LONG_LONG_INT - /* If 'long long' exists and is larger than 'long': */ - if (flags >= 16 || (flags & 4)) - type = TYPE_COUNT_LONGLONGINT_POINTER; - else + /* If 'long long' exists and is larger than 'long': */ + if (flags >= 16 || (flags & 4)) + type = TYPE_COUNT_LONGLONGINT_POINTER; + else #endif - /* If 'long long' exists and is the same as 'long', we parse - "lln" into TYPE_COUNT_LONGINT_POINTER. */ - if (flags >= 8) - type = TYPE_COUNT_LONGINT_POINTER; - else if (flags & 2) - type = TYPE_COUNT_SCHAR_POINTER; - else if (flags & 1) - type = TYPE_COUNT_SHORT_POINTER; - else - type = TYPE_COUNT_INT_POINTER; - break; + /* If 'long long' exists and is the same as 'long', we parse + "lln" into TYPE_COUNT_LONGINT_POINTER. */ + if (flags >= 8) + type = TYPE_COUNT_LONGINT_POINTER; + else if (flags & 2) + type = TYPE_COUNT_SCHAR_POINTER; + else if (flags & 1) + type = TYPE_COUNT_SHORT_POINTER; + else + type = TYPE_COUNT_INT_POINTER; + break; #if ENABLE_UNISTDIO - /* The unistdio extensions. */ - case 'U': - if (flags >= 16) - type = TYPE_U32_STRING; - else if (flags >= 8) - type = TYPE_U16_STRING; - else - type = TYPE_U8_STRING; - break; + /* The unistdio extensions. */ + case 'U': + if (flags >= 16) + type = TYPE_U32_STRING; + else if (flags >= 8) + type = TYPE_U16_STRING; + else + type = TYPE_U8_STRING; + break; #endif - case '%': - type = TYPE_NONE; - break; - default: - /* Unknown conversion character. */ - goto error; - } - } - - if (type != TYPE_NONE) - { - dp->arg_index = arg_index; - if (dp->arg_index == ARG_NONE) - { - dp->arg_index = arg_posn++; - if (dp->arg_index == ARG_NONE) - /* arg_posn wrapped around. */ - goto error; - } - REGISTER_ARG (dp->arg_index, type); - } - dp->conversion = c; - dp->dir_end = cp; - } - - d->count++; - if (d->count >= d_allocated) - { - size_t memory_size; - DIRECTIVE *memory; - - d_allocated = xtimes (d_allocated, 2); - memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); - if (size_overflow_p (memory_size)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - memory = (DIRECTIVE *) realloc (d->dir, memory_size); - if (memory == NULL) - /* Out of memory. */ - goto out_of_memory; - d->dir = memory; - } - } + case '%': + type = TYPE_NONE; + break; + default: + /* Unknown conversion character. */ + goto error; + } + } + + if (type != TYPE_NONE) + { + dp->arg_index = arg_index; + if (dp->arg_index == ARG_NONE) + { + dp->arg_index = arg_posn++; + if (dp->arg_index == ARG_NONE) + /* arg_posn wrapped around. */ + goto error; + } + REGISTER_ARG (dp->arg_index, type); + } + dp->conversion = c; + dp->dir_end = cp; + } + + d->count++; + if (d->count >= d_allocated) + { + size_t memory_size; + DIRECTIVE *memory; + + d_allocated = xtimes (d_allocated, 2); + memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); + if (size_overflow_p (memory_size)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + memory = (DIRECTIVE *) realloc (d->dir, memory_size); + if (memory == NULL) + /* Out of memory. */ + goto out_of_memory; + d->dir = memory; + } + } #if CHAR_T_ONLY_ASCII else if (!c_isascii (c)) - { - /* Non-ASCII character. Not supported. */ - goto error; - } + { + /* Non-ASCII character. Not supported. */ + goto error; + } #endif } d->dir[d->count].dir_start = cp; diff --git a/lib/printf-parse.h b/lib/printf-parse.h index 0a496cb..2cf965b 100644 --- a/lib/printf-parse.h +++ b/lib/printf-parse.h @@ -1,5 +1,6 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -26,15 +27,15 @@ /* Flags */ -#define FLAG_GROUP 1 /* ' flag */ -#define FLAG_LEFT 2 /* - flag */ -#define FLAG_SHOWSIGN 4 /* + flag */ -#define FLAG_SPACE 8 /* space flag */ -#define FLAG_ALT 16 /* # flag */ -#define FLAG_ZERO 32 +#define FLAG_GROUP 1 /* ' flag */ +#define FLAG_LEFT 2 /* - flag */ +#define FLAG_SHOWSIGN 4 /* + flag */ +#define FLAG_SPACE 8 /* space flag */ +#define FLAG_ALT 16 /* # flag */ +#define FLAG_ZERO 32 /* arg_index value indicating that no argument is consumed. */ -#define ARG_NONE (~(size_t)0) +#define ARG_NONE (~(size_t)0) /* xxx_directive: A parsed directive. xxx_directives: A parsed format string. */ @@ -163,10 +164,10 @@ extern int u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); extern int u16_printf_parse (const uint16_t *format, u16_directives *d, - arguments *a); + arguments *a); extern int u32_printf_parse (const uint32_t *format, u32_directives *d, - arguments *a); + arguments *a); #else # ifdef STATIC STATIC diff --git a/lib/ref-add.sin b/lib/ref-add.sin index 3acdcc8..cb482d7 100644 --- a/lib/ref-add.sin +++ b/lib/ref-add.sin @@ -1,6 +1,6 @@ # Add this package to a list of references stored in a text file. # -# Copyright (C) 2000 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/ref-del.sin b/lib/ref-del.sin index 7923d06..74f8e1c 100644 --- a/lib/ref-del.sin +++ b/lib/ref-del.sin @@ -1,6 +1,6 @@ # Remove this package from a list of references stored in a text file. # -# Copyright (C) 2000 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/relocatable.c b/lib/relocatable.c index 09ff8c9..172e91c 100644 --- a/lib/relocatable.c +++ b/lib/relocatable.c @@ -1,5 +1,5 @@ /* Provide relocatable packages. - Copyright (C) 2003-2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2003-2006, 2008-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ This must come before <config.h> because <config.h> may include <features.h>, and once <features.h> has been included, it's too late. */ #ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 +# define _GNU_SOURCE 1 #endif #include <config.h> @@ -102,11 +102,11 @@ static size_t curr_prefix_len; instead of "/"). */ static void set_this_relocation_prefix (const char *orig_prefix_arg, - const char *curr_prefix_arg) + const char *curr_prefix_arg) { if (orig_prefix_arg != NULL && curr_prefix_arg != NULL /* Optimization: if orig_prefix and curr_prefix are equal, the - relocation is a nop. */ + relocation is a nop. */ && strcmp (orig_prefix_arg, curr_prefix_arg) != 0) { /* Duplicate the argument strings. */ @@ -118,14 +118,14 @@ set_this_relocation_prefix (const char *orig_prefix_arg, #ifdef NO_XMALLOC if (memory != NULL) #endif - { - memcpy (memory, orig_prefix_arg, orig_prefix_len + 1); - orig_prefix = memory; - memory += orig_prefix_len + 1; - memcpy (memory, curr_prefix_arg, curr_prefix_len + 1); - curr_prefix = memory; - return; - } + { + memcpy (memory, orig_prefix_arg, orig_prefix_len + 1); + orig_prefix = memory; + memory += orig_prefix_len + 1; + memcpy (memory, curr_prefix_arg, curr_prefix_len + 1); + curr_prefix = memory; + return; + } } orig_prefix = NULL; curr_prefix = NULL; @@ -168,8 +168,8 @@ static #endif char * compute_curr_prefix (const char *orig_installprefix, - const char *orig_installdir, - const char *curr_pathname) + const char *orig_installdir, + const char *curr_pathname) { char *curr_installdir; const char *rel_installdir; @@ -194,9 +194,9 @@ compute_curr_prefix (const char *orig_installprefix, while (p > p_base) { - p--; - if (ISSLASH (*p)) - break; + p--; + if (ISSLASH (*p)) + break; } q = (char *) xmalloc (p - curr_pathname + 1); @@ -219,46 +219,46 @@ compute_curr_prefix (const char *orig_installprefix, while (rp > rel_installdir && cp > cp_base) { - bool same = false; - const char *rpi = rp; - const char *cpi = cp; - - while (rpi > rel_installdir && cpi > cp_base) - { - rpi--; - cpi--; - if (ISSLASH (*rpi) || ISSLASH (*cpi)) - { - if (ISSLASH (*rpi) && ISSLASH (*cpi)) - same = true; - break; - } - /* Do case-insensitive comparison if the filesystem is always or - often case-insensitive. It's better to accept the comparison - if the difference is only in case, rather than to fail. */ + bool same = false; + const char *rpi = rp; + const char *cpi = cp; + + while (rpi > rel_installdir && cpi > cp_base) + { + rpi--; + cpi--; + if (ISSLASH (*rpi) || ISSLASH (*cpi)) + { + if (ISSLASH (*rpi) && ISSLASH (*cpi)) + same = true; + break; + } + /* Do case-insensitive comparison if the file system is always or + often case-insensitive. It's better to accept the comparison + if the difference is only in case, rather than to fail. */ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ - /* Win32, Cygwin, OS/2, DOS - case insignificant filesystem */ - if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi) - != (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi)) - break; + /* Win32, Cygwin, OS/2, DOS - case insignificant file system */ + if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi) + != (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi)) + break; #else - if (*rpi != *cpi) - break; + if (*rpi != *cpi) + break; #endif - } - if (!same) - break; - /* The last pathname component was the same. opi and cpi now point - to the slash before it. */ - rp = rpi; - cp = cpi; + } + if (!same) + break; + /* The last pathname component was the same. opi and cpi now point + to the slash before it. */ + rp = rpi; + cp = cpi; } if (rp > rel_installdir) { - /* Unexpected: The curr_installdir does not end with rel_installdir. */ - free (curr_installdir); - return NULL; + /* Unexpected: The curr_installdir does not end with rel_installdir. */ + free (curr_installdir); + return NULL; } { @@ -268,10 +268,10 @@ compute_curr_prefix (const char *orig_installprefix, curr_prefix = (char *) xmalloc (curr_prefix_len + 1); #ifdef NO_XMALLOC if (curr_prefix == NULL) - { - free (curr_installdir); - return NULL; - } + { + free (curr_installdir); + return NULL; + } #endif memcpy (curr_prefix, curr_installdir, curr_prefix_len); curr_prefix[curr_prefix_len] = '\0'; @@ -305,30 +305,30 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved) static char location[MAX_PATH]; if (!GetModuleFileName (module_handle, location, sizeof (location))) - /* Shouldn't happen. */ - return FALSE; + /* Shouldn't happen. */ + return FALSE; if (!IS_PATH_WITH_DIR (location)) - /* Shouldn't happen. */ - return FALSE; + /* Shouldn't happen. */ + return FALSE; { #if defined __CYGWIN__ - /* On Cygwin, we need to convert paths coming from Win32 system calls - to the Unix-like slashified notation. */ - static char location_as_posix_path[2 * MAX_PATH]; - /* There's no error return defined for cygwin_conv_to_posix_path. - See cygwin-api/func-cygwin-conv-to-posix-path.html. - Does it overflow the buffer of expected size MAX_PATH or does it - truncate the path? I don't know. Let's catch both. */ - cygwin_conv_to_posix_path (location, location_as_posix_path); - location_as_posix_path[MAX_PATH - 1] = '\0'; - if (strlen (location_as_posix_path) >= MAX_PATH - 1) - /* A sign of buffer overflow or path truncation. */ - return FALSE; - shared_library_fullname = strdup (location_as_posix_path); + /* On Cygwin, we need to convert paths coming from Win32 system calls + to the Unix-like slashified notation. */ + static char location_as_posix_path[2 * MAX_PATH]; + /* There's no error return defined for cygwin_conv_to_posix_path. + See cygwin-api/func-cygwin-conv-to-posix-path.html. + Does it overflow the buffer of expected size MAX_PATH or does it + truncate the path? I don't know. Let's catch both. */ + cygwin_conv_to_posix_path (location, location_as_posix_path); + location_as_posix_path[MAX_PATH - 1] = '\0'; + if (strlen (location_as_posix_path) >= MAX_PATH - 1) + /* A sign of buffer overflow or path truncation. */ + return FALSE; + shared_library_fullname = strdup (location_as_posix_path); #else - shared_library_fullname = strdup (location); + shared_library_fullname = strdup (location); #endif } } @@ -351,37 +351,37 @@ find_shared_library_fullname () { unsigned long address = (unsigned long) &find_shared_library_fullname; for (;;) - { - unsigned long start, end; - int c; - - if (fscanf (fp, "%lx-%lx", &start, &end) != 2) - break; - if (address >= start && address <= end - 1) - { - /* Found it. Now see if this line contains a filename. */ - while (c = getc (fp), c != EOF && c != '\n' && c != '/') - continue; - if (c == '/') - { - size_t size; - int len; - - ungetc (c, fp); - shared_library_fullname = NULL; size = 0; - len = getline (&shared_library_fullname, &size, fp); - if (len >= 0) - { - /* Success: filled shared_library_fullname. */ - if (len > 0 && shared_library_fullname[len - 1] == '\n') - shared_library_fullname[len - 1] = '\0'; - } - } - break; - } - while (c = getc (fp), c != EOF && c != '\n') - continue; - } + { + unsigned long start, end; + int c; + + if (fscanf (fp, "%lx-%lx", &start, &end) != 2) + break; + if (address >= start && address <= end - 1) + { + /* Found it. Now see if this line contains a filename. */ + while (c = getc (fp), c != EOF && c != '\n' && c != '/') + continue; + if (c == '/') + { + size_t size; + int len; + + ungetc (c, fp); + shared_library_fullname = NULL; size = 0; + len = getline (&shared_library_fullname, &size, fp); + if (len >= 0) + { + /* Success: filled shared_library_fullname. */ + if (len > 0 && shared_library_fullname[len - 1] == '\n') + shared_library_fullname[len - 1] = '\0'; + } + } + break; + } + while (c = getc (fp), c != EOF && c != '\n') + continue; + } fclose (fp); } #endif @@ -422,69 +422,69 @@ relocate (const char *pathname) if (!initialized) { /* At this point, orig_prefix and curr_prefix likely have already been - set through the main program's set_program_name_and_installdir - function. This is sufficient in the case that the library has - initially been installed in the same orig_prefix. But we can do - better, to also cover the cases that 1. it has been installed - in a different prefix before being moved to orig_prefix and (later) - to curr_prefix, 2. unlike the program, it has not moved away from - orig_prefix. */ + set through the main program's set_program_name_and_installdir + function. This is sufficient in the case that the library has + initially been installed in the same orig_prefix. But we can do + better, to also cover the cases that 1. it has been installed + in a different prefix before being moved to orig_prefix and (later) + to curr_prefix, 2. unlike the program, it has not moved away from + orig_prefix. */ const char *orig_installprefix = INSTALLPREFIX; const char *orig_installdir = INSTALLDIR; char *curr_prefix_better; curr_prefix_better = - compute_curr_prefix (orig_installprefix, orig_installdir, - get_shared_library_fullname ()); + compute_curr_prefix (orig_installprefix, orig_installdir, + get_shared_library_fullname ()); set_relocation_prefix (orig_installprefix, - curr_prefix_better != NULL - ? curr_prefix_better - : curr_prefix); + curr_prefix_better != NULL + ? curr_prefix_better + : curr_prefix); if (curr_prefix_better != NULL) - free (curr_prefix_better); + free (curr_prefix_better); initialized = 1; } #endif /* Note: It is not necessary to perform case insensitive comparison here, - even for DOS-like filesystems, because the pathname argument was + even for DOS-like file systems, because the pathname argument was typically created from the same Makefile variable as orig_prefix came from. */ if (orig_prefix != NULL && curr_prefix != NULL && strncmp (pathname, orig_prefix, orig_prefix_len) == 0) { if (pathname[orig_prefix_len] == '\0') - { - /* pathname equals orig_prefix. */ - char *result = (char *) xmalloc (strlen (curr_prefix) + 1); + { + /* pathname equals orig_prefix. */ + char *result = (char *) xmalloc (strlen (curr_prefix) + 1); #ifdef NO_XMALLOC - if (result != NULL) + if (result != NULL) #endif - { - strcpy (result, curr_prefix); - return result; - } - } + { + strcpy (result, curr_prefix); + return result; + } + } else if (ISSLASH (pathname[orig_prefix_len])) - { - /* pathname starts with orig_prefix. */ - const char *pathname_tail = &pathname[orig_prefix_len]; - char *result = - (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1); + { + /* pathname starts with orig_prefix. */ + const char *pathname_tail = &pathname[orig_prefix_len]; + char *result = + (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1); #ifdef NO_XMALLOC - if (result != NULL) + if (result != NULL) #endif - { - memcpy (result, curr_prefix, curr_prefix_len); - strcpy (result + curr_prefix_len, pathname_tail); - return result; - } - } + { + memcpy (result, curr_prefix, curr_prefix_len); + strcpy (result + curr_prefix_len, pathname_tail); + return result; + } + } } /* Nothing to relocate. */ return pathname; diff --git a/lib/relocatable.h b/lib/relocatable.h index 5dfd710..6328fa8 100644 --- a/lib/relocatable.h +++ b/lib/relocatable.h @@ -1,5 +1,5 @@ /* Provide relocatable packages. - Copyright (C) 2003, 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ extern "C" { instead of "/"). */ extern RELOCATABLE_DLL_EXPORTED void set_relocation_prefix (const char *orig_prefix, - const char *curr_prefix); + const char *curr_prefix); /* Returns the pathname, relocated according to the current installation directory. @@ -65,8 +65,8 @@ extern const char * relocate (const char *pathname); file, and the current pathname of this file. Returns it, freshly allocated. Returns NULL upon failure. */ extern char * compute_curr_prefix (const char *orig_installprefix, - const char *orig_installdir, - const char *curr_pathname); + const char *orig_installdir, + const char *curr_pathname); #else diff --git a/lib/signbitd.c b/lib/signbitd.c index 8d082b6..d0fb4a9 100644 --- a/lib/signbitd.c +++ b/lib/signbitd.c @@ -1,5 +1,5 @@ /* signbit() macro: Determine the sign bit of a floating-point number. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/signbitf.c b/lib/signbitf.c index e75f38c..f2ef1d9 100644 --- a/lib/signbitf.c +++ b/lib/signbitf.c @@ -1,5 +1,5 @@ /* signbit() macro: Determine the sign bit of a floating-point number. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/signbitl.c b/lib/signbitl.c index 465937f..adcb71e 100644 --- a/lib/signbitl.c +++ b/lib/signbitl.c @@ -1,5 +1,5 @@ /* signbit() macro: Determine the sign bit of a floating-point number. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/size_max.h b/lib/size_max.h index 419d73a..381eea1 100644 --- a/lib/size_max.h +++ b/lib/size_max.h @@ -1,5 +1,5 @@ /* size_max.h -- declare SIZE_MAX through system headers - Copyright (C) 2005-2006 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h index 3390484..f2510a9 100644 --- a/lib/stdbool.in.h +++ b/lib/stdbool.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software; you can redistribute it and/or modify @@ -50,6 +50,9 @@ with this substitute. With this substitute, only the values 0 and 1 give the expected result when converted to _Bool' or 'bool'. + - C99 allows the use of (_Bool)0.0 in constant expressions, but + this substitute cannot always provide this property. + Also, it is suggested that programs use 'bool' rather than '_Bool'; this isn't required, but 'bool' is more common. */ diff --git a/lib/stddef.in.h b/lib/stddef.in.h index dacc83d..b1dfb67 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 11a2117..997e406 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -23,6 +23,10 @@ #ifndef _GL_STDINT_H +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + /* When including a system file that in turn includes <inttypes.h>, use the system <inttypes.h>, not our substitute. This avoids problems with (for example) VMS, whose <sys/bitypes.h> includes @@ -49,9 +53,6 @@ in <inttypes.h> would reinclude us, skipping our contents because _GL_STDINT_H is defined. The include_next requires a split double-inclusion guard. */ -# if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -# endif # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #endif @@ -102,8 +103,8 @@ ((signed) \ ? ~ _STDINT_MIN (signed, bits, zero) \ : /* The expression for the unsigned case. The subtraction of (signed) \ - is a nop in the unsigned case and avoids "signed integer overflow" \ - warnings in the signed case. */ \ + is a nop in the unsigned case and avoids "signed integer overflow" \ + warnings in the signed case. */ \ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) /* 7.18.1.1. Exact-width integer types */ @@ -454,10 +455,10 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - #undef SIG_ATOMIC_MAX #define SIG_ATOMIC_MIN \ _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) + 0@SIG_ATOMIC_T_SUFFIX@) #define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) + 0@SIG_ATOMIC_T_SUFFIX@) /* size_t limit */ diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 162d90d..528b6ef 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -1,5 +1,5 @@ /* Implementation details of FILE streams. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -21,26 +21,31 @@ /* BSD stdio derived implementations. */ +#if defined __NetBSD__ /* NetBSD */ +/* Get __NetBSD_Version__. */ +# include <sys/param.h> +#endif + #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ # if defined __DragonFly__ /* DragonFly */ /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ # define fp_ ((struct { struct __FILE_public pub; \ - struct { unsigned char *_base; int _size; } _bf; \ - void *cookie; \ - void *_close; \ - void *_read; \ - void *_seek; \ - void *_write; \ - struct { unsigned char *_base; int _size; } _ub; \ - int _ur; \ - unsigned char _ubuf[3]; \ - unsigned char _nbuf[1]; \ - struct { unsigned char *_base; int _size; } _lb; \ - int _blksize; \ - fpos_t _offset; \ - /* More fields, not relevant here. */ \ - } *) fp) + struct { unsigned char *_base; int _size; } _bf; \ + void *cookie; \ + void *_close; \ + void *_read; \ + void *_seek; \ + void *_write; \ + struct { unsigned char *_base; int _size; } _ub; \ + int _ur; \ + unsigned char _ubuf[3]; \ + unsigned char _nbuf[1]; \ + struct { unsigned char *_base; int _size; } _lb; \ + int _blksize; \ + fpos_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ # define _p pub._p # define _flags pub._flags @@ -50,7 +55,7 @@ # define fp_ fp # endif -# if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */ +# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */ /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ struct __sfileext @@ -59,7 +64,7 @@ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub -# else /* FreeBSD, DragonFly, MacOS X, Cygwin */ +# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */ # define fp_ub fp_->_ub # endif @@ -74,12 +79,12 @@ # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ - unsigned char *_base; \ - unsigned char *_end; \ - long _cnt; \ - int _file; \ - unsigned int _flag; \ - } *) fp) + unsigned char *_base; \ + unsigned char *_end; \ + long _cnt; \ + int _file; \ + unsigned int _flag; \ + } *) fp) # else # define fp_ fp # endif diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 2a62fb7..3839ff3 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdlib.h>. - Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -39,7 +39,7 @@ #include <stddef.h> /* Solaris declares getloadavg() in <sys/loadavg.h>. */ -#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@ +#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ # include <sys/loadavg.h> #endif @@ -49,24 +49,36 @@ # include <random.h> #endif -#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ +#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \ + || defined GNULIB_POSIXCHECK # include <stdint.h> #endif #if !@HAVE_STRUCT_RANDOM_DATA@ struct random_data { - int32_t *fptr; /* Front pointer. */ - int32_t *rptr; /* Rear pointer. */ - int32_t *state; /* Array of state values. */ - int rand_type; /* Type of random number generator. */ - int rand_deg; /* Degree of random number generator. */ - int rand_sep; /* Distance between front and rear. */ - int32_t *end_ptr; /* Pointer behind state table. */ + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ }; #endif -/* The definition of GL_LINK_WARNING is copied here. */ +#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ +/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ +/* But avoid namespace pollution on glibc systems and native Windows. */ +# include <unistd.h> +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ @@ -83,88 +95,84 @@ struct random_data #endif -#ifdef __cplusplus -extern "C" { -#endif - - -#if @GNULIB_MALLOC_POSIX@ -# if !@HAVE_MALLOC_POSIX@ -# undef malloc -# define malloc rpl_malloc -extern void * malloc (size_t size); +#if @GNULIB_ATOLL@ +/* Parse a signed decimal integer. + Returns the value of the integer. Errors are not detected. */ +# if !@HAVE_ATOLL@ +_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); +_GL_CXXALIASWARN (atoll); #elif defined GNULIB_POSIXCHECK -# undef malloc -# define malloc(s) \ - (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \ - "use gnulib module malloc-posix for portability"), \ - malloc (s)) -#endif - - -#if @GNULIB_REALLOC_POSIX@ -# if !@HAVE_REALLOC_POSIX@ -# undef realloc -# define realloc rpl_realloc -extern void * realloc (void *ptr, size_t size); +# undef atoll +# if HAVE_RAW_DECL_ATOLL +_GL_WARN_ON_USE (atoll, "atoll is unportable - " + "use gnulib module atoll for portability"); # endif -#elif defined GNULIB_POSIXCHECK -# undef realloc -# define realloc(p,s) \ - (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \ - "use gnulib module realloc-posix for portability"), \ - realloc (p, s)) #endif - #if @GNULIB_CALLOC_POSIX@ # if !@HAVE_CALLOC_POSIX@ -# undef calloc -# define calloc rpl_calloc -extern void * calloc (size_t nmemb, size_t size); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef calloc +# define calloc rpl_calloc +# endif +_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); +_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); +# else +_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); # endif +_GL_CXXALIASWARN (calloc); #elif defined GNULIB_POSIXCHECK # undef calloc -# define calloc(n,s) \ - (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \ - "use gnulib module calloc-posix for portability"), \ - calloc (n, s)) +/* Assume calloc is always declared. */ +_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " + "use gnulib module calloc-posix for portability"); #endif - -#if @GNULIB_ATOLL@ -# if !@HAVE_ATOLL@ -/* Parse a signed decimal integer. - Returns the value of the integer. Errors are not detected. */ -extern long long atoll (const char *string); +#if @GNULIB_CANONICALIZE_FILE_NAME@ +# if @REPLACE_CANONICALIZE_FILE_NAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define canonicalize_file_name rpl_canonicalize_file_name +# endif +_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); +# else +# if !@HAVE_CANONICALIZE_FILE_NAME@ +_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); # endif +_GL_CXXALIASWARN (canonicalize_file_name); #elif defined GNULIB_POSIXCHECK -# undef atoll -# define atoll(s) \ - (GL_LINK_WARNING ("atoll is unportable - " \ - "use gnulib module atoll for portability"), \ - atoll (s)) +# undef canonicalize_file_name +# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME +_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " + "use gnulib module canonicalize-lgpl for portability"); +# endif #endif - #if @GNULIB_GETLOADAVG@ -# if !@HAVE_DECL_GETLOADAVG@ /* Store max(NELEM,3) load average numbers in LOADAVG[]. The three numbers are the load average of the last 1 minute, the last 5 minutes, and the last 15 minutes, respectively. LOADAVG is an array of NELEM numbers. */ -extern int getloadavg (double loadavg[], int nelem); +# if !@HAVE_DECL_GETLOADAVG@ +_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) + _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); +_GL_CXXALIASWARN (getloadavg); #elif defined GNULIB_POSIXCHECK # undef getloadavg -# define getloadavg(l,n) \ - (GL_LINK_WARNING ("getloadavg is not portable - " \ - "use gnulib module getloadavg for portability"), \ - getloadavg (l, n)) +# if HAVE_RAW_DECL_GETLOADAVG +_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " + "use gnulib module getloadavg for portability"); +# endif #endif - #if @GNULIB_GETSUBOPT@ /* Assuming *OPTIONP is a comma separated list of elements of the form "token" or "token=value", getsubopt parses the first of these elements. @@ -178,37 +186,133 @@ extern int getloadavg (double loadavg[], int nelem); For more details see the POSIX:2001 specification. http://www.opengroup.org/susv3xsh/getsubopt.html */ # if !@HAVE_GETSUBOPT@ -extern int getsubopt (char **optionp, char *const *tokens, char **valuep); +_GL_FUNCDECL_SYS (getsubopt, int, + (char **optionp, char *const *tokens, char **valuep) + _GL_ARG_NONNULL ((1, 2, 3))); # endif +_GL_CXXALIAS_SYS (getsubopt, int, + (char **optionp, char *const *tokens, char **valuep)); +_GL_CXXALIASWARN (getsubopt); #elif defined GNULIB_POSIXCHECK # undef getsubopt -# define getsubopt(o,t,v) \ - (GL_LINK_WARNING ("getsubopt is unportable - " \ - "use gnulib module getsubopt for portability"), \ - getsubopt (o, t, v)) +# if HAVE_RAW_DECL_GETSUBOPT +_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " + "use gnulib module getsubopt for portability"); +# endif +#endif + +#if @GNULIB_GRANTPT@ +/* Change the ownership and access permission of the slave side of the + pseudo-terminal whose master side is specified by FD. */ +# if !@HAVE_GRANTPT@ +_GL_FUNCDECL_SYS (grantpt, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (grantpt, int, (int fd)); +_GL_CXXALIASWARN (grantpt); +#elif defined GNULIB_POSIXCHECK +# undef grantpt +# if HAVE_RAW_DECL_GRANTPT +_GL_WARN_ON_USE (ptsname, "grantpt is not portable - " + "use gnulib module grantpt for portability"); +# endif #endif +#if @GNULIB_MALLOC_POSIX@ +# if !@HAVE_MALLOC_POSIX@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef malloc +# define malloc rpl_malloc +# endif +_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); +_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); +# else +_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); +# endif +_GL_CXXALIASWARN (malloc); +#elif defined GNULIB_POSIXCHECK +# undef malloc +/* Assume malloc is always declared. */ +_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " + "use gnulib module malloc-posix for portability"); +#endif #if @GNULIB_MKDTEMP@ -# if !@HAVE_MKDTEMP@ /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the directory name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique name. The directory is created mode 700. */ -extern char * mkdtemp (char * /*template*/); +# if !@HAVE_MKDTEMP@ +_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); +_GL_CXXALIASWARN (mkdtemp); #elif defined GNULIB_POSIXCHECK # undef mkdtemp -# define mkdtemp(t) \ - (GL_LINK_WARNING ("mkdtemp is unportable - " \ - "use gnulib module mkdtemp for portability"), \ - mkdtemp (t)) +# if HAVE_RAW_DECL_MKDTEMP +_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " + "use gnulib module mkdtemp for portability"); +# endif #endif +#if @GNULIB_MKOSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKOSTEMP@ +_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); +_GL_CXXALIASWARN (mkostemp); +#elif defined GNULIB_POSIXCHECK +# undef mkostemp +# if HAVE_RAW_DECL_MKOSTEMP +_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " + "use gnulib module mkostemp for portability"); +# endif +#endif + +#if @GNULIB_MKOSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE before a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKOSTEMPS@ +_GL_FUNCDECL_SYS (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/)); +_GL_CXXALIASWARN (mkostemps); +#elif defined GNULIB_POSIXCHECK +# undef mkostemps +# if HAVE_RAW_DECL_MKOSTEMPS +_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " + "use gnulib module mkostemps for portability"); +# endif +#endif #if @GNULIB_MKSTEMP@ -# if @REPLACE_MKSTEMP@ /* Create a unique temporary file from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. @@ -218,124 +322,276 @@ extern char * mkdtemp (char * /*template*/); implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ -# define mkstemp rpl_mkstemp -extern int mkstemp (char * /*template*/); +# if @REPLACE_MKSTEMP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mkstemp rpl_mkstemp +# endif +_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); # else -/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ -# include <unistd.h> +# if ! @HAVE_MKSTEMP@ +_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); # endif +_GL_CXXALIASWARN (mkstemp); #elif defined GNULIB_POSIXCHECK # undef mkstemp -# define mkstemp(t) \ - (GL_LINK_WARNING ("mkstemp is unportable - " \ - "use gnulib module mkstemp for portability"), \ - mkstemp (t)) +# if HAVE_RAW_DECL_MKSTEMP +_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " + "use gnulib module mkstemp for portability"); +# endif #endif +#if @GNULIB_MKSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE prior to a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKSTEMPS@ +_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); +_GL_CXXALIASWARN (mkstemps); +#elif defined GNULIB_POSIXCHECK +# undef mkstemps +# if HAVE_RAW_DECL_MKSTEMPS +_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " + "use gnulib module mkstemps for portability"); +# endif +#endif + +#if @GNULIB_PTSNAME@ +/* Return the pathname of the pseudo-terminal slave associated with + the master FD is open on, or NULL on errors. */ +# if !@HAVE_PTSNAME@ +_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); +# endif +_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); +_GL_CXXALIASWARN (ptsname); +#elif defined GNULIB_POSIXCHECK +# undef ptsname +# if HAVE_RAW_DECL_PTSNAME +_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " + "use gnulib module ptsname for portability"); +# endif +#endif #if @GNULIB_PUTENV@ # if @REPLACE_PUTENV@ -# undef putenv -# define putenv rpl_putenv -extern int putenv (char *string); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putenv +# define putenv rpl_putenv +# endif +_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (putenv, int, (char *string)); +# else +_GL_CXXALIAS_SYS (putenv, int, (char *string)); # endif +_GL_CXXALIASWARN (putenv); #endif #if @GNULIB_RANDOM_R@ # if !@HAVE_RANDOM_R@ - # ifndef RAND_MAX # define RAND_MAX 2147483647 # endif +# endif +#endif -int srandom_r (unsigned int seed, struct random_data *rand_state); -int initstate_r (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state); -int setstate_r (char *arg_state, struct random_data *rand_state); -int random_r (struct random_data *buf, int32_t *result); +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); # endif +_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); +_GL_CXXALIASWARN (random_r); #elif defined GNULIB_POSIXCHECK # undef random_r -# define random_r(b,r) \ - (GL_LINK_WARNING ("random_r is unportable - " \ - "use gnulib module random_r for portability"), \ - random_r (b,r)) -# undef initstate_r -# define initstate_r(s,b,sz,r) \ - (GL_LINK_WARNING ("initstate_r is unportable - " \ - "use gnulib module random_r for portability"), \ - initstate_r (s,b,sz,r)) +# if HAVE_RAW_DECL_RANDOM_R +_GL_WARN_ON_USE (random_r, "random_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +_GL_CXXALIASWARN (srandom_r); +#elif defined GNULIB_POSIXCHECK # undef srandom_r -# define srandom_r(s,r) \ - (GL_LINK_WARNING ("srandom_r is unportable - " \ - "use gnulib module random_r for portability"), \ - srandom_r (s,r)) +# if HAVE_RAW_DECL_SRANDOM_R +_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +# endif +_GL_CXXALIAS_SYS (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +_GL_CXXALIASWARN (initstate_r); +#elif defined GNULIB_POSIXCHECK +# undef initstate_r +# if HAVE_RAW_DECL_INITSTATE_R +_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +_GL_CXXALIASWARN (setstate_r); +#elif defined GNULIB_POSIXCHECK # undef setstate_r -# define setstate_r(a,r) \ - (GL_LINK_WARNING ("setstate_r is unportable - " \ - "use gnulib module random_r for portability"), \ - setstate_r (a,r)) +# if HAVE_RAW_DECL_SETSTATE_R +_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " + "use gnulib module random_r for portability"); +# endif #endif +#if @GNULIB_REALLOC_POSIX@ +# if !@HAVE_REALLOC_POSIX@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef realloc +# define realloc rpl_realloc +# endif +_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); +_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); +# else +_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); +# endif +_GL_CXXALIASWARN (realloc); +#elif defined GNULIB_POSIXCHECK +# undef realloc +/* Assume realloc is always declared. */ +_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " + "use gnulib module realloc-posix for portability"); +#endif + +#if @GNULIB_REALPATH@ +# if @REPLACE_REALPATH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define realpath rpl_realpath +# endif +_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); +# else +# if !@HAVE_REALPATH@ +_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); +# endif +_GL_CXXALIASWARN (realpath); +#elif defined GNULIB_POSIXCHECK +# undef realpath +# if HAVE_RAW_DECL_REALPATH +_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " + "canonicalize or canonicalize-lgpl for portability"); +# endif +#endif + #if @GNULIB_RPMATCH@ -# if !@HAVE_RPMATCH@ /* Test a user response to a question. Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ -extern int rpmatch (const char *response); +# if !@HAVE_RPMATCH@ +_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); +_GL_CXXALIASWARN (rpmatch); #elif defined GNULIB_POSIXCHECK # undef rpmatch -# define rpmatch(r) \ - (GL_LINK_WARNING ("rpmatch is unportable - " \ - "use gnulib module rpmatch for portability"), \ - rpmatch (r)) +# if HAVE_RAW_DECL_RPMATCH +_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " + "use gnulib module rpmatch for portability"); +# endif #endif - #if @GNULIB_SETENV@ -# if !@HAVE_SETENV@ /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ -extern int setenv (const char *name, const char *value, int replace); -# endif -#endif - - -#if @GNULIB_UNSETENV@ -# if @HAVE_UNSETENV@ -# if @VOID_UNSETENV@ -/* On some systems, unsetenv() returns void. - This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ -# define unsetenv(name) ((unsetenv)(name), 0) +# if @REPLACE_SETENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setenv +# define setenv rpl_setenv # endif +_GL_FUNCDECL_RPL (setenv, int, + (const char *name, const char *value, int replace) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setenv, int, + (const char *name, const char *value, int replace)); # else -/* Remove the variable NAME from the environment. */ -extern int unsetenv (const char *name); +# if !@HAVE_SETENV@ +_GL_FUNCDECL_SYS (setenv, int, + (const char *name, const char *value, int replace) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (setenv, int, + (const char *name, const char *value, int replace)); +# endif +_GL_CXXALIASWARN (setenv); +#elif defined GNULIB_POSIXCHECK +# undef setenv +# if HAVE_RAW_DECL_SETENV +_GL_WARN_ON_USE (setenv, "setenv is unportable - " + "use gnulib module setenv for portability"); # endif #endif - #if @GNULIB_STRTOD@ -# if @REPLACE_STRTOD@ -# define strtod rpl_strtod -# endif -# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@ /* Parse a double from STRING, updating ENDP if appropriate. */ -extern double strtod (const char *str, char **endp); +# if @REPLACE_STRTOD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtod rpl_strtod +# endif +_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); +# else +# if !@HAVE_STRTOD@ +_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); # endif +_GL_CXXALIASWARN (strtod); #elif defined GNULIB_POSIXCHECK # undef strtod -# define strtod(s, e) \ - (GL_LINK_WARNING ("strtod is unportable - " \ - "use gnulib module strtod for portability"), \ - strtod (s, e)) +# if HAVE_RAW_DECL_STRTOD +_GL_WARN_ON_USE (strtod, "strtod is unportable - " + "use gnulib module strtod for portability"); +# endif #endif - #if @GNULIB_STRTOLL@ -# if !@HAVE_STRTOLL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, it may be decimal or octal (with prefix "0") or hexadecimal (with prefix @@ -344,19 +600,23 @@ extern double strtod (const char *str, char **endp); stored in *ENDPTR. Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set to ERANGE. */ -extern long long strtoll (const char *string, char **endptr, int base); +# if !@HAVE_STRTOLL@ +_GL_FUNCDECL_SYS (strtoll, long long, + (const char *string, char **endptr, int base) + _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (strtoll, long long, + (const char *string, char **endptr, int base)); +_GL_CXXALIASWARN (strtoll); #elif defined GNULIB_POSIXCHECK # undef strtoll -# define strtoll(s,e,b) \ - (GL_LINK_WARNING ("strtoll is unportable - " \ - "use gnulib module strtoll for portability"), \ - strtoll (s, e, b)) +# if HAVE_RAW_DECL_STRTOLL +_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " + "use gnulib module strtoll for portability"); +# endif #endif - #if @GNULIB_STRTOULL@ -# if !@HAVE_STRTOULL@ /* Parse an unsigned integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, it may be decimal or octal (with prefix "0") or hexadecimal (with prefix @@ -365,21 +625,63 @@ extern long long strtoll (const char *string, char **endptr, int base); stored in *ENDPTR. Upon overflow, the return value is ULLONG_MAX, and errno is set to ERANGE. */ -extern unsigned long long strtoull (const char *string, char **endptr, int base); +# if !@HAVE_STRTOULL@ +_GL_FUNCDECL_SYS (strtoull, unsigned long long, + (const char *string, char **endptr, int base) + _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (strtoull, unsigned long long, + (const char *string, char **endptr, int base)); +_GL_CXXALIASWARN (strtoull); #elif defined GNULIB_POSIXCHECK # undef strtoull -# define strtoull(s,e,b) \ - (GL_LINK_WARNING ("strtoull is unportable - " \ - "use gnulib module strtoull for portability"), \ - strtoull (s, e, b)) +# if HAVE_RAW_DECL_STRTOULL +_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " + "use gnulib module strtoull for portability"); +# endif #endif +#if @GNULIB_UNLOCKPT@ +/* Unlock the slave side of the pseudo-terminal whose master side is specified + by FD, so that it can be opened. */ +# if !@HAVE_UNLOCKPT@ +_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); +_GL_CXXALIASWARN (unlockpt); +#elif defined GNULIB_POSIXCHECK +# undef unlockpt +# if HAVE_RAW_DECL_UNLOCKPT +_GL_WARN_ON_USE (ptsname, "unlockpt is not portable - " + "use gnulib module unlockpt for portability"); +# endif +#endif -#ifdef __cplusplus -} +#if @GNULIB_UNSETENV@ +/* Remove the variable NAME from the environment. */ +# if @REPLACE_UNSETENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unsetenv +# define unsetenv rpl_unsetenv +# endif +_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); +# else +# if !@HAVE_UNSETENV@ +_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); +# endif +_GL_CXXALIASWARN (unsetenv); +#elif defined GNULIB_POSIXCHECK +# undef unsetenv +# if HAVE_RAW_DECL_UNSETENV +_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " + "use gnulib module unsetenv for portability"); +# endif #endif + #endif /* _GL_STDLIB_H */ #endif /* _GL_STDLIB_H */ #endif diff --git a/lib/streq.h b/lib/streq.h index 1b4b1c5..8791598 100644 --- a/lib/streq.h +++ b/lib/streq.h @@ -1,5 +1,5 @@ /* Optimized string comparison. - Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/striconveh.c b/lib/striconveh.c index b39a01f..ae10f3c 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -1,5 +1,5 @@ /* Character set conversion with error handling. - Copyright (C) 2001-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2010 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This program is free software: you can redistribute it and/or modify @@ -40,9 +40,98 @@ #if HAVE_ICONV -/* The caller must provide CD, CD1, CD2, not just CD, because when a conversion - error occurs, we may have to determine the Unicode representation of the - inconvertible character. */ +/* The caller must provide an iconveh_t, not just an iconv_t, because when a + conversion error occurs, we may have to determine the Unicode representation + of the inconvertible character. */ + +int +iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp) +{ + iconv_t cd; + iconv_t cd1; + iconv_t cd2; + + /* Avoid glibc-2.1 bug with EUC-KR. */ +# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION + if (c_strcasecmp (from_codeset, "EUC-KR") == 0 + || c_strcasecmp (to_codeset, "EUC-KR") == 0) + { + errno = EINVAL; + return -1; + } +# endif + + cd = iconv_open (to_codeset, from_codeset); + + if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)) + cd1 = (iconv_t)(-1); + else + { + cd1 = iconv_open ("UTF-8", from_codeset); + if (cd1 == (iconv_t)(-1)) + { + int saved_errno = errno; + if (cd != (iconv_t)(-1)) + iconv_close (cdp->cd); + errno = saved_errno; + return -1; + } + } + + if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 + || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 +# endif + ) + cd2 = (iconv_t)(-1); + else + { + cd2 = iconv_open (to_codeset, "UTF-8"); + if (cd2 == (iconv_t)(-1)) + { + int saved_errno = errno; + if (cd1 != (iconv_t)(-1)) + iconv_close (cd1); + if (cd != (iconv_t)(-1)) + iconv_close (cd); + errno = saved_errno; + return -1; + } + } + + cdp->cd = cd; + cdp->cd1 = cd1; + cdp->cd2 = cd2; + return 0; +} + +int +iconveh_close (const iconveh_t *cd) +{ + if (cd->cd2 != (iconv_t)(-1) && iconv_close (cd->cd2) < 0) + { + /* Return -1, but preserve the errno from iconv_close. */ + int saved_errno = errno; + if (cd->cd1 != (iconv_t)(-1)) + iconv_close (cd->cd1); + if (cd->cd != (iconv_t)(-1)) + iconv_close (cd->cd); + errno = saved_errno; + return -1; + } + if (cd->cd1 != (iconv_t)(-1) && iconv_close (cd->cd1) < 0) + { + /* Return -1, but preserve the errno from iconv_close. */ + int saved_errno = errno; + if (cd->cd != (iconv_t)(-1)) + iconv_close (cd->cd); + errno = saved_errno; + return -1; + } + if (cd->cd != (iconv_t)(-1) && iconv_close (cd->cd) < 0) + return -1; + return 0; +} /* iconv_carefully is like iconv, except that it stops as soon as it encounters a conversion error, and it returns in *INCREMENTED a boolean telling whether @@ -54,9 +143,9 @@ than doing a lossy conversion. */ static size_t iconv_carefully (iconv_t cd, - const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft, - bool *incremented) + const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft, + bool *incremented) { const char *inptr = *inbuf; const char *inptr_end = inptr + *inbytesleft; @@ -73,26 +162,26 @@ iconv_carefully (iconv_t cd, res = (size_t)(-1); for (insize = 1; inptr + insize <= inptr_end; insize++) - { - res = iconv (cd, - (ICONV_CONST char **) &inptr, &insize, - &outptr, &outsize); - if (!(res == (size_t)(-1) && errno == EINVAL)) - break; - /* iconv can eat up a shift sequence but give EINVAL while attempting - to convert the first character. E.g. libiconv does this. */ - if (inptr > inptr_before) - { - res = 0; - break; - } - } + { + res = iconv (cd, + (ICONV_CONST char **) &inptr, &insize, + &outptr, &outsize); + if (!(res == (size_t)(-1) && errno == EINVAL)) + break; + /* iconv can eat up a shift sequence but give EINVAL while attempting + to convert the first character. E.g. libiconv does this. */ + if (inptr > inptr_before) + { + res = 0; + break; + } + } if (res == 0) - { - *outbuf = outptr; - *outbytesleft = outsize; - } + { + *outbuf = outptr; + *outbytesleft = outsize; + } } while (res == 0 && inptr < inptr_end); @@ -101,9 +190,9 @@ iconv_carefully (iconv_t cd, if (res != (size_t)(-1) && res > 0) { /* iconv() has already incremented INPTR. We cannot go back to a - previous INPTR, otherwise the state inside CD would become invalid, - if FROM_CODESET is a stateful encoding. So, tell the caller that - *INBUF has already been incremented. */ + previous INPTR, otherwise the state inside CD would become invalid, + if FROM_CODESET is a stateful encoding. So, tell the caller that + *INBUF has already been incremented. */ *incremented = (inptr > inptr_before); errno = EILSEQ; return (size_t)(-1); @@ -124,9 +213,9 @@ iconv_carefully (iconv_t cd, converting one character or one shift sequence. */ static size_t iconv_carefully_1 (iconv_t cd, - const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft, - bool *incremented) + const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft, + bool *incremented) { const char *inptr_before = *inbuf; const char *inptr = inptr_before; @@ -140,17 +229,17 @@ iconv_carefully_1 (iconv_t cd, { inptr = inptr_before; res = iconv (cd, - (ICONV_CONST char **) &inptr, &insize, - &outptr, &outsize); + (ICONV_CONST char **) &inptr, &insize, + &outptr, &outsize); if (!(res == (size_t)(-1) && errno == EINVAL)) - break; + break; /* iconv can eat up a shift sequence but give EINVAL while attempting - to convert the first character. E.g. libiconv does this. */ + to convert the first character. E.g. libiconv does this. */ if (inptr > inptr_before) - { - res = 0; - break; - } + { + res = 0; + break; + } } *inbuf = inptr; @@ -163,9 +252,9 @@ iconv_carefully_1 (iconv_t cd, if (res != (size_t)(-1) && res > 0) { /* iconv() has already incremented INPTR. We cannot go back to a - previous INPTR, otherwise the state inside CD would become invalid, - if FROM_CODESET is a stateful encoding. So, tell the caller that - *INBUF has already been incremented. */ + previous INPTR, otherwise the state inside CD would become invalid, + if FROM_CODESET is a stateful encoding. So, tell the caller that + *INBUF has already been incremented. */ *incremented = (inptr > inptr_before); errno = EILSEQ; return (size_t)(-1); @@ -190,9 +279,9 @@ iconv_carefully_1 (iconv_t cd, character. */ static size_t utf8conv_carefully (bool one_character_only, - const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft, - bool *incremented) + const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft, + bool *incremented) { const char *inptr = *inbuf; size_t insize = *inbytesleft; @@ -209,39 +298,39 @@ utf8conv_carefully (bool one_character_only, n = u8_mbtoucr (&uc, (const uint8_t *) inptr, insize); if (n < 0) - { - errno = (n == -2 ? EINVAL : EILSEQ); - n = u8_mbtouc (&uc, (const uint8_t *) inptr, insize); - inptr += n; - insize -= n; - res = (size_t)(-1); - *incremented = true; - break; - } + { + errno = (n == -2 ? EINVAL : EILSEQ); + n = u8_mbtouc (&uc, (const uint8_t *) inptr, insize); + inptr += n; + insize -= n; + res = (size_t)(-1); + *incremented = true; + break; + } if (outsize == 0) - { - errno = E2BIG; - res = (size_t)(-1); - *incremented = false; - break; - } + { + errno = E2BIG; + res = (size_t)(-1); + *incremented = false; + break; + } m = u8_uctomb ((uint8_t *) outptr, uc, outsize); if (m == -2) - { - errno = E2BIG; - res = (size_t)(-1); - *incremented = false; - break; - } + { + errno = E2BIG; + res = (size_t)(-1); + *incremented = false; + break; + } inptr += n; insize -= n; if (m == -1) - { - errno = EILSEQ; - res = (size_t)(-1); - *incremented = true; - break; - } + { + errno = EILSEQ; + res = (size_t)(-1); + *incremented = true; + break; + } outptr += m; outsize -= m; } @@ -256,11 +345,11 @@ utf8conv_carefully (bool one_character_only, static int mem_cd_iconveh_internal (const char *src, size_t srclen, - iconv_t cd, iconv_t cd1, iconv_t cd2, - enum iconv_ilseq_handler handler, - size_t extra_alloc, - size_t *offsets, - char **resultp, size_t *lengthp) + iconv_t cd, iconv_t cd1, iconv_t cd2, + enum iconv_ilseq_handler handler, + size_t extra_alloc, + size_t *offsets, + char **resultp, size_t *lengthp) { /* When a conversion error occurs, we cannot start using CD1 and CD2 at this point: FROM_CODESET may be a stateful encoding like ISO-2022-KR. @@ -300,7 +389,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, size_t i; for (i = 0; i < srclen; i++) - offsets[i] = (size_t)(-1); + offsets[i] = (size_t)(-1); last_length = (size_t)(-1); } @@ -321,121 +410,121 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, while (insize > 0) { - char *outptr = result + length; - size_t outsize = allocated - extra_alloc - length; - bool incremented; - size_t res; - bool grow; - - if (offsets != NULL) - { - if (length != last_length) /* ensure that offset[] be increasing */ - { - offsets[inptr - src] = length; - last_length = length; - } - res = iconv_carefully_1 (cd, - &inptr, &insize, - &outptr, &outsize, - &incremented); - } - else - /* Use iconv_carefully instead of iconv here, because: - - If TO_CODESET is UTF-8, we can do the error handling in this - loop, no need for a second loop, - - With iconv() implementations other than GNU libiconv and GNU - libc, if we use iconv() in a big swoop, checking for an E2BIG - return, we lose the number of irreversible conversions. */ - res = iconv_carefully (cd, - &inptr, &insize, - &outptr, &outsize, - &incremented); - - length = outptr - result; - grow = (length + extra_alloc > allocated / 2); - if (res == (size_t)(-1)) - { - if (errno == E2BIG) - grow = true; - else if (errno == EINVAL) - break; - else if (errno == EILSEQ && handler != iconveh_error) - { - if (cd2 == (iconv_t)(-1)) - { - /* TO_CODESET is UTF-8. */ - /* Error handling can produce up to 1 byte of output. */ - if (length + 1 + extra_alloc > allocated) - { - char *memory; - - allocated = 2 * allocated; - if (length + 1 + extra_alloc > allocated) - abort (); - if (result == initial_result) - memory = (char *) malloc (allocated); - else - memory = (char *) realloc (result, allocated); - if (memory == NULL) - { - if (result != initial_result) - free (result); - errno = ENOMEM; - return -1; - } - if (result == initial_result) - memcpy (memory, initial_result, length); - result = memory; - grow = false; - } - /* The input is invalid in FROM_CODESET. Eat up one byte - and emit a question mark. */ - if (!incremented) - { - if (insize == 0) - abort (); - inptr++; - insize--; - } - result[length] = '?'; - length++; - } - else - goto indirectly; - } - else - { - if (result != initial_result) - { - int saved_errno = errno; - free (result); - errno = saved_errno; - } - return -1; - } - } - if (insize == 0) - break; - if (grow) - { - char *memory; - - allocated = 2 * allocated; - if (result == initial_result) - memory = (char *) malloc (allocated); - else - memory = (char *) realloc (result, allocated); - if (memory == NULL) - { - if (result != initial_result) - free (result); - errno = ENOMEM; - return -1; - } - if (result == initial_result) - memcpy (memory, initial_result, length); - result = memory; - } + char *outptr = result + length; + size_t outsize = allocated - extra_alloc - length; + bool incremented; + size_t res; + bool grow; + + if (offsets != NULL) + { + if (length != last_length) /* ensure that offset[] be increasing */ + { + offsets[inptr - src] = length; + last_length = length; + } + res = iconv_carefully_1 (cd, + &inptr, &insize, + &outptr, &outsize, + &incremented); + } + else + /* Use iconv_carefully instead of iconv here, because: + - If TO_CODESET is UTF-8, we can do the error handling in this + loop, no need for a second loop, + - With iconv() implementations other than GNU libiconv and GNU + libc, if we use iconv() in a big swoop, checking for an E2BIG + return, we lose the number of irreversible conversions. */ + res = iconv_carefully (cd, + &inptr, &insize, + &outptr, &outsize, + &incremented); + + length = outptr - result; + grow = (length + extra_alloc > allocated / 2); + if (res == (size_t)(-1)) + { + if (errno == E2BIG) + grow = true; + else if (errno == EINVAL) + break; + else if (errno == EILSEQ && handler != iconveh_error) + { + if (cd2 == (iconv_t)(-1)) + { + /* TO_CODESET is UTF-8. */ + /* Error handling can produce up to 1 byte of output. */ + if (length + 1 + extra_alloc > allocated) + { + char *memory; + + allocated = 2 * allocated; + if (length + 1 + extra_alloc > allocated) + abort (); + if (result == initial_result) + memory = (char *) malloc (allocated); + else + memory = (char *) realloc (result, allocated); + if (memory == NULL) + { + if (result != initial_result) + free (result); + errno = ENOMEM; + return -1; + } + if (result == initial_result) + memcpy (memory, initial_result, length); + result = memory; + grow = false; + } + /* The input is invalid in FROM_CODESET. Eat up one byte + and emit a question mark. */ + if (!incremented) + { + if (insize == 0) + abort (); + inptr++; + insize--; + } + result[length] = '?'; + length++; + } + else + goto indirectly; + } + else + { + if (result != initial_result) + { + int saved_errno = errno; + free (result); + errno = saved_errno; + } + return -1; + } + } + if (insize == 0) + break; + if (grow) + { + char *memory; + + allocated = 2 * allocated; + if (result == initial_result) + memory = (char *) malloc (allocated); + else + memory = (char *) realloc (result, allocated); + if (memory == NULL) + { + if (result != initial_result) + free (result); + errno = ENOMEM; + return -1; + } + if (result == initial_result) + memcpy (memory, initial_result, length); + result = memory; + } } } @@ -452,40 +541,40 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, res = iconv (cd, NULL, NULL, &outptr, &outsize); length = outptr - result; if (res == (size_t)(-1)) - { - if (errno == E2BIG) - { - char *memory; - - allocated = 2 * allocated; - if (result == initial_result) - memory = (char *) malloc (allocated); - else - memory = (char *) realloc (result, allocated); - if (memory == NULL) - { - if (result != initial_result) - free (result); - errno = ENOMEM; - return -1; - } - if (result == initial_result) - memcpy (memory, initial_result, length); - result = memory; - } - else - { - if (result != initial_result) - { - int saved_errno = errno; - free (result); - errno = saved_errno; - } - return -1; - } - } + { + if (errno == E2BIG) + { + char *memory; + + allocated = 2 * allocated; + if (result == initial_result) + memory = (char *) malloc (allocated); + else + memory = (char *) realloc (result, allocated); + if (memory == NULL) + { + if (result != initial_result) + free (result); + errno = ENOMEM; + return -1; + } + if (result == initial_result) + memcpy (memory, initial_result, length); + result = memory; + } + else + { + if (result != initial_result) + { + int saved_errno = errno; + free (result); + errno = saved_errno; + } + return -1; + } + } else - break; + break; } #endif @@ -500,7 +589,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, size_t i; for (i = 0; i < srclen; i++) - offsets[i] = (size_t)(-1); + offsets[i] = (size_t)(-1); last_length = (size_t)(-1); } @@ -527,350 +616,351 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, while (in1size > 0 || do_final_flush1 || utf8len > 0 || do_final_flush2) { - char *out1ptr = utf8buf + utf8len; - size_t out1size = utf8bufsize - utf8len; - bool incremented1; - size_t res1; - int errno1; - - /* Conversion step 1: from FROM_CODESET to UTF-8. */ - if (in1size > 0) - { - if (offsets != NULL - && length != last_length) /* ensure that offset[] be increasing */ - { - offsets[in1ptr - src] = length; - last_length = length; - } - if (cd1 != (iconv_t)(-1)) - { - if (slowly) - res1 = iconv_carefully_1 (cd1, - &in1ptr, &in1size, - &out1ptr, &out1size, - &incremented1); - else - res1 = iconv_carefully (cd1, - &in1ptr, &in1size, - &out1ptr, &out1size, - &incremented1); - } - else - { - /* FROM_CODESET is UTF-8. */ - res1 = utf8conv_carefully (slowly, - &in1ptr, &in1size, - &out1ptr, &out1size, - &incremented1); - } - } - else if (do_final_flush1) - { - /* Now get the conversion state of CD1 back to the initial state. - But avoid glibc-2.1 bug and Solaris 2.7 bug. */ + char *out1ptr = utf8buf + utf8len; + size_t out1size = utf8bufsize - utf8len; + bool incremented1; + size_t res1; + int errno1; + + /* Conversion step 1: from FROM_CODESET to UTF-8. */ + if (in1size > 0) + { + if (offsets != NULL + && length != last_length) /* ensure that offset[] be increasing */ + { + offsets[in1ptr - src] = length; + last_length = length; + } + if (cd1 != (iconv_t)(-1)) + { + if (slowly) + res1 = iconv_carefully_1 (cd1, + &in1ptr, &in1size, + &out1ptr, &out1size, + &incremented1); + else + res1 = iconv_carefully (cd1, + &in1ptr, &in1size, + &out1ptr, &out1size, + &incremented1); + } + else + { + /* FROM_CODESET is UTF-8. */ + res1 = utf8conv_carefully (slowly, + &in1ptr, &in1size, + &out1ptr, &out1size, + &incremented1); + } + } + else if (do_final_flush1) + { + /* Now get the conversion state of CD1 back to the initial state. + But avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) - if (cd1 != (iconv_t)(-1)) - res1 = iconv (cd1, NULL, NULL, &out1ptr, &out1size); - else + if (cd1 != (iconv_t)(-1)) + res1 = iconv (cd1, NULL, NULL, &out1ptr, &out1size); + else # endif - res1 = 0; - do_final_flush1 = false; - incremented1 = true; - } - else - { - res1 = 0; - incremented1 = true; - } - if (res1 == (size_t)(-1) - && !(errno == E2BIG || errno == EINVAL || errno == EILSEQ)) - { - if (result != initial_result) - { - int saved_errno = errno; - free (result); - errno = saved_errno; - } - return -1; - } - if (res1 == (size_t)(-1) - && errno == EILSEQ && handler != iconveh_error) - { - /* The input is invalid in FROM_CODESET. Eat up one byte and - emit a question mark. Room for the question mark was allocated - at the end of utf8buf. */ - if (!incremented1) - { - if (in1size == 0) - abort (); - in1ptr++; - in1size--; - } - utf8buf[utf8len++] = '?'; - } - errno1 = errno; - utf8len = out1ptr - utf8buf; - - if (offsets != NULL - || in1size == 0 - || utf8len > utf8bufsize / 2 - || (res1 == (size_t)(-1) && errno1 == E2BIG)) - { - /* Conversion step 2: from UTF-8 to TO_CODESET. */ - const char *in2ptr = utf8buf; - size_t in2size = utf8len; - - while (in2size > 0 - || (in1size == 0 && !do_final_flush1 && do_final_flush2)) - { - char *out2ptr = result + length; - size_t out2size = allocated - extra_alloc - length; - bool incremented2; - size_t res2; - bool grow; - - if (in2size > 0) - { - if (cd2 != (iconv_t)(-1)) - res2 = iconv_carefully (cd2, - &in2ptr, &in2size, - &out2ptr, &out2size, - &incremented2); - else - /* TO_CODESET is UTF-8. */ - res2 = utf8conv_carefully (false, - &in2ptr, &in2size, - &out2ptr, &out2size, - &incremented2); - } - else /* in1size == 0 && !do_final_flush1 - && in2size == 0 && do_final_flush2 */ - { - /* Now get the conversion state of CD1 back to the initial - state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */ + res1 = 0; + do_final_flush1 = false; + incremented1 = true; + } + else + { + res1 = 0; + incremented1 = true; + } + if (res1 == (size_t)(-1) + && !(errno == E2BIG || errno == EINVAL || errno == EILSEQ)) + { + if (result != initial_result) + { + int saved_errno = errno; + free (result); + errno = saved_errno; + } + return -1; + } + if (res1 == (size_t)(-1) + && errno == EILSEQ && handler != iconveh_error) + { + /* The input is invalid in FROM_CODESET. Eat up one byte and + emit a question mark. Room for the question mark was allocated + at the end of utf8buf. */ + if (!incremented1) + { + if (in1size == 0) + abort (); + in1ptr++; + in1size--; + } + *out1ptr++ = '?'; + res1 = 0; + } + errno1 = errno; + utf8len = out1ptr - utf8buf; + + if (offsets != NULL + || in1size == 0 + || utf8len > utf8bufsize / 2 + || (res1 == (size_t)(-1) && errno1 == E2BIG)) + { + /* Conversion step 2: from UTF-8 to TO_CODESET. */ + const char *in2ptr = utf8buf; + size_t in2size = utf8len; + + while (in2size > 0 + || (in1size == 0 && !do_final_flush1 && do_final_flush2)) + { + char *out2ptr = result + length; + size_t out2size = allocated - extra_alloc - length; + bool incremented2; + size_t res2; + bool grow; + + if (in2size > 0) + { + if (cd2 != (iconv_t)(-1)) + res2 = iconv_carefully (cd2, + &in2ptr, &in2size, + &out2ptr, &out2size, + &incremented2); + else + /* TO_CODESET is UTF-8. */ + res2 = utf8conv_carefully (false, + &in2ptr, &in2size, + &out2ptr, &out2size, + &incremented2); + } + else /* in1size == 0 && !do_final_flush1 + && in2size == 0 && do_final_flush2 */ + { + /* Now get the conversion state of CD1 back to the initial + state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) - if (cd2 != (iconv_t)(-1)) - res2 = iconv (cd2, NULL, NULL, &out2ptr, &out2size); - else + if (cd2 != (iconv_t)(-1)) + res2 = iconv (cd2, NULL, NULL, &out2ptr, &out2size); + else # endif - res2 = 0; - do_final_flush2 = false; - incremented2 = true; - } - - length = out2ptr - result; - grow = (length + extra_alloc > allocated / 2); - if (res2 == (size_t)(-1)) - { - if (errno == E2BIG) - grow = true; - else if (errno == EINVAL) - break; - else if (errno == EILSEQ && handler != iconveh_error) - { - /* Error handling can produce up to 10 bytes of ASCII - output. But TO_CODESET may be UCS-2, UTF-16 or - UCS-4, so use CD2 here as well. */ - char scratchbuf[10]; - size_t scratchlen; - ucs4_t uc; - const char *inptr; - size_t insize; - size_t res; - - if (incremented2) - { - if (u8_prev (&uc, (const uint8_t *) in2ptr, - (const uint8_t *) utf8buf) - == NULL) - abort (); - } - else - { - int n; - if (in2size == 0) - abort (); - n = u8_mbtouc_unsafe (&uc, (const uint8_t *) in2ptr, - in2size); - in2ptr += n; - in2size -= n; - } - - if (handler == iconveh_escape_sequence) - { - static char hex[16] = "0123456789ABCDEF"; - scratchlen = 0; - scratchbuf[scratchlen++] = '\\'; - if (uc < 0x10000) - scratchbuf[scratchlen++] = 'u'; - else - { - scratchbuf[scratchlen++] = 'U'; - scratchbuf[scratchlen++] = hex[(uc>>28) & 15]; - scratchbuf[scratchlen++] = hex[(uc>>24) & 15]; - scratchbuf[scratchlen++] = hex[(uc>>20) & 15]; - scratchbuf[scratchlen++] = hex[(uc>>16) & 15]; - } - scratchbuf[scratchlen++] = hex[(uc>>12) & 15]; - scratchbuf[scratchlen++] = hex[(uc>>8) & 15]; - scratchbuf[scratchlen++] = hex[(uc>>4) & 15]; - scratchbuf[scratchlen++] = hex[uc & 15]; - } - else - { - scratchbuf[0] = '?'; - scratchlen = 1; - } - - inptr = scratchbuf; - insize = scratchlen; - if (cd2 != (iconv_t)(-1)) - res = iconv (cd2, - (ICONV_CONST char **) &inptr, &insize, - &out2ptr, &out2size); - else - { - /* TO_CODESET is UTF-8. */ - if (out2size >= insize) - { - memcpy (out2ptr, inptr, insize); - out2ptr += insize; - out2size -= insize; - inptr += insize; - insize = 0; - res = 0; - } - else - { - errno = E2BIG; - res = (size_t)(-1); - } - } - length = out2ptr - result; - if (res == (size_t)(-1) && errno == E2BIG) - { - char *memory; - - allocated = 2 * allocated; - if (length + 1 + extra_alloc > allocated) - abort (); - if (result == initial_result) - memory = (char *) malloc (allocated); - else - memory = (char *) realloc (result, allocated); - if (memory == NULL) - { - if (result != initial_result) - free (result); - errno = ENOMEM; - return -1; - } - if (result == initial_result) - memcpy (memory, initial_result, length); - result = memory; - grow = false; - - out2ptr = result + length; - out2size = allocated - extra_alloc - length; - if (cd2 != (iconv_t)(-1)) - res = iconv (cd2, - (ICONV_CONST char **) &inptr, - &insize, - &out2ptr, &out2size); - else - { - /* TO_CODESET is UTF-8. */ - if (!(out2size >= insize)) - abort (); - memcpy (out2ptr, inptr, insize); - out2ptr += insize; - out2size -= insize; - inptr += insize; - insize = 0; - res = 0; - } - length = out2ptr - result; - } + res2 = 0; + do_final_flush2 = false; + incremented2 = true; + } + + length = out2ptr - result; + grow = (length + extra_alloc > allocated / 2); + if (res2 == (size_t)(-1)) + { + if (errno == E2BIG) + grow = true; + else if (errno == EINVAL) + break; + else if (errno == EILSEQ && handler != iconveh_error) + { + /* Error handling can produce up to 10 bytes of ASCII + output. But TO_CODESET may be UCS-2, UTF-16 or + UCS-4, so use CD2 here as well. */ + char scratchbuf[10]; + size_t scratchlen; + ucs4_t uc; + const char *inptr; + size_t insize; + size_t res; + + if (incremented2) + { + if (u8_prev (&uc, (const uint8_t *) in2ptr, + (const uint8_t *) utf8buf) + == NULL) + abort (); + } + else + { + int n; + if (in2size == 0) + abort (); + n = u8_mbtouc_unsafe (&uc, (const uint8_t *) in2ptr, + in2size); + in2ptr += n; + in2size -= n; + } + + if (handler == iconveh_escape_sequence) + { + static char hex[16] = "0123456789ABCDEF"; + scratchlen = 0; + scratchbuf[scratchlen++] = '\\'; + if (uc < 0x10000) + scratchbuf[scratchlen++] = 'u'; + else + { + scratchbuf[scratchlen++] = 'U'; + scratchbuf[scratchlen++] = hex[(uc>>28) & 15]; + scratchbuf[scratchlen++] = hex[(uc>>24) & 15]; + scratchbuf[scratchlen++] = hex[(uc>>20) & 15]; + scratchbuf[scratchlen++] = hex[(uc>>16) & 15]; + } + scratchbuf[scratchlen++] = hex[(uc>>12) & 15]; + scratchbuf[scratchlen++] = hex[(uc>>8) & 15]; + scratchbuf[scratchlen++] = hex[(uc>>4) & 15]; + scratchbuf[scratchlen++] = hex[uc & 15]; + } + else + { + scratchbuf[0] = '?'; + scratchlen = 1; + } + + inptr = scratchbuf; + insize = scratchlen; + if (cd2 != (iconv_t)(-1)) + res = iconv (cd2, + (ICONV_CONST char **) &inptr, &insize, + &out2ptr, &out2size); + else + { + /* TO_CODESET is UTF-8. */ + if (out2size >= insize) + { + memcpy (out2ptr, inptr, insize); + out2ptr += insize; + out2size -= insize; + inptr += insize; + insize = 0; + res = 0; + } + else + { + errno = E2BIG; + res = (size_t)(-1); + } + } + length = out2ptr - result; + if (res == (size_t)(-1) && errno == E2BIG) + { + char *memory; + + allocated = 2 * allocated; + if (length + 1 + extra_alloc > allocated) + abort (); + if (result == initial_result) + memory = (char *) malloc (allocated); + else + memory = (char *) realloc (result, allocated); + if (memory == NULL) + { + if (result != initial_result) + free (result); + errno = ENOMEM; + return -1; + } + if (result == initial_result) + memcpy (memory, initial_result, length); + result = memory; + grow = false; + + out2ptr = result + length; + out2size = allocated - extra_alloc - length; + if (cd2 != (iconv_t)(-1)) + res = iconv (cd2, + (ICONV_CONST char **) &inptr, + &insize, + &out2ptr, &out2size); + else + { + /* TO_CODESET is UTF-8. */ + if (!(out2size >= insize)) + abort (); + memcpy (out2ptr, inptr, insize); + out2ptr += insize; + out2size -= insize; + inptr += insize; + insize = 0; + res = 0; + } + length = out2ptr - result; + } # if !defined _LIBICONV_VERSION && !defined __GLIBC__ - /* Irix iconv() inserts a NUL byte if it cannot convert. - NetBSD iconv() inserts a question mark if it cannot - convert. - Only GNU libiconv and GNU libc are known to prefer - to fail rather than doing a lossy conversion. */ - if (res != (size_t)(-1) && res > 0) - { - errno = EILSEQ; - res = (size_t)(-1); - } + /* Irix iconv() inserts a NUL byte if it cannot convert. + NetBSD iconv() inserts a question mark if it cannot + convert. + Only GNU libiconv and GNU libc are known to prefer + to fail rather than doing a lossy conversion. */ + if (res != (size_t)(-1) && res > 0) + { + errno = EILSEQ; + res = (size_t)(-1); + } # endif - if (res == (size_t)(-1)) - { - /* Failure converting the ASCII replacement. */ - if (result != initial_result) - { - int saved_errno = errno; - free (result); - errno = saved_errno; - } - return -1; - } - } - else - { - if (result != initial_result) - { - int saved_errno = errno; - free (result); - errno = saved_errno; - } - return -1; - } - } - if (!(in2size > 0 - || (in1size == 0 && !do_final_flush1 && do_final_flush2))) - break; - if (grow) - { - char *memory; - - allocated = 2 * allocated; - if (result == initial_result) - memory = (char *) malloc (allocated); - else - memory = (char *) realloc (result, allocated); - if (memory == NULL) - { - if (result != initial_result) - free (result); - errno = ENOMEM; - return -1; - } - if (result == initial_result) - memcpy (memory, initial_result, length); - result = memory; - } - } - - /* Move the remaining bytes to the beginning of utf8buf. */ - if (in2size > 0) - memmove (utf8buf, in2ptr, in2size); - utf8len = in2size; - } - - if (res1 == (size_t)(-1)) - { - if (errno1 == EINVAL) - in1size = 0; - else if (errno1 == EILSEQ) - { - if (result != initial_result) - free (result); - errno = errno1; - return -1; - } - } + if (res == (size_t)(-1)) + { + /* Failure converting the ASCII replacement. */ + if (result != initial_result) + { + int saved_errno = errno; + free (result); + errno = saved_errno; + } + return -1; + } + } + else + { + if (result != initial_result) + { + int saved_errno = errno; + free (result); + errno = saved_errno; + } + return -1; + } + } + if (!(in2size > 0 + || (in1size == 0 && !do_final_flush1 && do_final_flush2))) + break; + if (grow) + { + char *memory; + + allocated = 2 * allocated; + if (result == initial_result) + memory = (char *) malloc (allocated); + else + memory = (char *) realloc (result, allocated); + if (memory == NULL) + { + if (result != initial_result) + free (result); + errno = ENOMEM; + return -1; + } + if (result == initial_result) + memcpy (memory, initial_result, length); + result = memory; + } + } + + /* Move the remaining bytes to the beginning of utf8buf. */ + if (in2size > 0) + memmove (utf8buf, in2ptr, in2size); + utf8len = in2size; + } + + if (res1 == (size_t)(-1)) + { + if (errno1 == EINVAL) + in1size = 0; + else if (errno1 == EILSEQ) + { + if (result != initial_result) + free (result); + errno = errno1; + return -1; + } + } } # undef utf8bufsize } @@ -884,14 +974,14 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, memory = (char *) malloc (memsize > 0 ? memsize : 1); if (memory != NULL) - { - memcpy (memory, tmpbuf, length); - result = memory; - } + { + memcpy (memory, tmpbuf, length); + result = memory; + } else - { - errno = ENOMEM; - return -1; + { + errno = ENOMEM; + return -1; } } else if (result != *resultp && length + extra_alloc < allocated) @@ -902,7 +992,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, memory = (char *) realloc (result, memsize > 0 ? memsize : 1); if (memory != NULL) - result = memory; + result = memory; } *resultp = result; *lengthp = length; @@ -913,19 +1003,19 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, int mem_cd_iconveh (const char *src, size_t srclen, - iconv_t cd, iconv_t cd1, iconv_t cd2, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp) + const iconveh_t *cd, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp) { - return mem_cd_iconveh_internal (src, srclen, cd, cd1, cd2, handler, 0, - offsets, resultp, lengthp); + return mem_cd_iconveh_internal (src, srclen, cd->cd, cd->cd1, cd->cd2, + handler, 0, offsets, resultp, lengthp); } char * str_cd_iconveh (const char *src, - iconv_t cd, iconv_t cd1, iconv_t cd2, - enum iconv_ilseq_handler handler) + const iconveh_t *cd, + enum iconv_ilseq_handler handler) { /* For most encodings, a trailing NUL byte in the input will be converted to a trailing NUL byte in the output. But not for UTF-7. So that this @@ -934,17 +1024,17 @@ str_cd_iconveh (const char *src, char *result = NULL; size_t length = 0; int retval = mem_cd_iconveh_internal (src, strlen (src), - cd, cd1, cd2, handler, 1, NULL, - &result, &length); + cd->cd, cd->cd1, cd->cd2, handler, 1, + NULL, &result, &length); if (retval < 0) { if (result != NULL) - { - int saved_errno = errno; - free (result); - errno = saved_errno; - } + { + int saved_errno = errno; + free (result); + errno = saved_errno; + } return NULL; } @@ -958,10 +1048,10 @@ str_cd_iconveh (const char *src, int mem_iconveh (const char *src, size_t srclen, - const char *from_codeset, const char *to_codeset, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp) + const char *from_codeset, const char *to_codeset, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp) { if (srclen == 0) { @@ -974,16 +1064,16 @@ mem_iconveh (const char *src, size_t srclen, char *result; if (*resultp != NULL && *lengthp >= srclen) - result = *resultp; + result = *resultp; else - { - result = (char *) malloc (srclen); - if (result == NULL) - { - errno = ENOMEM; - return -1; - } - } + { + result = (char *) malloc (srclen); + if (result == NULL) + { + errno = ENOMEM; + return -1; + } + } memcpy (result, src, srclen); *resultp = result; *lengthp = srclen; @@ -992,126 +1082,48 @@ mem_iconveh (const char *src, size_t srclen, else { #if HAVE_ICONV - iconv_t cd; - iconv_t cd1; - iconv_t cd2; + iconveh_t cd; char *result; size_t length; int retval; - /* Avoid glibc-2.1 bug with EUC-KR. */ -# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION - if (c_strcasecmp (from_codeset, "EUC-KR") == 0 - || c_strcasecmp (to_codeset, "EUC-KR") == 0) - { - errno = EINVAL; - return -1; - } -# endif - - cd = iconv_open (to_codeset, from_codeset); - - if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)) - cd1 = (iconv_t)(-1); - else - { - cd1 = iconv_open ("UTF-8", from_codeset); - if (cd1 == (iconv_t)(-1)) - { - int saved_errno = errno; - if (cd != (iconv_t)(-1)) - iconv_close (cd); - errno = saved_errno; - return -1; - } - } - - if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 - || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 -# endif - ) - cd2 = (iconv_t)(-1); - else - { - cd2 = iconv_open (to_codeset, "UTF-8"); - if (cd2 == (iconv_t)(-1)) - { - int saved_errno = errno; - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd != (iconv_t)(-1)) - iconv_close (cd); - errno = saved_errno; - return -1; - } - } + if (iconveh_open (to_codeset, from_codeset, &cd) < 0) + return -1; result = *resultp; length = *lengthp; - retval = mem_cd_iconveh (src, srclen, cd, cd1, cd2, handler, offsets, - &result, &length); + retval = mem_cd_iconveh (src, srclen, &cd, handler, offsets, + &result, &length); if (retval < 0) - { - /* Close cd, cd1, cd2, but preserve the errno from str_cd_iconv. */ - int saved_errno = errno; - if (cd2 != (iconv_t)(-1)) - iconv_close (cd2); - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd != (iconv_t)(-1)) - iconv_close (cd); - errno = saved_errno; - } + { + /* Close cd, but preserve the errno from str_cd_iconv. */ + int saved_errno = errno; + iconveh_close (&cd); + errno = saved_errno; + } else - { - if (cd2 != (iconv_t)(-1) && iconv_close (cd2) < 0) - { - /* Return -1, but free the allocated memory, and while doing - that, preserve the errno from iconv_close. */ - int saved_errno = errno; - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd != (iconv_t)(-1)) - iconv_close (cd); - if (result != *resultp && result != NULL) - free (result); - errno = saved_errno; - return -1; - } - if (cd1 != (iconv_t)(-1) && iconv_close (cd1) < 0) - { - /* Return -1, but free the allocated memory, and while doing - that, preserve the errno from iconv_close. */ - int saved_errno = errno; - if (cd != (iconv_t)(-1)) - iconv_close (cd); - if (result != *resultp && result != NULL) - free (result); - errno = saved_errno; - return -1; - } - if (cd != (iconv_t)(-1) && iconv_close (cd) < 0) - { - /* Return -1, but free the allocated memory, and while doing - that, preserve the errno from iconv_close. */ - int saved_errno = errno; - if (result != *resultp && result != NULL) - free (result); - errno = saved_errno; - return -1; - } - *resultp = result; - *lengthp = length; - } + { + if (iconveh_close (&cd) < 0) + { + /* Return -1, but free the allocated memory, and while doing + that, preserve the errno from iconveh_close. */ + int saved_errno = errno; + if (result != *resultp && result != NULL) + free (result); + errno = saved_errno; + return -1; + } + *resultp = result; + *lengthp = length; + } return retval; #else /* This is a different error code than if iconv_open existed but didn't - support from_codeset and to_codeset, so that the caller can emit - an error message such as - "iconv() is not supported. Installing GNU libiconv and - then reinstalling this package would fix this." */ + support from_codeset and to_codeset, so that the caller can emit + an error message such as + "iconv() is not supported. Installing GNU libiconv and + then reinstalling this package would fix this." */ errno = ENOSYS; return -1; #endif @@ -1120,130 +1132,54 @@ mem_iconveh (const char *src, size_t srclen, char * str_iconveh (const char *src, - const char *from_codeset, const char *to_codeset, - enum iconv_ilseq_handler handler) + const char *from_codeset, const char *to_codeset, + enum iconv_ilseq_handler handler) { if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0) { char *result = strdup (src); if (result == NULL) - errno = ENOMEM; + errno = ENOMEM; return result; } else { #if HAVE_ICONV - iconv_t cd; - iconv_t cd1; - iconv_t cd2; + iconveh_t cd; char *result; - /* Avoid glibc-2.1 bug with EUC-KR. */ -# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION - if (c_strcasecmp (from_codeset, "EUC-KR") == 0 - || c_strcasecmp (to_codeset, "EUC-KR") == 0) - { - errno = EINVAL; - return NULL; - } -# endif - - cd = iconv_open (to_codeset, from_codeset); + if (iconveh_open (to_codeset, from_codeset, &cd) < 0) + return NULL; - if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)) - cd1 = (iconv_t)(-1); - else - { - cd1 = iconv_open ("UTF-8", from_codeset); - if (cd1 == (iconv_t)(-1)) - { - int saved_errno = errno; - if (cd != (iconv_t)(-1)) - iconv_close (cd); - errno = saved_errno; - return NULL; - } - } - - if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 - || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 -# endif - ) - cd2 = (iconv_t)(-1); - else - { - cd2 = iconv_open (to_codeset, "UTF-8"); - if (cd2 == (iconv_t)(-1)) - { - int saved_errno = errno; - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd != (iconv_t)(-1)) - iconv_close (cd); - errno = saved_errno; - return NULL; - } - } - - result = str_cd_iconveh (src, cd, cd1, cd2, handler); + result = str_cd_iconveh (src, &cd, handler); if (result == NULL) - { - /* Close cd, cd1, cd2, but preserve the errno from str_cd_iconv. */ - int saved_errno = errno; - if (cd2 != (iconv_t)(-1)) - iconv_close (cd2); - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd != (iconv_t)(-1)) - iconv_close (cd); - errno = saved_errno; - } + { + /* Close cd, but preserve the errno from str_cd_iconv. */ + int saved_errno = errno; + iconveh_close (&cd); + errno = saved_errno; + } else - { - if (cd2 != (iconv_t)(-1) && iconv_close (cd2) < 0) - { - /* Return NULL, but free the allocated memory, and while doing - that, preserve the errno from iconv_close. */ - int saved_errno = errno; - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd != (iconv_t)(-1)) - iconv_close (cd); - free (result); - errno = saved_errno; - return NULL; - } - if (cd1 != (iconv_t)(-1) && iconv_close (cd1) < 0) - { - /* Return NULL, but free the allocated memory, and while doing - that, preserve the errno from iconv_close. */ - int saved_errno = errno; - if (cd != (iconv_t)(-1)) - iconv_close (cd); - free (result); - errno = saved_errno; - return NULL; - } - if (cd != (iconv_t)(-1) && iconv_close (cd) < 0) - { - /* Return NULL, but free the allocated memory, and while doing - that, preserve the errno from iconv_close. */ - int saved_errno = errno; - free (result); - errno = saved_errno; - return NULL; - } - } + { + if (iconveh_close (&cd) < 0) + { + /* Return NULL, but free the allocated memory, and while doing + that, preserve the errno from iconveh_close. */ + int saved_errno = errno; + free (result); + errno = saved_errno; + return NULL; + } + } return result; #else /* This is a different error code than if iconv_open existed but didn't - support from_codeset and to_codeset, so that the caller can emit - an error message such as - "iconv() is not supported. Installing GNU libiconv and - then reinstalling this package would fix this." */ + support from_codeset and to_codeset, so that the caller can emit + an error message such as + "iconv() is not supported. Installing GNU libiconv and + then reinstalling this package would fix this." */ errno = ENOSYS; return NULL; #endif diff --git a/lib/striconveh.h b/lib/striconveh.h index 98b4d0c..dc92cea 100644 --- a/lib/striconveh.h +++ b/lib/striconveh.h @@ -1,5 +1,5 @@ /* Character set conversion with error handling. - Copyright (C) 2001-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This program is free software: you can redistribute it and/or modify @@ -33,14 +33,38 @@ extern "C" { #if HAVE_ICONV +/* An conversion descriptor for use by the iconveh functions. */ +typedef struct + { + /* Conversion descriptor from FROM_CODESET to TO_CODESET, or (iconv_t)(-1) + if the system does not support a direct conversion from FROM_CODESET to + TO_CODESET. */ + iconv_t cd; + /* Conversion descriptor from FROM_CODESET to UTF-8 (or (iconv_t)(-1) if + FROM_CODESET is UTF-8). */ + iconv_t cd1; + /* Conversion descriptor from UTF-8 to TO_CODESET (or (iconv_t)(-1) if + TO_CODESET is UTF-8). */ + iconv_t cd2; + } + iconveh_t; + +/* Open a conversion descriptor for use by the iconveh functions. + If successful, fills *CDP and returns 0. Upon failure, return -1 with errno + set. */ +extern int + iconveh_open (const char *to_codeset, const char *from_codeset, + iconveh_t *cdp); + +/* Close a conversion descriptor created by iconveh_open(). + Return value: 0 if successful, otherwise -1 and errno set. */ +extern int + iconveh_close (const iconveh_t *cd); + /* Convert an entire string from one encoding to another, using iconv. The original string is at [SRC,...,SRC+SRCLEN-1]. - CD is the conversion descriptor from FROMCODE to TOCODE, or (iconv_t)(-1) if - the system does not support a direct conversion from FROMCODE to TOCODE. - CD1 is the conversion descriptor from FROM_CODESET to UTF-8 (or - (iconv_t)(-1) if FROM_CODESET is UTF-8). - CD2 is the conversion descriptor from UTF-8 to TO_CODESET (or (iconv_t)(-1) - if TO_CODESET is UTF-8). + CD points to the conversion descriptor from FROMCODE to TOCODE, created by + the function iconveh_open(). If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this array is filled with offsets into the result, i.e. the character starting at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]], @@ -54,28 +78,24 @@ extern "C" { unchanged if no dynamic memory allocation was necessary. */ extern int mem_cd_iconveh (const char *src, size_t srclen, - iconv_t cd, iconv_t cd1, iconv_t cd2, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp); + const iconveh_t *cd, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. - CD is the conversion descriptor from FROMCODE to TOCODE, or (iconv_t)(-1) if - the system does not support a direct conversion from FROMCODE to TOCODE. + CD points to the conversion descriptor from FROMCODE to TOCODE, created by + the function iconveh_open(). Both the "from" and the "to" encoding must use a single NUL byte at the end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). - CD1 is the conversion descriptor from FROM_CODESET to UTF-8 (or - (iconv_t)(-1) if FROM_CODESET is UTF-8). - CD2 is the conversion descriptor from UTF-8 to TO_CODESET (or (iconv_t)(-1) - if TO_CODESET is UTF-8). Allocate a malloced memory block for the result. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * str_cd_iconveh (const char *src, - iconv_t cd, iconv_t cd1, iconv_t cd2, - enum iconv_ilseq_handler handler); + const iconveh_t *cd, + enum iconv_ilseq_handler handler); #endif @@ -94,10 +114,10 @@ extern char * unchanged if no dynamic memory allocation was necessary. */ extern int mem_iconveh (const char *src, size_t srclen, - const char *from_codeset, const char *to_codeset, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp); + const char *from_codeset, const char *to_codeset, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. @@ -108,8 +128,8 @@ extern int successful, otherwise NULL and errno set. */ extern char * str_iconveh (const char *src, - const char *from_codeset, const char *to_codeset, - enum iconv_ilseq_handler handler); + const char *from_codeset, const char *to_codeset, + enum iconv_ilseq_handler handler); #ifdef __cplusplus diff --git a/lib/striconveha.c b/lib/striconveha.c index a0567b4..27e7b15 100644 --- a/lib/striconveha.c +++ b/lib/striconveha.c @@ -1,5 +1,5 @@ /* Character set conversion with error handling and autodetection. - Copyright (C) 2002, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible. This program is free software: you can redistribute it and/or modify @@ -82,7 +82,7 @@ static struct autodetect_alias **autodetect_list_end = int uniconv_register_autodetect (const char *name, - const char * const *try_in_order) + const char * const *try_in_order) { size_t namelen; size_t listlen; @@ -122,12 +122,12 @@ uniconv_register_autodetect (const char *name, memory += namelen; for (i = 0; i < listlen; i++) - { - size_t len = strlen (try_in_order[i]) + 1; - memcpy (memory, try_in_order[i], len); - new_try_in_order[i] = (const char *) memory; - memory += len; - } + { + size_t len = strlen (try_in_order[i]) + 1; + memcpy (memory, try_in_order[i], len); + new_try_in_order[i] = (const char *) memory; + memory += len; + } new_try_in_order[i] = NULL; /* Now insert the new alias. */ @@ -149,13 +149,13 @@ uniconv_register_autodetect (const char *name, /* Like mem_iconveha, except no handling of transliteration. */ static int mem_iconveha_notranslit (const char *src, size_t srclen, - const char *from_codeset, const char *to_codeset, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp) + const char *from_codeset, const char *to_codeset, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp) { int retval = mem_iconveh (src, srclen, from_codeset, to_codeset, handler, - offsets, resultp, lengthp); + offsets, resultp, lengthp); if (retval >= 0 || errno != EINVAL) return retval; else @@ -163,45 +163,45 @@ mem_iconveha_notranslit (const char *src, size_t srclen, struct autodetect_alias *alias; /* Unsupported from_codeset or to_codeset. Check whether the caller - requested autodetection. */ + requested autodetection. */ for (alias = autodetect_list; alias != NULL; alias = alias->next) - if (strcmp (from_codeset, alias->name) == 0) - { - const char * const *encodings; - - if (handler != iconveh_error) - { - /* First try all encodings without any forgiving. */ - encodings = alias->encodings_to_try; - do - { - retval = mem_iconveha_notranslit (src, srclen, - *encodings, to_codeset, - iconveh_error, offsets, - resultp, lengthp); - if (!(retval < 0 && errno == EILSEQ)) - return retval; - encodings++; - } - while (*encodings != NULL); - } - - encodings = alias->encodings_to_try; - do - { - retval = mem_iconveha_notranslit (src, srclen, - *encodings, to_codeset, - handler, offsets, - resultp, lengthp); - if (!(retval < 0 && errno == EILSEQ)) - return retval; - encodings++; - } - while (*encodings != NULL); - - /* Return the last call's result. */ - return -1; - } + if (strcmp (from_codeset, alias->name) == 0) + { + const char * const *encodings; + + if (handler != iconveh_error) + { + /* First try all encodings without any forgiving. */ + encodings = alias->encodings_to_try; + do + { + retval = mem_iconveha_notranslit (src, srclen, + *encodings, to_codeset, + iconveh_error, offsets, + resultp, lengthp); + if (!(retval < 0 && errno == EILSEQ)) + return retval; + encodings++; + } + while (*encodings != NULL); + } + + encodings = alias->encodings_to_try; + do + { + retval = mem_iconveha_notranslit (src, srclen, + *encodings, to_codeset, + handler, offsets, + resultp, lengthp); + if (!(retval < 0 && errno == EILSEQ)) + return retval; + encodings++; + } + while (*encodings != NULL); + + /* Return the last call's result. */ + return -1; + } /* It wasn't an autodetection name. */ errno = EINVAL; @@ -211,11 +211,11 @@ mem_iconveha_notranslit (const char *src, size_t srclen, int mem_iconveha (const char *src, size_t srclen, - const char *from_codeset, const char *to_codeset, - bool transliterate, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp) + const char *from_codeset, const char *to_codeset, + bool transliterate, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp) { if (srclen == 0) { @@ -236,8 +236,8 @@ mem_iconveha (const char *src, size_t srclen, memcpy (to_codeset_suffixed + len, "//TRANSLIT", 10 + 1); retval = mem_iconveha_notranslit (src, srclen, - from_codeset, to_codeset_suffixed, - handler, offsets, resultp, lengthp); + from_codeset, to_codeset_suffixed, + handler, offsets, resultp, lengthp); freea (to_codeset_suffixed); @@ -246,15 +246,15 @@ mem_iconveha (const char *src, size_t srclen, else #endif return mem_iconveha_notranslit (src, srclen, - from_codeset, to_codeset, - handler, offsets, resultp, lengthp); + from_codeset, to_codeset, + handler, offsets, resultp, lengthp); } /* Like str_iconveha, except no handling of transliteration. */ static char * str_iconveha_notranslit (const char *src, - const char *from_codeset, const char *to_codeset, - enum iconv_ilseq_handler handler) + const char *from_codeset, const char *to_codeset, + enum iconv_ilseq_handler handler) { char *result = str_iconveh (src, from_codeset, to_codeset, handler); @@ -265,43 +265,43 @@ str_iconveha_notranslit (const char *src, struct autodetect_alias *alias; /* Unsupported from_codeset or to_codeset. Check whether the caller - requested autodetection. */ + requested autodetection. */ for (alias = autodetect_list; alias != NULL; alias = alias->next) - if (strcmp (from_codeset, alias->name) == 0) - { - const char * const *encodings; - - if (handler != iconveh_error) - { - /* First try all encodings without any forgiving. */ - encodings = alias->encodings_to_try; - do - { - result = str_iconveha_notranslit (src, - *encodings, to_codeset, - iconveh_error); - if (!(result == NULL && errno == EILSEQ)) - return result; - encodings++; - } - while (*encodings != NULL); - } - - encodings = alias->encodings_to_try; - do - { - result = str_iconveha_notranslit (src, - *encodings, to_codeset, - handler); - if (!(result == NULL && errno == EILSEQ)) - return result; - encodings++; - } - while (*encodings != NULL); - - /* Return the last call's result. */ - return NULL; - } + if (strcmp (from_codeset, alias->name) == 0) + { + const char * const *encodings; + + if (handler != iconveh_error) + { + /* First try all encodings without any forgiving. */ + encodings = alias->encodings_to_try; + do + { + result = str_iconveha_notranslit (src, + *encodings, to_codeset, + iconveh_error); + if (!(result == NULL && errno == EILSEQ)) + return result; + encodings++; + } + while (*encodings != NULL); + } + + encodings = alias->encodings_to_try; + do + { + result = str_iconveha_notranslit (src, + *encodings, to_codeset, + handler); + if (!(result == NULL && errno == EILSEQ)) + return result; + encodings++; + } + while (*encodings != NULL); + + /* Return the last call's result. */ + return NULL; + } /* It wasn't an autodetection name. */ errno = EINVAL; @@ -311,16 +311,16 @@ str_iconveha_notranslit (const char *src, char * str_iconveha (const char *src, - const char *from_codeset, const char *to_codeset, - bool transliterate, - enum iconv_ilseq_handler handler) + const char *from_codeset, const char *to_codeset, + bool transliterate, + enum iconv_ilseq_handler handler) { if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0) { char *result = strdup (src); if (result == NULL) - errno = ENOMEM; + errno = ENOMEM; return result; } @@ -336,7 +336,7 @@ str_iconveha (const char *src, memcpy (to_codeset_suffixed + len, "//TRANSLIT", 10 + 1); result = str_iconveha_notranslit (src, from_codeset, to_codeset_suffixed, - handler); + handler); freea (to_codeset_suffixed); diff --git a/lib/striconveha.h b/lib/striconveha.h index c88eb52..5f106c3 100644 --- a/lib/striconveha.h +++ b/lib/striconveha.h @@ -1,5 +1,5 @@ /* Character set conversion with error handling and autodetection. - Copyright (C) 2002, 2005, 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2007-2010 Free Software Foundation, Inc. Written by Bruno Haible. This program is free software: you can redistribute it and/or modify @@ -48,11 +48,11 @@ extern "C" { unchanged if no dynamic memory allocation was necessary. */ extern int mem_iconveha (const char *src, size_t srclen, - const char *from_codeset, const char *to_codeset, - bool transliterate, - enum iconv_ilseq_handler handler, - size_t *offsets, - char **resultp, size_t *lengthp); + const char *from_codeset, const char *to_codeset, + bool transliterate, + enum iconv_ilseq_handler handler, + size_t *offsets, + char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. @@ -67,9 +67,9 @@ extern int successful, otherwise NULL and errno set. */ extern char * str_iconveha (const char *src, - const char *from_codeset, const char *to_codeset, - bool transliterate, - enum iconv_ilseq_handler handler); + const char *from_codeset, const char *to_codeset, + bool transliterate, + enum iconv_ilseq_handler handler); /* In the above, FROM_CODESET can also be one of the following values: @@ -84,7 +84,7 @@ extern char * Particular errno values: ENOMEM. */ extern int uniconv_register_autodetect (const char *name, - const char * const *try_in_order); + const char * const *try_in_order); #ifdef __cplusplus diff --git a/lib/string.in.h b/lib/string.in.h index 3540765..75deca0 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -31,6 +31,11 @@ /* NetBSD 5.0 mis-defines NULL. */ #include <stddef.h> +/* MirBSD defines mbslen as a macro. */ +#if @GNULIB_MBSLEN@ && defined __MirBSD__ +# include <wchar.h> +#endif + #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) @@ -43,75 +48,132 @@ #endif -/* The definition of GL_LINK_WARNING is copied here. */ +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ +/* The definition of _GL_ARG_NONNULL is copied here. */ -#ifdef __cplusplus -extern "C" { -#endif +/* The definition of _GL_WARN_ON_USE is copied here. */ /* Return the first instance of C within N bytes of S, or NULL. */ #if @GNULIB_MEMCHR@ # if @REPLACE_MEMCHR@ -# define memchr rpl_memchr -extern void *memchr (void const *__s, int __c, size_t __n) - __attribute__ ((__pure__)); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define memchr rpl_memchr +# endif +_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); +# else +# if ! @HAVE_MEMCHR@ +_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C" { const void * std::memchr (const void *, int, size_t); } + extern "C++" { void * std::memchr (void *, int, size_t); } */ +_GL_CXXALIAS_SYS_CAST2 (memchr, + void *, (void const *__s, int __c, size_t __n), + void const *, (void const *__s, int __c, size_t __n)); +# endif +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); +_GL_CXXALIASWARN1 (memchr, void const *, + (void const *__s, int __c, size_t __n)); +# else +_GL_CXXALIASWARN (memchr); # endif #elif defined GNULIB_POSIXCHECK # undef memchr -# define memchr(s,c,n) \ - (GL_LINK_WARNING ("memchr has platform-specific bugs - " \ - "use gnulib module memchr for portability" ), \ - memchr (s, c, n)) +/* Assume memchr is always declared. */ +_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " + "use gnulib module memchr for portability" ); #endif /* Return the first occurrence of NEEDLE in HAYSTACK. */ #if @GNULIB_MEMMEM@ # if @REPLACE_MEMMEM@ -# define memmem rpl_memmem -# endif -# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@ -extern void *memmem (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len) - __attribute__ ((__pure__)); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define memmem rpl_memmem +# endif +_GL_FUNCDECL_RPL (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len)); +# else +# if ! @HAVE_DECL_MEMMEM@ +_GL_FUNCDECL_SYS (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len)); # endif +_GL_CXXALIASWARN (memmem); #elif defined GNULIB_POSIXCHECK # undef memmem -# define memmem(a,al,b,bl) \ - (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \ - "use gnulib module memmem-simple for portability, " \ - "and module memmem for speed" ), \ - memmem (a, al, b, bl)) +# if HAVE_RAW_DECL_MEMMEM +_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " + "use gnulib module memmem-simple for portability, " + "and module memmem for speed" ); +# endif #endif /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ #if @GNULIB_MEMPCPY@ # if ! @HAVE_MEMPCPY@ -extern void *mempcpy (void *restrict __dest, void const *restrict __src, - size_t __n); +_GL_FUNCDECL_SYS (mempcpy, void *, + (void *restrict __dest, void const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); # endif +_GL_CXXALIAS_SYS (mempcpy, void *, + (void *restrict __dest, void const *restrict __src, + size_t __n)); +_GL_CXXALIASWARN (mempcpy); #elif defined GNULIB_POSIXCHECK # undef mempcpy -# define mempcpy(a,b,n) \ - (GL_LINK_WARNING ("mempcpy is unportable - " \ - "use gnulib module mempcpy for portability"), \ - mempcpy (a, b, n)) +# if HAVE_RAW_DECL_MEMPCPY +_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " + "use gnulib module mempcpy for portability"); +# endif #endif /* Search backwards through a block for a byte (specified as an int). */ #if @GNULIB_MEMRCHR@ # if ! @HAVE_DECL_MEMRCHR@ -extern void *memrchr (void const *, int, size_t) - __attribute__ ((__pure__)); +_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const void * std::memrchr (const void *, int, size_t); } + extern "C++" { void * std::memrchr (void *, int, size_t); } */ +_GL_CXXALIAS_SYS_CAST2 (memrchr, + void *, (void const *, int, size_t), + void const *, (void const *, int, size_t)); +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); +_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); +# else +_GL_CXXALIASWARN (memrchr); # endif #elif defined GNULIB_POSIXCHECK # undef memrchr -# define memrchr(a,b,c) \ - (GL_LINK_WARNING ("memrchr is unportable - " \ - "use gnulib module memrchr for portability"), \ - memrchr (a, b, c)) +# if HAVE_RAW_DECL_MEMRCHR +_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " + "use gnulib module memrchr for portability"); +# endif #endif /* Find the first occurrence of C in S. More efficient than @@ -119,119 +181,221 @@ extern void *memrchr (void const *, int, size_t) occur within N bytes. */ #if @GNULIB_RAWMEMCHR@ # if ! @HAVE_RAWMEMCHR@ -extern void *rawmemchr (void const *__s, int __c_in) - __attribute__ ((__pure__)); +_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const void * std::rawmemchr (const void *, int); } + extern "C++" { void * std::rawmemchr (void *, int); } */ +_GL_CXXALIAS_SYS_CAST2 (rawmemchr, + void *, (void const *__s, int __c_in), + void const *, (void const *__s, int __c_in)); +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); +_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); +# else +_GL_CXXALIASWARN (rawmemchr); # endif #elif defined GNULIB_POSIXCHECK # undef rawmemchr -# define rawmemchr(a,b) \ - (GL_LINK_WARNING ("rawmemchr is unportable - " \ - "use gnulib module rawmemchr for portability"), \ - rawmemchr (a, b)) +# if HAVE_RAW_DECL_RAWMEMCHR +_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " + "use gnulib module rawmemchr for portability"); +# endif #endif /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ #if @GNULIB_STPCPY@ # if ! @HAVE_STPCPY@ -extern char *stpcpy (char *restrict __dst, char const *restrict __src); +_GL_FUNCDECL_SYS (stpcpy, char *, + (char *restrict __dst, char const *restrict __src) + _GL_ARG_NONNULL ((1, 2))); # endif +_GL_CXXALIAS_SYS (stpcpy, char *, + (char *restrict __dst, char const *restrict __src)); +_GL_CXXALIASWARN (stpcpy); #elif defined GNULIB_POSIXCHECK # undef stpcpy -# define stpcpy(a,b) \ - (GL_LINK_WARNING ("stpcpy is unportable - " \ - "use gnulib module stpcpy for portability"), \ - stpcpy (a, b)) +# if HAVE_RAW_DECL_STPCPY +_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " + "use gnulib module stpcpy for portability"); +# endif #endif /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if @GNULIB_STPNCPY@ -# if ! @HAVE_STPNCPY@ -# define stpncpy gnu_stpncpy -extern char *stpncpy (char *restrict __dst, char const *restrict __src, - size_t __n); +# if @REPLACE_STPNCPY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define stpncpy rpl_stpncpy +# endif +_GL_FUNCDECL_RPL (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# else +# if ! @HAVE_STPNCPY@ +_GL_FUNCDECL_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); # endif +_GL_CXXALIASWARN (stpncpy); #elif defined GNULIB_POSIXCHECK # undef stpncpy -# define stpncpy(a,b,n) \ - (GL_LINK_WARNING ("stpncpy is unportable - " \ - "use gnulib module stpncpy for portability"), \ - stpncpy (a, b, n)) +# if HAVE_RAW_DECL_STPNCPY +_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " + "use gnulib module stpncpy for portability"); +# endif #endif #if defined GNULIB_POSIXCHECK /* strchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ # undef strchr -# define strchr(s,c) \ - (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \ - "in some multibyte locales - " \ - "use mbschr if you care about internationalization"), \ - strchr (s, c)) +/* Assume strchr is always declared. */ +_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " + "in some multibyte locales - " + "use mbschr if you care about internationalization"); #endif /* Find the first occurrence of C in S or the final NUL byte. */ #if @GNULIB_STRCHRNUL@ # if ! @HAVE_STRCHRNUL@ -extern char *strchrnul (char const *__s, int __c_in) - __attribute__ ((__pure__)); +_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * std::strchrnul (const char *, int); } + extern "C++" { char * std::strchrnul (char *, int); } */ +_GL_CXXALIAS_SYS_CAST2 (strchrnul, + char *, (char const *__s, int __c_in), + char const *, (char const *__s, int __c_in)); +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); +_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); +# else +_GL_CXXALIASWARN (strchrnul); # endif #elif defined GNULIB_POSIXCHECK # undef strchrnul -# define strchrnul(a,b) \ - (GL_LINK_WARNING ("strchrnul is unportable - " \ - "use gnulib module strchrnul for portability"), \ - strchrnul (a, b)) +# if HAVE_RAW_DECL_STRCHRNUL +_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " + "use gnulib module strchrnul for portability"); +# endif #endif /* Duplicate S, returning an identical malloc'd string. */ #if @GNULIB_STRDUP@ # if @REPLACE_STRDUP@ -# undef strdup -# define strdup rpl_strdup -# endif -# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@ -extern char *strdup (char const *__s); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strdup +# define strdup rpl_strdup +# endif +_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); +# else +# if !(@HAVE_DECL_STRDUP@ || defined strdup) +_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); # endif +_GL_CXXALIASWARN (strdup); #elif defined GNULIB_POSIXCHECK # undef strdup -# define strdup(a) \ - (GL_LINK_WARNING ("strdup is unportable - " \ - "use gnulib module strdup for portability"), \ - strdup (a)) +# if HAVE_RAW_DECL_STRDUP +_GL_WARN_ON_USE (strdup, "strdup is unportable - " + "use gnulib module strdup for portability"); +# endif +#endif + +/* Append no more than N characters from SRC onto DEST. */ +#if @GNULIB_STRNCAT@ +# if @REPLACE_STRNCAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strncat +# define strncat rpl_strncat +# endif +_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); +# else +_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); +# endif +_GL_CXXALIASWARN (strncat); +#elif defined GNULIB_POSIXCHECK +# undef strncat +# if HAVE_RAW_DECL_STRNCAT +_GL_WARN_ON_USE (strncat, "strncat is unportable - " + "use gnulib module strncat for portability"); +# endif #endif /* Return a newly allocated copy of at most N bytes of STRING. */ #if @GNULIB_STRNDUP@ -# if ! @HAVE_STRNDUP@ -# undef strndup -# define strndup rpl_strndup -# endif -# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@ -extern char *strndup (char const *__string, size_t __n); +# if @REPLACE_STRNDUP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strndup +# define strndup rpl_strndup +# endif +_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); +# else +# if ! @HAVE_DECL_STRNDUP@ +_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); # endif +_GL_CXXALIASWARN (strndup); #elif defined GNULIB_POSIXCHECK # undef strndup -# define strndup(a,n) \ - (GL_LINK_WARNING ("strndup is unportable - " \ - "use gnulib module strndup for portability"), \ - strndup (a, n)) +# if HAVE_RAW_DECL_STRNDUP +_GL_WARN_ON_USE (strndup, "strndup is unportable - " + "use gnulib module strndup for portability"); +# endif #endif /* Find the length (number of bytes) of STRING, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many bytes, return MAXLEN. */ #if @GNULIB_STRNLEN@ -# if ! @HAVE_DECL_STRNLEN@ -extern size_t strnlen (char const *__string, size_t __maxlen) - __attribute__ ((__pure__)); +# if @REPLACE_STRNLEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strnlen +# define strnlen rpl_strnlen +# endif +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); +# else +# if ! @HAVE_DECL_STRNLEN@ +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); # endif +_GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK # undef strnlen -# define strnlen(a,n) \ - (GL_LINK_WARNING ("strnlen is unportable - " \ - "use gnulib module strnlen for portability"), \ - strnlen (a, n)) +# if HAVE_RAW_DECL_STRNLEN +_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " + "use gnulib module strnlen for portability"); +# endif #endif #if defined GNULIB_POSIXCHECK @@ -240,18 +404,32 @@ extern size_t strnlen (char const *__string, size_t __maxlen) locale encoding is GB18030 and one of the characters to be searched is a digit. */ # undef strcspn -# define strcspn(s,a) \ - (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \ - "in multibyte locales - " \ - "use mbscspn if you care about internationalization"), \ - strcspn (s, a)) +/* Assume strcspn is always declared. */ +_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " + "in multibyte locales - " + "use mbscspn if you care about internationalization"); #endif /* Find the first occurrence in S of any character in ACCEPT. */ #if @GNULIB_STRPBRK@ # if ! @HAVE_STRPBRK@ -extern char *strpbrk (char const *__s, char const *__accept) - __attribute__ ((__pure__)); +_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1, 2))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C" { const char * strpbrk (const char *, const char *); } + extern "C++" { char * strpbrk (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strpbrk, + char *, (char const *__s, char const *__accept), + const char *, (char const *__s, char const *__accept)); +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); +_GL_CXXALIASWARN1 (strpbrk, char const *, + (char const *__s, char const *__accept)); +# else +_GL_CXXALIASWARN (strpbrk); # endif # if defined GNULIB_POSIXCHECK /* strpbrk() assumes the second argument is a list of single-byte characters. @@ -259,40 +437,36 @@ extern char *strpbrk (char const *__s, char const *__accept) locale encoding is GB18030 and one of the characters to be searched is a digit. */ # undef strpbrk -# define strpbrk(s,a) \ - (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \ - "in multibyte locales - " \ - "use mbspbrk if you care about internationalization"), \ - strpbrk (s, a)) +_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings " + "in multibyte locales - " + "use mbspbrk if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strpbrk -# define strpbrk(s,a) \ - (GL_LINK_WARNING ("strpbrk is unportable - " \ - "use gnulib module strpbrk for portability"), \ - strpbrk (s, a)) +# if HAVE_RAW_DECL_STRPBRK +_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - " + "use gnulib module strpbrk for portability"); +# endif #endif #if defined GNULIB_POSIXCHECK /* strspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it cannot work with multibyte strings. */ # undef strspn -# define strspn(s,a) \ - (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \ - "in multibyte locales - " \ - "use mbsspn if you care about internationalization"), \ - strspn (s, a)) +/* Assume strspn is always declared. */ +_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " + "in multibyte locales - " + "use mbsspn if you care about internationalization"); #endif #if defined GNULIB_POSIXCHECK /* strrchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ # undef strrchr -# define strrchr(s,c) \ - (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \ - "in some multibyte locales - " \ - "use mbsrchr if you care about internationalization"), \ - strrchr (s, c)) +/* Assume strrchr is always declared. */ +_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings " + "in some multibyte locales - " + "use mbsrchr if you care about internationalization"); #endif /* Search the next delimiter (char listed in DELIM) starting at *STRINGP. @@ -313,29 +487,51 @@ extern char *strpbrk (char const *__s, char const *__accept) See also strtok_r(). */ #if @GNULIB_STRSEP@ # if ! @HAVE_STRSEP@ -extern char *strsep (char **restrict __stringp, char const *restrict __delim); +_GL_FUNCDECL_SYS (strsep, char *, + (char **restrict __stringp, char const *restrict __delim) + _GL_ARG_NONNULL ((1, 2))); # endif +_GL_CXXALIAS_SYS (strsep, char *, + (char **restrict __stringp, char const *restrict __delim)); +_GL_CXXALIASWARN (strsep); # if defined GNULIB_POSIXCHECK # undef strsep -# define strsep(s,d) \ - (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \ - "in multibyte locales - " \ - "use mbssep if you care about internationalization"), \ - strsep (s, d)) +_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " + "in multibyte locales - " + "use mbssep if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strsep -# define strsep(s,d) \ - (GL_LINK_WARNING ("strsep is unportable - " \ - "use gnulib module strsep for portability"), \ - strsep (s, d)) +# if HAVE_RAW_DECL_STRSEP +_GL_WARN_ON_USE (strsep, "strsep is unportable - " + "use gnulib module strsep for portability"); +# endif #endif #if @GNULIB_STRSTR@ # if @REPLACE_STRSTR@ -# define strstr rpl_strstr -char *strstr (const char *haystack, const char *needle) - __attribute__ ((__pure__)); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strstr rpl_strstr +# endif +_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) + __attribute__ ((__pure__)) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); +# else + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * strstr (const char *, const char *); } + extern "C++" { char * strstr (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strstr, + char *, (const char *haystack, const char *needle), + const char *, (const char *haystack, const char *needle)); +# endif +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); +_GL_CXXALIASWARN1 (strstr, const char *, + (const char *haystack, const char *needle)); +# else +_GL_CXXALIASWARN (strstr); # endif #elif defined GNULIB_POSIXCHECK /* strstr() does not work with multibyte strings if the locale encoding is @@ -343,48 +539,70 @@ char *strstr (const char *haystack, const char *needle) POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strstr -# define strstr(a,b) \ - (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \ - "work correctly on character strings in most " \ - "multibyte locales - " \ - "use mbsstr if you care about internationalization, " \ - "or use strstr if you care about speed"), \ - strstr (a, b)) +/* Assume strstr is always declared. */ +_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " + "work correctly on character strings in most " + "multibyte locales - " + "use mbsstr if you care about internationalization, " + "or use strstr if you care about speed"); #endif /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive comparison. */ #if @GNULIB_STRCASESTR@ # if @REPLACE_STRCASESTR@ -# define strcasestr rpl_strcasestr +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strcasestr rpl_strcasestr +# endif +_GL_FUNCDECL_RPL (strcasestr, char *, + (const char *haystack, const char *needle) + __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strcasestr, char *, + (const char *haystack, const char *needle)); +# else +# if ! @HAVE_STRCASESTR@ +_GL_FUNCDECL_SYS (strcasestr, char *, + (const char *haystack, const char *needle) + __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * strcasestr (const char *, const char *); } + extern "C++" { char * strcasestr (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strcasestr, + char *, (const char *haystack, const char *needle), + const char *, (const char *haystack, const char *needle)); # endif -# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@ -extern char *strcasestr (const char *haystack, const char *needle) - __attribute__ ((__pure__)); +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); +_GL_CXXALIASWARN1 (strcasestr, const char *, + (const char *haystack, const char *needle)); +# else +_GL_CXXALIASWARN (strcasestr); # endif #elif defined GNULIB_POSIXCHECK /* strcasestr() does not work with multibyte strings: It is a glibc extension, and glibc implements it only for unibyte locales. */ # undef strcasestr -# define strcasestr(a,b) \ - (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \ - "in multibyte locales - " \ - "use mbscasestr if you care about " \ - "internationalization, or use c-strcasestr if you want " \ - "a locale independent function"), \ - strcasestr (a, b)) +# if HAVE_RAW_DECL_STRCASESTR +_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " + "strings in multibyte locales - " + "use mbscasestr if you care about " + "internationalization, or use c-strcasestr if you want " + "a locale independent function"); +# endif #endif /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: - char s[] = "-abc-=-def"; - char *sp; - x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" - x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL - x = strtok_r(NULL, "=", &sp); // x = NULL - // s = "abc\0-def\0" + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" This is a variant of strtok() that is multithread-safe. @@ -399,24 +617,44 @@ extern char *strcasestr (const char *haystack, const char *needle) See also strsep(). */ #if @GNULIB_STRTOK_R@ -# if ! @HAVE_DECL_STRTOK_R@ -extern char *strtok_r (char *restrict s, char const *restrict delim, - char **restrict save_ptr); +# if @REPLACE_STRTOK_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strtok_r +# define strtok_r rpl_strtok_r +# endif +_GL_FUNCDECL_RPL (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr)); +# else +# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK +# undef strtok_r +# endif +# if ! @HAVE_DECL_STRTOK_R@ +_GL_FUNCDECL_SYS (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr)); # endif +_GL_CXXALIASWARN (strtok_r); # if defined GNULIB_POSIXCHECK -# undef strtok_r -# define strtok_r(s,d,p) \ - (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \ - "in multibyte locales - " \ - "use mbstok_r if you care about internationalization"), \ - strtok_r (s, d, p)) +_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " + "strings in multibyte locales - " + "use mbstok_r if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strtok_r -# define strtok_r(s,d,p) \ - (GL_LINK_WARNING ("strtok_r is unportable - " \ - "use gnulib module strtok_r for portability"), \ - strtok_r (s, d, p)) +# if HAVE_RAW_DECL_STRTOK_R +_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " + "use gnulib module strtok_r for portability"); +# endif #endif @@ -426,13 +664,27 @@ extern char *strtok_r (char *restrict s, char const *restrict delim, #if @GNULIB_MBSLEN@ /* Return the number of multibyte characters in the character string STRING. This considers multibyte characters, unlike strlen, which counts bytes. */ -extern size_t mbslen (const char *string); +# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ +# undef mbslen +# endif +# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbslen rpl_mbslen +# endif +_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); +# else +_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); +# endif +_GL_CXXALIASWARN (mbslen); #endif #if @GNULIB_MBSNLEN@ /* Return the number of multibyte characters in the character string starting at STRING and ending at STRING + LEN. */ -extern size_t mbsnlen (const char *string, size_t len); +_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) + _GL_ARG_NONNULL ((1)); #endif #if @GNULIB_MBSCHR@ @@ -440,8 +692,19 @@ extern size_t mbsnlen (const char *string, size_t len); and return a pointer to it. Return NULL if C is not found in STRING. Unlike strchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ -# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ -extern char * mbschr (const char *string, int c); +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); +# else +_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); +# endif +_GL_CXXALIASWARN (mbschr); #endif #if @GNULIB_MBSRCHR@ @@ -449,8 +712,19 @@ extern char * mbschr (const char *string, int c); and return a pointer to it. Return NULL if C is not found in STRING. Unlike strrchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ -# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ -extern char * mbsrchr (const char *string, int c); +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); +# else +_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); +# endif +_GL_CXXALIASWARN (mbsrchr); #endif #if @GNULIB_MBSSTR@ @@ -458,7 +732,8 @@ extern char * mbsrchr (const char *string, int c); string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. Unlike strstr(), this function works correctly in multibyte locales with encodings different from UTF-8. */ -extern char * mbsstr (const char *haystack, const char *needle); +_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCASECMP@ @@ -468,7 +743,8 @@ extern char * mbsstr (const char *haystack, const char *needle); Note: This function may, in multibyte locales, return 0 for strings of different lengths! Unlike strcasecmp(), this function works correctly in multibyte locales. */ -extern int mbscasecmp (const char *s1, const char *s2); +_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSNCASECMP@ @@ -481,7 +757,8 @@ extern int mbscasecmp (const char *s1, const char *s2); of different lengths! Unlike strncasecmp(), this function works correctly in multibyte locales. But beware that N is not a byte count but a character count! */ -extern int mbsncasecmp (const char *s1, const char *s2, size_t n); +_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSPCASECMP@ @@ -494,7 +771,8 @@ extern int mbsncasecmp (const char *s1, const char *s2, size_t n); smaller length than PREFIX! Unlike strncasecmp(), this function works correctly in multibyte locales. */ -extern char * mbspcasecmp (const char *string, const char *prefix); +_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCASESTR@ @@ -503,7 +781,8 @@ extern char * mbspcasecmp (const char *string, const char *prefix); Note: This function may, in multibyte locales, return success even if strlen (haystack) < strlen (needle) ! Unlike strcasestr(), this function works correctly in multibyte locales. */ -extern char * mbscasestr (const char *haystack, const char *needle); +_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCSPN@ @@ -512,7 +791,8 @@ extern char * mbscasestr (const char *haystack, const char *needle); beginning of the string to this occurrence, or to the end of the string if none exists. Unlike strcspn(), this function works correctly in multibyte locales. */ -extern size_t mbscspn (const char *string, const char *accept); +_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSPBRK@ @@ -520,8 +800,19 @@ extern size_t mbscspn (const char *string, const char *accept); in the character string ACCEPT. Return the pointer to it, or NULL if none exists. Unlike strpbrk(), this function works correctly in multibyte locales. */ -# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ -extern char * mbspbrk (const char *string, const char *accept); +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); +# else +_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); +# endif +_GL_CXXALIASWARN (mbspbrk); #endif #if @GNULIB_MBSSPN@ @@ -530,7 +821,8 @@ extern char * mbspbrk (const char *string, const char *accept); beginning of the string to this occurrence, or to the end of the string if none exists. Unlike strspn(), this function works correctly in multibyte locales. */ -extern size_t mbsspn (const char *string, const char *reject); +_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSSEP@ @@ -548,7 +840,8 @@ extern size_t mbsspn (const char *string, const char *reject); Caveat: The identity of the delimiting character is lost. See also mbstok_r(). */ -extern char * mbssep (char **stringp, const char *delim); +_GL_EXTERN_C char * mbssep (char **stringp, const char *delim) + _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSTOK_R@ @@ -556,67 +849,81 @@ extern char * mbssep (char **stringp, const char *delim); the character string DELIM. If STRING is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: - char s[] = "-abc-=-def"; - char *sp; - x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" - x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL - x = mbstok_r(NULL, "=", &sp); // x = NULL - // s = "abc\0-def\0" + char s[] = "-abc-=-def"; + char *sp; + x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = mbstok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. See also mbssep(). */ -extern char * mbstok_r (char *string, const char *delim, char **save_ptr); +_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) + _GL_ARG_NONNULL ((2, 3)); #endif /* Map any int, typically from errno, into an error message. */ #if @GNULIB_STRERROR@ # if @REPLACE_STRERROR@ -# undef strerror -# define strerror rpl_strerror -extern char *strerror (int); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror +# define strerror rpl_strerror +# endif +_GL_FUNCDECL_RPL (strerror, char *, (int)); +_GL_CXXALIAS_RPL (strerror, char *, (int)); +# else +_GL_CXXALIAS_SYS (strerror, char *, (int)); # endif +_GL_CXXALIASWARN (strerror); #elif defined GNULIB_POSIXCHECK # undef strerror -# define strerror(e) \ - (GL_LINK_WARNING ("strerror is unportable - " \ - "use gnulib module strerror to guarantee non-NULL result"), \ - strerror (e)) +/* Assume strerror is always declared. */ +_GL_WARN_ON_USE (strerror, "strerror is unportable - " + "use gnulib module strerror to guarantee non-NULL result"); #endif #if @GNULIB_STRSIGNAL@ # if @REPLACE_STRSIGNAL@ -# define strsignal rpl_strsignal -# endif -# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@ -extern char *strsignal (int __sig); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strsignal rpl_strsignal +# endif +_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); +_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); +# else +# if ! @HAVE_DECL_STRSIGNAL@ +_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); +# endif +/* Need to cast, because on Cygwin 1.5.x systems, the return type is + 'const char *'. */ +_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); # endif +_GL_CXXALIASWARN (strsignal); #elif defined GNULIB_POSIXCHECK # undef strsignal -# define strsignal(a) \ - (GL_LINK_WARNING ("strsignal is unportable - " \ - "use gnulib module strsignal for portability"), \ - strsignal (a)) +# if HAVE_RAW_DECL_STRSIGNAL +_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " + "use gnulib module strsignal for portability"); +# endif #endif #if @GNULIB_STRVERSCMP@ # if !@HAVE_STRVERSCMP@ -extern int strverscmp (const char *, const char *); +_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) + _GL_ARG_NONNULL ((1, 2))); # endif +_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); +_GL_CXXALIASWARN (strverscmp); #elif defined GNULIB_POSIXCHECK # undef strverscmp -# define strverscmp(a, b) \ - (GL_LINK_WARNING ("strverscmp is unportable - " \ - "use gnulib module strverscmp for portability"), \ - strverscmp (a, b)) +# if HAVE_RAW_DECL_STRVERSCMP +_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " + "use gnulib module strverscmp for portability"); +# endif #endif -#ifdef __cplusplus -} -#endif - #endif /* _GL_STRING_H */ #endif /* _GL_STRING_H */ diff --git a/lib/strncat.c b/lib/strncat.c new file mode 100644 index 0000000..edc3c39 --- /dev/null +++ b/lib/strncat.c @@ -0,0 +1,33 @@ +/* Concatenate strings. + Copyright (C) 1999, 2002, 2006, 2010 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2002. + + This program 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 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 + 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <string.h> + +char * +strncat (char *dest, const char *src, size_t n) +{ + char *destptr = dest + strlen (dest); + + for (; n > 0 && (*destptr = *src) != '\0'; src++, destptr++, n--) + ; + if (n == 0) + *destptr = '\0'; + return dest; +} diff --git a/lib/unicase.h b/lib/unicase.h index e360ef4..57d16db 100644 --- a/lib/unicase.h +++ b/lib/unicase.h @@ -1,5 +1,5 @@ /* Unicode character case mappings. - Copyright (C) 2002, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -91,57 +91,57 @@ extern const char * case-mapping. It can also be NULL, for no normalization. */ extern uint8_t * u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_toupper (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_toupper (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Return the lowercase mapping of a string. The nf argument identifies the normalization form to apply after the case-mapping. It can also be NULL, for no normalization. */ extern uint8_t * u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_tolower (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_tolower (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Return the titlecase mapping of a string. The nf argument identifies the normalization form to apply after the case-mapping. It can also be NULL, for no normalization. */ extern uint8_t * u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_totitle (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_totitle (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* The case-mapping context given by a prefix string. */ typedef struct casing_prefix_context - { - /* These fields are private, undocumented. */ - uint32_t last_char_except_ignorable; - uint32_t last_char_normal_or_above; - } - casing_prefix_context_t; + { + /* These fields are private, undocumented. */ + uint32_t last_char_except_ignorable; + uint32_t last_char_normal_or_above; + } + casing_prefix_context_t; /* The case-mapping context of the empty prefix string. */ extern LIBUNISTRING_DLL_VARIABLE const casing_prefix_context_t unicase_empty_prefix_context; /* Return the case-mapping context of a given prefix string. */ @@ -155,22 +155,22 @@ extern casing_prefix_context_t case-mapping context of the prefix A. */ extern casing_prefix_context_t u8_casing_prefixes_context (const uint8_t *s, size_t n, - casing_prefix_context_t a_context); + casing_prefix_context_t a_context); extern casing_prefix_context_t u16_casing_prefixes_context (const uint16_t *s, size_t n, - casing_prefix_context_t a_context); + casing_prefix_context_t a_context); extern casing_prefix_context_t u32_casing_prefixes_context (const uint32_t *s, size_t n, - casing_prefix_context_t a_context); + casing_prefix_context_t a_context); /* The case-mapping context given by a suffix string. */ typedef struct casing_suffix_context - { - /* These fields are private, undocumented. */ - uint32_t first_char_except_ignorable; - uint32_t bits; - } - casing_suffix_context_t; + { + /* These fields are private, undocumented. */ + uint32_t first_char_except_ignorable; + uint32_t bits; + } + casing_suffix_context_t; /* The case-mapping context of the empty suffix string. */ extern LIBUNISTRING_DLL_VARIABLE const casing_suffix_context_t unicase_empty_suffix_context; /* Return the case-mapping context of a given suffix string. */ @@ -184,85 +184,85 @@ extern casing_suffix_context_t case-mapping context of the suffix A. */ extern casing_suffix_context_t u8_casing_suffixes_context (const uint8_t *s, size_t n, - casing_suffix_context_t a_context); + casing_suffix_context_t a_context); extern casing_suffix_context_t u16_casing_suffixes_context (const uint16_t *s, size_t n, - casing_suffix_context_t a_context); + casing_suffix_context_t a_context); extern casing_suffix_context_t u32_casing_suffixes_context (const uint32_t *s, size_t n, - casing_suffix_context_t a_context); + casing_suffix_context_t a_context); /* Return the uppercase mapping of a string that is surrounded by a prefix and a suffix. */ extern uint8_t * u8_ct_toupper (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_ct_toupper (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_ct_toupper (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Return the lowercase mapping of a string that is surrounded by a prefix and a suffix. */ extern uint8_t * u8_ct_tolower (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_ct_tolower (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_ct_tolower (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Return the titlecase mapping of a string that is surrounded by a prefix and a suffix. */ extern uint8_t * u8_ct_totitle (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_ct_totitle (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_ct_totitle (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Return the case folded string. Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent @@ -271,38 +271,38 @@ extern uint32_t * case-mapping. It can also be NULL, for no normalization. */ extern uint8_t * u8_casefold (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_casefold (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_casefold (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Likewise, for a string that is surrounded by a prefix and a suffix. */ extern uint8_t * u8_ct_casefold (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_ct_casefold (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_ct_casefold (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); /* Compare S1 and S2, ignoring differences in case and normalization. The nf argument identifies the normalization form to apply after the @@ -311,20 +311,20 @@ extern uint32_t * return 0. Upon failure, return -1 with errno set. */ extern int u8_casecmp (const uint8_t *s1, size_t n1, - const uint8_t *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const uint8_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); extern int u16_casecmp (const uint16_t *s1, size_t n1, - const uint16_t *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const uint16_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); extern int u32_casecmp (const uint32_t *s1, size_t n1, - const uint32_t *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const uint32_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); extern int ulc_casecmp (const char *s1, size_t n1, - const char *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const char *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); /* Convert the string S of length N to a NUL-terminated byte sequence, in such a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnulib @@ -332,16 +332,16 @@ extern int NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization. */ extern char * u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char *resultbuf, size_t *lengthp); extern char * u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char *resultbuf, size_t *lengthp); extern char * u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char *resultbuf, size_t *lengthp); extern char * ulc_casexfrm (const char *s, size_t n, const char *iso639_language, - uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char *resultbuf, size_t *lengthp); /* Compare S1 and S2, ignoring differences in case and normalization, using the collation rules of the current locale. @@ -352,81 +352,81 @@ extern char * return 0. Upon failure, return -1 with errno set. */ extern int u8_casecoll (const uint8_t *s1, size_t n1, - const uint8_t *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const uint8_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); extern int u16_casecoll (const uint16_t *s1, size_t n1, - const uint16_t *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const uint16_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); extern int u32_casecoll (const uint32_t *s1, size_t n1, - const uint32_t *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const uint32_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); extern int ulc_casecoll (const char *s1, size_t n1, - const char *s2, size_t n2, - const char *iso639_language, uninorm_t nf, int *resultp); + const char *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); /* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to false otherwise, and return 0. Upon failure, return -1 with errno set. */ extern int u8_is_uppercase (const uint8_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u16_is_uppercase (const uint16_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u32_is_uppercase (const uint32_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); /* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to false otherwise, and return 0. Upon failure, return -1 with errno set. */ extern int u8_is_lowercase (const uint8_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u16_is_lowercase (const uint16_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u32_is_lowercase (const uint32_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); /* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to false otherwise, and return 0. Upon failure, return -1 with errno set. */ extern int u8_is_titlecase (const uint8_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u16_is_titlecase (const uint16_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u32_is_titlecase (const uint32_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); /* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or to false otherwise, and return 0. Upon failure, return -1 with errno set. */ extern int u8_is_casefolded (const uint8_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u16_is_casefolded (const uint16_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u32_is_casefolded (const uint32_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); /* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) to either upper case or lower case or title case is not a no-op. @@ -436,16 +436,16 @@ extern int Upon failure, return -1 with errno set. */ extern int u8_is_cased (const uint8_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u16_is_cased (const uint16_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); extern int u32_is_cased (const uint32_t *s, size_t n, - const char *iso639_language, - bool *resultp); + const char *iso639_language, + bool *resultp); /* ========================================================================= */ diff --git a/lib/unicase/cased.c b/lib/unicase/cased.c index 5fbf4cb..ced6a0e 100644 --- a/lib/unicase/cased.c +++ b/lib/unicase/cased.c @@ -1,5 +1,5 @@ /* Test whether a Unicode character is cased. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -33,8 +33,8 @@ bool uc_is_cased (ucs4_t uc) { return (uc_is_property_lowercase (uc) - || uc_is_property_uppercase (uc) - || uc_is_general_category (uc, UC_TITLECASE_LETTER)); + || uc_is_property_uppercase (uc) + || uc_is_general_category (uc, UC_TITLECASE_LETTER)); } #else diff --git a/lib/unicase/casefold.h b/lib/unicase/casefold.h index d1f434c..1a4fe92 100644 --- a/lib/unicase/casefold.h +++ b/lib/unicase/casefold.h @@ -1,5 +1,5 @@ /* Casefolding of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/caseprop.h b/lib/unicase/caseprop.h index f84453e..391d169 100644 --- a/lib/unicase/caseprop.h +++ b/lib/unicase/caseprop.h @@ -1,5 +1,5 @@ /* Case related properties of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/context.h b/lib/unicase/context.h index 6a35798..a3303d6 100644 --- a/lib/unicase/context.h +++ b/lib/unicase/context.h @@ -1,5 +1,5 @@ /* Case-mapping contexts of UTF-8/UTF-16/UTF-32 substring. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/empty-prefix-context.c b/lib/unicase/empty-prefix-context.c index 3c46e9e..dada104 100644 --- a/lib/unicase/empty-prefix-context.c +++ b/lib/unicase/empty-prefix-context.c @@ -1,5 +1,5 @@ /* Case-mapping context of empty prefix string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/empty-suffix-context.c b/lib/unicase/empty-suffix-context.c index 4e00bff..fc59a6e 100644 --- a/lib/unicase/empty-suffix-context.c +++ b/lib/unicase/empty-suffix-context.c @@ -1,5 +1,5 @@ /* Case-mapping context of empty suffix string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/ignorable.c b/lib/unicase/ignorable.c index 84b2634..9cfce9f 100644 --- a/lib/unicase/ignorable.c +++ b/lib/unicase/ignorable.c @@ -1,5 +1,5 @@ /* Test whether a Unicode character is case-ignorable. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -47,12 +47,12 @@ uc_is_case_ignorable (ucs4_t uc) int wbp = uc_wordbreak_property (uc); return (wbp == WBP_MIDLETTER || wbp == WBP_MIDNUMLET - || uc_is_general_category_withtable (uc, UC_CATEGORY_MASK_Mn - | UC_CATEGORY_MASK_Me - | UC_CATEGORY_MASK_Cf - | UC_CATEGORY_MASK_Lm - | UC_CATEGORY_MASK_Sk)) - && !uc_is_cased (uc); + || uc_is_general_category_withtable (uc, UC_CATEGORY_MASK_Mn + | UC_CATEGORY_MASK_Me + | UC_CATEGORY_MASK_Cf + | UC_CATEGORY_MASK_Lm + | UC_CATEGORY_MASK_Sk)) + && !uc_is_cased (uc); } #else diff --git a/lib/unicase/invariant.h b/lib/unicase/invariant.h index 2015143..c65ae23 100644 --- a/lib/unicase/invariant.h +++ b/lib/unicase/invariant.h @@ -1,5 +1,5 @@ /* Internal functions for Unicode character case mappings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,22 +24,22 @@ /* Return true if mapping NFD(S) to via MAPPING is a no-op. */ extern int u8_is_invariant (const uint8_t *s, size_t n, - uint8_t * (*mapping) (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp), - const char *iso639_language, - bool *resultp); + uint8_t * (*mapping) (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp), + const char *iso639_language, + bool *resultp); extern int u16_is_invariant (const uint16_t *s, size_t n, - uint16_t * (*mapping) (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp), - const char *iso639_language, - bool *resultp); + uint16_t * (*mapping) (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp), + const char *iso639_language, + bool *resultp); extern int u32_is_invariant (const uint32_t *s, size_t n, - uint32_t * (*mapping) (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp), - const char *iso639_language, - bool *resultp); + uint32_t * (*mapping) (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp), + const char *iso639_language, + bool *resultp); diff --git a/lib/unicase/locale-language.c b/lib/unicase/locale-language.c index 074baa4..2ee65c7 100644 --- a/lib/unicase/locale-language.c +++ b/lib/unicase/locale-language.c @@ -1,5 +1,5 @@ /* Language code of current locale. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -46,9 +46,9 @@ uc_locale_language (void) if (p != locale_name) { const char *language = - uc_locale_languages_lookup (locale_name, p - locale_name); + uc_locale_languages_lookup (locale_name, p - locale_name); if (language != NULL) - return language; + return language; } return ""; diff --git a/lib/unicase/simple-mapping.h b/lib/unicase/simple-mapping.h index 44cecc8..83200b4 100644 --- a/lib/unicase/simple-mapping.h +++ b/lib/unicase/simple-mapping.h @@ -1,5 +1,5 @@ /* Simple case mapping for Unicode characters. - Copyright (C) 2002, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -23,17 +23,17 @@ FUNC (ucs4_t uc) { int lookup1 = u_mapping.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> mapping_header_2) & mapping_header_3; - int lookup2 = u_mapping.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & mapping_header_4); - int lookup3 = u_mapping.level3[lookup2 + index3]; + { + unsigned int index2 = (uc >> mapping_header_2) & mapping_header_3; + int lookup2 = u_mapping.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & mapping_header_4); + int lookup3 = u_mapping.level3[lookup2 + index3]; - return uc + lookup3; - } - } + return uc + lookup3; + } + } } return uc; } diff --git a/lib/unicase/special-casing.c b/lib/unicase/special-casing.c index 9cc207c..95b6c82 100644 --- a/lib/unicase/special-casing.c +++ b/lib/unicase/special-casing.c @@ -1,5 +1,5 @@ /* Special casing table. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/special-casing.h b/lib/unicase/special-casing.h index ab88b84..33911cf 100644 --- a/lib/unicase/special-casing.h +++ b/lib/unicase/special-casing.h @@ -1,5 +1,5 @@ /* Special casing table. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/tocasefold.c b/lib/unicase/tocasefold.c index 752ba60..1ba79bd 100644 --- a/lib/unicase/tocasefold.c +++ b/lib/unicase/tocasefold.c @@ -1,5 +1,5 @@ /* Casefold mapping for Unicode characters (locale and context independent). - Copyright (C) 2002, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/tolower.c b/lib/unicase/tolower.c index 5ed0c6d..c69f691 100644 --- a/lib/unicase/tolower.c +++ b/lib/unicase/tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for Unicode characters (locale and context independent). - Copyright (C) 2002, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/totitle.c b/lib/unicase/totitle.c index 0ca5a45..ced1b69 100644 --- a/lib/unicase/totitle.c +++ b/lib/unicase/totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for Unicode characters (locale and context independent). - Copyright (C) 2002, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/toupper.c b/lib/unicase/toupper.c index d74e45c..9642b70 100644 --- a/lib/unicase/toupper.c +++ b/lib/unicase/toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for Unicode characters (locale and context independent). - Copyright (C) 2002, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u-casecmp.h b/lib/unicase/u-casecmp.h index e1cf99c..88c308b 100644 --- a/lib/unicase/u-casecmp.h +++ b/lib/unicase/u-casecmp.h @@ -1,5 +1,5 @@ /* Case and normalization insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -45,11 +45,11 @@ FUNC (const SRC_UNIT *s1, size_t n1, const SRC_UNIT *s2, size_t n2, if (norms2 == NULL) { if (norms1 != buf1) - { - int saved_errno = errno; - free (norms1); - errno = saved_errno; - } + { + int saved_errno = errno; + free (norms1); + errno = saved_errno; + } return -1; } diff --git a/lib/unicase/u-casecoll.h b/lib/unicase/u-casecoll.h index 73094ab..700d49b 100644 --- a/lib/unicase/u-casecoll.h +++ b/lib/unicase/u-casecoll.h @@ -1,6 +1,6 @@ /* Locale dependent, case and normalization insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -43,17 +43,17 @@ FUNC (const UNIT *s1, size_t n1, const UNIT *s2, size_t n2, if (transformed2 == NULL) { if (transformed1 != buf1) - { - int saved_errno = errno; - free (transformed1); - errno = saved_errno; - } + { + int saved_errno = errno; + free (transformed1); + errno = saved_errno; + } return -1; } /* Compare the transformed strings. */ cmp = memcmp2 (transformed1, transformed1_length, - transformed2, transformed2_length); + transformed2, transformed2_length); if (cmp < 0) cmp = -1; else if (cmp > 0) diff --git a/lib/unicase/u-casefold.h b/lib/unicase/u-casefold.h index c41f4e1..b0dc89a 100644 --- a/lib/unicase/u-casefold.h +++ b/lib/unicase/u-casefold.h @@ -1,5 +1,5 @@ /* Casefolding mapping for Unicode strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -21,8 +21,8 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, UNIT *resultbuf, size_t *lengthp) { return U_CT_CASEFOLD (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u-casemap.h b/lib/unicase/u-casemap.h index ea41444..b5b4d2f 100644 --- a/lib/unicase/u-casemap.h +++ b/lib/unicase/u-casemap.h @@ -1,5 +1,5 @@ /* Case mapping for UTF-8/UTF-16/UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -58,311 +58,311 @@ FUNC (const UNIT *s, size_t n, while (s < s_end) { - ucs4_t uc; - int count = U_MBTOUC_UNSAFE (&uc, s, s_end - s); - - ucs4_t mapped_uc[3]; - unsigned int mapped_count; - - if (uc < 0x10000) - { - /* Look first in the special-casing table. */ - char code[3]; - - code[0] = (uc >> 8) & 0xff; - code[1] = uc & 0xff; - - for (code[2] = 0; ; code[2]++) - { - const struct special_casing_rule *rule = - gl_unicase_special_lookup (code, 3); - - if (rule == NULL) - break; - - /* Test if the condition applies. */ - /* Does the language apply? */ - if (rule->language[0] == '\0' - || (iso639_language != NULL - && iso639_language[0] == rule->language[0] - && iso639_language[1] == rule->language[1])) - { - /* Does the context apply? */ - int context = rule->context; - bool applies; - - if (context < 0) - context = - context; - switch (context) - { - case SCC_ALWAYS: - applies = true; - break; - - case SCC_FINAL_SIGMA: - /* "Before" condition: preceded by a sequence - consisting of a cased letter and a case-ignorable - sequence. - "After" condition: not followed by a sequence - consisting of a case-ignorable sequence and then a - cased letter. */ - /* Test the "before" condition. */ - applies = uc_is_cased (last_char_except_ignorable); - /* Test the "after" condition. */ - if (applies) - { - const UNIT *s2 = s + count; - for (;;) - { - if (s2 < s_end) - { - ucs4_t uc2; - int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); - /* Our uc_is_case_ignorable function is - known to return false for all cased - characters. So we can call - uc_is_case_ignorable first. */ - if (!uc_is_case_ignorable (uc2)) - { - applies = ! uc_is_cased (uc2); - break; - } - s2 += count2; - } - else - { - applies = ! uc_is_cased (suffix_context.first_char_except_ignorable); - break; - } - } - } - break; - - case SCC_AFTER_SOFT_DOTTED: - /* "Before" condition: There is a Soft_Dotted character - before it, with no intervening character of - combining class 0 or 230 (Above). */ - /* Test the "before" condition. */ - applies = uc_is_property_soft_dotted (last_char_normal_or_above); - break; - - case SCC_MORE_ABOVE: - /* "After" condition: followed by a character of - combining class 230 (Above) with no intervening - character of combining class 0 or 230 (Above). */ - /* Test the "after" condition. */ - { - const UNIT *s2 = s + count; - applies = false; - for (;;) - { - if (s2 < s_end) - { - ucs4_t uc2; - int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); - int ccc = uc_combining_class (uc2); - if (ccc == UC_CCC_A) - { - applies = true; - break; - } - if (ccc == UC_CCC_NR) - break; - s2 += count2; - } - else - { - applies = ((suffix_context.bits & SCC_MORE_ABOVE_MASK) != 0); - break; - } - } - } - break; - - case SCC_BEFORE_DOT: - /* "After" condition: followed by COMBINING DOT ABOVE - (U+0307). Any sequence of characters with a - combining class that is neither 0 nor 230 may - intervene between the current character and the - combining dot above. */ - /* Test the "after" condition. */ - { - const UNIT *s2 = s + count; - applies = false; - for (;;) - { - if (s2 < s_end) - { - ucs4_t uc2; - int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); - if (uc2 == 0x0307) /* COMBINING DOT ABOVE */ - { - applies = true; - break; - } - { - int ccc = uc_combining_class (uc2); - if (ccc == UC_CCC_A || ccc == UC_CCC_NR) - break; - } - s2 += count2; - } - else - { - applies = ((suffix_context.bits & SCC_BEFORE_DOT_MASK) != 0); - break; - } - } - } - break; - - case SCC_AFTER_I: - /* "Before" condition: There is an uppercase I before - it, and there is no intervening character of - combining class 0 or 230 (Above). */ - /* Test the "before" condition. */ - applies = (last_char_normal_or_above == 'I'); - break; - - default: - abort (); - } - if (rule->context < 0) - applies = !applies; - - if (applies) - { - /* The rule applies. - Look up the mapping (0 to 3 characters). */ - const unsigned short *mapped_in_rule = - (const unsigned short *)((const char *)rule + offset_in_rule); - - if (mapped_in_rule[0] == 0) - mapped_count = 0; - else - { - mapped_uc[0] = mapped_in_rule[0]; - if (mapped_in_rule[1] == 0) - mapped_count = 1; - else - { - mapped_uc[1] = mapped_in_rule[1]; - if (mapped_in_rule[2] == 0) - mapped_count = 2; - else - { - mapped_uc[2] = mapped_in_rule[2]; - mapped_count = 3; - } - } - } - goto found_mapping; - } - } - - /* Optimization: Save a hash table lookup in the next round. */ - if (!rule->has_next) - break; - } - } - - /* No special-cased mapping. So use the locale and context independent - mapping. */ - mapped_uc[0] = single_character_map (uc); - mapped_count = 1; + ucs4_t uc; + int count = U_MBTOUC_UNSAFE (&uc, s, s_end - s); + + ucs4_t mapped_uc[3]; + unsigned int mapped_count; + + if (uc < 0x10000) + { + /* Look first in the special-casing table. */ + char code[3]; + + code[0] = (uc >> 8) & 0xff; + code[1] = uc & 0xff; + + for (code[2] = 0; ; code[2]++) + { + const struct special_casing_rule *rule = + gl_unicase_special_lookup (code, 3); + + if (rule == NULL) + break; + + /* Test if the condition applies. */ + /* Does the language apply? */ + if (rule->language[0] == '\0' + || (iso639_language != NULL + && iso639_language[0] == rule->language[0] + && iso639_language[1] == rule->language[1])) + { + /* Does the context apply? */ + int context = rule->context; + bool applies; + + if (context < 0) + context = - context; + switch (context) + { + case SCC_ALWAYS: + applies = true; + break; + + case SCC_FINAL_SIGMA: + /* "Before" condition: preceded by a sequence + consisting of a cased letter and a case-ignorable + sequence. + "After" condition: not followed by a sequence + consisting of a case-ignorable sequence and then a + cased letter. */ + /* Test the "before" condition. */ + applies = uc_is_cased (last_char_except_ignorable); + /* Test the "after" condition. */ + if (applies) + { + const UNIT *s2 = s + count; + for (;;) + { + if (s2 < s_end) + { + ucs4_t uc2; + int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); + /* Our uc_is_case_ignorable function is + known to return false for all cased + characters. So we can call + uc_is_case_ignorable first. */ + if (!uc_is_case_ignorable (uc2)) + { + applies = ! uc_is_cased (uc2); + break; + } + s2 += count2; + } + else + { + applies = ! uc_is_cased (suffix_context.first_char_except_ignorable); + break; + } + } + } + break; + + case SCC_AFTER_SOFT_DOTTED: + /* "Before" condition: There is a Soft_Dotted character + before it, with no intervening character of + combining class 0 or 230 (Above). */ + /* Test the "before" condition. */ + applies = uc_is_property_soft_dotted (last_char_normal_or_above); + break; + + case SCC_MORE_ABOVE: + /* "After" condition: followed by a character of + combining class 230 (Above) with no intervening + character of combining class 0 or 230 (Above). */ + /* Test the "after" condition. */ + { + const UNIT *s2 = s + count; + applies = false; + for (;;) + { + if (s2 < s_end) + { + ucs4_t uc2; + int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); + int ccc = uc_combining_class (uc2); + if (ccc == UC_CCC_A) + { + applies = true; + break; + } + if (ccc == UC_CCC_NR) + break; + s2 += count2; + } + else + { + applies = ((suffix_context.bits & SCC_MORE_ABOVE_MASK) != 0); + break; + } + } + } + break; + + case SCC_BEFORE_DOT: + /* "After" condition: followed by COMBINING DOT ABOVE + (U+0307). Any sequence of characters with a + combining class that is neither 0 nor 230 may + intervene between the current character and the + combining dot above. */ + /* Test the "after" condition. */ + { + const UNIT *s2 = s + count; + applies = false; + for (;;) + { + if (s2 < s_end) + { + ucs4_t uc2; + int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); + if (uc2 == 0x0307) /* COMBINING DOT ABOVE */ + { + applies = true; + break; + } + { + int ccc = uc_combining_class (uc2); + if (ccc == UC_CCC_A || ccc == UC_CCC_NR) + break; + } + s2 += count2; + } + else + { + applies = ((suffix_context.bits & SCC_BEFORE_DOT_MASK) != 0); + break; + } + } + } + break; + + case SCC_AFTER_I: + /* "Before" condition: There is an uppercase I before + it, and there is no intervening character of + combining class 0 or 230 (Above). */ + /* Test the "before" condition. */ + applies = (last_char_normal_or_above == 'I'); + break; + + default: + abort (); + } + if (rule->context < 0) + applies = !applies; + + if (applies) + { + /* The rule applies. + Look up the mapping (0 to 3 characters). */ + const unsigned short *mapped_in_rule = + (const unsigned short *)((const char *)rule + offset_in_rule); + + if (mapped_in_rule[0] == 0) + mapped_count = 0; + else + { + mapped_uc[0] = mapped_in_rule[0]; + if (mapped_in_rule[1] == 0) + mapped_count = 1; + else + { + mapped_uc[1] = mapped_in_rule[1]; + if (mapped_in_rule[2] == 0) + mapped_count = 2; + else + { + mapped_uc[2] = mapped_in_rule[2]; + mapped_count = 3; + } + } + } + goto found_mapping; + } + } + + /* Optimization: Save a hash table lookup in the next round. */ + if (!rule->has_next) + break; + } + } + + /* No special-cased mapping. So use the locale and context independent + mapping. */ + mapped_uc[0] = single_character_map (uc); + mapped_count = 1; found_mapping: - /* Found the mapping: uc maps to mapped_uc[0..mapped_count-1]. */ - { - unsigned int i; - - for (i = 0; i < mapped_count; i++) - { - ucs4_t muc = mapped_uc[i]; - - /* Append muc to the result accumulator. */ - if (length < allocated) - { - int ret = U_UCTOMB (result + length, muc, allocated - length); - if (ret == -1) - { - errno = EINVAL; - goto fail; - } - if (ret >= 0) - { - length += ret; - goto done_appending; - } - } - { - size_t old_allocated = allocated; - size_t new_allocated = 2 * old_allocated; - if (new_allocated < 64) - new_allocated = 64; - if (new_allocated < old_allocated) /* integer overflow? */ - abort (); - { - UNIT *larger_result; - if (result == NULL) - { - larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail; - } - } - else if (result == resultbuf) - { - larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail; - } - U_CPY (larger_result, resultbuf, length); - } - else - { - larger_result = - (UNIT *) realloc (result, new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail; - } - } - result = larger_result; - allocated = new_allocated; - { - int ret = U_UCTOMB (result + length, muc, allocated - length); - if (ret == -1) - { - errno = EINVAL; - goto fail; - } - if (ret < 0) - abort (); - length += ret; - goto done_appending; - } - } - } - done_appending: ; - } - } - - if (!uc_is_case_ignorable (uc)) - last_char_except_ignorable = uc; - - { - int ccc = uc_combining_class (uc); - if (ccc == UC_CCC_A || ccc == UC_CCC_NR) - last_char_normal_or_above = uc; - } - - s += count; + /* Found the mapping: uc maps to mapped_uc[0..mapped_count-1]. */ + { + unsigned int i; + + for (i = 0; i < mapped_count; i++) + { + ucs4_t muc = mapped_uc[i]; + + /* Append muc to the result accumulator. */ + if (length < allocated) + { + int ret = U_UCTOMB (result + length, muc, allocated - length); + if (ret == -1) + { + errno = EINVAL; + goto fail; + } + if (ret >= 0) + { + length += ret; + goto done_appending; + } + } + { + size_t old_allocated = allocated; + size_t new_allocated = 2 * old_allocated; + if (new_allocated < 64) + new_allocated = 64; + if (new_allocated < old_allocated) /* integer overflow? */ + abort (); + { + UNIT *larger_result; + if (result == NULL) + { + larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail; + } + } + else if (result == resultbuf) + { + larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail; + } + U_CPY (larger_result, resultbuf, length); + } + else + { + larger_result = + (UNIT *) realloc (result, new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail; + } + } + result = larger_result; + allocated = new_allocated; + { + int ret = U_UCTOMB (result + length, muc, allocated - length); + if (ret == -1) + { + errno = EINVAL; + goto fail; + } + if (ret < 0) + abort (); + length += ret; + goto done_appending; + } + } + } + done_appending: ; + } + } + + if (!uc_is_case_ignorable (uc)) + last_char_except_ignorable = uc; + + { + int ccc = uc_combining_class (uc); + if (ccc == UC_CCC_A || ccc == UC_CCC_NR) + last_char_normal_or_above = uc; + } + + s += count; } } @@ -373,7 +373,7 @@ FUNC (const UNIT *s, size_t n, normalized_result = U_NORMALIZE (nf, result, length, resultbuf, lengthp); if (normalized_result == NULL) - goto fail; + goto fail; free (result); return normalized_result; @@ -382,15 +382,15 @@ FUNC (const UNIT *s, size_t n, if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - goto fail; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + goto fail; + } + } } else if (result != resultbuf && length < allocated) { @@ -399,7 +399,7 @@ FUNC (const UNIT *s, size_t n, memory = (UNIT *) realloc (result, length * sizeof (UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unicase/u-casexfrm.h b/lib/unicase/u-casexfrm.h index e36aff3..5c7430c 100644 --- a/lib/unicase/u-casexfrm.h +++ b/lib/unicase/u-casexfrm.h @@ -1,6 +1,6 @@ /* Locale dependent transformation for case insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -38,18 +38,18 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, uninorm_t nf, /* Convert it to locale encoding. */ convs_length = sizeof (convsbuf) - 1; convs = U_CONV_TO_ENCODING (locale_charset (), - iconveh_error, - foldeds, foldeds_length, - NULL, - convsbuf, &convs_length); + iconveh_error, + foldeds, foldeds_length, + NULL, + convsbuf, &convs_length); if (convs == NULL) { if (foldeds != foldedsbuf) - { - int saved_errno = errno; - free (foldeds); - errno = saved_errno; - } + { + int saved_errno = errno; + free (foldeds); + errno = saved_errno; + } return NULL; } @@ -61,11 +61,11 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, uninorm_t nf, { char *memory = (char *) realloc (convs, convs_length + 1); if (memory == NULL) - { - free (convs); - errno = ENOMEM; - return NULL; - } + { + free (convs); + errno = ENOMEM; + return NULL; + } convs = memory; } @@ -74,11 +74,11 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, uninorm_t nf, if (result == NULL) { if (convs != convsbuf) - { - int saved_errno = errno; - free (convs); - errno = saved_errno; - } + { + int saved_errno = errno; + free (convs); + errno = saved_errno; + } return NULL; } diff --git a/lib/unicase/u-ct-casefold.h b/lib/unicase/u-ct-casefold.h index d97be26..e11d0a8 100644 --- a/lib/unicase/u-ct-casefold.h +++ b/lib/unicase/u-ct-casefold.h @@ -1,5 +1,5 @@ /* Casefolding mapping for Unicode substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -36,14 +36,14 @@ FUNC (const UNIT *s, size_t n, if (nf == NULL) /* X -> toCasefold(X) */ return U_CASEMAP (s, n, prefix_context, suffix_context, iso639_language, - uc_tocasefold, offsetof (struct special_casing_rule, casefold[0]), - NULL, - resultbuf, lengthp); + uc_tocasefold, offsetof (struct special_casing_rule, casefold[0]), + NULL, + resultbuf, lengthp); else { uninorm_t nfd = uninorm_decomposing_form (nf); /* X -> nf(toCasefold(NFD(X))) or - X -> nf(toCasefold(nfd(toCasefold(NFD(X))))) */ + X -> nf(toCasefold(nfd(toCasefold(NFD(X))))) */ int repeat = (uninorm_is_compat_decomposing (nf) ? 2 : 1); UNIT tmpbuf1[2048 / sizeof (UNIT)]; UNIT tmpbuf2[2048 / sizeof (UNIT)]; @@ -55,51 +55,51 @@ FUNC (const UNIT *s, size_t n, tmp1_length = sizeof (tmpbuf1) / sizeof (UNIT); tmp1 = U_NORMALIZE (UNINORM_NFD, s, n, tmpbuf1, &tmp1_length); if (tmp1 == NULL) - /* errno is set here. */ - return NULL; + /* errno is set here. */ + return NULL; do - { - tmp2_length = sizeof (tmpbuf2) / sizeof (UNIT); - tmp2 = U_CASEMAP (tmp1, tmp1_length, - prefix_context, suffix_context, iso639_language, - uc_tocasefold, offsetof (struct special_casing_rule, casefold[0]), - NULL, - tmpbuf2, &tmp2_length); - if (tmp2 == NULL) - { - int saved_errno = errno; - if (tmp1 != tmpbuf1) - free (tmp1); - errno = saved_errno; - return NULL; - } + { + tmp2_length = sizeof (tmpbuf2) / sizeof (UNIT); + tmp2 = U_CASEMAP (tmp1, tmp1_length, + prefix_context, suffix_context, iso639_language, + uc_tocasefold, offsetof (struct special_casing_rule, casefold[0]), + NULL, + tmpbuf2, &tmp2_length); + if (tmp2 == NULL) + { + int saved_errno = errno; + if (tmp1 != tmpbuf1) + free (tmp1); + errno = saved_errno; + return NULL; + } - if (tmp1 != tmpbuf1) - free (tmp1); + if (tmp1 != tmpbuf1) + free (tmp1); - if (repeat > 1) - { - tmp1_length = sizeof (tmpbuf1) / sizeof (UNIT); - tmp1 = U_NORMALIZE (nfd, tmp2, tmp2_length, - tmpbuf1, &tmp1_length); - } - else - /* Last run through this loop. */ - tmp1 = U_NORMALIZE (nf, tmp2, tmp2_length, - resultbuf, lengthp); - if (tmp1 == NULL) - { - int saved_errno = errno; - if (tmp2 != tmpbuf2) - free (tmp2); - errno = saved_errno; - return NULL; - } + if (repeat > 1) + { + tmp1_length = sizeof (tmpbuf1) / sizeof (UNIT); + tmp1 = U_NORMALIZE (nfd, tmp2, tmp2_length, + tmpbuf1, &tmp1_length); + } + else + /* Last run through this loop. */ + tmp1 = U_NORMALIZE (nf, tmp2, tmp2_length, + resultbuf, lengthp); + if (tmp1 == NULL) + { + int saved_errno = errno; + if (tmp2 != tmpbuf2) + free (tmp2); + errno = saved_errno; + return NULL; + } - if (tmp2 != tmpbuf2) - free (tmp2); - } + if (tmp2 != tmpbuf2) + free (tmp2); + } while (--repeat > 0); return tmp1; diff --git a/lib/unicase/u-ct-totitle.h b/lib/unicase/u-ct-totitle.h index f0d4fd7..8892a5d 100644 --- a/lib/unicase/u-ct-totitle.h +++ b/lib/unicase/u-ct-totitle.h @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-8/UTF-16/UTF-32 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -55,10 +55,10 @@ FUNC (const UNIT *s, size_t n, { wordbreaks = (char *) malloc (n); if (wordbreaks == NULL) - { - errno = ENOMEM; - goto fail2; - } + { + errno = ENOMEM; + goto fail2; + } U_WORDBREAKS (s, n, wordbreaks); } else @@ -70,12 +70,12 @@ FUNC (const UNIT *s, size_t n, /* When considering the string as segmented by word boundaries: For each such segment: - - In the first part, we are searching for the first cased character. - In this state, in_word_first_part = true, and no conversion takes - place. - - In the second part, we are converting every character: the first - among these characters to title case, the other ones to lower case. - In this state, in_word_first_part = false. */ + - In the first part, we are searching for the first cased character. + In this state, in_word_first_part = true, and no conversion takes + place. + - In the second part, we are converting every character: the first + among these characters to title case, the other ones to lower case. + In this state, in_word_first_part = false. */ bool in_word_first_part = true; /* Helper for evaluating the FINAL_SIGMA condition: @@ -90,356 +90,356 @@ FUNC (const UNIT *s, size_t n, while (s < s_end) { - /* Fetch the next character. */ - ucs4_t uc; - int count = U_MBTOUC_UNSAFE (&uc, s, s_end - s); - - ucs4_t (*single_character_map) (ucs4_t); - size_t offset_in_rule; /* offset in 'struct special_casing_rule' */ - - ucs4_t mapped_uc[3]; - unsigned int mapped_count; - - if (*wp) - /* Crossing a word boundary. */ - in_word_first_part = true; - - /* Determine single_character_map, offset_in_rule. - There are three possibilities: - - uc should not be converted. - - uc should be titlecased. - - uc should be lowercased. */ - if (in_word_first_part) - { - if (uc_is_cased (uc)) - { - /* uc is to be titlecased. */ - single_character_map = uc_totitle; - offset_in_rule = offsetof (struct special_casing_rule, title[0]); - in_word_first_part = false; - } - else - { - /* uc is not converted. */ - single_character_map = NULL; - offset_in_rule = 0; - } - } - else - { - /* uc is to be lowercased. */ - single_character_map = uc_tolower; - offset_in_rule = offsetof (struct special_casing_rule, lower[0]); - } - - /* Actually map uc. */ - if (single_character_map == NULL) - { - mapped_uc[0] = uc; - mapped_count = 1; - goto found_mapping; - } - - if (uc < 0x10000) - { - /* Look first in the special-casing table. */ - char code[3]; - - code[0] = (uc >> 8) & 0xff; - code[1] = uc & 0xff; - - for (code[2] = 0; ; code[2]++) - { - const struct special_casing_rule *rule = - gl_unicase_special_lookup (code, 3); - - if (rule == NULL) - break; - - /* Test if the condition applies. */ - /* Does the language apply? */ - if (rule->language[0] == '\0' - || (iso639_language != NULL - && iso639_language[0] == rule->language[0] - && iso639_language[1] == rule->language[1])) - { - /* Does the context apply? */ - int context = rule->context; - bool applies; - - if (context < 0) - context = - context; - switch (context) - { - case SCC_ALWAYS: - applies = true; - break; - - case SCC_FINAL_SIGMA: - /* "Before" condition: preceded by a sequence - consisting of a cased letter and a case-ignorable - sequence. - "After" condition: not followed by a sequence - consisting of a case-ignorable sequence and then a - cased letter. */ - /* Test the "before" condition. */ - applies = uc_is_cased (last_char_except_ignorable); - /* Test the "after" condition. */ - if (applies) - { - const UNIT *s2 = s + count; - for (;;) - { - if (s2 < s_end) - { - ucs4_t uc2; - int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); - /* Our uc_is_case_ignorable function is - known to return false for all cased - characters. So we can call - uc_is_case_ignorable first. */ - if (!uc_is_case_ignorable (uc2)) - { - applies = ! uc_is_cased (uc2); - break; - } - s2 += count2; - } - else - { - applies = ! uc_is_cased (suffix_context.first_char_except_ignorable); - break; - } - } - } - break; - - case SCC_AFTER_SOFT_DOTTED: - /* "Before" condition: There is a Soft_Dotted character - before it, with no intervening character of - combining class 0 or 230 (Above). */ - /* Test the "before" condition. */ - applies = uc_is_property_soft_dotted (last_char_normal_or_above); - break; - - case SCC_MORE_ABOVE: - /* "After" condition: followed by a character of - combining class 230 (Above) with no intervening - character of combining class 0 or 230 (Above). */ - /* Test the "after" condition. */ - { - const UNIT *s2 = s + count; - applies = false; - for (;;) - { - if (s2 < s_end) - { - ucs4_t uc2; - int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); - int ccc = uc_combining_class (uc2); - if (ccc == UC_CCC_A) - { - applies = true; - break; - } - if (ccc == UC_CCC_NR) - break; - s2 += count2; - } - else - { - applies = ((suffix_context.bits & SCC_MORE_ABOVE_MASK) != 0); - break; - } - } - } - break; - - case SCC_BEFORE_DOT: - /* "After" condition: followed by COMBINING DOT ABOVE - (U+0307). Any sequence of characters with a - combining class that is neither 0 nor 230 may - intervene between the current character and the - combining dot above. */ - /* Test the "after" condition. */ - { - const UNIT *s2 = s + count; - applies = false; - for (;;) - { - if (s2 < s_end) - { - ucs4_t uc2; - int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); - if (uc2 == 0x0307) /* COMBINING DOT ABOVE */ - { - applies = true; - break; - } - { - int ccc = uc_combining_class (uc2); - if (ccc == UC_CCC_A || ccc == UC_CCC_NR) - break; - } - s2 += count2; - } - else - { - applies = ((suffix_context.bits & SCC_BEFORE_DOT_MASK) != 0); - break; - } - } - } - break; - - case SCC_AFTER_I: - /* "Before" condition: There is an uppercase I before - it, and there is no intervening character of - combining class 0 or 230 (Above). */ - /* Test the "before" condition. */ - applies = (last_char_normal_or_above == 'I'); - break; - - default: - abort (); - } - if (rule->context < 0) - applies = !applies; - - if (applies) - { - /* The rule applies. - Look up the mapping (0 to 3 characters). */ - const unsigned short *mapped_in_rule = - (const unsigned short *)((const char *)rule + offset_in_rule); - - if (mapped_in_rule[0] == 0) - mapped_count = 0; - else - { - mapped_uc[0] = mapped_in_rule[0]; - if (mapped_in_rule[1] == 0) - mapped_count = 1; - else - { - mapped_uc[1] = mapped_in_rule[1]; - if (mapped_in_rule[2] == 0) - mapped_count = 2; - else - { - mapped_uc[2] = mapped_in_rule[2]; - mapped_count = 3; - } - } - } - goto found_mapping; - } - } - - /* Optimization: Save a hash table lookup in the next round. */ - if (!rule->has_next) - break; - } - } - - /* No special-cased mapping. So use the locale and context independent - mapping. */ - mapped_uc[0] = single_character_map (uc); - mapped_count = 1; + /* Fetch the next character. */ + ucs4_t uc; + int count = U_MBTOUC_UNSAFE (&uc, s, s_end - s); + + ucs4_t (*single_character_map) (ucs4_t); + size_t offset_in_rule; /* offset in 'struct special_casing_rule' */ + + ucs4_t mapped_uc[3]; + unsigned int mapped_count; + + if (*wp) + /* Crossing a word boundary. */ + in_word_first_part = true; + + /* Determine single_character_map, offset_in_rule. + There are three possibilities: + - uc should not be converted. + - uc should be titlecased. + - uc should be lowercased. */ + if (in_word_first_part) + { + if (uc_is_cased (uc)) + { + /* uc is to be titlecased. */ + single_character_map = uc_totitle; + offset_in_rule = offsetof (struct special_casing_rule, title[0]); + in_word_first_part = false; + } + else + { + /* uc is not converted. */ + single_character_map = NULL; + offset_in_rule = 0; + } + } + else + { + /* uc is to be lowercased. */ + single_character_map = uc_tolower; + offset_in_rule = offsetof (struct special_casing_rule, lower[0]); + } + + /* Actually map uc. */ + if (single_character_map == NULL) + { + mapped_uc[0] = uc; + mapped_count = 1; + goto found_mapping; + } + + if (uc < 0x10000) + { + /* Look first in the special-casing table. */ + char code[3]; + + code[0] = (uc >> 8) & 0xff; + code[1] = uc & 0xff; + + for (code[2] = 0; ; code[2]++) + { + const struct special_casing_rule *rule = + gl_unicase_special_lookup (code, 3); + + if (rule == NULL) + break; + + /* Test if the condition applies. */ + /* Does the language apply? */ + if (rule->language[0] == '\0' + || (iso639_language != NULL + && iso639_language[0] == rule->language[0] + && iso639_language[1] == rule->language[1])) + { + /* Does the context apply? */ + int context = rule->context; + bool applies; + + if (context < 0) + context = - context; + switch (context) + { + case SCC_ALWAYS: + applies = true; + break; + + case SCC_FINAL_SIGMA: + /* "Before" condition: preceded by a sequence + consisting of a cased letter and a case-ignorable + sequence. + "After" condition: not followed by a sequence + consisting of a case-ignorable sequence and then a + cased letter. */ + /* Test the "before" condition. */ + applies = uc_is_cased (last_char_except_ignorable); + /* Test the "after" condition. */ + if (applies) + { + const UNIT *s2 = s + count; + for (;;) + { + if (s2 < s_end) + { + ucs4_t uc2; + int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); + /* Our uc_is_case_ignorable function is + known to return false for all cased + characters. So we can call + uc_is_case_ignorable first. */ + if (!uc_is_case_ignorable (uc2)) + { + applies = ! uc_is_cased (uc2); + break; + } + s2 += count2; + } + else + { + applies = ! uc_is_cased (suffix_context.first_char_except_ignorable); + break; + } + } + } + break; + + case SCC_AFTER_SOFT_DOTTED: + /* "Before" condition: There is a Soft_Dotted character + before it, with no intervening character of + combining class 0 or 230 (Above). */ + /* Test the "before" condition. */ + applies = uc_is_property_soft_dotted (last_char_normal_or_above); + break; + + case SCC_MORE_ABOVE: + /* "After" condition: followed by a character of + combining class 230 (Above) with no intervening + character of combining class 0 or 230 (Above). */ + /* Test the "after" condition. */ + { + const UNIT *s2 = s + count; + applies = false; + for (;;) + { + if (s2 < s_end) + { + ucs4_t uc2; + int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); + int ccc = uc_combining_class (uc2); + if (ccc == UC_CCC_A) + { + applies = true; + break; + } + if (ccc == UC_CCC_NR) + break; + s2 += count2; + } + else + { + applies = ((suffix_context.bits & SCC_MORE_ABOVE_MASK) != 0); + break; + } + } + } + break; + + case SCC_BEFORE_DOT: + /* "After" condition: followed by COMBINING DOT ABOVE + (U+0307). Any sequence of characters with a + combining class that is neither 0 nor 230 may + intervene between the current character and the + combining dot above. */ + /* Test the "after" condition. */ + { + const UNIT *s2 = s + count; + applies = false; + for (;;) + { + if (s2 < s_end) + { + ucs4_t uc2; + int count2 = U_MBTOUC_UNSAFE (&uc2, s2, s_end - s2); + if (uc2 == 0x0307) /* COMBINING DOT ABOVE */ + { + applies = true; + break; + } + { + int ccc = uc_combining_class (uc2); + if (ccc == UC_CCC_A || ccc == UC_CCC_NR) + break; + } + s2 += count2; + } + else + { + applies = ((suffix_context.bits & SCC_BEFORE_DOT_MASK) != 0); + break; + } + } + } + break; + + case SCC_AFTER_I: + /* "Before" condition: There is an uppercase I before + it, and there is no intervening character of + combining class 0 or 230 (Above). */ + /* Test the "before" condition. */ + applies = (last_char_normal_or_above == 'I'); + break; + + default: + abort (); + } + if (rule->context < 0) + applies = !applies; + + if (applies) + { + /* The rule applies. + Look up the mapping (0 to 3 characters). */ + const unsigned short *mapped_in_rule = + (const unsigned short *)((const char *)rule + offset_in_rule); + + if (mapped_in_rule[0] == 0) + mapped_count = 0; + else + { + mapped_uc[0] = mapped_in_rule[0]; + if (mapped_in_rule[1] == 0) + mapped_count = 1; + else + { + mapped_uc[1] = mapped_in_rule[1]; + if (mapped_in_rule[2] == 0) + mapped_count = 2; + else + { + mapped_uc[2] = mapped_in_rule[2]; + mapped_count = 3; + } + } + } + goto found_mapping; + } + } + + /* Optimization: Save a hash table lookup in the next round. */ + if (!rule->has_next) + break; + } + } + + /* No special-cased mapping. So use the locale and context independent + mapping. */ + mapped_uc[0] = single_character_map (uc); + mapped_count = 1; found_mapping: - /* Found the mapping: uc maps to mapped_uc[0..mapped_count-1]. */ - { - unsigned int i; - - for (i = 0; i < mapped_count; i++) - { - ucs4_t muc = mapped_uc[i]; - - /* Append muc to the result accumulator. */ - if (length < allocated) - { - int ret = U_UCTOMB (result + length, muc, allocated - length); - if (ret == -1) - { - errno = EINVAL; - goto fail1; - } - if (ret >= 0) - { - length += ret; - goto done_appending; - } - } - { - size_t old_allocated = allocated; - size_t new_allocated = 2 * old_allocated; - if (new_allocated < 64) - new_allocated = 64; - if (new_allocated < old_allocated) /* integer overflow? */ - abort (); - { - UNIT *larger_result; - if (result == NULL) - { - larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail1; - } - } - else if (result == resultbuf) - { - larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail1; - } - U_CPY (larger_result, resultbuf, length); - } - else - { - larger_result = - (UNIT *) realloc (result, new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail1; - } - } - result = larger_result; - allocated = new_allocated; - { - int ret = U_UCTOMB (result + length, muc, allocated - length); - if (ret == -1) - { - errno = EINVAL; - goto fail1; - } - if (ret < 0) - abort (); - length += ret; - goto done_appending; - } - } - } - done_appending: ; - } - } - - if (!uc_is_case_ignorable (uc)) - last_char_except_ignorable = uc; - - { - int ccc = uc_combining_class (uc); - if (ccc == UC_CCC_A || ccc == UC_CCC_NR) - last_char_normal_or_above = uc; - } - - s += count; - wp += count; + /* Found the mapping: uc maps to mapped_uc[0..mapped_count-1]. */ + { + unsigned int i; + + for (i = 0; i < mapped_count; i++) + { + ucs4_t muc = mapped_uc[i]; + + /* Append muc to the result accumulator. */ + if (length < allocated) + { + int ret = U_UCTOMB (result + length, muc, allocated - length); + if (ret == -1) + { + errno = EINVAL; + goto fail1; + } + if (ret >= 0) + { + length += ret; + goto done_appending; + } + } + { + size_t old_allocated = allocated; + size_t new_allocated = 2 * old_allocated; + if (new_allocated < 64) + new_allocated = 64; + if (new_allocated < old_allocated) /* integer overflow? */ + abort (); + { + UNIT *larger_result; + if (result == NULL) + { + larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail1; + } + } + else if (result == resultbuf) + { + larger_result = (UNIT *) malloc (new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail1; + } + U_CPY (larger_result, resultbuf, length); + } + else + { + larger_result = + (UNIT *) realloc (result, new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail1; + } + } + result = larger_result; + allocated = new_allocated; + { + int ret = U_UCTOMB (result + length, muc, allocated - length); + if (ret == -1) + { + errno = EINVAL; + goto fail1; + } + if (ret < 0) + abort (); + length += ret; + goto done_appending; + } + } + } + done_appending: ; + } + } + + if (!uc_is_case_ignorable (uc)) + last_char_except_ignorable = uc; + + { + int ccc = uc_combining_class (uc); + if (ccc == UC_CCC_A || ccc == UC_CCC_NR) + last_char_normal_or_above = uc; + } + + s += count; + wp += count; } } @@ -452,7 +452,7 @@ FUNC (const UNIT *s, size_t n, normalized_result = U_NORMALIZE (nf, result, length, resultbuf, lengthp); if (normalized_result == NULL) - goto fail2; + goto fail2; free (result); return normalized_result; @@ -461,15 +461,15 @@ FUNC (const UNIT *s, size_t n, if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - goto fail2; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + goto fail2; + } + } } else if (result != resultbuf && length < allocated) { @@ -478,7 +478,7 @@ FUNC (const UNIT *s, size_t n, memory = (UNIT *) realloc (result, length * sizeof (UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unicase/u-is-cased.h b/lib/unicase/u-is-cased.h index b96a60f..c187a30 100644 --- a/lib/unicase/u-is-cased.h +++ b/lib/unicase/u-is-cased.h @@ -1,5 +1,5 @@ /* Test whether case matters for a Unicode string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -39,30 +39,30 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, /* Apply toupper mapping. */ mapped_toupper = U_TOUPPER (norms, norms_length, iso639_language, NULL, - mappedbuf, &mapped_length); + mappedbuf, &mapped_length); if (mapped_toupper == NULL) goto fail; /* Compare. */ if (!(mapped_length == norms_length - && U_CMP (mapped_toupper, norms, norms_length) == 0)) + && U_CMP (mapped_toupper, norms, norms_length) == 0)) { if (mapped_toupper != mappedbuf) - free (mapped_toupper); + free (mapped_toupper); goto yes; } /* Apply tolower mapping. */ mapped_tolower = U_TOLOWER (norms, norms_length, iso639_language, NULL, - mapped_toupper, &mapped_length); + mapped_toupper, &mapped_length); if (mapped_tolower == NULL) { if (mapped_toupper != mappedbuf) - { - int saved_errno = errno; - free (mapped_toupper); - errno = saved_errno; - } + { + int saved_errno = errno; + free (mapped_toupper); + errno = saved_errno; + } goto fail; } @@ -71,24 +71,24 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, /* Compare. */ if (!(mapped_length == norms_length - && U_CMP (mapped_tolower, norms, norms_length) == 0)) + && U_CMP (mapped_tolower, norms, norms_length) == 0)) { if (mapped_tolower != mappedbuf) - free (mapped_tolower); + free (mapped_tolower); goto yes; } /* Apply totitle mapping. */ mapped_totitle = U_TOTITLE (norms, norms_length, iso639_language, NULL, - mapped_tolower, &mapped_length); + mapped_tolower, &mapped_length); if (mapped_totitle == NULL) { if (mapped_tolower != mappedbuf) - { - int saved_errno = errno; - free (mapped_tolower); - errno = saved_errno; - } + { + int saved_errno = errno; + free (mapped_tolower); + errno = saved_errno; + } goto fail; } @@ -97,10 +97,10 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, /* Compare. */ if (!(mapped_length == norms_length - && U_CMP (mapped_totitle, norms, norms_length) == 0)) + && U_CMP (mapped_totitle, norms, norms_length) == 0)) { if (mapped_totitle != mappedbuf) - free (mapped_totitle); + free (mapped_totitle); goto yes; } diff --git a/lib/unicase/u-is-invariant.h b/lib/unicase/u-is-invariant.h index e6b7fbb..541dd8d 100644 --- a/lib/unicase/u-is-invariant.h +++ b/lib/unicase/u-is-invariant.h @@ -1,5 +1,5 @@ /* Test whether a Unicode string is invariant under a given case mapping. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -18,8 +18,8 @@ int FUNC (const UNIT *s, size_t n, UNIT * (*mapping) (const UNIT *s, size_t n, const char *iso639_language, - uninorm_t nf, - UNIT *resultbuf, size_t *lengthp), + uninorm_t nf, + UNIT *resultbuf, size_t *lengthp), const char *iso639_language, bool *resultp) { @@ -40,21 +40,21 @@ FUNC (const UNIT *s, size_t n, /* Apply mapping. */ mapped_length = sizeof (mappedbuf) / sizeof (UNIT); mapped = mapping (norms, norms_length, iso639_language, NULL, - mappedbuf, &mapped_length); + mappedbuf, &mapped_length); if (mapped == NULL) { if (norms != normsbuf) - { - int saved_errno = errno; - free (norms); - errno = saved_errno; - } + { + int saved_errno = errno; + free (norms); + errno = saved_errno; + } return -1; } /* Compare. */ *resultp = (mapped_length == norms_length - && U_CMP (mapped, norms, norms_length) == 0); + && U_CMP (mapped, norms, norms_length) == 0); if (mapped != mappedbuf) free (mapped); diff --git a/lib/unicase/u-totitle.h b/lib/unicase/u-totitle.h index 431f000..658c95f 100644 --- a/lib/unicase/u-totitle.h +++ b/lib/unicase/u-totitle.h @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-8/UTF-16/UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -21,8 +21,8 @@ FUNC (const UNIT *s, size_t n, const char *iso639_language, UNIT *resultbuf, size_t *lengthp) { return U_CT_TOTITLE (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u16-casecmp.c b/lib/unicase/u16-casecmp.c index 1110874..e6780a9 100644 --- a/lib/unicase/u16-casecmp.c +++ b/lib/unicase/u16-casecmp.c @@ -1,5 +1,5 @@ /* Case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-casecoll.c b/lib/unicase/u16-casecoll.c index 882039c..986bdb8 100644 --- a/lib/unicase/u16-casecoll.c +++ b/lib/unicase/u16-casecoll.c @@ -1,6 +1,6 @@ /* Locale dependent, case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-casefold.c b/lib/unicase/u16-casefold.c index 5552275..037d51f 100644 --- a/lib/unicase/u16-casefold.c +++ b/lib/unicase/u16-casefold.c @@ -1,5 +1,5 @@ /* Casefolding mapping for UTF-16 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-casemap.c b/lib/unicase/u16-casemap.c index 0766de9..b8021e7 100644 --- a/lib/unicase/u16-casemap.c +++ b/lib/unicase/u16-casemap.c @@ -1,5 +1,5 @@ /* Case mapping for UTF-16 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-casexfrm.c b/lib/unicase/u16-casexfrm.c index 09d08ce..661902f 100644 --- a/lib/unicase/u16-casexfrm.c +++ b/lib/unicase/u16-casexfrm.c @@ -1,6 +1,6 @@ /* Locale dependent transformation for case insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-ct-casefold.c b/lib/unicase/u16-ct-casefold.c index 6dff77d..65e49e7 100644 --- a/lib/unicase/u16-ct-casefold.c +++ b/lib/unicase/u16-ct-casefold.c @@ -1,5 +1,5 @@ /* Casefolding mapping for UTF-16 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-ct-tolower.c b/lib/unicase/u16-ct-tolower.c index 36b34e0..2b09c7e 100644 --- a/lib/unicase/u16-ct-tolower.c +++ b/lib/unicase/u16-ct-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-16 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,14 +27,14 @@ uint16_t * u16_ct_tolower (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp) + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp) { return u16_casemap (s, n, prefix_context, suffix_context, iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u16-ct-totitle.c b/lib/unicase/u16-ct-totitle.c index c01021b..095bd9f 100644 --- a/lib/unicase/u16-ct-totitle.c +++ b/lib/unicase/u16-ct-totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-16 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-ct-toupper.c b/lib/unicase/u16-ct-toupper.c index 029c74b..d26f6c5 100644 --- a/lib/unicase/u16-ct-toupper.c +++ b/lib/unicase/u16-ct-toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for UTF-16 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,14 +27,14 @@ uint16_t * u16_ct_toupper (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp) + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp) { return u16_casemap (s, n, prefix_context, suffix_context, iso639_language, - uc_toupper, offsetof (struct special_casing_rule, upper[0]), - nf, - resultbuf, lengthp); + uc_toupper, offsetof (struct special_casing_rule, upper[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u16-is-cased.c b/lib/unicase/u16-is-cased.c index c2196ce..385c01a 100644 --- a/lib/unicase/u16-is-cased.c +++ b/lib/unicase/u16-is-cased.c @@ -1,5 +1,5 @@ /* Test whether case matters for an UTF-16 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-is-casefolded.c b/lib/unicase/u16-is-casefolded.c index 64a4ec1..dd3b6c1 100644 --- a/lib/unicase/u16-is-casefolded.c +++ b/lib/unicase/u16-is-casefolded.c @@ -1,5 +1,5 @@ /* Test whether an UTF-16 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u16_is_casefolded (const uint16_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u16_is_invariant (s, n, u16_casefold, iso639_language, resultp); } diff --git a/lib/unicase/u16-is-invariant.c b/lib/unicase/u16-is-invariant.c index cace25a..a7f40da 100644 --- a/lib/unicase/u16-is-invariant.c +++ b/lib/unicase/u16-is-invariant.c @@ -1,5 +1,5 @@ /* Test whether an UTF-16 string is invariant under a given case mapping. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -21,6 +21,7 @@ #include "unicase/invariant.h" #include <errno.h> +#include <stdbool.h> #include <stdlib.h> #include "uninorm.h" diff --git a/lib/unicase/u16-is-lowercase.c b/lib/unicase/u16-is-lowercase.c index 36a0151..de51a04 100644 --- a/lib/unicase/u16-is-lowercase.c +++ b/lib/unicase/u16-is-lowercase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-16 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u16_is_lowercase (const uint16_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u16_is_invariant (s, n, u16_tolower, iso639_language, resultp); } diff --git a/lib/unicase/u16-is-titlecase.c b/lib/unicase/u16-is-titlecase.c index 19aacea..4192aad 100644 --- a/lib/unicase/u16-is-titlecase.c +++ b/lib/unicase/u16-is-titlecase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-16 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u16_is_titlecase (const uint16_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u16_is_invariant (s, n, u16_totitle, iso639_language, resultp); } diff --git a/lib/unicase/u16-is-uppercase.c b/lib/unicase/u16-is-uppercase.c index 53e697f..509c9bb 100644 --- a/lib/unicase/u16-is-uppercase.c +++ b/lib/unicase/u16-is-uppercase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-16 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u16_is_uppercase (const uint16_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u16_is_invariant (s, n, u16_toupper, iso639_language, resultp); } diff --git a/lib/unicase/u16-tolower.c b/lib/unicase/u16-tolower.c index 0629cb4..c931cca 100644 --- a/lib/unicase/u16-tolower.c +++ b/lib/unicase/u16-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-16 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,13 +27,13 @@ uint16_t * u16_tolower (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp) { return u16_casemap (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u16-totitle.c b/lib/unicase/u16-totitle.c index e0d14e8..f7c5946 100644 --- a/lib/unicase/u16-totitle.c +++ b/lib/unicase/u16-totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-16 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u16-toupper.c b/lib/unicase/u16-toupper.c index f92989a..12e888a 100644 --- a/lib/unicase/u16-toupper.c +++ b/lib/unicase/u16-toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for UTF-16 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,13 +27,13 @@ uint16_t * u16_toupper (const uint16_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp) { return u16_casemap (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - uc_toupper, offsetof (struct special_casing_rule, upper[0]), - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_toupper, offsetof (struct special_casing_rule, upper[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u32-casecmp.c b/lib/unicase/u32-casecmp.c index e964915..7b67bb1 100644 --- a/lib/unicase/u32-casecmp.c +++ b/lib/unicase/u32-casecmp.c @@ -1,5 +1,5 @@ /* Case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-casecoll.c b/lib/unicase/u32-casecoll.c index 88d994a..6d1d772 100644 --- a/lib/unicase/u32-casecoll.c +++ b/lib/unicase/u32-casecoll.c @@ -1,6 +1,6 @@ /* Locale dependent, case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-casefold.c b/lib/unicase/u32-casefold.c index aff44f8..d1a1341 100644 --- a/lib/unicase/u32-casefold.c +++ b/lib/unicase/u32-casefold.c @@ -1,5 +1,5 @@ /* Casefolding mapping for UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-casemap.c b/lib/unicase/u32-casemap.c index 43e2641..6c8213c 100644 --- a/lib/unicase/u32-casemap.c +++ b/lib/unicase/u32-casemap.c @@ -1,5 +1,5 @@ /* Case mapping for UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-casexfrm.c b/lib/unicase/u32-casexfrm.c index cf8fee6..bd54497 100644 --- a/lib/unicase/u32-casexfrm.c +++ b/lib/unicase/u32-casexfrm.c @@ -1,6 +1,6 @@ /* Locale dependent transformation for case insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-ct-casefold.c b/lib/unicase/u32-ct-casefold.c index e206b67..f360cce 100644 --- a/lib/unicase/u32-ct-casefold.c +++ b/lib/unicase/u32-ct-casefold.c @@ -1,5 +1,5 @@ /* Casefolding mapping for UTF-32 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-ct-tolower.c b/lib/unicase/u32-ct-tolower.c index 83e9fa8..7df6a56 100644 --- a/lib/unicase/u32-ct-tolower.c +++ b/lib/unicase/u32-ct-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-32 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,14 +27,14 @@ uint32_t * u32_ct_tolower (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp) + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp) { return u32_casemap (s, n, prefix_context, suffix_context, iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u32-ct-totitle.c b/lib/unicase/u32-ct-totitle.c index f2a3878..d9f51bb 100644 --- a/lib/unicase/u32-ct-totitle.c +++ b/lib/unicase/u32-ct-totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-32 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-ct-toupper.c b/lib/unicase/u32-ct-toupper.c index 9043dde..e616556 100644 --- a/lib/unicase/u32-ct-toupper.c +++ b/lib/unicase/u32-ct-toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for UTF-32 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,14 +27,14 @@ uint32_t * u32_ct_toupper (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp) + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp) { return u32_casemap (s, n, prefix_context, suffix_context, iso639_language, - uc_toupper, offsetof (struct special_casing_rule, upper[0]), - nf, - resultbuf, lengthp); + uc_toupper, offsetof (struct special_casing_rule, upper[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u32-is-cased.c b/lib/unicase/u32-is-cased.c index 783e57e..e836dc1 100644 --- a/lib/unicase/u32-is-cased.c +++ b/lib/unicase/u32-is-cased.c @@ -1,5 +1,5 @@ /* Test whether case matters for an UTF-32 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-is-casefolded.c b/lib/unicase/u32-is-casefolded.c index a71c767..6c2bbb0 100644 --- a/lib/unicase/u32-is-casefolded.c +++ b/lib/unicase/u32-is-casefolded.c @@ -1,5 +1,5 @@ /* Test whether an UTF-32 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u32_is_casefolded (const uint32_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u32_is_invariant (s, n, u32_casefold, iso639_language, resultp); } diff --git a/lib/unicase/u32-is-invariant.c b/lib/unicase/u32-is-invariant.c index 190a30f..aea4c61 100644 --- a/lib/unicase/u32-is-invariant.c +++ b/lib/unicase/u32-is-invariant.c @@ -1,5 +1,5 @@ /* Test whether an UTF-32 string is invariant under a given case mapping. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -21,6 +21,7 @@ #include "unicase/invariant.h" #include <errno.h> +#include <stdbool.h> #include <stdlib.h> #include "uninorm.h" diff --git a/lib/unicase/u32-is-lowercase.c b/lib/unicase/u32-is-lowercase.c index 104afaa..cc2fa2d 100644 --- a/lib/unicase/u32-is-lowercase.c +++ b/lib/unicase/u32-is-lowercase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-32 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u32_is_lowercase (const uint32_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u32_is_invariant (s, n, u32_tolower, iso639_language, resultp); } diff --git a/lib/unicase/u32-is-titlecase.c b/lib/unicase/u32-is-titlecase.c index 5b07c8d..ee48fc7 100644 --- a/lib/unicase/u32-is-titlecase.c +++ b/lib/unicase/u32-is-titlecase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-32 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u32_is_titlecase (const uint32_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u32_is_invariant (s, n, u32_totitle, iso639_language, resultp); } diff --git a/lib/unicase/u32-is-uppercase.c b/lib/unicase/u32-is-uppercase.c index bb38fc6..369a68b 100644 --- a/lib/unicase/u32-is-uppercase.c +++ b/lib/unicase/u32-is-uppercase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-32 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u32_is_uppercase (const uint32_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u32_is_invariant (s, n, u32_toupper, iso639_language, resultp); } diff --git a/lib/unicase/u32-tolower.c b/lib/unicase/u32-tolower.c index daa5c4d..b9c53ed 100644 --- a/lib/unicase/u32-tolower.c +++ b/lib/unicase/u32-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,13 +27,13 @@ uint32_t * u32_tolower (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp) { return u32_casemap (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u32-totitle.c b/lib/unicase/u32-totitle.c index 21e1b0d..d144ae7 100644 --- a/lib/unicase/u32-totitle.c +++ b/lib/unicase/u32-totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u32-toupper.c b/lib/unicase/u32-toupper.c index 3430ad9..d58c8e2 100644 --- a/lib/unicase/u32-toupper.c +++ b/lib/unicase/u32-toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,13 +27,13 @@ uint32_t * u32_toupper (const uint32_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp) { return u32_casemap (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - uc_toupper, offsetof (struct special_casing_rule, upper[0]), - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_toupper, offsetof (struct special_casing_rule, upper[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u8-casecmp.c b/lib/unicase/u8-casecmp.c index 4a55de9..4edbfc3 100644 --- a/lib/unicase/u8-casecmp.c +++ b/lib/unicase/u8-casecmp.c @@ -1,5 +1,5 @@ /* Case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-casecoll.c b/lib/unicase/u8-casecoll.c index 28170e5..694011c 100644 --- a/lib/unicase/u8-casecoll.c +++ b/lib/unicase/u8-casecoll.c @@ -1,6 +1,6 @@ /* Locale dependent, case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-casefold.c b/lib/unicase/u8-casefold.c index 3210813..e3c9177 100644 --- a/lib/unicase/u8-casefold.c +++ b/lib/unicase/u8-casefold.c @@ -1,5 +1,5 @@ /* Casefolding mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -47,28 +47,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -92,9 +92,9 @@ main (int argc, char * argv[]) int length = strlen (input); size_t output_length; uint8_t *output = - u8_casefold ((uint8_t *) input, length, uc_locale_language (), - NULL, - NULL, &output_length); + u8_casefold ((uint8_t *) input, length, uc_locale_language (), + NULL, + NULL, &output_length); fwrite (output, 1, output_length, stdout); diff --git a/lib/unicase/u8-casemap.c b/lib/unicase/u8-casemap.c index 6f32915..9e4d0c0 100644 --- a/lib/unicase/u8-casemap.c +++ b/lib/unicase/u8-casemap.c @@ -1,5 +1,5 @@ /* Case mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-casexfrm.c b/lib/unicase/u8-casexfrm.c index 7e1d767..b3e0c66 100644 --- a/lib/unicase/u8-casexfrm.c +++ b/lib/unicase/u8-casexfrm.c @@ -1,6 +1,6 @@ /* Locale dependent transformation for case insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-ct-casefold.c b/lib/unicase/u8-ct-casefold.c index 4cc149c..45bacfc 100644 --- a/lib/unicase/u8-ct-casefold.c +++ b/lib/unicase/u8-ct-casefold.c @@ -1,5 +1,5 @@ /* Casefolding mapping for UTF-8 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-ct-tolower.c b/lib/unicase/u8-ct-tolower.c index 3755821..1b0ee33 100644 --- a/lib/unicase/u8-ct-tolower.c +++ b/lib/unicase/u8-ct-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-8 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,14 +27,14 @@ uint8_t * u8_ct_tolower (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp) + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp) { return u8_casemap (s, n, prefix_context, suffix_context, iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u8-ct-totitle.c b/lib/unicase/u8-ct-totitle.c index 64891af..7bcdc0d 100644 --- a/lib/unicase/u8-ct-totitle.c +++ b/lib/unicase/u8-ct-totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-8 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-ct-toupper.c b/lib/unicase/u8-ct-toupper.c index 9dca2fc..c22b25a 100644 --- a/lib/unicase/u8-ct-toupper.c +++ b/lib/unicase/u8-ct-toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for UTF-8 substrings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,14 +27,14 @@ uint8_t * u8_ct_toupper (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp) + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp) { return u8_casemap (s, n, prefix_context, suffix_context, iso639_language, - uc_toupper, offsetof (struct special_casing_rule, upper[0]), - nf, - resultbuf, lengthp); + uc_toupper, offsetof (struct special_casing_rule, upper[0]), + nf, + resultbuf, lengthp); } diff --git a/lib/unicase/u8-is-cased.c b/lib/unicase/u8-is-cased.c index 5cdcc33..56fc9c7 100644 --- a/lib/unicase/u8-is-cased.c +++ b/lib/unicase/u8-is-cased.c @@ -1,5 +1,5 @@ /* Test whether case matters for an UTF-8 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/u8-is-casefolded.c b/lib/unicase/u8-is-casefolded.c index 30122b7..007a512 100644 --- a/lib/unicase/u8-is-casefolded.c +++ b/lib/unicase/u8-is-casefolded.c @@ -1,5 +1,5 @@ /* Test whether an UTF-8 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u8_is_casefolded (const uint8_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u8_is_invariant (s, n, u8_casefold, iso639_language, resultp); } diff --git a/lib/unicase/u8-is-invariant.c b/lib/unicase/u8-is-invariant.c index 2c4913b..4794e56 100644 --- a/lib/unicase/u8-is-invariant.c +++ b/lib/unicase/u8-is-invariant.c @@ -1,5 +1,5 @@ /* Test whether an UTF-8 string is invariant under a given case mapping. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -21,6 +21,7 @@ #include "unicase/invariant.h" #include <errno.h> +#include <stdbool.h> #include <stdlib.h> #include "uninorm.h" diff --git a/lib/unicase/u8-is-lowercase.c b/lib/unicase/u8-is-lowercase.c index 5b0df8b..8501614 100644 --- a/lib/unicase/u8-is-lowercase.c +++ b/lib/unicase/u8-is-lowercase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-8 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u8_is_lowercase (const uint8_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u8_is_invariant (s, n, u8_tolower, iso639_language, resultp); } diff --git a/lib/unicase/u8-is-titlecase.c b/lib/unicase/u8-is-titlecase.c index 474502a..6357a34 100644 --- a/lib/unicase/u8-is-titlecase.c +++ b/lib/unicase/u8-is-titlecase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-8 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u8_is_titlecase (const uint8_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u8_is_invariant (s, n, u8_totitle, iso639_language, resultp); } diff --git a/lib/unicase/u8-is-uppercase.c b/lib/unicase/u8-is-uppercase.c index 7f14f92..817579f 100644 --- a/lib/unicase/u8-is-uppercase.c +++ b/lib/unicase/u8-is-uppercase.c @@ -1,5 +1,5 @@ /* Test whether an UTF-8 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -24,7 +24,7 @@ int u8_is_uppercase (const uint8_t *s, size_t n, const char *iso639_language, - bool *resultp) + bool *resultp) { return u8_is_invariant (s, n, u8_toupper, iso639_language, resultp); } diff --git a/lib/unicase/u8-tolower.c b/lib/unicase/u8-tolower.c index 1cd7cfa..f657feb 100644 --- a/lib/unicase/u8-tolower.c +++ b/lib/unicase/u8-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,15 +27,15 @@ uint8_t * u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp) { return u8_casemap (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - uc_tolower, offsetof (struct special_casing_rule, lower[0]), - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_tolower, offsetof (struct special_casing_rule, lower[0]), + nf, + resultbuf, lengthp); } @@ -60,28 +60,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -105,9 +105,9 @@ main (int argc, char * argv[]) int length = strlen (input); size_t output_length; uint8_t *output = - u8_tolower ((uint8_t *) input, length, uc_locale_language (), - NULL, - NULL, &output_length); + u8_tolower ((uint8_t *) input, length, uc_locale_language (), + NULL, + NULL, &output_length); fwrite (output, 1, output_length, stdout); diff --git a/lib/unicase/u8-totitle.c b/lib/unicase/u8-totitle.c index cf29c1b..e63cda9 100644 --- a/lib/unicase/u8-totitle.c +++ b/lib/unicase/u8-totitle.c @@ -1,5 +1,5 @@ /* Titlecase mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -47,28 +47,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -92,9 +92,9 @@ main (int argc, char * argv[]) int length = strlen (input); size_t output_length; uint8_t *output = - u8_toupper ((uint8_t *) input, length, uc_locale_language (), - NULL, - NULL, &output_length); + u8_toupper ((uint8_t *) input, length, uc_locale_language (), + NULL, + NULL, &output_length); fwrite (output, 1, output_length, stdout); diff --git a/lib/unicase/u8-toupper.c b/lib/unicase/u8-toupper.c index a97d98c..7429e52 100644 --- a/lib/unicase/u8-toupper.c +++ b/lib/unicase/u8-toupper.c @@ -1,5 +1,5 @@ /* Uppercase mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,15 +27,15 @@ uint8_t * u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp) { return u8_casemap (s, n, - unicase_empty_prefix_context, unicase_empty_suffix_context, - iso639_language, - uc_toupper, offsetof (struct special_casing_rule, upper[0]), - nf, - resultbuf, lengthp); + unicase_empty_prefix_context, unicase_empty_suffix_context, + iso639_language, + uc_toupper, offsetof (struct special_casing_rule, upper[0]), + nf, + resultbuf, lengthp); } @@ -60,28 +60,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -105,9 +105,9 @@ main (int argc, char * argv[]) int length = strlen (input); size_t output_length; uint8_t *output = - u8_toupper ((uint8_t *) input, length, uc_locale_language (), - NULL, - NULL, &output_length); + u8_toupper ((uint8_t *) input, length, uc_locale_language (), + NULL, + NULL, &output_length); fwrite (output, 1, output_length, stdout); diff --git a/lib/unicase/ulc-casecmp.c b/lib/unicase/ulc-casecmp.c index e071021..1f343cd 100644 --- a/lib/unicase/ulc-casecmp.c +++ b/lib/unicase/ulc-casecmp.c @@ -1,5 +1,5 @@ /* Case and normalization insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -30,8 +30,8 @@ static uint8_t * ulc_u8_casefold (const char *s, size_t n, const char *iso639_language, - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp) + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp) { uint8_t convbuf[2048 / sizeof (uint8_t)]; uint8_t *conv; @@ -42,22 +42,22 @@ ulc_u8_casefold (const char *s, size_t n, const char *iso639_language, conv_length = sizeof (convbuf) / sizeof (uint8_t); conv = u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL, - convbuf, &conv_length); + convbuf, &conv_length); if (conv == NULL) /* errno is set here. */ return NULL; /* Case-fold and normalize. */ result = u8_casefold (conv, conv_length, iso639_language, nf, - resultbuf, lengthp); + resultbuf, lengthp); if (result == NULL) { if (conv != convbuf) - { - int saved_errno = errno; - free (conv); - errno = saved_errno; - } + { + int saved_errno = errno; + free (conv); + errno = saved_errno; + } return NULL; } diff --git a/lib/unicase/ulc-casecoll.c b/lib/unicase/ulc-casecoll.c index 9730b6d..9645e14 100644 --- a/lib/unicase/ulc-casecoll.c +++ b/lib/unicase/ulc-casecoll.c @@ -1,5 +1,5 @@ /* Locale dependent, case and normalization insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unicase/ulc-casexfrm.c b/lib/unicase/ulc-casexfrm.c index aded556..8998211 100644 --- a/lib/unicase/ulc-casexfrm.c +++ b/lib/unicase/ulc-casexfrm.c @@ -1,5 +1,5 @@ /* Locale dependent transformation for case insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,8 +27,8 @@ char * ulc_casexfrm (const char *s, size_t n, const char *iso639_language, - uninorm_t nf, - char *resultbuf, size_t *lengthp) + uninorm_t nf, + char *resultbuf, size_t *lengthp) { uint8_t convbuf[2048 / sizeof (uint8_t)]; uint8_t *conv; @@ -39,22 +39,22 @@ ulc_casexfrm (const char *s, size_t n, const char *iso639_language, conv_length = sizeof (convbuf) / sizeof (uint8_t); conv = u8_conv_from_encoding (locale_charset (), iconveh_error, s, n, NULL, - convbuf, &conv_length); + convbuf, &conv_length); if (conv == NULL) /* errno is set here. */ return NULL; /* Case-fold and normalize. */ result = u8_casexfrm (conv, conv_length, iso639_language, nf, - resultbuf, lengthp); + resultbuf, lengthp); if (result == NULL) { if (conv != convbuf) - { - int saved_errno = errno; - free (conv); - errno = saved_errno; - } + { + int saved_errno = errno; + free (conv); + errno = saved_errno; + } return NULL; } diff --git a/lib/unicase/unicasemap.h b/lib/unicase/unicasemap.h index 8da8c51..0188083 100644 --- a/lib/unicase/unicasemap.h +++ b/lib/unicase/unicasemap.h @@ -1,5 +1,5 @@ /* Case mapping for UTF-8/UTF-16/UTF-32 strings (locale dependent). - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -23,30 +23,30 @@ extern uint8_t * u8_casemap (const uint8_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - ucs4_t (*single_character_map) (ucs4_t), - size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ - uninorm_t nf, - uint8_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + ucs4_t (*single_character_map) (ucs4_t), + size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ + uninorm_t nf, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_casemap (const uint16_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - ucs4_t (*single_character_map) (ucs4_t), - size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ - uninorm_t nf, - uint16_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + ucs4_t (*single_character_map) (ucs4_t), + size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ + uninorm_t nf, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_casemap (const uint32_t *s, size_t n, - casing_prefix_context_t prefix_context, - casing_suffix_context_t suffix_context, - const char *iso639_language, - ucs4_t (*single_character_map) (ucs4_t), - size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ - uninorm_t nf, - uint32_t *resultbuf, size_t *lengthp); + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + ucs4_t (*single_character_map) (ucs4_t), + size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ + uninorm_t nf, + uint32_t *resultbuf, size_t *lengthp); diff --git a/lib/uniconv.h b/lib/uniconv.h index 223386f..bd32ae6 100644 --- a/lib/uniconv.h +++ b/lib/uniconv.h @@ -1,5 +1,5 @@ /* Conversions between Unicode and legacy encodings. - Copyright (C) 2002, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -55,22 +55,22 @@ extern "C" { values: EINVAL, EILSEQ, ENOMEM. */ extern uint8_t * u8_conv_from_encoding (const char *fromcode, - enum iconv_ilseq_handler handler, - const char *src, size_t srclen, - size_t *offsets, - uint8_t *resultbuf, size_t *lengthp); + enum iconv_ilseq_handler handler, + const char *src, size_t srclen, + size_t *offsets, + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_conv_from_encoding (const char *fromcode, - enum iconv_ilseq_handler handler, - const char *src, size_t srclen, - size_t *offsets, - uint16_t *resultbuf, size_t *lengthp); + enum iconv_ilseq_handler handler, + const char *src, size_t srclen, + size_t *offsets, + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_conv_from_encoding (const char *fromcode, - enum iconv_ilseq_handler handler, - const char *src, size_t srclen, - size_t *offsets, - uint32_t *resultbuf, size_t *lengthp); + enum iconv_ilseq_handler handler, + const char *src, size_t srclen, + size_t *offsets, + uint32_t *resultbuf, size_t *lengthp); /* Converts an entire Unicode string, possibly including NUL units, from a Unicode encoding to a given encoding. @@ -92,54 +92,54 @@ extern uint32_t * values: EINVAL, EILSEQ, ENOMEM. */ extern char * u8_conv_to_encoding (const char *tocode, - enum iconv_ilseq_handler handler, - const uint8_t *src, size_t srclen, - size_t *offsets, - char *resultbuf, size_t *lengthp); + enum iconv_ilseq_handler handler, + const uint8_t *src, size_t srclen, + size_t *offsets, + char *resultbuf, size_t *lengthp); extern char * u16_conv_to_encoding (const char *tocode, - enum iconv_ilseq_handler handler, - const uint16_t *src, size_t srclen, - size_t *offsets, - char *resultbuf, size_t *lengthp); + enum iconv_ilseq_handler handler, + const uint16_t *src, size_t srclen, + size_t *offsets, + char *resultbuf, size_t *lengthp); extern char * u32_conv_to_encoding (const char *tocode, - enum iconv_ilseq_handler handler, - const uint32_t *src, size_t srclen, - size_t *offsets, - char *resultbuf, size_t *lengthp); + enum iconv_ilseq_handler handler, + const uint32_t *src, size_t srclen, + size_t *offsets, + char *resultbuf, size_t *lengthp); /* Converts a NUL terminated string from a given encoding. The result is malloc allocated, or NULL (with errno set) in case of error. Particular errno values: EILSEQ, ENOMEM. */ extern uint8_t * u8_strconv_from_encoding (const char *string, - const char *fromcode, - enum iconv_ilseq_handler handler); + const char *fromcode, + enum iconv_ilseq_handler handler); extern uint16_t * u16_strconv_from_encoding (const char *string, - const char *fromcode, - enum iconv_ilseq_handler handler); + const char *fromcode, + enum iconv_ilseq_handler handler); extern uint32_t * u32_strconv_from_encoding (const char *string, - const char *fromcode, - enum iconv_ilseq_handler handler); + const char *fromcode, + enum iconv_ilseq_handler handler); /* Converts a NUL terminated string to a given encoding. The result is malloc allocated, or NULL (with errno set) in case of error. Particular errno values: EILSEQ, ENOMEM. */ extern char * u8_strconv_to_encoding (const uint8_t *string, - const char *tocode, - enum iconv_ilseq_handler handler); + const char *tocode, + enum iconv_ilseq_handler handler); extern char * u16_strconv_to_encoding (const uint16_t *string, - const char *tocode, - enum iconv_ilseq_handler handler); + const char *tocode, + enum iconv_ilseq_handler handler); extern char * u32_strconv_to_encoding (const uint32_t *string, - const char *tocode, - enum iconv_ilseq_handler handler); + const char *tocode, + enum iconv_ilseq_handler handler); /* Converts a NUL terminated string from the locale encoding. The result is malloc allocated, or NULL (with errno set) in case of error. diff --git a/lib/uniconv/u-conv-from-enc.h b/lib/uniconv/u-conv-from-enc.h index fa0f0d3..457bd0f 100644 --- a/lib/uniconv/u-conv-from-enc.h +++ b/lib/uniconv/u-conv-from-enc.h @@ -1,5 +1,5 @@ /* Conversion to UTF-16/UTF-32 from legacy encodings. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -26,7 +26,7 @@ FUNC (const char *fromcode, size_t length = *lengthp * sizeof (UNIT); if (mem_iconveha (src, srclen, fromcode, UTF_NAME, true, handler, - offsets, &result, &length) < 0) + offsets, &result, &length) < 0) return NULL; if (offsets != NULL) { @@ -35,8 +35,8 @@ FUNC (const char *fromcode, size_t *o; for (o = offsets; o < offsets_end; o++) - if (*o != (size_t)(-1)) - *o = *o / sizeof (UNIT); + if (*o != (size_t)(-1)) + *o = *o / sizeof (UNIT); } if ((length % sizeof (UNIT)) != 0) abort (); @@ -49,7 +49,7 @@ FUNC (const char *fromcode, utf8_string = u8_conv_from_encoding (fromcode, handler, src, srclen, offsets, - NULL, &utf8_length); + NULL, &utf8_length); if (utf8_string == NULL) return NULL; result = U8_TO_U (utf8_string, utf8_length, resultbuf, lengthp); @@ -65,25 +65,25 @@ FUNC (const char *fromcode, size_t length = *lengthp; size_t *offsets_end = offsets + srclen; size_t *o; - size_t off8 = 0; /* offset into utf8_string */ - size_t offunit = 0; /* offset into result */ + size_t off8 = 0; /* offset into utf8_string */ + size_t offunit = 0; /* offset into result */ for (o = offsets; o < offsets_end; o++) - if (*o != (size_t)(-1)) - { - while (off8 < *o) - { - int count8 = u8_mblen (utf8_string + off8, utf8_length - off8); - int countunit = U_MBLEN (result + offunit, length - offunit); - if (count8 < 0 || countunit < 0) - abort (); - off8 += count8; - offunit += countunit; - } - if (*o != off8) - abort (); - *o = offunit; - } + if (*o != (size_t)(-1)) + { + while (off8 < *o) + { + int count8 = u8_mblen (utf8_string + off8, utf8_length - off8); + int countunit = U_MBLEN (result + offunit, length - offunit); + if (count8 < 0 || countunit < 0) + abort (); + off8 += count8; + offunit += countunit; + } + if (*o != off8) + abort (); + *o = offunit; + } } free (utf8_string); return result; diff --git a/lib/uniconv/u-conv-to-enc.h b/lib/uniconv/u-conv-to-enc.h index ed71548..43d82c7 100644 --- a/lib/uniconv/u-conv-to-enc.h +++ b/lib/uniconv/u-conv-to-enc.h @@ -1,5 +1,5 @@ /* Conversion from UTF-16/UTF-32 to legacy encodings. - Copyright (C) 2002, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -29,12 +29,12 @@ FUNC (const char *tocode, if (offsets != NULL && srclen > 0) { scaled_offsets = - (size_t *) malloc (srclen * sizeof (UNIT) * sizeof (size_t)); + (size_t *) malloc (srclen * sizeof (UNIT) * sizeof (size_t)); if (scaled_offsets == NULL) - { - errno = ENOMEM; - return NULL; - } + { + errno = ENOMEM; + return NULL; + } } else scaled_offsets = NULL; @@ -42,9 +42,9 @@ FUNC (const char *tocode, result = resultbuf; length = *lengthp; if (mem_iconveha ((const char *) src, srclen * sizeof (UNIT), - UTF_NAME, tocode, - handler == iconveh_question_mark, handler, - scaled_offsets, &result, &length) < 0) + UTF_NAME, tocode, + handler == iconveh_question_mark, handler, + scaled_offsets, &result, &length) < 0) { int saved_errno = errno; free (scaled_offsets); @@ -55,11 +55,11 @@ FUNC (const char *tocode, if (offsets != NULL) { /* Convert scaled_offsets[srclen * sizeof (UNIT)] to - offsets[srclen]. */ + offsets[srclen]. */ size_t i; for (i = 0; i < srclen; i++) - offsets[i] = scaled_offsets[i * sizeof (UNIT)]; + offsets[i] = scaled_offsets[i * sizeof (UNIT)]; free (scaled_offsets); } @@ -67,10 +67,10 @@ FUNC (const char *tocode, { result = (char *) malloc (1); if (result == NULL) - { - errno = ENOMEM; - return NULL; - } + { + errno = ENOMEM; + return NULL; + } } *lengthp = length; return result; @@ -91,62 +91,62 @@ FUNC (const char *tocode, { scaled_offsets = (size_t *) malloc (utf8_srclen * sizeof (size_t)); if (scaled_offsets == NULL) - { - if (utf8_src != tmpbuf) - free (utf8_src); - errno = ENOMEM; - return NULL; - } + { + if (utf8_src != tmpbuf) + free (utf8_src); + errno = ENOMEM; + return NULL; + } } else scaled_offsets = NULL; result = u8_conv_to_encoding (tocode, handler, utf8_src, utf8_srclen, - scaled_offsets, resultbuf, lengthp); + scaled_offsets, resultbuf, lengthp); if (result == NULL) { int saved_errno = errno; free (scaled_offsets); if (utf8_src != tmpbuf) - free (utf8_src); + free (utf8_src); errno = saved_errno; return NULL; } if (offsets != NULL) { - size_t iunit; /* offset into src */ - size_t i8; /* offset into utf8_src */ + size_t iunit; /* offset into src */ + size_t i8; /* offset into utf8_src */ for (iunit = 0; iunit < srclen; iunit++) - offsets[iunit] = (size_t)(-1); + offsets[iunit] = (size_t)(-1); iunit = 0; i8 = 0; while (iunit < srclen && i8 < utf8_srclen) - { - int countunit; - int count8; - - offsets[iunit] = scaled_offsets[i8]; - - countunit = U_MBLEN (src + iunit, srclen - iunit); - count8 = u8_mblen (utf8_src + i8, utf8_srclen - i8); - if (countunit < 0 || count8 < 0) - abort (); - iunit += countunit; - i8 += count8; - } + { + int countunit; + int count8; + + offsets[iunit] = scaled_offsets[i8]; + + countunit = U_MBLEN (src + iunit, srclen - iunit); + count8 = u8_mblen (utf8_src + i8, utf8_srclen - i8); + if (countunit < 0 || count8 < 0) + abort (); + iunit += countunit; + i8 += count8; + } /* Check that utf8_src has been traversed entirely. */ if (i8 < utf8_srclen) - abort (); + abort (); /* Check that src has been traversed entirely, except possibly for an - incomplete sequence of units at the end. */ + incomplete sequence of units at the end. */ if (iunit < srclen) - { - offsets[iunit] = *lengthp; - if (!(U_MBLEN (src + iunit, srclen - iunit) < 0)) - abort (); - } + { + offsets[iunit] = *lengthp; + if (!(U_MBLEN (src + iunit, srclen - iunit) < 0)) + abort (); + } free (scaled_offsets); } if (utf8_src != tmpbuf) diff --git a/lib/uniconv/u-strconv-from-enc.h b/lib/uniconv/u-strconv-from-enc.h index 25813c7..df91c38 100644 --- a/lib/uniconv/u-strconv-from-enc.h +++ b/lib/uniconv/u-strconv-from-enc.h @@ -1,5 +1,5 @@ /* Conversion to UTF-8/UTF-16/UTF-32 from legacy encodings. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -24,13 +24,13 @@ FUNC (const char *string, result = U_CONV_FROM_ENCODING (fromcode, handler, - string, strlen (string) + 1, NULL, - NULL, &length); + string, strlen (string) + 1, NULL, + NULL, &length); if (result == NULL) return NULL; /* Verify the result has exactly one NUL unit, at the end. */ if (!(length > 0 && result[length-1] == 0 - && U_STRLEN (result) == length-1)) + && U_STRLEN (result) == length-1)) { free (result); errno = EILSEQ; diff --git a/lib/uniconv/u-strconv-to-enc.h b/lib/uniconv/u-strconv-to-enc.h index b6e6ebb..c15182f 100644 --- a/lib/uniconv/u-strconv-to-enc.h +++ b/lib/uniconv/u-strconv-to-enc.h @@ -1,5 +1,5 @@ /* Conversion from UTF-16/UTF-32 to legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -24,9 +24,9 @@ FUNC (const UNIT *string, size_t length = 0; if (mem_iconveha ((const char *) string, (U_STRLEN (string) + 1) * sizeof (UNIT), - UTF_NAME, tocode, - handler == iconveh_question_mark, handler, - NULL, &result, &length) < 0) + UTF_NAME, tocode, + handler == iconveh_question_mark, handler, + NULL, &result, &length) < 0) return NULL; /* Verify the result has exactly one NUL byte, at the end. */ if (!(length > 0 && result[length-1] == '\0' && strlen (result) == length-1)) @@ -49,11 +49,11 @@ FUNC (const UNIT *string, if (result == NULL) { if (utf8_string != tmpbuf) - { - int saved_errno = errno; - free (utf8_string); - errno = saved_errno; - } + { + int saved_errno = errno; + free (utf8_string); + errno = saved_errno; + } return NULL; } if (utf8_string != tmpbuf) diff --git a/lib/uniconv/u16-conv-from-enc.c b/lib/uniconv/u16-conv-from-enc.c index f38add3..dc4c21d 100644 --- a/lib/uniconv/u16-conv-from-enc.c +++ b/lib/uniconv/u16-conv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-16 from legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u16-conv-to-enc.c b/lib/uniconv/u16-conv-to-enc.c index ba70736..cce454d 100644 --- a/lib/uniconv/u16-conv-to-enc.c +++ b/lib/uniconv/u16-conv-to-enc.c @@ -1,5 +1,5 @@ /* Conversion from UTF-16 to legacy encodings. - Copyright (C) 2002, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -81,69 +81,69 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) /* Fetch a Unicode character from the input string. */ count = u16_mbtoucr (&uc, s, s_end - s); if (count < 0) - { - if (count == -2) - /* Incomplete sequence of units. */ - break; - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (count == -2) + /* Incomplete sequence of units. */ + break; + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } s += count; /* Store it in the output string. */ count = u8_uctomb (result + length, uc, allocated - length); if (count == -1) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } if (count == -2) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 6 > allocated) - allocated = length + 6; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - count = u8_uctomb (result + length, uc, allocated - length); - if (count < 0) - abort (); - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 6 > allocated) + allocated = length + 6; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + count = u8_uctomb (result + length, uc, allocated - length); + if (count < 0) + abort (); + } length += count; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -152,7 +152,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/uniconv/u16-strconv-from-enc.c b/lib/uniconv/u16-strconv-from-enc.c index 736d0c4..ebdd62e 100644 --- a/lib/uniconv/u16-strconv-from-enc.c +++ b/lib/uniconv/u16-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-16 from legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u16-strconv-from-locale.c b/lib/uniconv/u16-strconv-from-locale.c index 63ddeb0..c6695d1 100644 --- a/lib/uniconv/u16-strconv-from-locale.c +++ b/lib/uniconv/u16-strconv-from-locale.c @@ -1,5 +1,5 @@ /* Conversion to UTF-16 from the locale encoding. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u16-strconv-to-enc.c b/lib/uniconv/u16-strconv-to-enc.c index 10e895e..c8e00e7 100644 --- a/lib/uniconv/u16-strconv-to-enc.c +++ b/lib/uniconv/u16-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Conversion from UTF-16 to legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u16-strconv-to-locale.c b/lib/uniconv/u16-strconv-to-locale.c index 14fd7b3..74fcbed 100644 --- a/lib/uniconv/u16-strconv-to-locale.c +++ b/lib/uniconv/u16-strconv-to-locale.c @@ -1,5 +1,5 @@ /* Conversion from UTF-16 to the locale encoding. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u32-conv-from-enc.c b/lib/uniconv/u32-conv-from-enc.c index bac6301..f5c6e8e 100644 --- a/lib/uniconv/u32-conv-from-enc.c +++ b/lib/uniconv/u32-conv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-32 from legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u32-conv-to-enc.c b/lib/uniconv/u32-conv-to-enc.c index 9155aba..7bfc9f4 100644 --- a/lib/uniconv/u32-conv-to-enc.c +++ b/lib/uniconv/u32-conv-to-enc.c @@ -1,5 +1,5 @@ /* Conversion from UTF-32 to legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u32-strconv-from-enc.c b/lib/uniconv/u32-strconv-from-enc.c index aaac74f..65ff600 100644 --- a/lib/uniconv/u32-strconv-from-enc.c +++ b/lib/uniconv/u32-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-32 from legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u32-strconv-from-locale.c b/lib/uniconv/u32-strconv-from-locale.c index 2cddcb6..103e41b 100644 --- a/lib/uniconv/u32-strconv-from-locale.c +++ b/lib/uniconv/u32-strconv-from-locale.c @@ -1,5 +1,5 @@ /* Conversion to UTF-32 from the locale encoding. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u32-strconv-to-enc.c b/lib/uniconv/u32-strconv-to-enc.c index c77e0b6..fd45013 100644 --- a/lib/uniconv/u32-strconv-to-enc.c +++ b/lib/uniconv/u32-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Conversion from UTF-32 to legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u32-strconv-to-locale.c b/lib/uniconv/u32-strconv-to-locale.c index 64ab59f..57cc47e 100644 --- a/lib/uniconv/u32-strconv-to-locale.c +++ b/lib/uniconv/u32-strconv-to-locale.c @@ -1,5 +1,5 @@ /* Conversion from UTF-32 to the locale encoding. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u8-conv-from-enc.c b/lib/uniconv/u8-conv-from-enc.c index 7605e63..88d666c 100644 --- a/lib/uniconv/u8-conv-from-enc.c +++ b/lib/uniconv/u8-conv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-8 from legacy encodings. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -31,10 +31,10 @@ uint8_t * u8_conv_from_encoding (const char *fromcode, - enum iconv_ilseq_handler handler, - const char *src, size_t srclen, - size_t *offsets, - uint8_t *resultbuf, size_t *lengthp) + enum iconv_ilseq_handler handler, + const char *src, size_t srclen, + size_t *offsets, + uint8_t *resultbuf, size_t *lengthp) { if (STRCASEEQ (fromcode, "UTF-8", 'U','T','F','-','8',0,0,0,0)) { @@ -42,40 +42,40 @@ u8_conv_from_encoding (const char *fromcode, uint8_t *result; if (u8_check ((const uint8_t *) src, srclen)) - { - errno = EILSEQ; - return NULL; - } + { + errno = EILSEQ; + return NULL; + } if (offsets != NULL) - { - size_t i; - - for (i = 0; i < srclen; ) - { - int count = u8_mblen ((const uint8_t *) src + i, srclen - i); - /* We can rely on count > 0 because of the previous u8_check. */ - if (count <= 0) - abort (); - offsets[i] = i; - i++; - while (--count > 0) - offsets[i++] = (size_t)(-1); - } - } + { + size_t i; + + for (i = 0; i < srclen; ) + { + int count = u8_mblen ((const uint8_t *) src + i, srclen - i); + /* We can rely on count > 0 because of the previous u8_check. */ + if (count <= 0) + abort (); + offsets[i] = i; + i++; + while (--count > 0) + offsets[i++] = (size_t)(-1); + } + } /* Memory allocation. */ if (resultbuf != NULL && *lengthp >= srclen) - result = resultbuf; + result = resultbuf; else - { - result = (uint8_t *) malloc (srclen > 0 ? srclen : 1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + result = (uint8_t *) malloc (srclen > 0 ? srclen : 1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } memcpy ((char *) result, src, srclen); *lengthp = srclen; @@ -87,18 +87,18 @@ u8_conv_from_encoding (const char *fromcode, size_t length = *lengthp; if (mem_iconveha (src, srclen, fromcode, "UTF-8", true, handler, - offsets, &result, &length) < 0) - return NULL; + offsets, &result, &length) < 0) + return NULL; if (result == NULL) /* when (resultbuf == NULL && length == 0) */ - { - result = (char *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + result = (char *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } *lengthp = length; return (uint8_t *) result; } diff --git a/lib/uniconv/u8-conv-to-enc.c b/lib/uniconv/u8-conv-to-enc.c index 90accce..cacf259 100644 --- a/lib/uniconv/u8-conv-to-enc.c +++ b/lib/uniconv/u8-conv-to-enc.c @@ -1,5 +1,5 @@ /* Conversion from UTF-8 to legacy encodings. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -31,10 +31,10 @@ char * u8_conv_to_encoding (const char *tocode, - enum iconv_ilseq_handler handler, - const uint8_t *src, size_t srclen, - size_t *offsets, - char *resultbuf, size_t *lengthp) + enum iconv_ilseq_handler handler, + const uint8_t *src, size_t srclen, + size_t *offsets, + char *resultbuf, size_t *lengthp) { if (STRCASEEQ (tocode, "UTF-8", 'U','T','F','-','8',0,0,0,0)) { @@ -43,24 +43,24 @@ u8_conv_to_encoding (const char *tocode, /* Conversion from UTF-8 to UTF-8. No need to go through iconv(). */ #if CONFIG_UNICODE_SAFETY if (u8_check (src, srclen)) - { - errno = EILSEQ; - return NULL; - } + { + errno = EILSEQ; + return NULL; + } #endif /* Memory allocation. */ if (resultbuf != NULL && *lengthp >= srclen) - result = resultbuf; + result = resultbuf; else - { - result = (char *) malloc (srclen > 0 ? srclen : 1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + result = (char *) malloc (srclen > 0 ? srclen : 1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } memcpy (result, (const char *) src, srclen); *lengthp = srclen; @@ -72,20 +72,20 @@ u8_conv_to_encoding (const char *tocode, size_t length = *lengthp; if (mem_iconveha ((const char *) src, srclen, - "UTF-8", tocode, - handler == iconveh_question_mark, handler, - offsets, &result, &length) < 0) - return NULL; + "UTF-8", tocode, + handler == iconveh_question_mark, handler, + offsets, &result, &length) < 0) + return NULL; if (result == NULL) /* when (resultbuf == NULL && length == 0) */ - { - result = (char *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + result = (char *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } *lengthp = length; return result; } diff --git a/lib/uniconv/u8-strconv-from-enc.c b/lib/uniconv/u8-strconv-from-enc.c index 0f5736f..e177666 100644 --- a/lib/uniconv/u8-strconv-from-enc.c +++ b/lib/uniconv/u8-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-8 from legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u8-strconv-from-locale.c b/lib/uniconv/u8-strconv-from-locale.c index a901a3d..e149ce3 100644 --- a/lib/uniconv/u8-strconv-from-locale.c +++ b/lib/uniconv/u8-strconv-from-locale.c @@ -1,5 +1,5 @@ /* Conversion to UTF-8 from the locale encoding. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniconv/u8-strconv-to-enc.c b/lib/uniconv/u8-strconv-to-enc.c index a3f12b6..d593cf1 100644 --- a/lib/uniconv/u8-strconv-to-enc.c +++ b/lib/uniconv/u8-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Conversion from UTF-8 to legacy encodings. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -31,8 +31,8 @@ char * u8_strconv_to_encoding (const uint8_t *string, - const char *tocode, - enum iconv_ilseq_handler handler) + const char *tocode, + enum iconv_ilseq_handler handler) { char *result; size_t length; @@ -43,17 +43,17 @@ u8_strconv_to_encoding (const uint8_t *string, length = u8_strlen (string) + 1; #if CONFIG_UNICODE_SAFETY if (u8_check (string, length)) - { - errno = EILSEQ; - return NULL; - } + { + errno = EILSEQ; + return NULL; + } #endif result = (char *) malloc (length); if (result == NULL) - { - errno = ENOMEM; - return NULL; - } + { + errno = ENOMEM; + return NULL; + } memcpy (result, (const char *) string, length); return result; } @@ -62,18 +62,18 @@ u8_strconv_to_encoding (const uint8_t *string, result = NULL; length = 0; if (mem_iconveha ((const char *) string, u8_strlen (string) + 1, - "UTF-8", tocode, - handler == iconveh_question_mark, handler, - NULL, &result, &length) < 0) - return NULL; + "UTF-8", tocode, + handler == iconveh_question_mark, handler, + NULL, &result, &length) < 0) + return NULL; /* Verify the result has exactly one NUL byte, at the end. */ if (!(length > 0 && result[length-1] == '\0' - && strlen (result) == length-1)) - { - free (result); - errno = EILSEQ; - return NULL; - } + && strlen (result) == length-1)) + { + free (result); + errno = EILSEQ; + return NULL; + } return result; } } diff --git a/lib/uniconv/u8-strconv-to-locale.c b/lib/uniconv/u8-strconv-to-locale.c index 27c45fb..8bdc812 100644 --- a/lib/uniconv/u8-strconv-to-locale.c +++ b/lib/uniconv/u8-strconv-to-locale.c @@ -1,5 +1,5 @@ /* Conversion from UTF-8 to the locale encoding. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unictype.h b/lib/unictype.h index 1fc0440..e374873 100644 --- a/lib/unictype.h +++ b/lib/unictype.h @@ -1,5 +1,5 @@ /* Unicode character classification and properties. - Copyright (C) 2002, 2005-2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -186,14 +186,14 @@ extern const uc_general_category_t _UC_CATEGORY_NONE; This corresponds to the unions of the two sets of characters. */ extern uc_general_category_t uc_general_category_or (uc_general_category_t category1, - uc_general_category_t category2); + uc_general_category_t category2); /* Return the intersection of two general categories as bit masks. This *does*not* correspond to the intersection of the two sets of characters. */ extern uc_general_category_t uc_general_category_and (uc_general_category_t category1, - uc_general_category_t category2); + uc_general_category_t category2); /* Return the intersection of a general category with the complement of a second general category, as bit masks. @@ -201,7 +201,7 @@ extern uc_general_category_t viewing the categories as sets of characters. */ extern uc_general_category_t uc_general_category_and_not (uc_general_category_t category1, - uc_general_category_t category2); + uc_general_category_t category2); /* Return the name of a general category. */ extern const char * diff --git a/lib/unictype/bidi_byname.c b/lib/unictype/bidi_byname.c index 8a6cb71..868f05d 100644 --- a/lib/unictype/bidi_byname.c +++ b/lib/unictype/bidi_byname.c @@ -1,5 +1,5 @@ /* Bidi categories of Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -27,143 +27,143 @@ uc_bidi_category_byname (const char *category_name) { case 'A': switch (category_name[1]) - { - case 'L': - if (category_name[2] == '\0') - return UC_BIDI_AL; - break; - case 'N': - if (category_name[2] == '\0') - return UC_BIDI_AN; - break; - } + { + case 'L': + if (category_name[2] == '\0') + return UC_BIDI_AL; + break; + case 'N': + if (category_name[2] == '\0') + return UC_BIDI_AN; + break; + } break; case 'B': switch (category_name[1]) - { - case '\0': - return UC_BIDI_B; - case 'N': - if (category_name[2] == '\0') - return UC_BIDI_BN; - break; - } + { + case '\0': + return UC_BIDI_B; + case 'N': + if (category_name[2] == '\0') + return UC_BIDI_BN; + break; + } break; case 'C': switch (category_name[1]) - { - case 'S': - if (category_name[2] == '\0') - return UC_BIDI_CS; - break; - } + { + case 'S': + if (category_name[2] == '\0') + return UC_BIDI_CS; + break; + } break; case 'E': switch (category_name[1]) - { - case 'N': - if (category_name[2] == '\0') - return UC_BIDI_EN; - break; - case 'S': - if (category_name[2] == '\0') - return UC_BIDI_ES; - break; - case 'T': - if (category_name[2] == '\0') - return UC_BIDI_ET; - break; - } + { + case 'N': + if (category_name[2] == '\0') + return UC_BIDI_EN; + break; + case 'S': + if (category_name[2] == '\0') + return UC_BIDI_ES; + break; + case 'T': + if (category_name[2] == '\0') + return UC_BIDI_ET; + break; + } break; case 'L': switch (category_name[1]) - { - case '\0': - return UC_BIDI_L; - case 'R': - switch (category_name[2]) - { - case 'E': - if (category_name[3] == '\0') - return UC_BIDI_LRE; - break; - case 'O': - if (category_name[3] == '\0') - return UC_BIDI_LRO; - break; - } - break; - } + { + case '\0': + return UC_BIDI_L; + case 'R': + switch (category_name[2]) + { + case 'E': + if (category_name[3] == '\0') + return UC_BIDI_LRE; + break; + case 'O': + if (category_name[3] == '\0') + return UC_BIDI_LRO; + break; + } + break; + } break; case 'N': switch (category_name[1]) - { - case 'S': - switch (category_name[2]) - { - case 'M': - if (category_name[3] == '\0') - return UC_BIDI_NSM; - break; - } - break; - } + { + case 'S': + switch (category_name[2]) + { + case 'M': + if (category_name[3] == '\0') + return UC_BIDI_NSM; + break; + } + break; + } break; case 'O': switch (category_name[1]) - { - case 'N': - if (category_name[2] == '\0') - return UC_BIDI_ON; - break; - } + { + case 'N': + if (category_name[2] == '\0') + return UC_BIDI_ON; + break; + } break; case 'P': switch (category_name[1]) - { - case 'D': - switch (category_name[2]) - { - case 'F': - if (category_name[3] == '\0') - return UC_BIDI_PDF; - break; - } - break; - } + { + case 'D': + switch (category_name[2]) + { + case 'F': + if (category_name[3] == '\0') + return UC_BIDI_PDF; + break; + } + break; + } break; case 'R': switch (category_name[1]) - { - case '\0': - return UC_BIDI_R; - case 'L': - switch (category_name[2]) - { - case 'E': - if (category_name[3] == '\0') - return UC_BIDI_RLE; - break; - case 'O': - if (category_name[3] == '\0') - return UC_BIDI_RLO; - break; - } - break; - } + { + case '\0': + return UC_BIDI_R; + case 'L': + switch (category_name[2]) + { + case 'E': + if (category_name[3] == '\0') + return UC_BIDI_RLE; + break; + case 'O': + if (category_name[3] == '\0') + return UC_BIDI_RLO; + break; + } + break; + } break; case 'S': if (category_name[1] == '\0') - return UC_BIDI_S; + return UC_BIDI_S; break; case 'W': switch (category_name[1]) - { - case 'S': - if (category_name[2] == '\0') - return UC_BIDI_WS; - break; - } + { + case 'S': + if (category_name[2] == '\0') + return UC_BIDI_WS; + break; + } break; } /* Invalid category name. */ diff --git a/lib/unictype/bidi_name.c b/lib/unictype/bidi_name.c index 7652976..28bb4ba 100644 --- a/lib/unictype/bidi_name.c +++ b/lib/unictype/bidi_name.c @@ -1,5 +1,5 @@ /* Bidi categories of Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/bidi_of.c b/lib/unictype/bidi_of.c index 93fc7a8..4a293a8 100644 --- a/lib/unictype/bidi_of.c +++ b/lib/unictype/bidi_of.c @@ -1,5 +1,5 @@ /* Bidi categories of Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,22 +31,22 @@ uc_bidi_category (ucs4_t uc) { int lookup1 = u_bidi_category.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> bidi_category_header_2) & bidi_category_header_3; - int lookup2 = u_bidi_category.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = ((uc & bidi_category_header_4) + lookup2) * 5; - /* level3 contains 5-bit values, packed into 16-bit words. */ - unsigned int lookup3 = - ((u_bidi_category.level3[index3>>4] - | (u_bidi_category.level3[(index3>>4)+1] << 16)) - >> (index3 % 16)) - & 0x1f; - - return lookup3; - } - } + { + unsigned int index2 = (uc >> bidi_category_header_2) & bidi_category_header_3; + int lookup2 = u_bidi_category.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = ((uc & bidi_category_header_4) + lookup2) * 5; + /* level3 contains 5-bit values, packed into 16-bit words. */ + unsigned int lookup3 = + ((u_bidi_category.level3[index3>>4] + | (u_bidi_category.level3[(index3>>4)+1] << 16)) + >> (index3 % 16)) + & 0x1f; + + return lookup3; + } + } } return UC_BIDI_L; } diff --git a/lib/unictype/bidi_test.c b/lib/unictype/bidi_test.c index 72887bb..0a9fa5c 100644 --- a/lib/unictype/bidi_test.c +++ b/lib/unictype/bidi_test.c @@ -1,5 +1,5 @@ /* Bidi categories of Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/bitmap.h b/lib/unictype/bitmap.h index 280b298..4e743c5 100644 --- a/lib/unictype/bitmap.h +++ b/lib/unictype/bitmap.h @@ -1,5 +1,5 @@ /* Three-level bitmap lookup. - Copyright (C) 2000-2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 2000-2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2000-2002. This program is free software: you can redistribute it and/or modify it @@ -31,17 +31,17 @@ bitmap_lookup (const void *table, ucs4_t uc) { int lookup1 = ((const int *) table)[1 + index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> header_2) & header_3; - int lookup2 = ((const short *) table)[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc >> 5) & header_4; - unsigned int lookup3 = ((const int *) table)[lookup2 + index3]; + { + unsigned int index2 = (uc >> header_2) & header_3; + int lookup2 = ((const short *) table)[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc >> 5) & header_4; + unsigned int lookup3 = ((const int *) table)[lookup2 + index3]; - return (lookup3 >> (uc & 0x1f)) & 1; - } - } + return (lookup3 >> (uc & 0x1f)) & 1; + } + } } return 0; } diff --git a/lib/unictype/block_test.c b/lib/unictype/block_test.c index 4005ad0..04722b4 100644 --- a/lib/unictype/block_test.c +++ b/lib/unictype/block_test.c @@ -1,5 +1,5 @@ /* Blocks of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/blocks.c b/lib/unictype/blocks.c index a20bbce..e83e546 100644 --- a/lib/unictype/blocks.c +++ b/lib/unictype/blocks.c @@ -1,5 +1,5 @@ /* Blocks of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -45,11 +45,11 @@ uc_block (ucs4_t uc) { unsigned int mid_index = (first_index + last_index) / 2; if (blocks[mid_index].end < uc) - first_index = mid_index + 1; + first_index = mid_index + 1; else if (uc < blocks[mid_index].start) - last_index = mid_index; + last_index = mid_index; else - return &blocks[mid_index]; + return &blocks[mid_index]; } return NULL; } diff --git a/lib/unictype/categ_C.c b/lib/unictype/categ_C.c index d14d8c0..3c3860d 100644 --- a/lib/unictype/categ_C.c +++ b/lib/unictype/categ_C.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Cc.c b/lib/unictype/categ_Cc.c index 572f88f..653848d 100644 --- a/lib/unictype/categ_Cc.c +++ b/lib/unictype/categ_Cc.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Cf.c b/lib/unictype/categ_Cf.c index 19cd842..fd53e7a 100644 --- a/lib/unictype/categ_Cf.c +++ b/lib/unictype/categ_Cf.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Cn.c b/lib/unictype/categ_Cn.c index 131704a..63242dc 100644 --- a/lib/unictype/categ_Cn.c +++ b/lib/unictype/categ_Cn.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Co.c b/lib/unictype/categ_Co.c index 70b5ac7..3452a17 100644 --- a/lib/unictype/categ_Co.c +++ b/lib/unictype/categ_Co.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Cs.c b/lib/unictype/categ_Cs.c index a3f5cea..cd94733 100644 --- a/lib/unictype/categ_Cs.c +++ b/lib/unictype/categ_Cs.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_L.c b/lib/unictype/categ_L.c index b62b2a2..4b7f16d 100644 --- a/lib/unictype/categ_L.c +++ b/lib/unictype/categ_L.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Ll.c b/lib/unictype/categ_Ll.c index 37da1a0..e7e752e 100644 --- a/lib/unictype/categ_Ll.c +++ b/lib/unictype/categ_Ll.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Lm.c b/lib/unictype/categ_Lm.c index 296e53d..fc01602 100644 --- a/lib/unictype/categ_Lm.c +++ b/lib/unictype/categ_Lm.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Lo.c b/lib/unictype/categ_Lo.c index 5c7781e..57ae611 100644 --- a/lib/unictype/categ_Lo.c +++ b/lib/unictype/categ_Lo.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Lt.c b/lib/unictype/categ_Lt.c index 485acf6..9de263d 100644 --- a/lib/unictype/categ_Lt.c +++ b/lib/unictype/categ_Lt.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Lu.c b/lib/unictype/categ_Lu.c index 26faae2..6000421 100644 --- a/lib/unictype/categ_Lu.c +++ b/lib/unictype/categ_Lu.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_M.c b/lib/unictype/categ_M.c index ab7f149..8e6ff70 100644 --- a/lib/unictype/categ_M.c +++ b/lib/unictype/categ_M.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Mc.c b/lib/unictype/categ_Mc.c index c54a565..f4cca6b 100644 --- a/lib/unictype/categ_Mc.c +++ b/lib/unictype/categ_Mc.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Me.c b/lib/unictype/categ_Me.c index 00e2a01..62b1ad9 100644 --- a/lib/unictype/categ_Me.c +++ b/lib/unictype/categ_Me.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Mn.c b/lib/unictype/categ_Mn.c index 5990ee5..edcf3c5 100644 --- a/lib/unictype/categ_Mn.c +++ b/lib/unictype/categ_Mn.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_N.c b/lib/unictype/categ_N.c index 5aa9248..e326ff2 100644 --- a/lib/unictype/categ_N.c +++ b/lib/unictype/categ_N.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Nd.c b/lib/unictype/categ_Nd.c index f5ad322..c6b0258 100644 --- a/lib/unictype/categ_Nd.c +++ b/lib/unictype/categ_Nd.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Nl.c b/lib/unictype/categ_Nl.c index 6fe9370..50a39bb 100644 --- a/lib/unictype/categ_Nl.c +++ b/lib/unictype/categ_Nl.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_No.c b/lib/unictype/categ_No.c index 055177f..f36899d 100644 --- a/lib/unictype/categ_No.c +++ b/lib/unictype/categ_No.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_P.c b/lib/unictype/categ_P.c index e1dbbcd..14f94ad 100644 --- a/lib/unictype/categ_P.c +++ b/lib/unictype/categ_P.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Pc.c b/lib/unictype/categ_Pc.c index 06558ad..a0c9ff8 100644 --- a/lib/unictype/categ_Pc.c +++ b/lib/unictype/categ_Pc.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Pd.c b/lib/unictype/categ_Pd.c index 96516d5..8e66633 100644 --- a/lib/unictype/categ_Pd.c +++ b/lib/unictype/categ_Pd.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Pe.c b/lib/unictype/categ_Pe.c index 5315532..f911f38 100644 --- a/lib/unictype/categ_Pe.c +++ b/lib/unictype/categ_Pe.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Pf.c b/lib/unictype/categ_Pf.c index 435e19f..c49b52b 100644 --- a/lib/unictype/categ_Pf.c +++ b/lib/unictype/categ_Pf.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Pi.c b/lib/unictype/categ_Pi.c index 9ea1de1..bf55500 100644 --- a/lib/unictype/categ_Pi.c +++ b/lib/unictype/categ_Pi.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Po.c b/lib/unictype/categ_Po.c index 4c2e2cb..71cc4b0 100644 --- a/lib/unictype/categ_Po.c +++ b/lib/unictype/categ_Po.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Ps.c b/lib/unictype/categ_Ps.c index 4e10039..ce49d39 100644 --- a/lib/unictype/categ_Ps.c +++ b/lib/unictype/categ_Ps.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_S.c b/lib/unictype/categ_S.c index 4eb51f5..1661bb2 100644 --- a/lib/unictype/categ_S.c +++ b/lib/unictype/categ_S.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Sc.c b/lib/unictype/categ_Sc.c index 171d5b8..f5933fa 100644 --- a/lib/unictype/categ_Sc.c +++ b/lib/unictype/categ_Sc.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Sk.c b/lib/unictype/categ_Sk.c index 5f4d84e..3ff4552 100644 --- a/lib/unictype/categ_Sk.c +++ b/lib/unictype/categ_Sk.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Sm.c b/lib/unictype/categ_Sm.c index 158823f..f1f09f1 100644 --- a/lib/unictype/categ_Sm.c +++ b/lib/unictype/categ_Sm.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_So.c b/lib/unictype/categ_So.c index a1f688b..691dcc2 100644 --- a/lib/unictype/categ_So.c +++ b/lib/unictype/categ_So.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Z.c b/lib/unictype/categ_Z.c index eb187d6..569d82a 100644 --- a/lib/unictype/categ_Z.c +++ b/lib/unictype/categ_Z.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Zl.c b/lib/unictype/categ_Zl.c index 4a6e3df..58b075e 100644 --- a/lib/unictype/categ_Zl.c +++ b/lib/unictype/categ_Zl.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Zp.c b/lib/unictype/categ_Zp.c index 23f682c..3cc8c6c 100644 --- a/lib/unictype/categ_Zp.c +++ b/lib/unictype/categ_Zp.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_Zs.c b/lib/unictype/categ_Zs.c index c997157..b4cfed6 100644 --- a/lib/unictype/categ_Zs.c +++ b/lib/unictype/categ_Zs.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_and.c b/lib/unictype/categ_and.c index 2101f94..67a06fa 100644 --- a/lib/unictype/categ_and.c +++ b/lib/unictype/categ_and.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -22,7 +22,7 @@ uc_general_category_t uc_general_category_and (uc_general_category_t category1, - uc_general_category_t category2) + uc_general_category_t category2) { uint32_t bitmask; uc_general_category_t result; diff --git a/lib/unictype/categ_and_not.c b/lib/unictype/categ_and_not.c index 6cc2759..b550ccc 100644 --- a/lib/unictype/categ_and_not.c +++ b/lib/unictype/categ_and_not.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -22,7 +22,7 @@ uc_general_category_t uc_general_category_and_not (uc_general_category_t category1, - uc_general_category_t category2) + uc_general_category_t category2) { uint32_t bitmask; uc_general_category_t result; diff --git a/lib/unictype/categ_byname.c b/lib/unictype/categ_byname.c index a175dd1..fb75b67 100644 --- a/lib/unictype/categ_byname.c +++ b/lib/unictype/categ_byname.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -28,77 +28,77 @@ uc_general_category_byname (const char *category_name) switch (category_name[0]) { case 'L': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_L; - case 'u': return UC_CATEGORY_Lu; - case 'l': return UC_CATEGORY_Ll; - case 't': return UC_CATEGORY_Lt; - case 'm': return UC_CATEGORY_Lm; - case 'o': return UC_CATEGORY_Lo; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_L; + case 'u': return UC_CATEGORY_Lu; + case 'l': return UC_CATEGORY_Ll; + case 't': return UC_CATEGORY_Lt; + case 'm': return UC_CATEGORY_Lm; + case 'o': return UC_CATEGORY_Lo; + } + break; case 'M': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_M; - case 'n': return UC_CATEGORY_Mn; - case 'c': return UC_CATEGORY_Mc; - case 'e': return UC_CATEGORY_Me; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_M; + case 'n': return UC_CATEGORY_Mn; + case 'c': return UC_CATEGORY_Mc; + case 'e': return UC_CATEGORY_Me; + } + break; case 'N': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_N; - case 'd': return UC_CATEGORY_Nd; - case 'l': return UC_CATEGORY_Nl; - case 'o': return UC_CATEGORY_No; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_N; + case 'd': return UC_CATEGORY_Nd; + case 'l': return UC_CATEGORY_Nl; + case 'o': return UC_CATEGORY_No; + } + break; case 'P': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_P; - case 'c': return UC_CATEGORY_Pc; - case 'd': return UC_CATEGORY_Pd; - case 's': return UC_CATEGORY_Ps; - case 'e': return UC_CATEGORY_Pe; - case 'i': return UC_CATEGORY_Pi; - case 'f': return UC_CATEGORY_Pf; - case 'o': return UC_CATEGORY_Po; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_P; + case 'c': return UC_CATEGORY_Pc; + case 'd': return UC_CATEGORY_Pd; + case 's': return UC_CATEGORY_Ps; + case 'e': return UC_CATEGORY_Pe; + case 'i': return UC_CATEGORY_Pi; + case 'f': return UC_CATEGORY_Pf; + case 'o': return UC_CATEGORY_Po; + } + break; case 'S': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_S; - case 'm': return UC_CATEGORY_Sm; - case 'c': return UC_CATEGORY_Sc; - case 'k': return UC_CATEGORY_Sk; - case 'o': return UC_CATEGORY_So; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_S; + case 'm': return UC_CATEGORY_Sm; + case 'c': return UC_CATEGORY_Sc; + case 'k': return UC_CATEGORY_Sk; + case 'o': return UC_CATEGORY_So; + } + break; case 'Z': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_Z; - case 's': return UC_CATEGORY_Zs; - case 'l': return UC_CATEGORY_Zl; - case 'p': return UC_CATEGORY_Zp; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_Z; + case 's': return UC_CATEGORY_Zs; + case 'l': return UC_CATEGORY_Zl; + case 'p': return UC_CATEGORY_Zp; + } + break; case 'C': - switch (category_name[1]) - { - case '\0': return UC_CATEGORY_C; - case 'c': return UC_CATEGORY_Cc; - case 'f': return UC_CATEGORY_Cf; - case 's': return UC_CATEGORY_Cs; - case 'o': return UC_CATEGORY_Co; - case 'n': return UC_CATEGORY_Cn; - } - break; + switch (category_name[1]) + { + case '\0': return UC_CATEGORY_C; + case 'c': return UC_CATEGORY_Cc; + case 'f': return UC_CATEGORY_Cf; + case 's': return UC_CATEGORY_Cs; + case 'o': return UC_CATEGORY_Co; + case 'n': return UC_CATEGORY_Cn; + } + break; } /* Invalid category name. */ return _UC_CATEGORY_NONE; diff --git a/lib/unictype/categ_name.c b/lib/unictype/categ_name.c index 10421ef..1243e2f 100644 --- a/lib/unictype/categ_name.c +++ b/lib/unictype/categ_name.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -35,43 +35,43 @@ uc_general_category_name (uc_general_category_t category) if (bitmask != 0) { if ((bitmask & (bitmask - 1)) == 0) - { - int bit; - /* Take log2 using a variant of Robert Harley's method. - Found by Bruno Haible 1996. */ - uint32_t n = bitmask; - static const char ord2_tab[64] = - { - -1, 0, 1, 12, 2, 6, -1, 13, 3, -1, 7, -1, -1, -1, -1, 14, - 10, 4, -1, -1, 8, -1, -1, 25, -1, -1, -1, -1, -1, 21, 27, 15, - 31, 11, 5, -1, -1, -1, -1, -1, 9, -1, -1, 24, -1, -1, 20, 26, - 30, -1, -1, -1, -1, 23, -1, 19, 29, -1, 22, 18, 28, 17, 16, -1 - }; - n += n << 4; - n += n << 6; - n = (n << 16) - n; - bit = ord2_tab[n >> 26]; + { + int bit; + /* Take log2 using a variant of Robert Harley's method. + Found by Bruno Haible 1996. */ + uint32_t n = bitmask; + static const char ord2_tab[64] = + { + -1, 0, 1, 12, 2, 6, -1, 13, 3, -1, 7, -1, -1, -1, -1, 14, + 10, 4, -1, -1, 8, -1, -1, 25, -1, -1, -1, -1, -1, 21, 27, 15, + 31, 11, 5, -1, -1, -1, -1, -1, 9, -1, -1, 24, -1, -1, 20, 26, + 30, -1, -1, -1, -1, 23, -1, 19, 29, -1, 22, 18, 28, 17, 16, -1 + }; + n += n << 4; + n += n << 6; + n = (n << 16) - n; + bit = ord2_tab[n >> 26]; - if (bit < sizeof (u_category_name) / sizeof (u_category_name[0])) - return u_category_name[bit]; - } + if (bit < sizeof (u_category_name) / sizeof (u_category_name[0])) + return u_category_name[bit]; + } else - { - if (bitmask == UC_CATEGORY_MASK_L) - return "L"; - if (bitmask == UC_CATEGORY_MASK_M) - return "M"; - if (bitmask == UC_CATEGORY_MASK_N) - return "N"; - if (bitmask == UC_CATEGORY_MASK_P) - return "P"; - if (bitmask == UC_CATEGORY_MASK_S) - return "S"; - if (bitmask == UC_CATEGORY_MASK_Z) - return "Z"; - if (bitmask == UC_CATEGORY_MASK_C) - return "C"; - } + { + if (bitmask == UC_CATEGORY_MASK_L) + return "L"; + if (bitmask == UC_CATEGORY_MASK_M) + return "M"; + if (bitmask == UC_CATEGORY_MASK_N) + return "N"; + if (bitmask == UC_CATEGORY_MASK_P) + return "P"; + if (bitmask == UC_CATEGORY_MASK_S) + return "S"; + if (bitmask == UC_CATEGORY_MASK_Z) + return "Z"; + if (bitmask == UC_CATEGORY_MASK_C) + return "C"; + } } return NULL; } diff --git a/lib/unictype/categ_none.c b/lib/unictype/categ_none.c index 9e33ab9..39bc8b2 100644 --- a/lib/unictype/categ_none.c +++ b/lib/unictype/categ_none.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/categ_of.c b/lib/unictype/categ_of.c index 85b694f..66cca8d 100644 --- a/lib/unictype/categ_of.c +++ b/lib/unictype/categ_of.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,22 +31,22 @@ lookup_withtable (ucs4_t uc) { int lookup1 = u_category.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> category_header_2) & category_header_3; - int lookup2 = u_category.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = ((uc & category_header_4) + lookup2) * 5; - /* level3 contains 5-bit values, packed into 16-bit words. */ - unsigned int lookup3 = - ((u_category.level3[index3>>4] - | (u_category.level3[(index3>>4)+1] << 16)) - >> (index3 % 16)) - & 0x1f; + { + unsigned int index2 = (uc >> category_header_2) & category_header_3; + int lookup2 = u_category.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = ((uc & category_header_4) + lookup2) * 5; + /* level3 contains 5-bit values, packed into 16-bit words. */ + unsigned int lookup3 = + ((u_category.level3[index3>>4] + | (u_category.level3[(index3>>4)+1] << 16)) + >> (index3 % 16)) + & 0x1f; - return lookup3; - } - } + return lookup3; + } + } return 29; /* = log2(UC_CATEGORY_MASK_Cn) */ } return -1; diff --git a/lib/unictype/categ_or.c b/lib/unictype/categ_or.c index 9864210..9118418 100644 --- a/lib/unictype/categ_or.c +++ b/lib/unictype/categ_or.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -22,7 +22,7 @@ uc_general_category_t uc_general_category_or (uc_general_category_t category1, - uc_general_category_t category2) + uc_general_category_t category2) { uint32_t bitmask; uc_general_category_t result; diff --git a/lib/unictype/categ_test.c b/lib/unictype/categ_test.c index e46f0f6..dd935e7 100644 --- a/lib/unictype/categ_test.c +++ b/lib/unictype/categ_test.c @@ -1,5 +1,5 @@ /* Categories of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/combining.c b/lib/unictype/combining.c index d2e33e6..dfddc90 100644 --- a/lib/unictype/combining.c +++ b/lib/unictype/combining.c @@ -1,5 +1,5 @@ /* Combining classes of Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,17 +31,17 @@ uc_combining_class (ucs4_t uc) { int lookup1 = u_combclass.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> combclass_header_2) & combclass_header_3; - int lookup2 = u_combclass.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & combclass_header_4); - unsigned int lookup3 = u_combclass.level3[lookup2 + index3]; - - return lookup3; - } - } + { + unsigned int index2 = (uc >> combclass_header_2) & combclass_header_3; + int lookup2 = u_combclass.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & combclass_header_4); + unsigned int lookup3 = u_combclass.level3[lookup2 + index3]; + + return lookup3; + } + } } return 0; } diff --git a/lib/unictype/ctype_alnum.c b/lib/unictype/ctype_alnum.c index 464fbb0..aaf7484 100644 --- a/lib/unictype/ctype_alnum.c +++ b/lib/unictype/ctype_alnum.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_alpha.c b/lib/unictype/ctype_alpha.c index 4ca6e99..8c64b6d 100644 --- a/lib/unictype/ctype_alpha.c +++ b/lib/unictype/ctype_alpha.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_blank.c b/lib/unictype/ctype_blank.c index 7e5e44f..5e2ea54 100644 --- a/lib/unictype/ctype_blank.c +++ b/lib/unictype/ctype_blank.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_cntrl.c b/lib/unictype/ctype_cntrl.c index 8d9b148..13869c5 100644 --- a/lib/unictype/ctype_cntrl.c +++ b/lib/unictype/ctype_cntrl.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_digit.c b/lib/unictype/ctype_digit.c index b18d920..ec444d4 100644 --- a/lib/unictype/ctype_digit.c +++ b/lib/unictype/ctype_digit.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_graph.c b/lib/unictype/ctype_graph.c index 3c0ae11..474211b 100644 --- a/lib/unictype/ctype_graph.c +++ b/lib/unictype/ctype_graph.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_lower.c b/lib/unictype/ctype_lower.c index 1bc8434..8e1e118 100644 --- a/lib/unictype/ctype_lower.c +++ b/lib/unictype/ctype_lower.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_print.c b/lib/unictype/ctype_print.c index 1423801..8e53e0f 100644 --- a/lib/unictype/ctype_print.c +++ b/lib/unictype/ctype_print.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_punct.c b/lib/unictype/ctype_punct.c index e6b7946..8071a26 100644 --- a/lib/unictype/ctype_punct.c +++ b/lib/unictype/ctype_punct.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_space.c b/lib/unictype/ctype_space.c index 09d2c11..93ad873 100644 --- a/lib/unictype/ctype_space.c +++ b/lib/unictype/ctype_space.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_upper.c b/lib/unictype/ctype_upper.c index 7724a04..9348fcc 100644 --- a/lib/unictype/ctype_upper.c +++ b/lib/unictype/ctype_upper.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/ctype_xdigit.c b/lib/unictype/ctype_xdigit.c index 60c44c4..e540008 100644 --- a/lib/unictype/ctype_xdigit.c +++ b/lib/unictype/ctype_xdigit.c @@ -1,5 +1,5 @@ /* ISO C <ctype.h> like properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/decdigit.c b/lib/unictype/decdigit.c index 48b0592..79f8339 100644 --- a/lib/unictype/decdigit.c +++ b/lib/unictype/decdigit.c @@ -1,5 +1,5 @@ /* Values of decimal digit Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,19 +31,19 @@ uc_decimal_value (ucs4_t uc) { int lookup1 = u_decdigit.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> decdigit_header_2) & decdigit_header_3; - int lookup2 = u_decdigit.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & decdigit_header_4) + lookup2; - /* level3 contains 4-bit values. */ - unsigned int lookup3 = - (u_decdigit.level3[index3>>1] >> ((index3 % 2) * 4)) & 0x0f; - - return (int) lookup3 - 1; - } - } + { + unsigned int index2 = (uc >> decdigit_header_2) & decdigit_header_3; + int lookup2 = u_decdigit.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & decdigit_header_4) + lookup2; + /* level3 contains 4-bit values. */ + unsigned int lookup3 = + (u_decdigit.level3[index3>>1] >> ((index3 % 2) * 4)) & 0x0f; + + return (int) lookup3 - 1; + } + } } return -1; } diff --git a/lib/unictype/digit.c b/lib/unictype/digit.c index 21545c7..ba999a2 100644 --- a/lib/unictype/digit.c +++ b/lib/unictype/digit.c @@ -1,5 +1,5 @@ /* Values of digit Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,19 +31,19 @@ uc_digit_value (ucs4_t uc) { int lookup1 = u_digit.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> digit_header_2) & digit_header_3; - int lookup2 = u_digit.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & digit_header_4) + lookup2; - /* level3 contains 4-bit values. */ - unsigned int lookup3 = - (u_digit.level3[index3>>1] >> ((index3 % 2) * 4)) & 0x0f; - - return (int) lookup3 - 1; - } - } + { + unsigned int index2 = (uc >> digit_header_2) & digit_header_3; + int lookup2 = u_digit.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & digit_header_4) + lookup2; + /* level3 contains 4-bit values. */ + unsigned int lookup3 = + (u_digit.level3[index3>>1] >> ((index3 % 2) * 4)) & 0x0f; + + return (int) lookup3 - 1; + } + } } return -1; } diff --git a/lib/unictype/identsyntaxmap.h b/lib/unictype/identsyntaxmap.h index 5d9db39..5ff13fc 100644 --- a/lib/unictype/identsyntaxmap.h +++ b/lib/unictype/identsyntaxmap.h @@ -1,5 +1,5 @@ /* Three-level bitmap lookup. - Copyright (C) 2000-2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 2000-2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2000-2002. This program is free software: you can redistribute it and/or modify it @@ -25,18 +25,18 @@ identsyntax_lookup (ucs4_t uc) { int lookup1 = TABLE.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> identsyntax_header_2) & identsyntax_header_3; - int lookup2 = TABLE.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & identsyntax_header_4) + lookup2; - /* level3 contains 2-bit values. */ - unsigned int lookup3 = TABLE.level3[index3 >> 3]; + { + unsigned int index2 = (uc >> identsyntax_header_2) & identsyntax_header_3; + int lookup2 = TABLE.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & identsyntax_header_4) + lookup2; + /* level3 contains 2-bit values. */ + unsigned int lookup3 = TABLE.level3[index3 >> 3]; - return (lookup3 >> (2 * (index3 & 7))) & 3; - } - } + return (lookup3 >> (2 * (index3 & 7))) & 3; + } + } } return UC_IDENTIFIER_INVALID; } diff --git a/lib/unictype/mirror.c b/lib/unictype/mirror.c index 7577544..066d9d3 100644 --- a/lib/unictype/mirror.c +++ b/lib/unictype/mirror.c @@ -1,5 +1,5 @@ /* Mirrored Unicode characters. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,18 +31,18 @@ uc_mirror_char (ucs4_t uc, ucs4_t *puc) { int lookup1 = u_mirror.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> mirror_header_2) & mirror_header_3; - int lookup2 = u_mirror.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & mirror_header_4); - int lookup3 = u_mirror.level3[lookup2 + index3]; - - *puc = uc + lookup3; - return (lookup3 != 0); - } - } + { + unsigned int index2 = (uc >> mirror_header_2) & mirror_header_3; + int lookup2 = u_mirror.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & mirror_header_4); + int lookup3 = u_mirror.level3[lookup2 + index3]; + + *puc = uc + lookup3; + return (lookup3 != 0); + } + } } *puc = uc; return false; diff --git a/lib/unictype/numeric.c b/lib/unictype/numeric.c index fb1512e..9eb4630 100644 --- a/lib/unictype/numeric.c +++ b/lib/unictype/numeric.c @@ -1,5 +1,5 @@ /* Values of numeric Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,22 +31,22 @@ uc_numeric_value (ucs4_t uc) { int lookup1 = u_numeric.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> numeric_header_2) & numeric_header_3; - int lookup2 = u_numeric.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = ((uc & numeric_header_4) + lookup2) * 7; - /* level3 contains 7-bit values, packed into 16-bit words. */ - unsigned int lookup3 = - ((u_numeric.level3[index3>>4] - | (u_numeric.level3[(index3>>4)+1] << 16)) - >> (index3 % 16)) - & 0x7f; - - return u_numeric_values[lookup3]; - } - } + { + unsigned int index2 = (uc >> numeric_header_2) & numeric_header_3; + int lookup2 = u_numeric.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = ((uc & numeric_header_4) + lookup2) * 7; + /* level3 contains 7-bit values, packed into 16-bit words. */ + unsigned int lookup3 = + ((u_numeric.level3[index3>>4] + | (u_numeric.level3[(index3>>4)+1] << 16)) + >> (index3 % 16)) + & 0x7f; + + return u_numeric_values[lookup3]; + } + } } { const uc_fraction_t default_value = { 0, 0 }; diff --git a/lib/unictype/pr_alphabetic.c b/lib/unictype/pr_alphabetic.c index 9992091..f94c71a 100644 --- a/lib/unictype/pr_alphabetic.c +++ b/lib/unictype/pr_alphabetic.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_ascii_hex_digit.c b/lib/unictype/pr_ascii_hex_digit.c index 90d3d3a..4bad897 100644 --- a/lib/unictype/pr_ascii_hex_digit.c +++ b/lib/unictype/pr_ascii_hex_digit.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_arabic_digit.c b/lib/unictype/pr_bidi_arabic_digit.c index 15f5f6b..8bcea66 100644 --- a/lib/unictype/pr_bidi_arabic_digit.c +++ b/lib/unictype/pr_bidi_arabic_digit.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_arabic_right_to_left.c b/lib/unictype/pr_bidi_arabic_right_to_left.c index 8166767..834d67a 100644 --- a/lib/unictype/pr_bidi_arabic_right_to_left.c +++ b/lib/unictype/pr_bidi_arabic_right_to_left.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_block_separator.c b/lib/unictype/pr_bidi_block_separator.c index 1775d36..bec778d 100644 --- a/lib/unictype/pr_bidi_block_separator.c +++ b/lib/unictype/pr_bidi_block_separator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_boundary_neutral.c b/lib/unictype/pr_bidi_boundary_neutral.c index 923e89f..f64ae85 100644 --- a/lib/unictype/pr_bidi_boundary_neutral.c +++ b/lib/unictype/pr_bidi_boundary_neutral.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_common_separator.c b/lib/unictype/pr_bidi_common_separator.c index 2cc1f14..2989ca6 100644 --- a/lib/unictype/pr_bidi_common_separator.c +++ b/lib/unictype/pr_bidi_common_separator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_control.c b/lib/unictype/pr_bidi_control.c index 9a4f209..6bb0adf 100644 --- a/lib/unictype/pr_bidi_control.c +++ b/lib/unictype/pr_bidi_control.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_embedding_or_override.c b/lib/unictype/pr_bidi_embedding_or_override.c index 7026522..3af5785 100644 --- a/lib/unictype/pr_bidi_embedding_or_override.c +++ b/lib/unictype/pr_bidi_embedding_or_override.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -40,7 +40,7 @@ uc_is_property_bidi_embedding_or_override (ucs4_t uc) { int category = uc_bidi_category (uc); return (category == UC_BIDI_LRE || category == UC_BIDI_LRO - || category == UC_BIDI_RLE || category == UC_BIDI_RLO); + || category == UC_BIDI_RLE || category == UC_BIDI_RLO); } #endif diff --git a/lib/unictype/pr_bidi_eur_num_separator.c b/lib/unictype/pr_bidi_eur_num_separator.c index 53d3ea7..97a74b3 100644 --- a/lib/unictype/pr_bidi_eur_num_separator.c +++ b/lib/unictype/pr_bidi_eur_num_separator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_eur_num_terminator.c b/lib/unictype/pr_bidi_eur_num_terminator.c index de1f4ab..7376c42 100644 --- a/lib/unictype/pr_bidi_eur_num_terminator.c +++ b/lib/unictype/pr_bidi_eur_num_terminator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_european_digit.c b/lib/unictype/pr_bidi_european_digit.c index e27c5d3..f727dca 100644 --- a/lib/unictype/pr_bidi_european_digit.c +++ b/lib/unictype/pr_bidi_european_digit.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_hebrew_right_to_left.c b/lib/unictype/pr_bidi_hebrew_right_to_left.c index 9dced03..42e836f 100644 --- a/lib/unictype/pr_bidi_hebrew_right_to_left.c +++ b/lib/unictype/pr_bidi_hebrew_right_to_left.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_left_to_right.c b/lib/unictype/pr_bidi_left_to_right.c index fee8443..3da97eb 100644 --- a/lib/unictype/pr_bidi_left_to_right.c +++ b/lib/unictype/pr_bidi_left_to_right.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_non_spacing_mark.c b/lib/unictype/pr_bidi_non_spacing_mark.c index 660d4c1..df470bb 100644 --- a/lib/unictype/pr_bidi_non_spacing_mark.c +++ b/lib/unictype/pr_bidi_non_spacing_mark.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_other_neutral.c b/lib/unictype/pr_bidi_other_neutral.c index f87b5fb..0f63bca 100644 --- a/lib/unictype/pr_bidi_other_neutral.c +++ b/lib/unictype/pr_bidi_other_neutral.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_pdf.c b/lib/unictype/pr_bidi_pdf.c index 808a1ef..7e8ace2 100644 --- a/lib/unictype/pr_bidi_pdf.c +++ b/lib/unictype/pr_bidi_pdf.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_segment_separator.c b/lib/unictype/pr_bidi_segment_separator.c index 0b3b08a..6452b07 100644 --- a/lib/unictype/pr_bidi_segment_separator.c +++ b/lib/unictype/pr_bidi_segment_separator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_bidi_whitespace.c b/lib/unictype/pr_bidi_whitespace.c index d16928a..ef22a3e 100644 --- a/lib/unictype/pr_bidi_whitespace.c +++ b/lib/unictype/pr_bidi_whitespace.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_byname.c b/lib/unictype/pr_byname.c index cb6e553..89d59b9 100644 --- a/lib/unictype/pr_byname.c +++ b/lib/unictype/pr_byname.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -40,16 +40,16 @@ uc_property_byname (const char *property_name) { unsigned char c = (unsigned char) *cp; if (c >= 0x80) - goto invalid; + goto invalid; if (c >= 'A' && c <= 'Z') - c += 'a' - 'A'; + c += 'a' - 'A'; else if (c == ' ' || c == '-') - c = '_'; + c = '_'; *bp = c; if (c == '\0') - break; + break; if (--count == 0) - goto invalid; + goto invalid; } found = uc_property_lookup (buf, bp - buf); if (found != NULL) diff --git a/lib/unictype/pr_combining.c b/lib/unictype/pr_combining.c index 5332b36..631a1b2 100644 --- a/lib/unictype/pr_combining.c +++ b/lib/unictype/pr_combining.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_composite.c b/lib/unictype/pr_composite.c index 4f01ea8..0aae82a 100644 --- a/lib/unictype/pr_composite.c +++ b/lib/unictype/pr_composite.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_currency_symbol.c b/lib/unictype/pr_currency_symbol.c index 8a8723b..1f37bb5 100644 --- a/lib/unictype/pr_currency_symbol.c +++ b/lib/unictype/pr_currency_symbol.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_dash.c b/lib/unictype/pr_dash.c index 16bccad..033dc6c 100644 --- a/lib/unictype/pr_dash.c +++ b/lib/unictype/pr_dash.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_decimal_digit.c b/lib/unictype/pr_decimal_digit.c index e344158..de31d24 100644 --- a/lib/unictype/pr_decimal_digit.c +++ b/lib/unictype/pr_decimal_digit.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_default_ignorable_code_point.c b/lib/unictype/pr_default_ignorable_code_point.c index f4b7f19..ce0e816 100644 --- a/lib/unictype/pr_default_ignorable_code_point.c +++ b/lib/unictype/pr_default_ignorable_code_point.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_deprecated.c b/lib/unictype/pr_deprecated.c index 2b3903b..9f8cf61 100644 --- a/lib/unictype/pr_deprecated.c +++ b/lib/unictype/pr_deprecated.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_diacritic.c b/lib/unictype/pr_diacritic.c index f541cd1..cb23950 100644 --- a/lib/unictype/pr_diacritic.c +++ b/lib/unictype/pr_diacritic.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_extender.c b/lib/unictype/pr_extender.c index 25f11f6..5e5a69c 100644 --- a/lib/unictype/pr_extender.c +++ b/lib/unictype/pr_extender.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_format_control.c b/lib/unictype/pr_format_control.c index f63bb29..aca189e 100644 --- a/lib/unictype/pr_format_control.c +++ b/lib/unictype/pr_format_control.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_grapheme_base.c b/lib/unictype/pr_grapheme_base.c index 6b090bc..1d6530c 100644 --- a/lib/unictype/pr_grapheme_base.c +++ b/lib/unictype/pr_grapheme_base.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_grapheme_extend.c b/lib/unictype/pr_grapheme_extend.c index c51e82e..1a95297 100644 --- a/lib/unictype/pr_grapheme_extend.c +++ b/lib/unictype/pr_grapheme_extend.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_grapheme_link.c b/lib/unictype/pr_grapheme_link.c index e7aa133..b3a499c 100644 --- a/lib/unictype/pr_grapheme_link.c +++ b/lib/unictype/pr_grapheme_link.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_hex_digit.c b/lib/unictype/pr_hex_digit.c index 09357b9..ce5a73a 100644 --- a/lib/unictype/pr_hex_digit.c +++ b/lib/unictype/pr_hex_digit.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_hyphen.c b/lib/unictype/pr_hyphen.c index 22a55b6..c2a5d0f 100644 --- a/lib/unictype/pr_hyphen.c +++ b/lib/unictype/pr_hyphen.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_id_continue.c b/lib/unictype/pr_id_continue.c index 5903dc6..0115c46 100644 --- a/lib/unictype/pr_id_continue.c +++ b/lib/unictype/pr_id_continue.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_id_start.c b/lib/unictype/pr_id_start.c index 7d5f35f..ec349dd 100644 --- a/lib/unictype/pr_id_start.c +++ b/lib/unictype/pr_id_start.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_ideographic.c b/lib/unictype/pr_ideographic.c index 18f7d02..266034c 100644 --- a/lib/unictype/pr_ideographic.c +++ b/lib/unictype/pr_ideographic.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_ids_binary_operator.c b/lib/unictype/pr_ids_binary_operator.c index 74e50c1..25e12a3 100644 --- a/lib/unictype/pr_ids_binary_operator.c +++ b/lib/unictype/pr_ids_binary_operator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_ids_trinary_operator.c b/lib/unictype/pr_ids_trinary_operator.c index 422c219..2a85221 100644 --- a/lib/unictype/pr_ids_trinary_operator.c +++ b/lib/unictype/pr_ids_trinary_operator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_ignorable_control.c b/lib/unictype/pr_ignorable_control.c index 00a7223..7b04244 100644 --- a/lib/unictype/pr_ignorable_control.c +++ b/lib/unictype/pr_ignorable_control.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_iso_control.c b/lib/unictype/pr_iso_control.c index 9d2f392..bba6608 100644 --- a/lib/unictype/pr_iso_control.c +++ b/lib/unictype/pr_iso_control.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_join_control.c b/lib/unictype/pr_join_control.c index ad22cea..8cf3706 100644 --- a/lib/unictype/pr_join_control.c +++ b/lib/unictype/pr_join_control.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_left_of_pair.c b/lib/unictype/pr_left_of_pair.c index 62b45f4..344e3f0 100644 --- a/lib/unictype/pr_left_of_pair.c +++ b/lib/unictype/pr_left_of_pair.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_line_separator.c b/lib/unictype/pr_line_separator.c index 0c0b320..72c1964 100644 --- a/lib/unictype/pr_line_separator.c +++ b/lib/unictype/pr_line_separator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_logical_order_exception.c b/lib/unictype/pr_logical_order_exception.c index e06f271..720e951 100644 --- a/lib/unictype/pr_logical_order_exception.c +++ b/lib/unictype/pr_logical_order_exception.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_lowercase.c b/lib/unictype/pr_lowercase.c index ed719da..1dbbba2 100644 --- a/lib/unictype/pr_lowercase.c +++ b/lib/unictype/pr_lowercase.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_math.c b/lib/unictype/pr_math.c index a4971d2..35bde04 100644 --- a/lib/unictype/pr_math.c +++ b/lib/unictype/pr_math.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_non_break.c b/lib/unictype/pr_non_break.c index d1855d4..7ef84ff 100644 --- a/lib/unictype/pr_non_break.c +++ b/lib/unictype/pr_non_break.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_not_a_character.c b/lib/unictype/pr_not_a_character.c index 05910fe..b8b96c3 100644 --- a/lib/unictype/pr_not_a_character.c +++ b/lib/unictype/pr_not_a_character.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_numeric.c b/lib/unictype/pr_numeric.c index dfa2250..7fe7633 100644 --- a/lib/unictype/pr_numeric.c +++ b/lib/unictype/pr_numeric.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_alphabetic.c b/lib/unictype/pr_other_alphabetic.c index 1a880f5..398288f 100644 --- a/lib/unictype/pr_other_alphabetic.c +++ b/lib/unictype/pr_other_alphabetic.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_default_ignorable_code_point.c b/lib/unictype/pr_other_default_ignorable_code_point.c index 434977d..1f65195 100644 --- a/lib/unictype/pr_other_default_ignorable_code_point.c +++ b/lib/unictype/pr_other_default_ignorable_code_point.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_grapheme_extend.c b/lib/unictype/pr_other_grapheme_extend.c index fb7af9c..209e19f 100644 --- a/lib/unictype/pr_other_grapheme_extend.c +++ b/lib/unictype/pr_other_grapheme_extend.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_id_continue.c b/lib/unictype/pr_other_id_continue.c index 75e71c3..aeb00cc 100644 --- a/lib/unictype/pr_other_id_continue.c +++ b/lib/unictype/pr_other_id_continue.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_id_start.c b/lib/unictype/pr_other_id_start.c index 1858e47..40d09bc 100644 --- a/lib/unictype/pr_other_id_start.c +++ b/lib/unictype/pr_other_id_start.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_lowercase.c b/lib/unictype/pr_other_lowercase.c index c199b17..8126f3c 100644 --- a/lib/unictype/pr_other_lowercase.c +++ b/lib/unictype/pr_other_lowercase.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_math.c b/lib/unictype/pr_other_math.c index 7e130e7..30a864d 100644 --- a/lib/unictype/pr_other_math.c +++ b/lib/unictype/pr_other_math.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_other_uppercase.c b/lib/unictype/pr_other_uppercase.c index 278ce51..9c6b1de 100644 --- a/lib/unictype/pr_other_uppercase.c +++ b/lib/unictype/pr_other_uppercase.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_paired_punctuation.c b/lib/unictype/pr_paired_punctuation.c index 52b0dbb..1faa2cd 100644 --- a/lib/unictype/pr_paired_punctuation.c +++ b/lib/unictype/pr_paired_punctuation.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_paragraph_separator.c b/lib/unictype/pr_paragraph_separator.c index c1aeff3..dc7260d 100644 --- a/lib/unictype/pr_paragraph_separator.c +++ b/lib/unictype/pr_paragraph_separator.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_pattern_syntax.c b/lib/unictype/pr_pattern_syntax.c index 5f5366f..bd46e3f 100644 --- a/lib/unictype/pr_pattern_syntax.c +++ b/lib/unictype/pr_pattern_syntax.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_pattern_white_space.c b/lib/unictype/pr_pattern_white_space.c index 407cc7e..6c4465c 100644 --- a/lib/unictype/pr_pattern_white_space.c +++ b/lib/unictype/pr_pattern_white_space.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_private_use.c b/lib/unictype/pr_private_use.c index 64a28c7..815ac9b 100644 --- a/lib/unictype/pr_private_use.c +++ b/lib/unictype/pr_private_use.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -39,8 +39,8 @@ bool uc_is_property_private_use (ucs4_t uc) { return (uc >= 0xE000 && uc <= 0xF8FF) - || (uc >= 0xF0000 && uc <= 0xFFFFD) - || (uc >= 0x100000 && uc <= 0x10FFFD); + || (uc >= 0xF0000 && uc <= 0xFFFFD) + || (uc >= 0x100000 && uc <= 0x10FFFD); } #endif diff --git a/lib/unictype/pr_punctuation.c b/lib/unictype/pr_punctuation.c index 00efeee..39f0cfa 100644 --- a/lib/unictype/pr_punctuation.c +++ b/lib/unictype/pr_punctuation.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_quotation_mark.c b/lib/unictype/pr_quotation_mark.c index e07fef2..13e3239 100644 --- a/lib/unictype/pr_quotation_mark.c +++ b/lib/unictype/pr_quotation_mark.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_radical.c b/lib/unictype/pr_radical.c index 1343162..3d82389 100644 --- a/lib/unictype/pr_radical.c +++ b/lib/unictype/pr_radical.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_sentence_terminal.c b/lib/unictype/pr_sentence_terminal.c index 85d5e68..81a94da 100644 --- a/lib/unictype/pr_sentence_terminal.c +++ b/lib/unictype/pr_sentence_terminal.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_soft_dotted.c b/lib/unictype/pr_soft_dotted.c index b261d3c..b4a5c8b 100644 --- a/lib/unictype/pr_soft_dotted.c +++ b/lib/unictype/pr_soft_dotted.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_space.c b/lib/unictype/pr_space.c index 5bc3881..b34b366 100644 --- a/lib/unictype/pr_space.c +++ b/lib/unictype/pr_space.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_terminal_punctuation.c b/lib/unictype/pr_terminal_punctuation.c index 30a79f9..5843a34 100644 --- a/lib/unictype/pr_terminal_punctuation.c +++ b/lib/unictype/pr_terminal_punctuation.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_test.c b/lib/unictype/pr_test.c index 6d997b4..e106839 100644 --- a/lib/unictype/pr_test.c +++ b/lib/unictype/pr_test.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_titlecase.c b/lib/unictype/pr_titlecase.c index eeb7dcc..93a6a88 100644 --- a/lib/unictype/pr_titlecase.c +++ b/lib/unictype/pr_titlecase.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_unassigned_code_value.c b/lib/unictype/pr_unassigned_code_value.c index 328b5e7..b7baf1b 100644 --- a/lib/unictype/pr_unassigned_code_value.c +++ b/lib/unictype/pr_unassigned_code_value.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_unified_ideograph.c b/lib/unictype/pr_unified_ideograph.c index 99096a8..b08494f 100644 --- a/lib/unictype/pr_unified_ideograph.c +++ b/lib/unictype/pr_unified_ideograph.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_uppercase.c b/lib/unictype/pr_uppercase.c index 38c122a..d373393 100644 --- a/lib/unictype/pr_uppercase.c +++ b/lib/unictype/pr_uppercase.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_variation_selector.c b/lib/unictype/pr_variation_selector.c index 2f1d388..d7604d6 100644 --- a/lib/unictype/pr_variation_selector.c +++ b/lib/unictype/pr_variation_selector.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_white_space.c b/lib/unictype/pr_white_space.c index 1cd9c5f..18dc4ec 100644 --- a/lib/unictype/pr_white_space.c +++ b/lib/unictype/pr_white_space.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_xid_continue.c b/lib/unictype/pr_xid_continue.c index d7d92c3..67faae1 100644 --- a/lib/unictype/pr_xid_continue.c +++ b/lib/unictype/pr_xid_continue.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_xid_start.c b/lib/unictype/pr_xid_start.c index 13aab1b..b9b496f 100644 --- a/lib/unictype/pr_xid_start.c +++ b/lib/unictype/pr_xid_start.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/pr_zero_width.c b/lib/unictype/pr_zero_width.c index 7decbda..903e003 100644 --- a/lib/unictype/pr_zero_width.c +++ b/lib/unictype/pr_zero_width.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/scripts.c b/lib/unictype/scripts.c index 092009d..822c3c5 100644 --- a/lib/unictype/scripts.c +++ b/lib/unictype/scripts.c @@ -1,5 +1,5 @@ /* Scripts of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -33,18 +33,18 @@ uc_script (ucs4_t uc) { int lookup1 = u_script.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> script_header_2) & script_header_3; - int lookup2 = u_script.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & script_header_4); - unsigned char lookup3 = u_script.level3[lookup2 + index3]; + { + unsigned int index2 = (uc >> script_header_2) & script_header_3; + int lookup2 = u_script.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & script_header_4); + unsigned char lookup3 = u_script.level3[lookup2 + index3]; - if (lookup3 != 0xff) - return &scripts[lookup3]; - } - } + if (lookup3 != 0xff) + return &scripts[lookup3]; + } + } } return NULL; } diff --git a/lib/unictype/sy_c_ident.c b/lib/unictype/sy_c_ident.c index c6033c8..3d89841 100644 --- a/lib/unictype/sy_c_ident.c +++ b/lib/unictype/sy_c_ident.c @@ -1,5 +1,5 @@ /* Syntax properties of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/sy_c_whitespace.c b/lib/unictype/sy_c_whitespace.c index 6d996a6..989838f 100644 --- a/lib/unictype/sy_c_whitespace.c +++ b/lib/unictype/sy_c_whitespace.c @@ -1,5 +1,5 @@ /* Syntax properties of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/sy_java_ident.c b/lib/unictype/sy_java_ident.c index b0770d6..1defc2b 100644 --- a/lib/unictype/sy_java_ident.c +++ b/lib/unictype/sy_java_ident.c @@ -1,5 +1,5 @@ /* Syntax properties of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unictype/sy_java_whitespace.c b/lib/unictype/sy_java_whitespace.c index 4b56f3e..34d3afd 100644 --- a/lib/unictype/sy_java_whitespace.c +++ b/lib/unictype/sy_java_whitespace.c @@ -1,5 +1,5 @@ /* Syntax properties of Unicode characters. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unilbrk.h b/lib/unilbrk.h index 1f5e262..ca8f42b 100644 --- a/lib/unilbrk.h +++ b/lib/unilbrk.h @@ -1,5 +1,5 @@ /* Line breaking of Unicode strings. - Copyright (C) 2001-2003, 2005-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -58,16 +58,16 @@ enum */ extern void u8_possible_linebreaks (const uint8_t *s, size_t n, - const char *encoding, char *p); + const char *encoding, char *p); extern void u16_possible_linebreaks (const uint16_t *s, size_t n, - const char *encoding, char *p); + const char *encoding, char *p); extern void u32_possible_linebreaks (const uint32_t *s, size_t n, - const char *encoding, char *p); + const char *encoding, char *p); extern void ulc_possible_linebreaks (const char *s, size_t n, - const char *encoding, char *p); + const char *encoding, char *p); /* Choose the best line breaks, assuming the uc_width function. The string is s[0..n-1]. The maximum number of columns per line is given @@ -82,24 +82,24 @@ extern void */ extern int u8_width_linebreaks (const uint8_t *s, size_t n, int width, - int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p); + int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p); extern int u16_width_linebreaks (const uint16_t *s, size_t n, int width, - int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p); + int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p); extern int u32_width_linebreaks (const uint32_t *s, size_t n, int width, - int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p); + int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p); extern int ulc_width_linebreaks (const char *s, size_t n, int width, - int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p); + int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p); #ifdef __cplusplus diff --git a/lib/unilbrk/lbrkprop1.h b/lib/unilbrk/lbrkprop1.h index 66fd584..ba6e1b8 100644 --- a/lib/unilbrk/lbrkprop1.h +++ b/lib/unilbrk/lbrkprop1.h @@ -2,7 +2,7 @@ /* Line breaking properties of Unicode characters. */ /* Generated automatically by gen-lbrk for Unicode 5.1.0. */ -/* Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/unilbrk/lbrkprop2.h b/lib/unilbrk/lbrkprop2.h index a71b4d9..45b93b1 100644 --- a/lib/unilbrk/lbrkprop2.h +++ b/lib/unilbrk/lbrkprop2.h @@ -2,7 +2,7 @@ /* Line breaking properties of Unicode characters. */ /* Generated automatically by gen-lbrk for Unicode 5.1.0. */ -/* Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/unilbrk/lbrktables.c b/lib/unilbrk/lbrktables.c index ae3ebf4..fbc8931 100644 --- a/lib/unilbrk/lbrktables.c +++ b/lib/unilbrk/lbrktables.c @@ -1,5 +1,5 @@ /* Line breaking auxiliary tables. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -25,8 +25,8 @@ const unsigned char unilbrk_table[24][24] = { - /* after */ - /* WJ GL B2 BA BB HY CL EX IN NS OP QU IS NU PO PR SY AL H2 H3 ID JL JV JT */ + /* after */ + /* WJ GL B2 BA BB HY CL EX IN NS OP QU IS NU PO PR SY AL H2 H3 ID JL JV JT */ /* WJ */ { P, I, I, I, I, I, P, P, I, I, I, I, P, I, I, I, P, I, I, I, I, I, I, I, }, /* GL */ { P, I, I, I, I, I, P, P, I, I, I, I, P, I, I, I, P, I, I, I, I, I, I, I, }, /* B2 */ { P, I, P, I, D, I, P, P, D, I, D, I, P, D, D, D, P, D, D, D, D, D, D, D, }, diff --git a/lib/unilbrk/lbrktables.h b/lib/unilbrk/lbrktables.h index 33b525b..e86c49f 100644 --- a/lib/unilbrk/lbrktables.h +++ b/lib/unilbrk/lbrktables.h @@ -1,5 +1,5 @@ /* Line breaking auxiliary tables. - Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -70,15 +70,15 @@ unilbrkprop_lookup (ucs4_t uc) { int lookup1 = unilbrkprop.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> lbrkprop_header_2) & lbrkprop_header_3; - int lookup2 = unilbrkprop.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = uc & lbrkprop_header_4; - return unilbrkprop.level3[lookup2 + index3]; - } - } + { + unsigned int index2 = (uc >> lbrkprop_header_2) & lbrkprop_header_3; + int lookup2 = unilbrkprop.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = uc & lbrkprop_header_4; + return unilbrkprop.level3[lookup2 + index3]; + } + } } return LBP_XX; } diff --git a/lib/unilbrk/u16-possible-linebreaks.c b/lib/unilbrk/u16-possible-linebreaks.c index f5b6992..25b9851 100644 --- a/lib/unilbrk/u16-possible-linebreaks.c +++ b/lib/unilbrk/u16-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-16 strings. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -46,117 +46,117 @@ u16_possible_linebreaks (const uint16_t *s, size_t n, const char *encoding, char int prop = unilbrkprop_lookup (uc); if (prop == LBP_BK) - { - /* Mandatory break. */ - *p = UC_BREAK_MANDATORY; - last_prop = LBP_BK; - seen_space = NULL; - seen_space2 = NULL; - } + { + /* Mandatory break. */ + *p = UC_BREAK_MANDATORY; + last_prop = LBP_BK; + seen_space = NULL; + seen_space2 = NULL; + } else - { - char *q; + { + char *q; - /* Resolve property values whose behaviour is not fixed. */ - switch (prop) - { - case LBP_AI: - /* Resolve ambiguous. */ - prop = LBP_AI_REPLACEMENT; - break; - case LBP_CB: - /* This is arbitrary. */ - prop = LBP_ID; - break; - case LBP_SA: - /* We don't handle complex scripts yet. - Treat LBP_SA like LBP_XX. */ - case LBP_XX: - /* This is arbitrary. */ - prop = LBP_AL; - break; - } + /* Resolve property values whose behaviour is not fixed. */ + switch (prop) + { + case LBP_AI: + /* Resolve ambiguous. */ + prop = LBP_AI_REPLACEMENT; + break; + case LBP_CB: + /* This is arbitrary. */ + prop = LBP_ID; + break; + case LBP_SA: + /* We don't handle complex scripts yet. + Treat LBP_SA like LBP_XX. */ + case LBP_XX: + /* This is arbitrary. */ + prop = LBP_AL; + break; + } - /* Deal with spaces and combining characters. */ - q = p; - if (prop == LBP_SP) - { - /* Don't break just before a space. */ - *p = UC_BREAK_PROHIBITED; - seen_space2 = seen_space; - seen_space = p; - } - else if (prop == LBP_ZW) - { - /* Don't break just before a zero-width space. */ - *p = UC_BREAK_PROHIBITED; - last_prop = LBP_ZW; - seen_space = NULL; - seen_space2 = NULL; - } - else if (prop == LBP_CM) - { - /* Don't break just before a combining character, except immediately after a - zero-width space. */ - if (last_prop == LBP_ZW) - { - /* Break after zero-width space. */ - *p = UC_BREAK_POSSIBLE; - /* A combining character turns a preceding space into LBP_ID. */ - last_prop = LBP_ID; - } - else - { - *p = UC_BREAK_PROHIBITED; - /* A combining character turns a preceding space into LBP_ID. */ - if (seen_space != NULL) - { - q = seen_space; - seen_space = seen_space2; - prop = LBP_ID; - goto lookup_via_table; - } - } - } - else - { - lookup_via_table: - /* prop must be usable as an index for table 7.3 of UTR #14. */ - if (!(prop >= 0 && prop < sizeof (unilbrk_table) / sizeof (unilbrk_table[0]))) - abort (); + /* Deal with spaces and combining characters. */ + q = p; + if (prop == LBP_SP) + { + /* Don't break just before a space. */ + *p = UC_BREAK_PROHIBITED; + seen_space2 = seen_space; + seen_space = p; + } + else if (prop == LBP_ZW) + { + /* Don't break just before a zero-width space. */ + *p = UC_BREAK_PROHIBITED; + last_prop = LBP_ZW; + seen_space = NULL; + seen_space2 = NULL; + } + else if (prop == LBP_CM) + { + /* Don't break just before a combining character, except immediately after a + zero-width space. */ + if (last_prop == LBP_ZW) + { + /* Break after zero-width space. */ + *p = UC_BREAK_POSSIBLE; + /* A combining character turns a preceding space into LBP_ID. */ + last_prop = LBP_ID; + } + else + { + *p = UC_BREAK_PROHIBITED; + /* A combining character turns a preceding space into LBP_ID. */ + if (seen_space != NULL) + { + q = seen_space; + seen_space = seen_space2; + prop = LBP_ID; + goto lookup_via_table; + } + } + } + else + { + lookup_via_table: + /* prop must be usable as an index for table 7.3 of UTR #14. */ + if (!(prop >= 0 && prop < sizeof (unilbrk_table) / sizeof (unilbrk_table[0]))) + abort (); - if (last_prop == LBP_BK) - { - /* Don't break at the beginning of a line. */ - *q = UC_BREAK_PROHIBITED; - } - else if (last_prop == LBP_ZW) - { - /* Break after zero-width space. */ - *q = UC_BREAK_POSSIBLE; - } - else - { - switch (unilbrk_table [last_prop] [prop]) - { - case D: - *q = UC_BREAK_POSSIBLE; - break; - case I: - *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED); - break; - case P: - *q = UC_BREAK_PROHIBITED; - break; - default: - abort (); - } - } - last_prop = prop; - seen_space = NULL; - seen_space2 = NULL; - } - } + if (last_prop == LBP_BK) + { + /* Don't break at the beginning of a line. */ + *q = UC_BREAK_PROHIBITED; + } + else if (last_prop == LBP_ZW) + { + /* Break after zero-width space. */ + *q = UC_BREAK_POSSIBLE; + } + else + { + switch (unilbrk_table [last_prop] [prop]) + { + case D: + *q = UC_BREAK_POSSIBLE; + break; + case I: + *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED); + break; + case P: + *q = UC_BREAK_PROHIBITED; + break; + default: + abort (); + } + } + last_prop = prop; + seen_space = NULL; + seen_space2 = NULL; + } + } s += count; p += count; diff --git a/lib/unilbrk/u16-width-linebreaks.c b/lib/unilbrk/u16-width-linebreaks.c index 6444559..152178e 100644 --- a/lib/unilbrk/u16-width-linebreaks.c +++ b/lib/unilbrk/u16-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-16 strings. - Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -25,9 +25,9 @@ int u16_width_linebreaks (const uint16_t *s, size_t n, - int width, int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p) + int width, int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p) { const uint16_t *s_end; char *last_p; @@ -47,53 +47,53 @@ u16_width_linebreaks (const uint16_t *s, size_t n, /* Respect the override. */ if (o != NULL && *o != UC_BREAK_UNDEFINED) - *p = *o; + *p = *o; if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY) - { - /* An atomic piece of text ends here. */ - if (last_p != NULL && last_column + piece_width > width) - { - /* Insert a line break. */ - *last_p = UC_BREAK_POSSIBLE; - last_column = 0; - } - } + { + /* An atomic piece of text ends here. */ + if (last_p != NULL && last_column + piece_width > width) + { + /* Insert a line break. */ + *last_p = UC_BREAK_POSSIBLE; + last_column = 0; + } + } if (*p == UC_BREAK_MANDATORY) - { - /* uc is a line break character. */ - /* Start a new piece at column 0. */ - last_p = NULL; - last_column = 0; - piece_width = 0; - } + { + /* uc is a line break character. */ + /* Start a new piece at column 0. */ + last_p = NULL; + last_column = 0; + piece_width = 0; + } else - { - /* uc is not a line break character. */ - int w; - - if (*p == UC_BREAK_POSSIBLE) - { - /* Start a new piece. */ - last_p = p; - last_column += piece_width; - piece_width = 0; - /* No line break for the moment, may be turned into - UC_BREAK_POSSIBLE later, via last_p. */ - } - - *p = UC_BREAK_PROHIBITED; - - w = uc_width (uc, encoding); - if (w >= 0) /* ignore control characters in the string */ - piece_width += w; - } + { + /* uc is not a line break character. */ + int w; + + if (*p == UC_BREAK_POSSIBLE) + { + /* Start a new piece. */ + last_p = p; + last_column += piece_width; + piece_width = 0; + /* No line break for the moment, may be turned into + UC_BREAK_POSSIBLE later, via last_p. */ + } + + *p = UC_BREAK_PROHIBITED; + + w = uc_width (uc, encoding); + if (w >= 0) /* ignore control characters in the string */ + piece_width += w; + } s += count; p += count; if (o != NULL) - o += count; + o += count; } /* The last atomic piece of text ends here. */ diff --git a/lib/unilbrk/u32-possible-linebreaks.c b/lib/unilbrk/u32-possible-linebreaks.c index c843e12..c375a0c 100644 --- a/lib/unilbrk/u32-possible-linebreaks.c +++ b/lib/unilbrk/u32-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-32 strings. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -40,117 +40,117 @@ u32_possible_linebreaks (const uint32_t *s, size_t n, const char *encoding, char int prop = unilbrkprop_lookup (uc); if (prop == LBP_BK) - { - /* Mandatory break. */ - *p = UC_BREAK_MANDATORY; - last_prop = LBP_BK; - seen_space = NULL; - seen_space2 = NULL; - } + { + /* Mandatory break. */ + *p = UC_BREAK_MANDATORY; + last_prop = LBP_BK; + seen_space = NULL; + seen_space2 = NULL; + } else - { - char *q; + { + char *q; - /* Resolve property values whose behaviour is not fixed. */ - switch (prop) - { - case LBP_AI: - /* Resolve ambiguous. */ - prop = LBP_AI_REPLACEMENT; - break; - case LBP_CB: - /* This is arbitrary. */ - prop = LBP_ID; - break; - case LBP_SA: - /* We don't handle complex scripts yet. - Treat LBP_SA like LBP_XX. */ - case LBP_XX: - /* This is arbitrary. */ - prop = LBP_AL; - break; - } + /* Resolve property values whose behaviour is not fixed. */ + switch (prop) + { + case LBP_AI: + /* Resolve ambiguous. */ + prop = LBP_AI_REPLACEMENT; + break; + case LBP_CB: + /* This is arbitrary. */ + prop = LBP_ID; + break; + case LBP_SA: + /* We don't handle complex scripts yet. + Treat LBP_SA like LBP_XX. */ + case LBP_XX: + /* This is arbitrary. */ + prop = LBP_AL; + break; + } - /* Deal with spaces and combining characters. */ - q = p; - if (prop == LBP_SP) - { - /* Don't break just before a space. */ - *p = UC_BREAK_PROHIBITED; - seen_space2 = seen_space; - seen_space = p; - } - else if (prop == LBP_ZW) - { - /* Don't break just before a zero-width space. */ - *p = UC_BREAK_PROHIBITED; - last_prop = LBP_ZW; - seen_space = NULL; - seen_space2 = NULL; - } - else if (prop == LBP_CM) - { - /* Don't break just before a combining character, except immediately after a - zero-width space. */ - if (last_prop == LBP_ZW) - { - /* Break after zero-width space. */ - *p = UC_BREAK_POSSIBLE; - /* A combining character turns a preceding space into LBP_ID. */ - last_prop = LBP_ID; - } - else - { - *p = UC_BREAK_PROHIBITED; - /* A combining character turns a preceding space into LBP_ID. */ - if (seen_space != NULL) - { - q = seen_space; - seen_space = seen_space2; - prop = LBP_ID; - goto lookup_via_table; - } - } - } - else - { - lookup_via_table: - /* prop must be usable as an index for table 7.3 of UTR #14. */ - if (!(prop >= 0 && prop < sizeof (unilbrk_table) / sizeof (unilbrk_table[0]))) - abort (); + /* Deal with spaces and combining characters. */ + q = p; + if (prop == LBP_SP) + { + /* Don't break just before a space. */ + *p = UC_BREAK_PROHIBITED; + seen_space2 = seen_space; + seen_space = p; + } + else if (prop == LBP_ZW) + { + /* Don't break just before a zero-width space. */ + *p = UC_BREAK_PROHIBITED; + last_prop = LBP_ZW; + seen_space = NULL; + seen_space2 = NULL; + } + else if (prop == LBP_CM) + { + /* Don't break just before a combining character, except immediately after a + zero-width space. */ + if (last_prop == LBP_ZW) + { + /* Break after zero-width space. */ + *p = UC_BREAK_POSSIBLE; + /* A combining character turns a preceding space into LBP_ID. */ + last_prop = LBP_ID; + } + else + { + *p = UC_BREAK_PROHIBITED; + /* A combining character turns a preceding space into LBP_ID. */ + if (seen_space != NULL) + { + q = seen_space; + seen_space = seen_space2; + prop = LBP_ID; + goto lookup_via_table; + } + } + } + else + { + lookup_via_table: + /* prop must be usable as an index for table 7.3 of UTR #14. */ + if (!(prop >= 0 && prop < sizeof (unilbrk_table) / sizeof (unilbrk_table[0]))) + abort (); - if (last_prop == LBP_BK) - { - /* Don't break at the beginning of a line. */ - *q = UC_BREAK_PROHIBITED; - } - else if (last_prop == LBP_ZW) - { - /* Break after zero-width space. */ - *q = UC_BREAK_POSSIBLE; - } - else - { - switch (unilbrk_table [last_prop] [prop]) - { - case D: - *q = UC_BREAK_POSSIBLE; - break; - case I: - *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED); - break; - case P: - *q = UC_BREAK_PROHIBITED; - break; - default: - abort (); - } - } - last_prop = prop; - seen_space = NULL; - seen_space2 = NULL; - } - } + if (last_prop == LBP_BK) + { + /* Don't break at the beginning of a line. */ + *q = UC_BREAK_PROHIBITED; + } + else if (last_prop == LBP_ZW) + { + /* Break after zero-width space. */ + *q = UC_BREAK_POSSIBLE; + } + else + { + switch (unilbrk_table [last_prop] [prop]) + { + case D: + *q = UC_BREAK_POSSIBLE; + break; + case I: + *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED); + break; + case P: + *q = UC_BREAK_PROHIBITED; + break; + default: + abort (); + } + } + last_prop = prop; + seen_space = NULL; + seen_space2 = NULL; + } + } s++; p++; diff --git a/lib/unilbrk/u32-width-linebreaks.c b/lib/unilbrk/u32-width-linebreaks.c index 2d36256..c5803db 100644 --- a/lib/unilbrk/u32-width-linebreaks.c +++ b/lib/unilbrk/u32-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-32 strings. - Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -24,9 +24,9 @@ int u32_width_linebreaks (const uint32_t *s, size_t n, - int width, int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p) + int width, int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p) { const uint32_t *s_end; char *last_p; @@ -45,53 +45,53 @@ u32_width_linebreaks (const uint32_t *s, size_t n, /* Respect the override. */ if (o != NULL && *o != UC_BREAK_UNDEFINED) - *p = *o; + *p = *o; if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY) - { - /* An atomic piece of text ends here. */ - if (last_p != NULL && last_column + piece_width > width) - { - /* Insert a line break. */ - *last_p = UC_BREAK_POSSIBLE; - last_column = 0; - } - } + { + /* An atomic piece of text ends here. */ + if (last_p != NULL && last_column + piece_width > width) + { + /* Insert a line break. */ + *last_p = UC_BREAK_POSSIBLE; + last_column = 0; + } + } if (*p == UC_BREAK_MANDATORY) - { - /* uc is a line break character. */ - /* Start a new piece at column 0. */ - last_p = NULL; - last_column = 0; - piece_width = 0; - } + { + /* uc is a line break character. */ + /* Start a new piece at column 0. */ + last_p = NULL; + last_column = 0; + piece_width = 0; + } else - { - /* uc is not a line break character. */ - int w; - - if (*p == UC_BREAK_POSSIBLE) - { - /* Start a new piece. */ - last_p = p; - last_column += piece_width; - piece_width = 0; - /* No line break for the moment, may be turned into - UC_BREAK_POSSIBLE later, via last_p. */ - } - - *p = UC_BREAK_PROHIBITED; - - w = uc_width (uc, encoding); - if (w >= 0) /* ignore control characters in the string */ - piece_width += w; - } + { + /* uc is not a line break character. */ + int w; + + if (*p == UC_BREAK_POSSIBLE) + { + /* Start a new piece. */ + last_p = p; + last_column += piece_width; + piece_width = 0; + /* No line break for the moment, may be turned into + UC_BREAK_POSSIBLE later, via last_p. */ + } + + *p = UC_BREAK_PROHIBITED; + + w = uc_width (uc, encoding); + if (w >= 0) /* ignore control characters in the string */ + piece_width += w; + } s++; p++; if (o != NULL) - o++; + o++; } /* The last atomic piece of text ends here. */ diff --git a/lib/unilbrk/u8-possible-linebreaks.c b/lib/unilbrk/u8-possible-linebreaks.c index 94e14f4..d65335e 100644 --- a/lib/unilbrk/u8-possible-linebreaks.c +++ b/lib/unilbrk/u8-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-8 strings. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -46,117 +46,117 @@ u8_possible_linebreaks (const uint8_t *s, size_t n, const char *encoding, char * int prop = unilbrkprop_lookup (uc); if (prop == LBP_BK) - { - /* Mandatory break. */ - *p = UC_BREAK_MANDATORY; - last_prop = LBP_BK; - seen_space = NULL; - seen_space2 = NULL; - } + { + /* Mandatory break. */ + *p = UC_BREAK_MANDATORY; + last_prop = LBP_BK; + seen_space = NULL; + seen_space2 = NULL; + } else - { - char *q; + { + char *q; - /* Resolve property values whose behaviour is not fixed. */ - switch (prop) - { - case LBP_AI: - /* Resolve ambiguous. */ - prop = LBP_AI_REPLACEMENT; - break; - case LBP_CB: - /* This is arbitrary. */ - prop = LBP_ID; - break; - case LBP_SA: - /* We don't handle complex scripts yet. - Treat LBP_SA like LBP_XX. */ - case LBP_XX: - /* This is arbitrary. */ - prop = LBP_AL; - break; - } + /* Resolve property values whose behaviour is not fixed. */ + switch (prop) + { + case LBP_AI: + /* Resolve ambiguous. */ + prop = LBP_AI_REPLACEMENT; + break; + case LBP_CB: + /* This is arbitrary. */ + prop = LBP_ID; + break; + case LBP_SA: + /* We don't handle complex scripts yet. + Treat LBP_SA like LBP_XX. */ + case LBP_XX: + /* This is arbitrary. */ + prop = LBP_AL; + break; + } - /* Deal with spaces and combining characters. */ - q = p; - if (prop == LBP_SP) - { - /* Don't break just before a space. */ - *p = UC_BREAK_PROHIBITED; - seen_space2 = seen_space; - seen_space = p; - } - else if (prop == LBP_ZW) - { - /* Don't break just before a zero-width space. */ - *p = UC_BREAK_PROHIBITED; - last_prop = LBP_ZW; - seen_space = NULL; - seen_space2 = NULL; - } - else if (prop == LBP_CM) - { - /* Don't break just before a combining character, except immediately after a - zero-width space. */ - if (last_prop == LBP_ZW) - { - /* Break after zero-width space. */ - *p = UC_BREAK_POSSIBLE; - /* A combining character turns a preceding space into LBP_ID. */ - last_prop = LBP_ID; - } - else - { - *p = UC_BREAK_PROHIBITED; - /* A combining character turns a preceding space into LBP_ID. */ - if (seen_space != NULL) - { - q = seen_space; - seen_space = seen_space2; - prop = LBP_ID; - goto lookup_via_table; - } - } - } - else - { - lookup_via_table: - /* prop must be usable as an index for table 7.3 of UTR #14. */ - if (!(prop >= 0 && prop < sizeof (unilbrk_table) / sizeof (unilbrk_table[0]))) - abort (); + /* Deal with spaces and combining characters. */ + q = p; + if (prop == LBP_SP) + { + /* Don't break just before a space. */ + *p = UC_BREAK_PROHIBITED; + seen_space2 = seen_space; + seen_space = p; + } + else if (prop == LBP_ZW) + { + /* Don't break just before a zero-width space. */ + *p = UC_BREAK_PROHIBITED; + last_prop = LBP_ZW; + seen_space = NULL; + seen_space2 = NULL; + } + else if (prop == LBP_CM) + { + /* Don't break just before a combining character, except immediately after a + zero-width space. */ + if (last_prop == LBP_ZW) + { + /* Break after zero-width space. */ + *p = UC_BREAK_POSSIBLE; + /* A combining character turns a preceding space into LBP_ID. */ + last_prop = LBP_ID; + } + else + { + *p = UC_BREAK_PROHIBITED; + /* A combining character turns a preceding space into LBP_ID. */ + if (seen_space != NULL) + { + q = seen_space; + seen_space = seen_space2; + prop = LBP_ID; + goto lookup_via_table; + } + } + } + else + { + lookup_via_table: + /* prop must be usable as an index for table 7.3 of UTR #14. */ + if (!(prop >= 0 && prop < sizeof (unilbrk_table) / sizeof (unilbrk_table[0]))) + abort (); - if (last_prop == LBP_BK) - { - /* Don't break at the beginning of a line. */ - *q = UC_BREAK_PROHIBITED; - } - else if (last_prop == LBP_ZW) - { - /* Break after zero-width space. */ - *q = UC_BREAK_POSSIBLE; - } - else - { - switch (unilbrk_table [last_prop] [prop]) - { - case D: - *q = UC_BREAK_POSSIBLE; - break; - case I: - *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED); - break; - case P: - *q = UC_BREAK_PROHIBITED; - break; - default: - abort (); - } - } - last_prop = prop; - seen_space = NULL; - seen_space2 = NULL; - } - } + if (last_prop == LBP_BK) + { + /* Don't break at the beginning of a line. */ + *q = UC_BREAK_PROHIBITED; + } + else if (last_prop == LBP_ZW) + { + /* Break after zero-width space. */ + *q = UC_BREAK_POSSIBLE; + } + else + { + switch (unilbrk_table [last_prop] [prop]) + { + case D: + *q = UC_BREAK_POSSIBLE; + break; + case I: + *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED); + break; + case P: + *q = UC_BREAK_PROHIBITED; + break; + default: + abort (); + } + } + last_prop = prop; + seen_space = NULL; + seen_space2 = NULL; + } + } s += count; p += count; @@ -183,28 +183,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -231,24 +231,24 @@ main (int argc, char * argv[]) u8_possible_linebreaks ((uint8_t *) input, length, "UTF-8", breaks); for (i = 0; i < length; i++) - { - switch (breaks[i]) - { - case UC_BREAK_POSSIBLE: - /* U+2027 in UTF-8 encoding */ - putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout); - break; - case UC_BREAK_MANDATORY: - /* U+21B2 (or U+21B5) in UTF-8 encoding */ - putc (0xe2, stdout); putc (0x86, stdout); putc (0xb2, stdout); - break; - case UC_BREAK_PROHIBITED: - break; - default: - abort (); - } - putc (input[i], stdout); - } + { + switch (breaks[i]) + { + case UC_BREAK_POSSIBLE: + /* U+2027 in UTF-8 encoding */ + putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout); + break; + case UC_BREAK_MANDATORY: + /* U+21B2 (or U+21B5) in UTF-8 encoding */ + putc (0xe2, stdout); putc (0x86, stdout); putc (0xb2, stdout); + break; + case UC_BREAK_PROHIBITED: + break; + default: + abort (); + } + putc (input[i], stdout); + } free (breaks); diff --git a/lib/unilbrk/u8-width-linebreaks.c b/lib/unilbrk/u8-width-linebreaks.c index 7e7f2e9..fffe62a 100644 --- a/lib/unilbrk/u8-width-linebreaks.c +++ b/lib/unilbrk/u8-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-8 strings. - Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -25,9 +25,9 @@ int u8_width_linebreaks (const uint8_t *s, size_t n, - int width, int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p) + int width, int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p) { const uint8_t *s_end; char *last_p; @@ -47,53 +47,53 @@ u8_width_linebreaks (const uint8_t *s, size_t n, /* Respect the override. */ if (o != NULL && *o != UC_BREAK_UNDEFINED) - *p = *o; + *p = *o; if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY) - { - /* An atomic piece of text ends here. */ - if (last_p != NULL && last_column + piece_width > width) - { - /* Insert a line break. */ - *last_p = UC_BREAK_POSSIBLE; - last_column = 0; - } - } + { + /* An atomic piece of text ends here. */ + if (last_p != NULL && last_column + piece_width > width) + { + /* Insert a line break. */ + *last_p = UC_BREAK_POSSIBLE; + last_column = 0; + } + } if (*p == UC_BREAK_MANDATORY) - { - /* uc is a line break character. */ - /* Start a new piece at column 0. */ - last_p = NULL; - last_column = 0; - piece_width = 0; - } + { + /* uc is a line break character. */ + /* Start a new piece at column 0. */ + last_p = NULL; + last_column = 0; + piece_width = 0; + } else - { - /* uc is not a line break character. */ - int w; - - if (*p == UC_BREAK_POSSIBLE) - { - /* Start a new piece. */ - last_p = p; - last_column += piece_width; - piece_width = 0; - /* No line break for the moment, may be turned into - UC_BREAK_POSSIBLE later, via last_p. */ - } - - *p = UC_BREAK_PROHIBITED; - - w = uc_width (uc, encoding); - if (w >= 0) /* ignore control characters in the string */ - piece_width += w; - } + { + /* uc is not a line break character. */ + int w; + + if (*p == UC_BREAK_POSSIBLE) + { + /* Start a new piece. */ + last_p = p; + last_column += piece_width; + piece_width = 0; + /* No line break for the moment, may be turned into + UC_BREAK_POSSIBLE later, via last_p. */ + } + + *p = UC_BREAK_PROHIBITED; + + w = uc_width (uc, encoding); + if (w >= 0) /* ignore control characters in the string */ + piece_width += w; + } s += count; p += count; if (o != NULL) - o += count; + o += count; } /* The last atomic piece of text ends here. */ @@ -128,28 +128,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -177,21 +177,21 @@ main (int argc, char * argv[]) u8_width_linebreaks ((uint8_t *) input, length, width, 0, 0, NULL, "UTF-8", breaks); for (i = 0; i < length; i++) - { - switch (breaks[i]) - { - case UC_BREAK_POSSIBLE: - putc ('\n', stdout); - break; - case UC_BREAK_MANDATORY: - break; - case UC_BREAK_PROHIBITED: - break; - default: - abort (); - } - putc (input[i], stdout); - } + { + switch (breaks[i]) + { + case UC_BREAK_POSSIBLE: + putc ('\n', stdout); + break; + case UC_BREAK_MANDATORY: + break; + case UC_BREAK_PROHIBITED: + break; + default: + abort (); + } + putc (input[i], stdout); + } free (breaks); diff --git a/lib/unilbrk/ulc-common.c b/lib/unilbrk/ulc-common.c index d035ded..1ed9c82 100644 --- a/lib/unilbrk/ulc-common.c +++ b/lib/unilbrk/ulc-common.c @@ -1,5 +1,5 @@ /* Line breaking auxiliary functions. - Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -43,7 +43,7 @@ is_all_ascii (const char *s, size_t n) unsigned char c = (unsigned char) *s; if (!(c_isprint (c) || c_isspace (c))) - return 0; + return 0; } return 1; } diff --git a/lib/unilbrk/ulc-common.h b/lib/unilbrk/ulc-common.h index 3b48188..bd3c6e4 100644 --- a/lib/unilbrk/ulc-common.h +++ b/lib/unilbrk/ulc-common.h @@ -1,5 +1,5 @@ /* Line breaking auxiliary functions. - Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unilbrk/ulc-possible-linebreaks.c b/lib/unilbrk/ulc-possible-linebreaks.c index cb95241..eed59b4 100644 --- a/lib/unilbrk/ulc-possible-linebreaks.c +++ b/lib/unilbrk/ulc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of strings. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -42,76 +42,76 @@ void ulc_possible_linebreaks (const char *s, size_t n, const char *encoding, - char *p) + char *p) { if (n > 0) { if (is_utf8_encoding (encoding)) - u8_possible_linebreaks ((const uint8_t *) s, n, encoding, p); + u8_possible_linebreaks ((const uint8_t *) s, n, encoding, p); else - { - /* Convert the string to UTF-8 and build a translation table - from offsets into s to offsets into the translated string. */ - size_t *offsets = (size_t *) malloc (n * sizeof (size_t)); - - if (offsets != NULL) - { - uint8_t *t; - size_t m; - - t = u8_conv_from_encoding (encoding, iconveh_question_mark, - s, n, offsets, NULL, &m); - if (t != NULL) - { - char *q = (char *) (m > 0 ? malloc (m) : NULL); - - if (m == 0 || q != NULL) - { - size_t i; - - /* Determine the possible line breaks of the UTF-8 - string. */ - u8_possible_linebreaks (t, m, encoding, q); - - /* Translate the result back to the original string. */ - memset (p, UC_BREAK_PROHIBITED, n); - for (i = 0; i < n; i++) - if (offsets[i] != (size_t)(-1)) - p[i] = q[offsets[i]]; - - free (q); - free (t); - free (offsets); - return; - } - free (t); - } - free (offsets); - } - - /* Impossible to convert. */ + { + /* Convert the string to UTF-8 and build a translation table + from offsets into s to offsets into the translated string. */ + size_t *offsets = (size_t *) malloc (n * sizeof (size_t)); + + if (offsets != NULL) + { + uint8_t *t; + size_t m; + + t = u8_conv_from_encoding (encoding, iconveh_question_mark, + s, n, offsets, NULL, &m); + if (t != NULL) + { + char *q = (char *) (m > 0 ? malloc (m) : NULL); + + if (m == 0 || q != NULL) + { + size_t i; + + /* Determine the possible line breaks of the UTF-8 + string. */ + u8_possible_linebreaks (t, m, encoding, q); + + /* Translate the result back to the original string. */ + memset (p, UC_BREAK_PROHIBITED, n); + for (i = 0; i < n; i++) + if (offsets[i] != (size_t)(-1)) + p[i] = q[offsets[i]]; + + free (q); + free (t); + free (offsets); + return; + } + free (t); + } + free (offsets); + } + + /* Impossible to convert. */ #if C_CTYPE_ASCII - if (is_all_ascii (s, n)) - { - /* ASCII is a subset of UTF-8. */ - u8_possible_linebreaks ((const uint8_t *) s, n, encoding, p); - return; - } + if (is_all_ascii (s, n)) + { + /* ASCII is a subset of UTF-8. */ + u8_possible_linebreaks ((const uint8_t *) s, n, encoding, p); + return; + } #endif - /* We have a non-ASCII string and cannot convert it. - Don't produce line breaks except those already present in the - input string. All we assume here is that the encoding is - minimally ASCII compatible. */ - { - const char *s_end = s + n; - while (s < s_end) - { - *p = (*s == '\n' ? UC_BREAK_MANDATORY : UC_BREAK_PROHIBITED); - s++; - p++; - } - } - } + /* We have a non-ASCII string and cannot convert it. + Don't produce line breaks except those already present in the + input string. All we assume here is that the encoding is + minimally ASCII compatible. */ + { + const char *s_end = s + n; + while (s < s_end) + { + *p = (*s == '\n' ? UC_BREAK_MANDATORY : UC_BREAK_PROHIBITED); + s++; + p++; + } + } + } } } @@ -136,28 +136,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -185,21 +185,21 @@ main (int argc, char * argv[]) ulc_possible_linebreaks (input, length, locale_charset (), breaks); for (i = 0; i < length; i++) - { - switch (breaks[i]) - { - case UC_BREAK_POSSIBLE: - putc ('|', stdout); - break; - case UC_BREAK_MANDATORY: - break; - case UC_BREAK_PROHIBITED: - break; - default: - abort (); - } - putc (input[i], stdout); - } + { + switch (breaks[i]) + { + case UC_BREAK_POSSIBLE: + putc ('|', stdout); + break; + case UC_BREAK_MANDATORY: + break; + case UC_BREAK_PROHIBITED: + break; + default: + abort (); + } + putc (input[i], stdout); + } free (breaks); diff --git a/lib/unilbrk/ulc-width-linebreaks.c b/lib/unilbrk/ulc-width-linebreaks.c index 3b091bf..16b3881 100644 --- a/lib/unilbrk/ulc-width-linebreaks.c +++ b/lib/unilbrk/ulc-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of strings. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -42,94 +42,94 @@ int ulc_width_linebreaks (const char *s, size_t n, - int width, int start_column, int at_end_columns, - const char *o, const char *encoding, - char *p) + int width, int start_column, int at_end_columns, + const char *o, const char *encoding, + char *p) { if (n > 0) { if (is_utf8_encoding (encoding)) - return u8_width_linebreaks ((const uint8_t *) s, n, width, start_column, at_end_columns, o, encoding, p); + return u8_width_linebreaks ((const uint8_t *) s, n, width, start_column, at_end_columns, o, encoding, p); else - { - /* Convert the string to UTF-8 and build a translation table - from offsets into s to offsets into the translated string. */ - size_t *offsets = (size_t *) malloc (n * sizeof (size_t)); - - if (offsets != NULL) - { - uint8_t *t; - size_t m; - - t = u8_conv_from_encoding (encoding, iconveh_question_mark, - s, n, offsets, NULL, &m); - if (t != NULL) - { - char *memory = - (char *) (m > 0 ? malloc (m + (o != NULL ? m : 0)) : NULL); - - if (m == 0 || memory != NULL) - { - char *q = (char *) memory; - char *o8 = (o != NULL ? (char *) (q + m) : NULL); - int res_column; - size_t i; - - /* Translate the overrides to the UTF-8 string. */ - if (o != NULL) - { - memset (o8, UC_BREAK_UNDEFINED, m); - for (i = 0; i < n; i++) - if (offsets[i] != (size_t)(-1)) - o8[offsets[i]] = o[i]; - } - - /* Determine the line breaks of the UTF-8 string. */ - res_column = - u8_width_linebreaks (t, m, width, start_column, at_end_columns, o8, encoding, q); - - /* Translate the result back to the original string. */ - memset (p, UC_BREAK_PROHIBITED, n); - for (i = 0; i < n; i++) - if (offsets[i] != (size_t)(-1)) - p[i] = q[offsets[i]]; - - free (memory); - free (t); - free (offsets); - return res_column; - } - free (t); - } - free (offsets); - } - /* Impossible to convert. */ + { + /* Convert the string to UTF-8 and build a translation table + from offsets into s to offsets into the translated string. */ + size_t *offsets = (size_t *) malloc (n * sizeof (size_t)); + + if (offsets != NULL) + { + uint8_t *t; + size_t m; + + t = u8_conv_from_encoding (encoding, iconveh_question_mark, + s, n, offsets, NULL, &m); + if (t != NULL) + { + char *memory = + (char *) (m > 0 ? malloc (m + (o != NULL ? m : 0)) : NULL); + + if (m == 0 || memory != NULL) + { + char *q = (char *) memory; + char *o8 = (o != NULL ? (char *) (q + m) : NULL); + int res_column; + size_t i; + + /* Translate the overrides to the UTF-8 string. */ + if (o != NULL) + { + memset (o8, UC_BREAK_UNDEFINED, m); + for (i = 0; i < n; i++) + if (offsets[i] != (size_t)(-1)) + o8[offsets[i]] = o[i]; + } + + /* Determine the line breaks of the UTF-8 string. */ + res_column = + u8_width_linebreaks (t, m, width, start_column, at_end_columns, o8, encoding, q); + + /* Translate the result back to the original string. */ + memset (p, UC_BREAK_PROHIBITED, n); + for (i = 0; i < n; i++) + if (offsets[i] != (size_t)(-1)) + p[i] = q[offsets[i]]; + + free (memory); + free (t); + free (offsets); + return res_column; + } + free (t); + } + free (offsets); + } + /* Impossible to convert. */ #if C_CTYPE_ASCII - if (is_all_ascii (s, n)) - { - /* ASCII is a subset of UTF-8. */ - return u8_width_linebreaks ((const uint8_t *) s, n, width, start_column, at_end_columns, o, encoding, p); - } + if (is_all_ascii (s, n)) + { + /* ASCII is a subset of UTF-8. */ + return u8_width_linebreaks ((const uint8_t *) s, n, width, start_column, at_end_columns, o, encoding, p); + } #endif - /* We have a non-ASCII string and cannot convert it. - Don't produce line breaks except those already present in the - input string. All we assume here is that the encoding is - minimally ASCII compatible. */ - { - const char *s_end = s + n; - while (s < s_end) - { - *p = ((o != NULL && *o == UC_BREAK_MANDATORY) || *s == '\n' - ? UC_BREAK_MANDATORY - : UC_BREAK_PROHIBITED); - s++; - p++; - if (o != NULL) - o++; - } - /* We cannot compute widths in this case. */ - } - } + /* We have a non-ASCII string and cannot convert it. + Don't produce line breaks except those already present in the + input string. All we assume here is that the encoding is + minimally ASCII compatible. */ + { + const char *s_end = s + n; + while (s < s_end) + { + *p = ((o != NULL && *o == UC_BREAK_MANDATORY) || *s == '\n' + ? UC_BREAK_MANDATORY + : UC_BREAK_PROHIBITED); + s++; + p++; + if (o != NULL) + o++; + } + /* We cannot compute widths in this case. */ + } + } } return start_column; } @@ -154,28 +154,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -204,21 +204,21 @@ main (int argc, char * argv[]) ulc_width_linebreaks (input, length, width, 0, 0, NULL, locale_charset (), breaks); for (i = 0; i < length; i++) - { - switch (breaks[i]) - { - case UC_BREAK_POSSIBLE: - putc ('\n', stdout); - break; - case UC_BREAK_MANDATORY: - break; - case UC_BREAK_PROHIBITED: - break; - default: - abort (); - } - putc (input[i], stdout); - } + { + switch (breaks[i]) + { + case UC_BREAK_POSSIBLE: + putc ('\n', stdout); + break; + case UC_BREAK_MANDATORY: + break; + case UC_BREAK_PROHIBITED: + break; + default: + abort (); + } + putc (input[i], stdout); + } free (breaks); diff --git a/lib/uniname.h b/lib/uniname.h index 7b5a367..1d0f81c 100644 --- a/lib/uniname.h +++ b/lib/uniname.h @@ -1,5 +1,6 @@ /* Association between Unicode characters and their names. - Copyright (C) 2000-2002, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2000-2002, 2005, 2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniname/uniname.c b/lib/uniname/uniname.c index bef58af..e4b81cc 100644 --- a/lib/uniname/uniname.c +++ b/lib/uniname/uniname.c @@ -1,5 +1,5 @@ /* Association between Unicode characters and their names. - Copyright (C) 2000-2002, 2005-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2000-2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -73,16 +73,16 @@ unicode_name_word (unsigned int index, unsigned int *lengthp) { unsigned int i = (i1 + i2) >> 1; if (unicode_name_by_length[i].ind_offset <= index) - i1 = i; + i1 = i; else - i2 = i; + i2 = i; } i = i1; assert (unicode_name_by_length[i].ind_offset <= index - && index < unicode_name_by_length[i+1].ind_offset); + && index < unicode_name_by_length[i+1].ind_offset); *lengthp = i; return &unicode_name_words[unicode_name_by_length[i].extra_offset - + (index-unicode_name_by_length[i].ind_offset)*i]; + + (index-unicode_name_by_length[i].ind_offset)*i]; } /* Looks up the index of a word. */ @@ -97,32 +97,32 @@ unicode_name_word_lookup (const char *word, unsigned int length) unsigned int i1 = i0; unsigned int i2 = unicode_name_by_length[length+1].ind_offset; while (i2 - i1 > 0) - { - unsigned int i = (i1 + i2) >> 1; - const char *p = &unicode_name_words[extra_offset + (i-i0)*length]; - const char *w = word; - unsigned int n = length; - for (;;) - { - if (*p < *w) - { - if (i1 == i) - return -1; - /* Note here: i1 < i < i2. */ - i1 = i; - break; - } - if (*p > *w) - { - /* Note here: i1 <= i < i2. */ - i2 = i; - break; - } - p++; w++; n--; - if (n == 0) - return i; - } - } + { + unsigned int i = (i1 + i2) >> 1; + const char *p = &unicode_name_words[extra_offset + (i-i0)*length]; + const char *w = word; + unsigned int n = length; + for (;;) + { + if (*p < *w) + { + if (i1 == i) + return -1; + /* Note here: i1 < i < i2. */ + i1 = i; + break; + } + if (*p > *w) + { + /* Note here: i1 <= i < i2. */ + i2 = i; + break; + } + p++; w++; n--; + if (n == 0) + return i; + } + } } return -1; } @@ -171,21 +171,21 @@ unicode_character_name (ucs4_t c, char *buf) q = jamo_initial_short_name[index1]; while (*q != '\0') - *ptr++ = *q++; + *ptr++ = *q++; q = jamo_medial_short_name[index2]; while (*q != '\0') - *ptr++ = *q++; + *ptr++ = *q++; q = jamo_final_short_name[index3]; while (*q != '\0') - *ptr++ = *q++; + *ptr++ = *q++; *ptr = '\0'; return buf; } else if ((c >= 0xF900 && c <= 0xFA2D) || (c >= 0xFA30 && c <= 0xFA6A) - || (c >= 0xFA70 && c <= 0xFAD9) || (c >= 0x2F800 && c <= 0x2FA1D)) + || (c >= 0xFA70 && c <= 0xFAD9) || (c >= 0x2F800 && c <= 0x2FA1D)) { /* Special case for CJK compatibility ideographs. Keeps the tables - small. */ + small. */ char *ptr; int i; @@ -194,10 +194,10 @@ unicode_character_name (ucs4_t c, char *buf) ptr = buf + 28; for (i = (c < 0x10000 ? 12 : 16); i >= 0; i -= 4) - { - unsigned int x = (c >> i) & 0xf; - *ptr++ = (x < 10 ? '0' : 'A' - 10) + x; - } + { + unsigned int x = (c >> i) & 0xf; + *ptr++ = (x < 10 ? '0' : 'A' - 10) + x; + } *ptr = '\0'; return buf; } @@ -207,91 +207,91 @@ unicode_character_name (ucs4_t c, char *buf) /* Transform the code so that it fits in 16 bits. */ switch (c >> 12) - { - case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: - break; - case 0x0A: - c -= 0x05000; - break; - case 0x0F: - c -= 0x09000; - break; - case 0x10: - c -= 0x09000; - break; - case 0x12: - c -= 0x0A000; - break; - case 0x1D: - c -= 0x14000; - break; - case 0x1F: - c -= 0x15000; - break; - case 0x2F: - c -= 0x24000; - break; - case 0xE0: - c -= 0xD4000; - break; - default: - return NULL; - } + { + case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: + break; + case 0x0A: + c -= 0x05000; + break; + case 0x0F: + c -= 0x09000; + break; + case 0x10: + c -= 0x09000; + break; + case 0x12: + c -= 0x0A000; + break; + case 0x1D: + c -= 0x14000; + break; + case 0x1F: + c -= 0x15000; + break; + case 0x2F: + c -= 0x24000; + break; + case 0xE0: + c -= 0xD4000; + break; + default: + return NULL; + } { - /* Binary search in unicode_code_to_name. */ - unsigned int i1 = 0; - unsigned int i2 = SIZEOF (unicode_code_to_name); - for (;;) - { - unsigned int i = (i1 + i2) >> 1; - if (unicode_code_to_name[i].code == c) - { - words = &unicode_names[unicode_code_to_name[i].name]; - break; - } - else if (unicode_code_to_name[i].code < c) - { - if (i1 == i) - { - words = NULL; - break; - } - /* Note here: i1 < i < i2. */ - i1 = i; - } - else if (unicode_code_to_name[i].code > c) - { - if (i2 == i) - { - words = NULL; - break; - } - /* Note here: i1 <= i < i2. */ - i2 = i; - } - } + /* Binary search in unicode_code_to_name. */ + unsigned int i1 = 0; + unsigned int i2 = SIZEOF (unicode_code_to_name); + for (;;) + { + unsigned int i = (i1 + i2) >> 1; + if (unicode_code_to_name[i].code == c) + { + words = &unicode_names[unicode_code_to_name[i].name]; + break; + } + else if (unicode_code_to_name[i].code < c) + { + if (i1 == i) + { + words = NULL; + break; + } + /* Note here: i1 < i < i2. */ + i1 = i; + } + else if (unicode_code_to_name[i].code > c) + { + if (i2 == i) + { + words = NULL; + break; + } + /* Note here: i1 <= i < i2. */ + i2 = i; + } + } } if (words != NULL) - { - /* Found it in unicode_code_to_name. Now concatenate the words. */ - /* buf needs to have at least UNICODE_CHARNAME_MAX_LENGTH bytes. */ - char *ptr = buf; - for (;;) - { - unsigned int wordlen; - const char *word = unicode_name_word (*words>>1, &wordlen); - do - *ptr++ = *word++; - while (--wordlen > 0); - if ((*words & 1) == 0) - break; - *ptr++ = ' '; - words++; - } - *ptr = '\0'; - return buf; - } + { + /* Found it in unicode_code_to_name. Now concatenate the words. */ + /* buf needs to have at least UNICODE_CHARNAME_MAX_LENGTH bytes. */ + char *ptr = buf; + for (;;) + { + unsigned int wordlen; + const char *word = unicode_name_word (*words>>1, &wordlen); + do + *ptr++ = *word++; + while (--wordlen > 0); + if ((*words & 1) == 0) + break; + *ptr++ = ' '; + words++; + } + *ptr = '\0'; + return buf; + } return NULL; } } @@ -308,209 +308,209 @@ unicode_name_character (const char *name) char buf[UNICODE_CHARNAME_MAX_LENGTH]; char *ptr = buf; for (;;) - { - char c = *name++; - if (!(c >= ' ' && c <= '~')) - break; - *ptr++ = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); - if (--len == 0) - goto filled_buf; - } + { + char c = *name++; + if (!(c >= ' ' && c <= '~')) + break; + *ptr++ = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); + if (--len == 0) + goto filled_buf; + } if (false) filled_buf: - { - /* Convert the constituents to uint16_t words. */ - uint16_t words[UNICODE_CHARNAME_MAX_WORDS]; - uint16_t *wordptr = words; - { - const char *p1 = buf; - for (;;) - { - { - int word; - const char *p2 = p1; - while (p2 < ptr && *p2 != ' ') - p2++; - word = unicode_name_word_lookup (p1, p2 - p1); - if (word < 0) - break; - if (wordptr == &words[UNICODE_CHARNAME_MAX_WORDS]) - break; - *wordptr++ = word; - if (p2 == ptr) - goto filled_words; - p1 = p2 + 1; - } - /* Special case for Hangul syllables. Keeps the tables small. */ - if (wordptr == &words[2] - && words[0] == UNICODE_CHARNAME_WORD_HANGUL - && words[1] == UNICODE_CHARNAME_WORD_SYLLABLE) - { - /* Split the last word [p1..ptr) into three parts: - 1) [BCDGHJKMNPRST] - 2) [AEIOUWY] - 3) [BCDGHIJKLMNPST] - */ - const char *p2; - const char *p3; - const char *p4; - - p2 = p1; - while (p2 < ptr - && (*p2 == 'B' || *p2 == 'C' || *p2 == 'D' - || *p2 == 'G' || *p2 == 'H' || *p2 == 'J' - || *p2 == 'K' || *p2 == 'M' || *p2 == 'N' - || *p2 == 'P' || *p2 == 'R' || *p2 == 'S' - || *p2 == 'T')) - p2++; - p3 = p2; - while (p3 < ptr - && (*p3 == 'A' || *p3 == 'E' || *p3 == 'I' - || *p3 == 'O' || *p3 == 'U' || *p3 == 'W' - || *p3 == 'Y')) - p3++; - p4 = p3; - while (p4 < ptr - && (*p4 == 'B' || *p4 == 'C' || *p4 == 'D' - || *p4 == 'G' || *p4 == 'H' || *p4 == 'I' - || *p4 == 'J' || *p4 == 'K' || *p4 == 'L' - || *p4 == 'M' || *p4 == 'N' || *p4 == 'P' - || *p4 == 'S' || *p4 == 'T')) - p4++; - if (p4 == ptr) - { - unsigned int n1 = p2 - p1; - unsigned int n2 = p3 - p2; - unsigned int n3 = p4 - p3; - - if (n1 <= 2 && (n2 >= 1 && n2 <= 3) && n3 <= 2) - { - unsigned int index1; - - for (index1 = 0; index1 < 19; index1++) - if (memcmp(jamo_initial_short_name[index1], p1, n1) == 0 - && jamo_initial_short_name[index1][n1] == '\0') - { - unsigned int index2; - - for (index2 = 0; index2 < 21; index2++) - if (memcmp(jamo_medial_short_name[index2], p2, n2) == 0 - && jamo_medial_short_name[index2][n2] == '\0') - { - unsigned int index3; - - for (index3 = 0; index3 < 28; index3++) - if (memcmp(jamo_final_short_name[index3], p3, n3) == 0 - && jamo_final_short_name[index3][n3] == '\0') - { - return 0xAC00 + (index1 * 21 + index2) * 28 + index3; - } - break; - } - break; - } - } - } - } - /* Special case for CJK compatibility ideographs. Keeps the - tables small. */ - if (wordptr == &words[2] - && words[0] == UNICODE_CHARNAME_WORD_CJK - && words[1] == UNICODE_CHARNAME_WORD_COMPATIBILITY - && p1 + 14 <= ptr - && p1 + 15 >= ptr - && memcmp (p1, "IDEOGRAPH-", 10) == 0) - { - const char *p2 = p1 + 10; - - if (*p2 != '0') - { - unsigned int c = 0; - - for (;;) - { - if (*p2 >= '0' && *p2 <= '9') - c += (*p2 - '0'); - else if (*p2 >= 'A' && *p2 <= 'F') - c += (*p2 - 'A' + 10); - else - break; - p2++; - if (p2 == ptr) - { - if ((c >= 0xF900 && c <= 0xFA2D) - || (c >= 0xFA30 && c <= 0xFA6A) - || (c >= 0xFA70 && c <= 0xFAD9) - || (c >= 0x2F800 && c <= 0x2FA1D)) - return c; - else - break; - } - c = c << 4; - } - } - } - } - } - if (false) - filled_words: - { - /* Multiply by 2, to simplify later comparisons. */ - unsigned int words_length = wordptr - words; - { - int i = words_length - 1; - words[i] = 2 * words[i]; - for (; --i >= 0; ) - words[i] = 2 * words[i] + 1; - } - /* Binary search in unicode_name_to_code. */ - { - unsigned int i1 = 0; - unsigned int i2 = SIZEOF (unicode_name_to_code); - for (;;) - { - unsigned int i = (i1 + i2) >> 1; - const uint16_t *w = words; - const uint16_t *p = &unicode_names[unicode_name_to_code[i].name]; - unsigned int n = words_length; - for (;;) - { - if (*p < *w) - { - if (i1 == i) - goto name_not_found; - /* Note here: i1 < i < i2. */ - i1 = i; - break; - } - else if (*p > *w) - { - if (i2 == i) - goto name_not_found; - /* Note here: i1 <= i < i2. */ - i2 = i; - break; - } - p++; w++; n--; - if (n == 0) - { - unsigned int c = unicode_name_to_code[i].code; - - /* Undo the transformation to 16-bit space. */ - static const unsigned int offset[13] = - { - 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, - 0x05000, 0x09000, 0x09000, 0x0A000, 0x14000, - 0x15000, 0x24000, 0xD4000 - }; - return c + offset[c >> 12]; - } - } - } - } - name_not_found: ; - } - } + { + /* Convert the constituents to uint16_t words. */ + uint16_t words[UNICODE_CHARNAME_MAX_WORDS]; + uint16_t *wordptr = words; + { + const char *p1 = buf; + for (;;) + { + { + int word; + const char *p2 = p1; + while (p2 < ptr && *p2 != ' ') + p2++; + word = unicode_name_word_lookup (p1, p2 - p1); + if (word < 0) + break; + if (wordptr == &words[UNICODE_CHARNAME_MAX_WORDS]) + break; + *wordptr++ = word; + if (p2 == ptr) + goto filled_words; + p1 = p2 + 1; + } + /* Special case for Hangul syllables. Keeps the tables small. */ + if (wordptr == &words[2] + && words[0] == UNICODE_CHARNAME_WORD_HANGUL + && words[1] == UNICODE_CHARNAME_WORD_SYLLABLE) + { + /* Split the last word [p1..ptr) into three parts: + 1) [BCDGHJKMNPRST] + 2) [AEIOUWY] + 3) [BCDGHIJKLMNPST] + */ + const char *p2; + const char *p3; + const char *p4; + + p2 = p1; + while (p2 < ptr + && (*p2 == 'B' || *p2 == 'C' || *p2 == 'D' + || *p2 == 'G' || *p2 == 'H' || *p2 == 'J' + || *p2 == 'K' || *p2 == 'M' || *p2 == 'N' + || *p2 == 'P' || *p2 == 'R' || *p2 == 'S' + || *p2 == 'T')) + p2++; + p3 = p2; + while (p3 < ptr + && (*p3 == 'A' || *p3 == 'E' || *p3 == 'I' + || *p3 == 'O' || *p3 == 'U' || *p3 == 'W' + || *p3 == 'Y')) + p3++; + p4 = p3; + while (p4 < ptr + && (*p4 == 'B' || *p4 == 'C' || *p4 == 'D' + || *p4 == 'G' || *p4 == 'H' || *p4 == 'I' + || *p4 == 'J' || *p4 == 'K' || *p4 == 'L' + || *p4 == 'M' || *p4 == 'N' || *p4 == 'P' + || *p4 == 'S' || *p4 == 'T')) + p4++; + if (p4 == ptr) + { + unsigned int n1 = p2 - p1; + unsigned int n2 = p3 - p2; + unsigned int n3 = p4 - p3; + + if (n1 <= 2 && (n2 >= 1 && n2 <= 3) && n3 <= 2) + { + unsigned int index1; + + for (index1 = 0; index1 < 19; index1++) + if (memcmp (jamo_initial_short_name[index1], p1, n1) == 0 + && jamo_initial_short_name[index1][n1] == '\0') + { + unsigned int index2; + + for (index2 = 0; index2 < 21; index2++) + if (memcmp (jamo_medial_short_name[index2], p2, n2) == 0 + && jamo_medial_short_name[index2][n2] == '\0') + { + unsigned int index3; + + for (index3 = 0; index3 < 28; index3++) + if (memcmp (jamo_final_short_name[index3], p3, n3) == 0 + && jamo_final_short_name[index3][n3] == '\0') + { + return 0xAC00 + (index1 * 21 + index2) * 28 + index3; + } + break; + } + break; + } + } + } + } + /* Special case for CJK compatibility ideographs. Keeps the + tables small. */ + if (wordptr == &words[2] + && words[0] == UNICODE_CHARNAME_WORD_CJK + && words[1] == UNICODE_CHARNAME_WORD_COMPATIBILITY + && p1 + 14 <= ptr + && p1 + 15 >= ptr + && memcmp (p1, "IDEOGRAPH-", 10) == 0) + { + const char *p2 = p1 + 10; + + if (*p2 != '0') + { + unsigned int c = 0; + + for (;;) + { + if (*p2 >= '0' && *p2 <= '9') + c += (*p2 - '0'); + else if (*p2 >= 'A' && *p2 <= 'F') + c += (*p2 - 'A' + 10); + else + break; + p2++; + if (p2 == ptr) + { + if ((c >= 0xF900 && c <= 0xFA2D) + || (c >= 0xFA30 && c <= 0xFA6A) + || (c >= 0xFA70 && c <= 0xFAD9) + || (c >= 0x2F800 && c <= 0x2FA1D)) + return c; + else + break; + } + c = c << 4; + } + } + } + } + } + if (false) + filled_words: + { + /* Multiply by 2, to simplify later comparisons. */ + unsigned int words_length = wordptr - words; + { + int i = words_length - 1; + words[i] = 2 * words[i]; + for (; --i >= 0; ) + words[i] = 2 * words[i] + 1; + } + /* Binary search in unicode_name_to_code. */ + { + unsigned int i1 = 0; + unsigned int i2 = SIZEOF (unicode_name_to_code); + for (;;) + { + unsigned int i = (i1 + i2) >> 1; + const uint16_t *w = words; + const uint16_t *p = &unicode_names[unicode_name_to_code[i].name]; + unsigned int n = words_length; + for (;;) + { + if (*p < *w) + { + if (i1 == i) + goto name_not_found; + /* Note here: i1 < i < i2. */ + i1 = i; + break; + } + else if (*p > *w) + { + if (i2 == i) + goto name_not_found; + /* Note here: i1 <= i < i2. */ + i2 = i; + break; + } + p++; w++; n--; + if (n == 0) + { + unsigned int c = unicode_name_to_code[i].code; + + /* Undo the transformation to 16-bit space. */ + static const unsigned int offset[13] = + { + 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, + 0x05000, 0x09000, 0x09000, 0x0A000, 0x14000, + 0x15000, 0x24000, 0xD4000 + }; + return c + offset[c >> 12]; + } + } + } + } + name_not_found: ; + } + } } return UNINAME_INVALID; } diff --git a/lib/uninorm.h b/lib/uninorm.h index 6850967..5fdcc22 100644 --- a/lib/uninorm.h +++ b/lib/uninorm.h @@ -1,5 +1,5 @@ /* Normalization forms (composition and decomposition) of Unicode strings. - Copyright (C) 2001-2002, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -143,13 +143,13 @@ extern uninorm_t uninorm_decomposing_form (uninorm_t nf); /* Return the specified normalization form of a string. */ extern uint8_t * u8_normalize (uninorm_t nf, const uint8_t *s, size_t n, - uint8_t *resultbuf, size_t *lengthp); + uint8_t *resultbuf, size_t *lengthp); extern uint16_t * u16_normalize (uninorm_t nf, const uint16_t *s, size_t n, - uint16_t *resultbuf, size_t *lengthp); + uint16_t *resultbuf, size_t *lengthp); extern uint32_t * u32_normalize (uninorm_t nf, const uint32_t *s, size_t n, - uint32_t *resultbuf, size_t *lengthp); + uint32_t *resultbuf, size_t *lengthp); /* Compare S1 and S2, ignoring differences in normalization. @@ -158,13 +158,13 @@ extern uint32_t * return 0. Upon failure, return -1 with errno set. */ extern int u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, - uninorm_t nf, int *resultp); + uninorm_t nf, int *resultp); extern int u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, - uninorm_t nf, int *resultp); + uninorm_t nf, int *resultp); extern int u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, - uninorm_t nf, int *resultp); + uninorm_t nf, int *resultp); /* Converts the string S of length N to a NUL-terminated byte sequence, in such @@ -173,13 +173,13 @@ extern int NF must be either UNINORM_NFC or UNINORM_NFKC. */ extern char * u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, - char *resultbuf, size_t *lengthp); + char *resultbuf, size_t *lengthp); extern char * u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, - char *resultbuf, size_t *lengthp); + char *resultbuf, size_t *lengthp); extern char * u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, - char *resultbuf, size_t *lengthp); + char *resultbuf, size_t *lengthp); /* Compare S1 and S2, ignoring differences in normalization, using the @@ -189,13 +189,13 @@ extern char * return 0. Upon failure, return -1 with errno set. */ extern int u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, - uninorm_t nf, int *resultp); + uninorm_t nf, int *resultp); extern int u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, - uninorm_t nf, int *resultp); + uninorm_t nf, int *resultp); extern int u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, - uninorm_t nf, int *resultp); + uninorm_t nf, int *resultp); /* Normalization of a stream of Unicode characters. @@ -216,8 +216,8 @@ struct uninorm_filter; Return the new filter, or NULL with errno set upon failure. */ extern struct uninorm_filter * uninorm_filter_create (uninorm_t nf, - int (*stream_func) (void *stream_data, ucs4_t uc), - void *stream_data); + int (*stream_func) (void *stream_data, ucs4_t uc), + void *stream_data); /* Stuff a Unicode character into a normalizing filter. Return 0 if successful, or -1 with errno set upon failure. */ diff --git a/lib/uninorm/canonical-decomposition.c b/lib/uninorm/canonical-decomposition.c index 210b74b..e6e39e0 100644 --- a/lib/uninorm/canonical-decomposition.c +++ b/lib/uninorm/canonical-decomposition.c @@ -1,5 +1,5 @@ /* Canonical decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -31,77 +31,77 @@ uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition) { /* Hangul syllable. See Unicode standard, chapter 3, section "Hangul Syllable Decomposition", See also the clarification at - <http://www.unicode.org/versions/Unicode5.1.0/>, section - "Clarification of Hangul Jamo Handling". */ + <http://www.unicode.org/versions/Unicode5.1.0/>, section + "Clarification of Hangul Jamo Handling". */ unsigned int t; uc -= 0xAC00; t = uc % 28; if (t == 0) - { - unsigned int v, l; + { + unsigned int v, l; - uc = uc / 28; - v = uc % 21; - l = uc / 21; + uc = uc / 28; + v = uc % 21; + l = uc / 21; - decomposition[0] = 0x1100 + l; - decomposition[1] = 0x1161 + v; - return 2; - } + decomposition[0] = 0x1100 + l; + decomposition[1] = 0x1161 + v; + return 2; + } else - { + { #if 1 /* Return the pairwise decomposition, not the full decomposition. */ - decomposition[0] = 0xAC00 + uc - t; /* = 0xAC00 + (l * 21 + v) * 28; */ - decomposition[1] = 0x11A7 + t; - return 2; + decomposition[0] = 0xAC00 + uc - t; /* = 0xAC00 + (l * 21 + v) * 28; */ + decomposition[1] = 0x11A7 + t; + return 2; #else - unsigned int v, l; + unsigned int v, l; - uc = uc / 28; - v = uc % 21; - l = uc / 21; + uc = uc / 28; + v = uc % 21; + l = uc / 21; - decomposition[0] = 0x1100 + l; - decomposition[1] = 0x1161 + v; - decomposition[2] = 0x11A7 + t; - return 3; + decomposition[0] = 0x1100 + l; + decomposition[1] = 0x1161 + v; + decomposition[2] = 0x11A7 + t; + return 3; #endif - } + } } else if (uc < 0x110000) { unsigned short entry = decomp_index (uc); /* An entry of (unsigned short)(-1) denotes an absent entry. - Otherwise, bit 15 of the entry tells whether the decomposition - is a canonical one. */ + Otherwise, bit 15 of the entry tells whether the decomposition + is a canonical one. */ if (entry < 0x8000) - { - const unsigned char *p; - unsigned int element; - unsigned int length; - - p = &gl_uninorm_decomp_chars_table[3 * entry]; - element = (p[0] << 16) | (p[1] << 8) | p[2]; - /* The first element has 5 bits for the decomposition type. */ - if (((element >> 18) & 0x1f) != UC_DECOMP_CANONICAL) - abort (); - length = 1; - for (;;) - { - /* Every element has an 18 bits wide Unicode code point. */ - *decomposition = element & 0x3ffff; - /* Bit 23 tells whether there are more elements, */ - if ((element & (1 << 23)) == 0) - break; - p += 3; - element = (p[0] << 16) | (p[1] << 8) | p[2]; - decomposition++; - length++; - } - return length; - } + { + const unsigned char *p; + unsigned int element; + unsigned int length; + + p = &gl_uninorm_decomp_chars_table[3 * entry]; + element = (p[0] << 16) | (p[1] << 8) | p[2]; + /* The first element has 5 bits for the decomposition type. */ + if (((element >> 18) & 0x1f) != UC_DECOMP_CANONICAL) + abort (); + length = 1; + for (;;) + { + /* Every element has an 18 bits wide Unicode code point. */ + *decomposition = element & 0x3ffff; + /* Bit 23 tells whether there are more elements, */ + if ((element & (1 << 23)) == 0) + break; + p += 3; + element = (p[0] << 16) | (p[1] << 8) | p[2]; + decomposition++; + length++; + } + return length; + } } return -1; } diff --git a/lib/uninorm/compat-decomposition.c b/lib/uninorm/compat-decomposition.c index 19ec87e..740cc5c 100644 --- a/lib/uninorm/compat-decomposition.c +++ b/lib/uninorm/compat-decomposition.c @@ -1,5 +1,5 @@ /* Compatibility decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/composition-table.gperf b/lib/uninorm/composition-table.gperf index f7f0feb..4651725 100644 --- a/lib/uninorm/composition-table.gperf +++ b/lib/uninorm/composition-table.gperf @@ -2,7 +2,7 @@ /* Canonical composition of Unicode characters. */ /* Generated automatically by gen-uni-tables for Unicode 5.1.0. */ -/* Copyright (C) 2009 Free Software Foundation, Inc. +/* Copyright (C) 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/uninorm/composition.c b/lib/uninorm/composition.c index 4caf9a0..c9cddbe 100644 --- a/lib/uninorm/composition.c +++ b/lib/uninorm/composition.c @@ -1,5 +1,5 @@ /* Canonical composition of Unicode characters. - Copyright (C) 2002, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -32,54 +32,54 @@ uc_composition (ucs4_t uc1, ucs4_t uc2) if (uc1 < 0x10000 && uc2 < 0x10000) { if (uc2 >= 0x1161 && uc2 < 0x1161 + 21 - && uc1 >= 0x1100 && uc1 < 0x1100 + 19) - { - /* Hangul: Combine single letter L and single letter V to form - two-letter syllable LV. */ - return 0xAC00 + ((uc1 - 0x1100) * 21 + (uc2 - 0x1161)) * 28; - } + && uc1 >= 0x1100 && uc1 < 0x1100 + 19) + { + /* Hangul: Combine single letter L and single letter V to form + two-letter syllable LV. */ + return 0xAC00 + ((uc1 - 0x1100) * 21 + (uc2 - 0x1161)) * 28; + } else if (uc2 > 0x11A7 && uc2 < 0x11A7 + 28 - && uc1 >= 0xAC00 && uc1 < 0xD7A4 && ((uc1 - 0xAC00) % 28) == 0) - { - /* Hangul: Combine two-letter syllable LV with single-letter T - to form three-letter syllable LVT. */ - return uc1 + (uc2 - 0x11A7); - } + && uc1 >= 0xAC00 && uc1 < 0xD7A4 && ((uc1 - 0xAC00) % 28) == 0) + { + /* Hangul: Combine two-letter syllable LV with single-letter T + to form three-letter syllable LVT. */ + return uc1 + (uc2 - 0x11A7); + } else - { + { #if 0 - unsigned int uc = MUL1 * uc1 * MUL2 * uc2; - unsigned int index1 = uc >> composition_header_0; - if (index1 < composition_header_1) - { - int lookup1 = u_composition.level1[index1]; - if (lookup1 >= 0) - { - unsigned int index2 = (uc >> composition_header_2) & composition_header_3; - int lookup2 = u_composition.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = (uc & composition_header_4); - unsigned int lookup3 = u_composition.level3[lookup2 + index3]; - if ((lookup3 >> 16) == uc2) - return lookup3 & ((1U << 16) - 1); - } - } - } + unsigned int uc = MUL1 * uc1 * MUL2 * uc2; + unsigned int index1 = uc >> composition_header_0; + if (index1 < composition_header_1) + { + int lookup1 = u_composition.level1[index1]; + if (lookup1 >= 0) + { + unsigned int index2 = (uc >> composition_header_2) & composition_header_3; + int lookup2 = u_composition.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & composition_header_4); + unsigned int lookup3 = u_composition.level3[lookup2 + index3]; + if ((lookup3 >> 16) == uc2) + return lookup3 & ((1U << 16) - 1); + } + } + } #else - char codes[4]; - const struct composition_rule *rule; + char codes[4]; + const struct composition_rule *rule; - codes[0] = (uc1 >> 8) & 0xff; - codes[1] = uc1 & 0xff; - codes[2] = (uc2 >> 8) & 0xff; - codes[3] = uc2 & 0xff; + codes[0] = (uc1 >> 8) & 0xff; + codes[1] = uc1 & 0xff; + codes[2] = (uc2 >> 8) & 0xff; + codes[3] = uc2 & 0xff; - rule = gl_uninorm_compose_lookup (codes, 4); - if (rule != NULL) - return rule->combined; + rule = gl_uninorm_compose_lookup (codes, 4); + if (rule != NULL) + return rule->combined; #endif - } + } } return 0; } diff --git a/lib/uninorm/decompose-internal.c b/lib/uninorm/decompose-internal.c index 53b745d..f9c2277 100644 --- a/lib/uninorm/decompose-internal.c +++ b/lib/uninorm/decompose-internal.c @@ -1,5 +1,5 @@ /* Decomposition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/decompose-internal.h b/lib/uninorm/decompose-internal.h index c1bf125..d952e2f 100644 --- a/lib/uninorm/decompose-internal.h +++ b/lib/uninorm/decompose-internal.h @@ -1,5 +1,5 @@ /* Decomposition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -27,10 +27,10 @@ extern int struct ucs4_with_ccc { ucs4_t code; - int ccc; /* range 0..255 */ + int ccc; /* range 0..255 */ }; /* Stable-sort an array of 'struct ucs4_with_ccc'. */ extern void gl_uninorm_decompose_merge_sort_inplace (struct ucs4_with_ccc *src, size_t n, - struct ucs4_with_ccc *tmp); + struct ucs4_with_ccc *tmp); diff --git a/lib/uninorm/decomposing-form.c b/lib/uninorm/decomposing-form.c index 3b49cb8..a19f6d3 100644 --- a/lib/uninorm/decomposing-form.c +++ b/lib/uninorm/decomposing-form.c @@ -1,5 +1,5 @@ /* Decomposing variant of a normalization form. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/decomposition-table.c b/lib/uninorm/decomposition-table.c index 63f6442..b19b47a 100644 --- a/lib/uninorm/decomposition-table.c +++ b/lib/uninorm/decomposition-table.c @@ -1,5 +1,5 @@ /* Decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/decomposition-table.h b/lib/uninorm/decomposition-table.h index ad0e1a3..9238ff9 100644 --- a/lib/uninorm/decomposition-table.h +++ b/lib/uninorm/decomposition-table.h @@ -1,5 +1,5 @@ /* Decomposition of Unicode characters. - Copyright (C) 2001-2003, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -34,15 +34,15 @@ decomp_index (ucs4_t uc) { int lookup1 = gl_uninorm_decomp_index_table.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> decomp_header_2) & decomp_header_3; - int lookup2 = gl_uninorm_decomp_index_table.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = uc & decomp_header_4; - return gl_uninorm_decomp_index_table.level3[lookup2 + index3]; - } - } + { + unsigned int index2 = (uc >> decomp_header_2) & decomp_header_3; + int lookup2 = gl_uninorm_decomp_index_table.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = uc & decomp_header_4; + return gl_uninorm_decomp_index_table.level3[lookup2 + index3]; + } + } } return (unsigned short)(-1); } diff --git a/lib/uninorm/decomposition.c b/lib/uninorm/decomposition.c index af03018..a29e105 100644 --- a/lib/uninorm/decomposition.c +++ b/lib/uninorm/decomposition.c @@ -1,5 +1,5 @@ /* Decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -29,8 +29,8 @@ uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition) { /* Hangul syllable. See Unicode standard, chapter 3, section "Hangul Syllable Decomposition", See also the clarification at - <http://www.unicode.org/versions/Unicode5.1.0/>, section - "Clarification of Hangul Jamo Handling". */ + <http://www.unicode.org/versions/Unicode5.1.0/>, section + "Clarification of Hangul Jamo Handling". */ unsigned int t; uc -= 0xAC00; @@ -38,65 +38,65 @@ uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition) *decomp_tag = UC_DECOMP_CANONICAL; if (t == 0) - { - unsigned int v, l; + { + unsigned int v, l; - uc = uc / 28; - v = uc % 21; - l = uc / 21; + uc = uc / 28; + v = uc % 21; + l = uc / 21; - decomposition[0] = 0x1100 + l; - decomposition[1] = 0x1161 + v; - return 2; - } + decomposition[0] = 0x1100 + l; + decomposition[1] = 0x1161 + v; + return 2; + } else - { + { #if 1 /* Return the pairwise decomposition, not the full decomposition. */ - decomposition[0] = 0xAC00 + uc - t; /* = 0xAC00 + (l * 21 + v) * 28; */ - decomposition[1] = 0x11A7 + t; - return 2; + decomposition[0] = 0xAC00 + uc - t; /* = 0xAC00 + (l * 21 + v) * 28; */ + decomposition[1] = 0x11A7 + t; + return 2; #else - unsigned int v, l; + unsigned int v, l; - uc = uc / 28; - v = uc % 21; - l = uc / 21; + uc = uc / 28; + v = uc % 21; + l = uc / 21; - decomposition[0] = 0x1100 + l; - decomposition[1] = 0x1161 + v; - decomposition[2] = 0x11A7 + t; - return 3; + decomposition[0] = 0x1100 + l; + decomposition[1] = 0x1161 + v; + decomposition[2] = 0x11A7 + t; + return 3; #endif - } + } } else if (uc < 0x110000) { unsigned short entry = decomp_index (uc); if (entry != (unsigned short)(-1)) - { - const unsigned char *p; - unsigned int element; - unsigned int length; + { + const unsigned char *p; + unsigned int element; + unsigned int length; - p = &gl_uninorm_decomp_chars_table[3 * (entry & 0x7FFF)]; - element = (p[0] << 16) | (p[1] << 8) | p[2]; - /* The first element has 5 bits for the decomposition type. */ - *decomp_tag = (element >> 18) & 0x1f; - length = 1; - for (;;) - { - /* Every element has an 18 bits wide Unicode code point. */ - *decomposition = element & 0x3ffff; - /* Bit 23 tells whether there are more elements, */ - if ((element & (1 << 23)) == 0) - break; - p += 3; - element = (p[0] << 16) | (p[1] << 8) | p[2]; - decomposition++; - length++; - } - return length; - } + p = &gl_uninorm_decomp_chars_table[3 * (entry & 0x7FFF)]; + element = (p[0] << 16) | (p[1] << 8) | p[2]; + /* The first element has 5 bits for the decomposition type. */ + *decomp_tag = (element >> 18) & 0x1f; + length = 1; + for (;;) + { + /* Every element has an 18 bits wide Unicode code point. */ + *decomposition = element & 0x3ffff; + /* Bit 23 tells whether there are more elements, */ + if ((element & (1 << 23)) == 0) + break; + p += 3; + element = (p[0] << 16) | (p[1] << 8) | p[2]; + decomposition++; + length++; + } + return length; + } } return -1; } diff --git a/lib/uninorm/nfc.c b/lib/uninorm/nfc.c index c205b16..ecc1aba 100644 --- a/lib/uninorm/nfc.c +++ b/lib/uninorm/nfc.c @@ -1,5 +1,5 @@ /* Unicode Normalization Form C. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/nfd.c b/lib/uninorm/nfd.c index 54c98bc..1e7194d 100644 --- a/lib/uninorm/nfd.c +++ b/lib/uninorm/nfd.c @@ -1,5 +1,5 @@ /* Unicode Normalization Form D. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/nfkc.c b/lib/uninorm/nfkc.c index 1fb52f1..fdd05ac 100644 --- a/lib/uninorm/nfkc.c +++ b/lib/uninorm/nfkc.c @@ -1,5 +1,5 @@ /* Unicode Normalization Form KC. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/nfkd.c b/lib/uninorm/nfkd.c index 871dd64..cff0df2 100644 --- a/lib/uninorm/nfkd.c +++ b/lib/uninorm/nfkd.c @@ -1,5 +1,5 @@ /* Unicode Normalization Form KD. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/normalize-internal.h b/lib/uninorm/normalize-internal.h index 0b346c6..f4c8c8e 100644 --- a/lib/uninorm/normalize-internal.h +++ b/lib/uninorm/normalize-internal.h @@ -1,5 +1,5 @@ /* Normalization of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u-normalize-internal.h b/lib/uninorm/u-normalize-internal.h index 70c3255..43b7ec3 100644 --- a/lib/uninorm/u-normalize-internal.h +++ b/lib/uninorm/u-normalize-internal.h @@ -1,5 +1,5 @@ /* Decomposition and composition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -56,293 +56,293 @@ FUNC (uninorm_t nf, const UNIT *s, size_t n, for (;;) { - int count; - ucs4_t decomposed[UC_DECOMPOSITION_MAX_LENGTH]; - int decomposed_count; - int i; - - if (s < s_end) - { - /* Fetch the next character. */ - count = U_MBTOUC_UNSAFE (&decomposed[0], s, s_end - s); - decomposed_count = 1; - - /* Decompose it, recursively. - It would be possible to precompute the recursive decomposition - and store it in a table. But this would significantly increase - the size of the decomposition tables, because for example for - U+1FC1 the recursive canonical decomposition and the recursive - compatibility decomposition are different. */ - { - int curr; - - for (curr = 0; curr < decomposed_count; ) - { - /* Invariant: decomposed[0..curr-1] is fully decomposed, i.e. - all elements are atomic. */ - ucs4_t curr_decomposed[UC_DECOMPOSITION_MAX_LENGTH]; - int curr_decomposed_count; - - curr_decomposed_count = decomposer (decomposed[curr], curr_decomposed); - if (curr_decomposed_count >= 0) - { - /* Move curr_decomposed[0..curr_decomposed_count-1] over - decomposed[curr], making room. It's not worth using - memcpy() here, since the counts are so small. */ - int shift = curr_decomposed_count - 1; - - if (shift < 0) - abort (); - if (shift > 0) - { - int j; - - decomposed_count += shift; - if (decomposed_count > UC_DECOMPOSITION_MAX_LENGTH) - abort (); - for (j = decomposed_count - 1 - shift; j > curr; j--) - decomposed[j + shift] = decomposed[j]; - } - for (; shift >= 0; shift--) - decomposed[curr + shift] = curr_decomposed[shift]; - } - else - { - /* decomposed[curr] is atomic. */ - curr++; - } - } - } - } - else - { - count = 0; - decomposed_count = 0; - } - - i = 0; - for (;;) - { - ucs4_t uc; - int ccc; - - if (s < s_end) - { - /* Fetch the next character from the decomposition. */ - if (i == decomposed_count) - break; - uc = decomposed[i]; - ccc = uc_combining_class (uc); - } - else - { - /* End of string reached. */ - uc = 0; - ccc = 0; - } - - if (ccc == 0) - { - size_t j; - - /* Apply the canonical ordering algorithm to the accumulated - sequence of characters. */ - if (sortbuf_count > 1) - gl_uninorm_decompose_merge_sort_inplace (sortbuf, sortbuf_count, - sortbuf + sortbuf_count); - - if (composer != NULL) - { - /* Attempt to combine decomposed characters, as specified - in the Unicode Standard Annex #15 "Unicode Normalization - Forms". We need to check - 1. whether the first accumulated character is a - "starter" (i.e. has ccc = 0). This is usually the - case. But when the string starts with a - non-starter, the sortbuf also starts with a - non-starter. Btw, this check could also be - omitted, because the composition table has only - entries (code1, code2) for which code1 is a - starter; if the first accumulated character is not - a starter, no lookup will succeed. - 2. If the sortbuf has more than one character, check - for each of these characters that are not "blocked" - from the starter (i.e. have a ccc that is higher - than the ccc of the previous character) whether it - can be combined with the first character. - 3. If only one character is left in sortbuf, check - whether it can be combined with the next character - (also a starter). */ - if (sortbuf_count > 0 && sortbuf[0].ccc == 0) - { - for (j = 1; j < sortbuf_count; ) - { - if (sortbuf[j].ccc > sortbuf[j - 1].ccc) - { - ucs4_t combined = - composer (sortbuf[0].code, sortbuf[j].code); - if (combined) - { - size_t k; - - sortbuf[0].code = combined; - /* sortbuf[0].ccc = 0, still valid. */ - for (k = j + 1; k < sortbuf_count; k++) - sortbuf[k - 1] = sortbuf[k]; - sortbuf_count--; - continue; - } - } - j++; - } - if (s < s_end && sortbuf_count == 1) - { - ucs4_t combined = - composer (sortbuf[0].code, uc); - if (combined) - { - uc = combined; - ccc = 0; - /* uc could be further combined with subsequent - characters. So don't put it into sortbuf[0] in - this round, only in the next round. */ - sortbuf_count = 0; - } - } - } - } - - for (j = 0; j < sortbuf_count; j++) - { - ucs4_t muc = sortbuf[j].code; - - /* Append muc to the result accumulator. */ - if (length < allocated) - { - int ret = - U_UCTOMB (result + length, muc, allocated - length); - if (ret == -1) - { - errno = EINVAL; - goto fail; - } - if (ret >= 0) - { - length += ret; - goto done_appending; - } - } - { - size_t old_allocated = allocated; - size_t new_allocated = 2 * old_allocated; - if (new_allocated < 64) - new_allocated = 64; - if (new_allocated < old_allocated) /* integer overflow? */ - abort (); - { - UNIT *larger_result; - if (result == NULL) - { - larger_result = - (UNIT *) malloc (new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail; - } - } - else if (result == resultbuf) - { - larger_result = - (UNIT *) malloc (new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail; - } - U_CPY (larger_result, resultbuf, length); - } - else - { - larger_result = - (UNIT *) realloc (result, new_allocated * sizeof (UNIT)); - if (larger_result == NULL) - { - errno = ENOMEM; - goto fail; - } - } - result = larger_result; - allocated = new_allocated; - { - int ret = - U_UCTOMB (result + length, muc, allocated - length); - if (ret == -1) - { - errno = EINVAL; - goto fail; - } - if (ret < 0) - abort (); - length += ret; - goto done_appending; - } - } - } - done_appending: ; - } - - /* sortbuf is now empty. */ - sortbuf_count = 0; - } - - if (!(s < s_end)) - /* End of string reached. */ - break; - - /* Append (uc, ccc) to sortbuf. */ - if (sortbuf_count == sortbuf_allocated) - { - struct ucs4_with_ccc *new_sortbuf; - - sortbuf_allocated = 2 * sortbuf_allocated; - if (sortbuf_allocated < sortbuf_count) /* integer overflow? */ - abort (); - new_sortbuf = - (struct ucs4_with_ccc *) malloc (2 * sortbuf_allocated * sizeof (struct ucs4_with_ccc)); - memcpy (new_sortbuf, sortbuf, - sortbuf_count * sizeof (struct ucs4_with_ccc)); - if (sortbuf != sortbuf_preallocated) - free (sortbuf); - sortbuf = new_sortbuf; - } - sortbuf[sortbuf_count].code = uc; - sortbuf[sortbuf_count].ccc = ccc; - sortbuf_count++; - - i++; - } - - if (!(s < s_end)) - /* End of string reached. */ - break; - - s += count; + int count; + ucs4_t decomposed[UC_DECOMPOSITION_MAX_LENGTH]; + int decomposed_count; + int i; + + if (s < s_end) + { + /* Fetch the next character. */ + count = U_MBTOUC_UNSAFE (&decomposed[0], s, s_end - s); + decomposed_count = 1; + + /* Decompose it, recursively. + It would be possible to precompute the recursive decomposition + and store it in a table. But this would significantly increase + the size of the decomposition tables, because for example for + U+1FC1 the recursive canonical decomposition and the recursive + compatibility decomposition are different. */ + { + int curr; + + for (curr = 0; curr < decomposed_count; ) + { + /* Invariant: decomposed[0..curr-1] is fully decomposed, i.e. + all elements are atomic. */ + ucs4_t curr_decomposed[UC_DECOMPOSITION_MAX_LENGTH]; + int curr_decomposed_count; + + curr_decomposed_count = decomposer (decomposed[curr], curr_decomposed); + if (curr_decomposed_count >= 0) + { + /* Move curr_decomposed[0..curr_decomposed_count-1] over + decomposed[curr], making room. It's not worth using + memcpy() here, since the counts are so small. */ + int shift = curr_decomposed_count - 1; + + if (shift < 0) + abort (); + if (shift > 0) + { + int j; + + decomposed_count += shift; + if (decomposed_count > UC_DECOMPOSITION_MAX_LENGTH) + abort (); + for (j = decomposed_count - 1 - shift; j > curr; j--) + decomposed[j + shift] = decomposed[j]; + } + for (; shift >= 0; shift--) + decomposed[curr + shift] = curr_decomposed[shift]; + } + else + { + /* decomposed[curr] is atomic. */ + curr++; + } + } + } + } + else + { + count = 0; + decomposed_count = 0; + } + + i = 0; + for (;;) + { + ucs4_t uc; + int ccc; + + if (s < s_end) + { + /* Fetch the next character from the decomposition. */ + if (i == decomposed_count) + break; + uc = decomposed[i]; + ccc = uc_combining_class (uc); + } + else + { + /* End of string reached. */ + uc = 0; + ccc = 0; + } + + if (ccc == 0) + { + size_t j; + + /* Apply the canonical ordering algorithm to the accumulated + sequence of characters. */ + if (sortbuf_count > 1) + gl_uninorm_decompose_merge_sort_inplace (sortbuf, sortbuf_count, + sortbuf + sortbuf_count); + + if (composer != NULL) + { + /* Attempt to combine decomposed characters, as specified + in the Unicode Standard Annex #15 "Unicode Normalization + Forms". We need to check + 1. whether the first accumulated character is a + "starter" (i.e. has ccc = 0). This is usually the + case. But when the string starts with a + non-starter, the sortbuf also starts with a + non-starter. Btw, this check could also be + omitted, because the composition table has only + entries (code1, code2) for which code1 is a + starter; if the first accumulated character is not + a starter, no lookup will succeed. + 2. If the sortbuf has more than one character, check + for each of these characters that are not "blocked" + from the starter (i.e. have a ccc that is higher + than the ccc of the previous character) whether it + can be combined with the first character. + 3. If only one character is left in sortbuf, check + whether it can be combined with the next character + (also a starter). */ + if (sortbuf_count > 0 && sortbuf[0].ccc == 0) + { + for (j = 1; j < sortbuf_count; ) + { + if (sortbuf[j].ccc > sortbuf[j - 1].ccc) + { + ucs4_t combined = + composer (sortbuf[0].code, sortbuf[j].code); + if (combined) + { + size_t k; + + sortbuf[0].code = combined; + /* sortbuf[0].ccc = 0, still valid. */ + for (k = j + 1; k < sortbuf_count; k++) + sortbuf[k - 1] = sortbuf[k]; + sortbuf_count--; + continue; + } + } + j++; + } + if (s < s_end && sortbuf_count == 1) + { + ucs4_t combined = + composer (sortbuf[0].code, uc); + if (combined) + { + uc = combined; + ccc = 0; + /* uc could be further combined with subsequent + characters. So don't put it into sortbuf[0] in + this round, only in the next round. */ + sortbuf_count = 0; + } + } + } + } + + for (j = 0; j < sortbuf_count; j++) + { + ucs4_t muc = sortbuf[j].code; + + /* Append muc to the result accumulator. */ + if (length < allocated) + { + int ret = + U_UCTOMB (result + length, muc, allocated - length); + if (ret == -1) + { + errno = EINVAL; + goto fail; + } + if (ret >= 0) + { + length += ret; + goto done_appending; + } + } + { + size_t old_allocated = allocated; + size_t new_allocated = 2 * old_allocated; + if (new_allocated < 64) + new_allocated = 64; + if (new_allocated < old_allocated) /* integer overflow? */ + abort (); + { + UNIT *larger_result; + if (result == NULL) + { + larger_result = + (UNIT *) malloc (new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail; + } + } + else if (result == resultbuf) + { + larger_result = + (UNIT *) malloc (new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail; + } + U_CPY (larger_result, resultbuf, length); + } + else + { + larger_result = + (UNIT *) realloc (result, new_allocated * sizeof (UNIT)); + if (larger_result == NULL) + { + errno = ENOMEM; + goto fail; + } + } + result = larger_result; + allocated = new_allocated; + { + int ret = + U_UCTOMB (result + length, muc, allocated - length); + if (ret == -1) + { + errno = EINVAL; + goto fail; + } + if (ret < 0) + abort (); + length += ret; + goto done_appending; + } + } + } + done_appending: ; + } + + /* sortbuf is now empty. */ + sortbuf_count = 0; + } + + if (!(s < s_end)) + /* End of string reached. */ + break; + + /* Append (uc, ccc) to sortbuf. */ + if (sortbuf_count == sortbuf_allocated) + { + struct ucs4_with_ccc *new_sortbuf; + + sortbuf_allocated = 2 * sortbuf_allocated; + if (sortbuf_allocated < sortbuf_count) /* integer overflow? */ + abort (); + new_sortbuf = + (struct ucs4_with_ccc *) malloc (2 * sortbuf_allocated * sizeof (struct ucs4_with_ccc)); + memcpy (new_sortbuf, sortbuf, + sortbuf_count * sizeof (struct ucs4_with_ccc)); + if (sortbuf != sortbuf_preallocated) + free (sortbuf); + sortbuf = new_sortbuf; + } + sortbuf[sortbuf_count].code = uc; + sortbuf[sortbuf_count].ccc = ccc; + sortbuf_count++; + + i++; + } + + if (!(s < s_end)) + /* End of string reached. */ + break; + + s += count; } } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - goto fail; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + goto fail; + } + } } else if (result != resultbuf && length < allocated) { @@ -351,7 +351,7 @@ FUNC (uninorm_t nf, const UNIT *s, size_t n, memory = (UNIT *) realloc (result, length * sizeof (UNIT)); if (memory != NULL) - result = memory; + result = memory; } if (sortbuf_count > 0) diff --git a/lib/uninorm/u-normcmp.h b/lib/uninorm/u-normcmp.h index 6616440..5cda5db 100644 --- a/lib/uninorm/u-normcmp.h +++ b/lib/uninorm/u-normcmp.h @@ -1,5 +1,5 @@ /* Normalization insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -40,11 +40,11 @@ FUNC (const UNIT *s1, size_t n1, const UNIT *s2, size_t n2, if (norms2 == NULL) { if (norms1 != buf1) - { - int saved_errno = errno; - free (norms1); - errno = saved_errno; - } + { + int saved_errno = errno; + free (norms1); + errno = saved_errno; + } return -1; } diff --git a/lib/uninorm/u-normcoll.h b/lib/uninorm/u-normcoll.h index e30880b..d76e725 100644 --- a/lib/uninorm/u-normcoll.h +++ b/lib/uninorm/u-normcoll.h @@ -1,5 +1,5 @@ /* Locale dependent, normalization insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -40,17 +40,17 @@ FUNC (const UNIT *s1, size_t n1, const UNIT *s2, size_t n2, if (transformed2 == NULL) { if (transformed1 != buf1) - { - int saved_errno = errno; - free (transformed1); - errno = saved_errno; - } + { + int saved_errno = errno; + free (transformed1); + errno = saved_errno; + } return -1; } /* Compare the transformed strings. */ cmp = memcmp2 (transformed1, transformed1_length, - transformed2, transformed2_length); + transformed2, transformed2_length); if (cmp < 0) cmp = -1; else if (cmp > 0) diff --git a/lib/uninorm/u-normxfrm.h b/lib/uninorm/u-normxfrm.h index 6ed1e3c..ce84ff6 100644 --- a/lib/uninorm/u-normxfrm.h +++ b/lib/uninorm/u-normxfrm.h @@ -1,5 +1,5 @@ /* Locale dependent transformation for comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -37,18 +37,18 @@ FUNC (const UNIT *s, size_t n, uninorm_t nf, /* Convert it to locale encoding. */ convs_length = sizeof (convsbuf) - 1; convs = U_CONV_TO_ENCODING (locale_charset (), - iconveh_error, - norms, norms_length, - NULL, - convsbuf, &convs_length); + iconveh_error, + norms, norms_length, + NULL, + convsbuf, &convs_length); if (convs == NULL) { if (norms != normsbuf) - { - int saved_errno = errno; - free (norms); - errno = saved_errno; - } + { + int saved_errno = errno; + free (norms); + errno = saved_errno; + } return NULL; } @@ -60,11 +60,11 @@ FUNC (const UNIT *s, size_t n, uninorm_t nf, { char *memory = (char *) realloc (convs, convs_length + 1); if (memory == NULL) - { - free (convs); - errno = ENOMEM; - return NULL; - } + { + free (convs); + errno = ENOMEM; + return NULL; + } convs = memory; } @@ -73,11 +73,11 @@ FUNC (const UNIT *s, size_t n, uninorm_t nf, if (result == NULL) { if (convs != convsbuf) - { - int saved_errno = errno; - free (convs); - errno = saved_errno; - } + { + int saved_errno = errno; + free (convs); + errno = saved_errno; + } return NULL; } diff --git a/lib/uninorm/u16-normalize.c b/lib/uninorm/u16-normalize.c index 86334d5..df50e8d 100644 --- a/lib/uninorm/u16-normalize.c +++ b/lib/uninorm/u16-normalize.c @@ -1,5 +1,5 @@ /* Normalization of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u16-normcmp.c b/lib/uninorm/u16-normcmp.c index c66cc1b..e246a26 100644 --- a/lib/uninorm/u16-normcmp.c +++ b/lib/uninorm/u16-normcmp.c @@ -1,5 +1,5 @@ /* Normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u16-normcoll.c b/lib/uninorm/u16-normcoll.c index a4f76c1..b851472 100644 --- a/lib/uninorm/u16-normcoll.c +++ b/lib/uninorm/u16-normcoll.c @@ -1,5 +1,5 @@ /* Locale dependent, normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u16-normxfrm.c b/lib/uninorm/u16-normxfrm.c index cc22d8e..41d274a 100644 --- a/lib/uninorm/u16-normxfrm.c +++ b/lib/uninorm/u16-normxfrm.c @@ -1,5 +1,5 @@ /* Locale dependent transformation for comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u32-normalize.c b/lib/uninorm/u32-normalize.c index 6549423..9ab8e5d 100644 --- a/lib/uninorm/u32-normalize.c +++ b/lib/uninorm/u32-normalize.c @@ -1,5 +1,5 @@ /* Normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u32-normcmp.c b/lib/uninorm/u32-normcmp.c index 58f890d..705c345 100644 --- a/lib/uninorm/u32-normcmp.c +++ b/lib/uninorm/u32-normcmp.c @@ -1,5 +1,5 @@ /* Normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u32-normcoll.c b/lib/uninorm/u32-normcoll.c index 0343f76..3770803 100644 --- a/lib/uninorm/u32-normcoll.c +++ b/lib/uninorm/u32-normcoll.c @@ -1,5 +1,5 @@ /* Locale dependent, normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u32-normxfrm.c b/lib/uninorm/u32-normxfrm.c index 4b4dbc0..7e953f9 100644 --- a/lib/uninorm/u32-normxfrm.c +++ b/lib/uninorm/u32-normxfrm.c @@ -1,5 +1,5 @@ /* Locale dependent transformation for comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u8-normalize.c b/lib/uninorm/u8-normalize.c index 7e003ec..6367994 100644 --- a/lib/uninorm/u8-normalize.c +++ b/lib/uninorm/u8-normalize.c @@ -1,5 +1,5 @@ /* Normalization of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u8-normcmp.c b/lib/uninorm/u8-normcmp.c index 6994f6c..02a4d5e 100644 --- a/lib/uninorm/u8-normcmp.c +++ b/lib/uninorm/u8-normcmp.c @@ -1,5 +1,5 @@ /* Normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u8-normcoll.c b/lib/uninorm/u8-normcoll.c index 4d163d4..5c392d9 100644 --- a/lib/uninorm/u8-normcoll.c +++ b/lib/uninorm/u8-normcoll.c @@ -1,5 +1,5 @@ /* Locale dependent, normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/u8-normxfrm.c b/lib/uninorm/u8-normxfrm.c index 31da05d..47d4fdc 100644 --- a/lib/uninorm/u8-normxfrm.c +++ b/lib/uninorm/u8-normxfrm.c @@ -1,5 +1,5 @@ /* Locale dependent transformation for comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uninorm/uninorm-filter.c b/lib/uninorm/uninorm-filter.c index 1d03cfa..dbc5e10 100644 --- a/lib/uninorm/uninorm-filter.c +++ b/lib/uninorm/uninorm-filter.c @@ -1,5 +1,5 @@ /* Stream-based normalization of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -50,8 +50,8 @@ struct uninorm_filter struct uninorm_filter * uninorm_filter_create (uninorm_t nf, - int (*stream_func) (void *stream_data, ucs4_t uc), - void *stream_data) + int (*stream_func) (void *stream_data, ucs4_t uc), + void *stream_data) { struct uninorm_filter *filter = (struct uninorm_filter *) malloc (sizeof (struct uninorm_filter)); @@ -92,40 +92,40 @@ uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc_arg) for (curr = 0; curr < decomposed_count; ) { - /* Invariant: decomposed[0..curr-1] is fully decomposed, i.e. - all elements are atomic. */ - ucs4_t curr_decomposed[UC_DECOMPOSITION_MAX_LENGTH]; - int curr_decomposed_count; - - curr_decomposed_count = - filter->decomposer (decomposed[curr], curr_decomposed); - if (curr_decomposed_count >= 0) - { - /* Move curr_decomposed[0..curr_decomposed_count-1] over - decomposed[curr], making room. It's not worth using - memcpy() here, since the counts are so small. */ - int shift = curr_decomposed_count - 1; - - if (shift < 0) - abort (); - if (shift > 0) - { - int j; - - decomposed_count += shift; - if (decomposed_count > UC_DECOMPOSITION_MAX_LENGTH) - abort (); - for (j = decomposed_count - 1 - shift; j > curr; j--) - decomposed[j + shift] = decomposed[j]; - } - for (; shift >= 0; shift--) - decomposed[curr + shift] = curr_decomposed[shift]; - } - else - { - /* decomposed[curr] is atomic. */ - curr++; - } + /* Invariant: decomposed[0..curr-1] is fully decomposed, i.e. + all elements are atomic. */ + ucs4_t curr_decomposed[UC_DECOMPOSITION_MAX_LENGTH]; + int curr_decomposed_count; + + curr_decomposed_count = + filter->decomposer (decomposed[curr], curr_decomposed); + if (curr_decomposed_count >= 0) + { + /* Move curr_decomposed[0..curr_decomposed_count-1] over + decomposed[curr], making room. It's not worth using + memcpy() here, since the counts are so small. */ + int shift = curr_decomposed_count - 1; + + if (shift < 0) + abort (); + if (shift > 0) + { + int j; + + decomposed_count += shift; + if (decomposed_count > UC_DECOMPOSITION_MAX_LENGTH) + abort (); + for (j = decomposed_count - 1 - shift; j > curr; j--) + decomposed[j + shift] = decomposed[j]; + } + for (; shift >= 0; shift--) + decomposed[curr + shift] = curr_decomposed[shift]; + } + else + { + /* decomposed[curr] is atomic. */ + curr++; + } } } @@ -137,119 +137,119 @@ uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc_arg) for (i = 0; i < decomposed_count; i++) { - /* Fetch the next character from the decomposition. */ - ucs4_t uc = decomposed[i]; - int ccc = uc_combining_class (uc); - - if (ccc == 0) - { - size_t j; - - /* Apply the canonical ordering algorithm to the accumulated - sequence of characters. */ - if (sortbuf_count > 1) - gl_uninorm_decompose_merge_sort_inplace (sortbuf, sortbuf_count, - sortbuf + sortbuf_count); - - if (filter->composer != NULL) - { - /* Attempt to combine decomposed characters, as specified - in the Unicode Standard Annex #15 "Unicode Normalization - Forms". We need to check - 1. whether the first accumulated character is a - "starter" (i.e. has ccc = 0). This is usually the - case. But when the string starts with a - non-starter, the sortbuf also starts with a - non-starter. Btw, this check could also be - omitted, because the composition table has only - entries (code1, code2) for which code1 is a - starter; if the first accumulated character is not - a starter, no lookup will succeed. - 2. If the sortbuf has more than one character, check - for each of these characters that are not "blocked" - from the starter (i.e. have a ccc that is higher - than the ccc of the previous character) whether it - can be combined with the first character. - 3. If only one character is left in sortbuf, check - whether it can be combined with the next character - (also a starter). */ - if (sortbuf_count > 0 && sortbuf[0].ccc == 0) - { - for (j = 1; j < sortbuf_count; ) - { - if (sortbuf[j].ccc > sortbuf[j - 1].ccc) - { - ucs4_t combined = - filter->composer (sortbuf[0].code, sortbuf[j].code); - if (combined) - { - size_t k; - - sortbuf[0].code = combined; - /* sortbuf[0].ccc = 0, still valid. */ - for (k = j + 1; k < sortbuf_count; k++) - sortbuf[k - 1] = sortbuf[k]; - sortbuf_count--; - continue; - } - } - j++; - } - if (sortbuf_count == 1) - { - ucs4_t combined = - filter->composer (sortbuf[0].code, uc); - if (combined) - { - uc = combined; - ccc = 0; - /* uc could be further combined with subsequent - characters. So don't put it into sortbuf[0] in - this round, only in the next round. */ - sortbuf_count = 0; - } - } - } - } - - for (j = 0; j < sortbuf_count; j++) - { - ucs4_t muc = sortbuf[j].code; - - /* Output muc to the encapsulated stream. */ - int ret = filter->stream_func (filter->stream_data, muc); - if (ret < 0) - { - /* errno is set here. */ - filter->sortbuf_count = 0; - return -1; - } - } - - /* sortbuf is now empty. */ - sortbuf_count = 0; - } - - /* Append (uc, ccc) to sortbuf. */ - if (sortbuf_count == filter->sortbuf_allocated) - { - struct ucs4_with_ccc *new_sortbuf; - - filter->sortbuf_allocated = 2 * filter->sortbuf_allocated; - if (filter->sortbuf_allocated < sortbuf_count) /* integer overflow? */ - abort (); - new_sortbuf = - (struct ucs4_with_ccc *) - malloc (2 * filter->sortbuf_allocated * sizeof (struct ucs4_with_ccc)); - memcpy (new_sortbuf, filter->sortbuf, - sortbuf_count * sizeof (struct ucs4_with_ccc)); - if (filter->sortbuf != filter->sortbuf_preallocated) - free (filter->sortbuf); - filter->sortbuf = new_sortbuf; - } - filter->sortbuf[sortbuf_count].code = uc; - filter->sortbuf[sortbuf_count].ccc = ccc; - sortbuf_count++; + /* Fetch the next character from the decomposition. */ + ucs4_t uc = decomposed[i]; + int ccc = uc_combining_class (uc); + + if (ccc == 0) + { + size_t j; + + /* Apply the canonical ordering algorithm to the accumulated + sequence of characters. */ + if (sortbuf_count > 1) + gl_uninorm_decompose_merge_sort_inplace (sortbuf, sortbuf_count, + sortbuf + sortbuf_count); + + if (filter->composer != NULL) + { + /* Attempt to combine decomposed characters, as specified + in the Unicode Standard Annex #15 "Unicode Normalization + Forms". We need to check + 1. whether the first accumulated character is a + "starter" (i.e. has ccc = 0). This is usually the + case. But when the string starts with a + non-starter, the sortbuf also starts with a + non-starter. Btw, this check could also be + omitted, because the composition table has only + entries (code1, code2) for which code1 is a + starter; if the first accumulated character is not + a starter, no lookup will succeed. + 2. If the sortbuf has more than one character, check + for each of these characters that are not "blocked" + from the starter (i.e. have a ccc that is higher + than the ccc of the previous character) whether it + can be combined with the first character. + 3. If only one character is left in sortbuf, check + whether it can be combined with the next character + (also a starter). */ + if (sortbuf_count > 0 && sortbuf[0].ccc == 0) + { + for (j = 1; j < sortbuf_count; ) + { + if (sortbuf[j].ccc > sortbuf[j - 1].ccc) + { + ucs4_t combined = + filter->composer (sortbuf[0].code, sortbuf[j].code); + if (combined) + { + size_t k; + + sortbuf[0].code = combined; + /* sortbuf[0].ccc = 0, still valid. */ + for (k = j + 1; k < sortbuf_count; k++) + sortbuf[k - 1] = sortbuf[k]; + sortbuf_count--; + continue; + } + } + j++; + } + if (sortbuf_count == 1) + { + ucs4_t combined = + filter->composer (sortbuf[0].code, uc); + if (combined) + { + uc = combined; + ccc = 0; + /* uc could be further combined with subsequent + characters. So don't put it into sortbuf[0] in + this round, only in the next round. */ + sortbuf_count = 0; + } + } + } + } + + for (j = 0; j < sortbuf_count; j++) + { + ucs4_t muc = sortbuf[j].code; + + /* Output muc to the encapsulated stream. */ + int ret = filter->stream_func (filter->stream_data, muc); + if (ret < 0) + { + /* errno is set here. */ + filter->sortbuf_count = 0; + return -1; + } + } + + /* sortbuf is now empty. */ + sortbuf_count = 0; + } + + /* Append (uc, ccc) to sortbuf. */ + if (sortbuf_count == filter->sortbuf_allocated) + { + struct ucs4_with_ccc *new_sortbuf; + + filter->sortbuf_allocated = 2 * filter->sortbuf_allocated; + if (filter->sortbuf_allocated < sortbuf_count) /* integer overflow? */ + abort (); + new_sortbuf = + (struct ucs4_with_ccc *) + malloc (2 * filter->sortbuf_allocated * sizeof (struct ucs4_with_ccc)); + memcpy (new_sortbuf, filter->sortbuf, + sortbuf_count * sizeof (struct ucs4_with_ccc)); + if (filter->sortbuf != filter->sortbuf_preallocated) + free (filter->sortbuf); + filter->sortbuf = new_sortbuf; + } + filter->sortbuf[sortbuf_count].code = uc; + filter->sortbuf[sortbuf_count].ccc = ccc; + sortbuf_count++; } filter->sortbuf_count = sortbuf_count; @@ -276,53 +276,53 @@ uninorm_filter_flush (struct uninorm_filter *filter) sequence of characters. */ if (sortbuf_count > 1) gl_uninorm_decompose_merge_sort_inplace (sortbuf, sortbuf_count, - sortbuf + sortbuf_count); + sortbuf + sortbuf_count); if (filter->composer != NULL) { /* Attempt to combine decomposed characters, as specified - in the Unicode Standard Annex #15 "Unicode Normalization - Forms". We need to check - 1. whether the first accumulated character is a - "starter" (i.e. has ccc = 0). This is usually the - case. But when the string starts with a - non-starter, the sortbuf also starts with a - non-starter. Btw, this check could also be - omitted, because the composition table has only - entries (code1, code2) for which code1 is a - starter; if the first accumulated character is not - a starter, no lookup will succeed. - 2. If the sortbuf has more than one character, check - for each of these characters that are not "blocked" - from the starter (i.e. have a ccc that is higher - than the ccc of the previous character) whether it - can be combined with the first character. - 3. If only one character is left in sortbuf, check - whether it can be combined with the next character - (also a starter). */ + in the Unicode Standard Annex #15 "Unicode Normalization + Forms". We need to check + 1. whether the first accumulated character is a + "starter" (i.e. has ccc = 0). This is usually the + case. But when the string starts with a + non-starter, the sortbuf also starts with a + non-starter. Btw, this check could also be + omitted, because the composition table has only + entries (code1, code2) for which code1 is a + starter; if the first accumulated character is not + a starter, no lookup will succeed. + 2. If the sortbuf has more than one character, check + for each of these characters that are not "blocked" + from the starter (i.e. have a ccc that is higher + than the ccc of the previous character) whether it + can be combined with the first character. + 3. If only one character is left in sortbuf, check + whether it can be combined with the next character + (also a starter). */ if (sortbuf_count > 0 && sortbuf[0].ccc == 0) - { - for (j = 1; j < sortbuf_count; ) - { - if (sortbuf[j].ccc > sortbuf[j - 1].ccc) - { - ucs4_t combined = - filter->composer (sortbuf[0].code, sortbuf[j].code); - if (combined) - { - size_t k; - - sortbuf[0].code = combined; - /* sortbuf[0].ccc = 0, still valid. */ - for (k = j + 1; k < sortbuf_count; k++) - sortbuf[k - 1] = sortbuf[k]; - sortbuf_count--; - continue; - } - } - j++; - } - } + { + for (j = 1; j < sortbuf_count; ) + { + if (sortbuf[j].ccc > sortbuf[j - 1].ccc) + { + ucs4_t combined = + filter->composer (sortbuf[0].code, sortbuf[j].code); + if (combined) + { + size_t k; + + sortbuf[0].code = combined; + /* sortbuf[0].ccc = 0, still valid. */ + for (k = j + 1; k < sortbuf_count; k++) + sortbuf[k - 1] = sortbuf[k]; + sortbuf_count--; + continue; + } + } + j++; + } + } } for (j = 0; j < sortbuf_count; j++) @@ -332,11 +332,11 @@ uninorm_filter_flush (struct uninorm_filter *filter) /* Output muc to the encapsulated stream. */ int ret = filter->stream_func (filter->stream_data, muc); if (ret < 0) - { - /* errno is set here. */ - filter->sortbuf_count = 0; - return -1; - } + { + /* errno is set here. */ + filter->sortbuf_count = 0; + return -1; + } } /* sortbuf is now empty. */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 19bf5be..fa82bbf 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2003-2009 Free Software Foundation, Inc. + Copyright (C) 2003-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -15,85 +15,171 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _GL_UNISTD_H - #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +/* Special invocation convention: + - On mingw, several headers, including <winsock2.h>, include <unistd.h>, + but we need to ensure that both the system <unistd.h> and <winsock2.h> + are completely included before we replace gethostname. */ +#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ + && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H +/* <unistd.h> is being indirectly included for the first time from + <winsock2.h>; avoid declaring any overrides. */ +# if @HAVE_UNISTD_H@ +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ +# else +# error unexpected; report this to bug-gnulib@gnu.org +# endif +# define _GL_WINSOCK2_H_WITNESS + +/* Normal invocation. */ +#elif !defined _GL_UNISTD_H + /* The include_next requires a split double-inclusion guard. */ #if @HAVE_UNISTD_H@ # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ #endif -#ifndef _GL_UNISTD_H +/* Get all possible declarations of gethostname(). */ +#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ + && !defined _GL_INCLUDING_WINSOCK2_H +# define _GL_INCLUDING_WINSOCK2_H +# include <winsock2.h> +# undef _GL_INCLUDING_WINSOCK2_H +#endif + +#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H #define _GL_UNISTD_H /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ #include <stddef.h> /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ -#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) +/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ +/* But avoid namespace pollution on glibc systems. */ +#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ + || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \ + && ! defined __GLIBC__ # include <stdio.h> #endif +/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ +# include <fcntl.h> +#endif + /* mingw fails to declare _exit in <unistd.h>. */ /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ -#include <stdlib.h> +/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +# include <stdlib.h> +#endif + +/* mingw declares getcwd in <io.h>, not in <unistd.h>. */ +#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) +# include <io.h> +#endif -#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ +#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ + || @GNULIB_PREAD@ || defined GNULIB_POSIXCHECK) /* Get ssize_t. */ # include <sys/types.h> #endif -/* Get getopt(), optarg, optind, opterr, optopt. */ -#if @GNULIB_UNISTD_H_GETOPT@ +/* Get getopt(), optarg, optind, opterr, optopt. + But avoid namespace pollution on glibc systems. */ +#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT # include <getopt.h> #endif +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + #if @GNULIB_GETHOSTNAME@ /* Get all possible declarations of gethostname(). */ # if @UNISTD_H_HAVE_WINSOCK2_H@ -# include <winsock2.h> # if !defined _GL_SYS_SOCKET_H -# undef socket -# define socket socket_used_without_including_sys_socket_h -# undef connect -# define connect connect_used_without_including_sys_socket_h -# undef accept -# define accept accept_used_without_including_sys_socket_h -# undef bind -# define bind bind_used_without_including_sys_socket_h -# undef getpeername -# define getpeername getpeername_used_without_including_sys_socket_h -# undef getsockname -# define getsockname getsockname_used_without_including_sys_socket_h -# undef getsockopt -# define getsockopt getsockopt_used_without_including_sys_socket_h -# undef listen -# define listen listen_used_without_including_sys_socket_h -# undef recv -# define recv recv_used_without_including_sys_socket_h -# undef send -# define send send_used_without_including_sys_socket_h -# undef recvfrom -# define recvfrom recvfrom_used_without_including_sys_socket_h -# undef sendto -# define sendto sendto_used_without_including_sys_socket_h -# undef setsockopt -# define setsockopt setsockopt_used_without_including_sys_socket_h -# undef shutdown -# define shutdown shutdown_used_without_including_sys_socket_h +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef socket +# define socket socket_used_without_including_sys_socket_h +# undef connect +# define connect connect_used_without_including_sys_socket_h +# undef accept +# define accept accept_used_without_including_sys_socket_h +# undef bind +# define bind bind_used_without_including_sys_socket_h +# undef getpeername +# define getpeername getpeername_used_without_including_sys_socket_h +# undef getsockname +# define getsockname getsockname_used_without_including_sys_socket_h +# undef getsockopt +# define getsockopt getsockopt_used_without_including_sys_socket_h +# undef listen +# define listen listen_used_without_including_sys_socket_h +# undef recv +# define recv recv_used_without_including_sys_socket_h +# undef send +# define send send_used_without_including_sys_socket_h +# undef recvfrom +# define recvfrom recvfrom_used_without_including_sys_socket_h +# undef sendto +# define sendto sendto_used_without_including_sys_socket_h +# undef setsockopt +# define setsockopt setsockopt_used_without_including_sys_socket_h +# undef shutdown +# define shutdown shutdown_used_without_including_sys_socket_h +# else + _GL_WARN_ON_USE (socket, + "socket() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (connect, + "connect() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (accept, + "accept() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (bind, + "bind() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (getpeername, + "getpeername() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (getsockname, + "getsockname() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (getsockopt, + "getsockopt() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (listen, + "listen() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (recv, + "recv() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (send, + "send() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (recvfrom, + "recvfrom() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (sendto, + "sendto() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (setsockopt, + "setsockopt() used without including <sys/socket.h>"); + _GL_WARN_ON_USE (shutdown, + "shutdown() used without including <sys/socket.h>"); +# endif # endif # if !defined _GL_SYS_SELECT_H -# undef select -# define select select_used_without_including_sys_select_h +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef select +# define select select_used_without_including_sys_select_h +# else + _GL_WARN_ON_USE (select, + "select() used without including <sys/select.h>"); +# endif # endif # endif #endif -/* The definition of GL_LINK_WARNING is copied here. */ - /* OS/2 EMX lacks these macros. */ #ifndef STDIN_FILENO @@ -106,75 +192,147 @@ # define STDERR_FILENO 2 #endif +/* Ensure *_OK macros exist. */ +#ifndef F_OK +# define F_OK 0 +# define X_OK 1 +# define W_OK 2 +# define R_OK 4 +#endif + + /* Declare overridden functions. */ -#ifdef __cplusplus -extern "C" { + +#if defined GNULIB_POSIXCHECK +/* The access() function is a security risk. */ +_GL_WARN_ON_USE (access, "the access function is a security risk - " + "use the gnulib module faccessat instead"); #endif #if @GNULIB_CHOWN@ -# if @REPLACE_CHOWN@ -# ifndef REPLACE_CHOWN -# define REPLACE_CHOWN 1 -# endif -# if REPLACE_CHOWN /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/chown.html>. */ +# if @REPLACE_CHOWN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef chown # define chown rpl_chown -extern int chown (const char *file, uid_t uid, gid_t gid); # endif +_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); +# else +# if !@HAVE_CHOWN@ +_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); # endif +_GL_CXXALIASWARN (chown); #elif defined GNULIB_POSIXCHECK # undef chown -# define chown(f,u,g) \ - (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \ - "doesn't treat a uid or gid of -1 on some systems - " \ - "use gnulib module chown for portability"), \ - chown (f, u, g)) +# if HAVE_RAW_DECL_CHOWN +_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " + "doesn't treat a uid or gid of -1 on some systems - " + "use gnulib module chown for portability"); +# endif #endif #if @GNULIB_CLOSE@ # if @REPLACE_CLOSE@ /* Automatically included by modules that need a replacement for close. */ -# undef close -# define close rpl_close -extern int close (int); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef close +# define close rpl_close +# endif +_GL_FUNCDECL_RPL (close, int, (int fd)); +_GL_CXXALIAS_RPL (close, int, (int fd)); +# else +_GL_CXXALIAS_SYS (close, int, (int fd)); # endif +_GL_CXXALIASWARN (close); #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ # undef close # define close close_used_without_requesting_gnulib_module_close #elif defined GNULIB_POSIXCHECK # undef close -# define close(f) \ - (GL_LINK_WARNING ("close does not portably work on sockets - " \ - "use gnulib module close for portability"), \ - close (f)) +/* Assume close is always declared. */ +_GL_WARN_ON_USE (close, "close does not portably work on sockets - " + "use gnulib module close for portability"); #endif -#if @GNULIB_DUP2@ -# if @REPLACE_DUP2@ -# define dup2 rpl_dup2 +#if @REPLACE_DUP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dup rpl_dup # endif -# if !@HAVE_DUP2@ || @REPLACE_DUP2@ +_GL_FUNCDECL_RPL (dup, int, (int oldfd)); +_GL_CXXALIAS_RPL (dup, int, (int oldfd)); +#else +_GL_CXXALIAS_SYS (dup, int, (int oldfd)); +#endif +_GL_CXXALIASWARN (dup); + + +#if @GNULIB_DUP2@ /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if NEWFD = OLDFD, otherwise close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/dup2.html>. */ -extern int dup2 (int oldfd, int newfd); +# if @REPLACE_DUP2@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dup2 rpl_dup2 +# endif +_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); +_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); +# else +# if !@HAVE_DUP2@ +_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); +# endif +_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); # endif +_GL_CXXALIASWARN (dup2); #elif defined GNULIB_POSIXCHECK # undef dup2 -# define dup2(o,n) \ - (GL_LINK_WARNING ("dup2 is unportable - " \ - "use gnulib module dup2 for portability"), \ - dup2 (o, n)) +# if HAVE_RAW_DECL_DUP2 +_GL_WARN_ON_USE (dup2, "dup2 is unportable - " + "use gnulib module dup2 for portability"); +# endif +#endif + + +#if @GNULIB_DUP3@ +/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the + specified flags. + The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + Close NEWFD first if it is open. + Return newfd if successful, otherwise -1 and errno set. + See the Linux man page at + <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ +# if @HAVE_DUP3@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dup3 rpl_dup3 +# endif +_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); +_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); +# else +_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); +_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); +# endif +_GL_CXXALIASWARN (dup3); +#elif defined GNULIB_POSIXCHECK +# undef dup3 +# if HAVE_RAW_DECL_DUP3 +_GL_WARN_ON_USE (dup3, "dup3 is unportable - " + "use gnulib module dup3 for portability"); +# endif #endif @@ -186,59 +344,126 @@ extern int dup2 (int oldfd, int newfd); # include <crt_externs.h> # define environ (*_NSGetEnviron ()) # else +# ifdef __cplusplus +extern "C" { +# endif extern char **environ; +# ifdef __cplusplus +} +# endif # endif # endif #elif defined GNULIB_POSIXCHECK -# undef environ -# define environ \ - (GL_LINK_WARNING ("environ is unportable - " \ - "use gnulib module environ for portability"), \ - environ) +# if HAVE_RAW_DECL_ENVIRON +static inline char *** +rpl_environ (void) +{ + return &environ; +} +_GL_WARN_ON_USE (rpl_environ, "environ is unportable - " + "use gnulib module environ for portability"); +# undef environ +# define environ (*rpl_environ ()) +# endif #endif #if @GNULIB_EUIDACCESS@ -# if !@HAVE_EUIDACCESS@ -/* Like access(), except that is uses the effective user id and group id of +/* Like access(), except that it uses the effective user id and group id of the current process. */ -extern int euidaccess (const char *filename, int mode); +# if !@HAVE_EUIDACCESS@ +_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); +_GL_CXXALIASWARN (euidaccess); +# if defined GNULIB_POSIXCHECK +/* Like access(), this function is a security risk. */ +_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " + "use the gnulib module faccessat instead"); # endif #elif defined GNULIB_POSIXCHECK # undef euidaccess -# define euidaccess(f,m) \ - (GL_LINK_WARNING ("euidaccess is unportable - " \ - "use gnulib module euidaccess for portability"), \ - euidaccess (f, m)) +# if HAVE_RAW_DECL_EUIDACCESS +_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " + "use gnulib module euidaccess for portability"); +# endif #endif -#if @GNULIB_FCHDIR@ -# if @REPLACE_FCHDIR@ +#if @GNULIB_FACCESSAT@ +# if !@HAVE_FACCESSAT@ +_GL_FUNCDECL_SYS (faccessat, int, + (int fd, char const *file, int mode, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (faccessat, int, + (int fd, char const *file, int mode, int flag)); +_GL_CXXALIASWARN (faccessat); +#elif defined GNULIB_POSIXCHECK +# undef faccessat +# if HAVE_RAW_DECL_FACCESSAT +_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " + "use gnulib module faccessat for portability"); +# endif +#endif + +#if @GNULIB_FCHDIR@ /* Change the process' current working directory to the directory on which the given file descriptor is open. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/fchdir.html>. */ -extern int fchdir (int /*fd*/); +# if ! @HAVE_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); -# define dup rpl_dup -extern int dup (int); - -# if @REPLACE_DUP2@ -# undef dup2 -# endif -# define dup2 rpl_dup2_fchdir -extern int dup2 (int, int); +/* Gnulib internal hooks needed to maintain the fchdir metadata. */ +_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) + _GL_ARG_NONNULL ((2)); +_GL_EXTERN_C void _gl_unregister_fd (int fd); +_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); +_GL_EXTERN_C const char *_gl_directory_name (int fd); # endif +_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); +_GL_CXXALIASWARN (fchdir); #elif defined GNULIB_POSIXCHECK # undef fchdir -# define fchdir(f) \ - (GL_LINK_WARNING ("fchdir is unportable - " \ - "use gnulib module fchdir for portability"), \ - fchdir (f)) +# if HAVE_RAW_DECL_FCHDIR +_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " + "use gnulib module fchdir for portability"); +# endif +#endif + + +#if @GNULIB_FCHOWNAT@ +# if @REPLACE_FCHOWNAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fchownat +# define fchownat rpl_fchownat +# endif +_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag)); +# else +# if !@HAVE_FCHOWNAT@ +_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag)); +# endif +_GL_CXXALIASWARN (fchownat); +#elif defined GNULIB_POSIXCHECK +# undef fchownat +# if HAVE_RAW_DECL_FCHOWNAT +_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " + "use gnulib module openat for portability"); +# endif #endif @@ -248,39 +473,39 @@ extern int dup2 (int, int); See POSIX:2001 specification <http://www.opengroup.org/susv3xsh/fsync.html>. */ # if !@HAVE_FSYNC@ -extern int fsync (int fd); +_GL_FUNCDECL_SYS (fsync, int, (int fd)); # endif +_GL_CXXALIAS_SYS (fsync, int, (int fd)); +_GL_CXXALIASWARN (fsync); #elif defined GNULIB_POSIXCHECK # undef fsync -# define fsync(fd) \ - (GL_LINK_WARNING ("fsync is unportable - " \ - "use gnulib module fsync for portability"), \ - fsync (fd)) +# if HAVE_RAW_DECL_FSYNC +_GL_WARN_ON_USE (fsync, "fsync is unportable - " + "use gnulib module fsync for portability"); +# endif #endif #if @GNULIB_FTRUNCATE@ -# if !@HAVE_FTRUNCATE@ /* Change the size of the file to which FD is opened to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ -extern int ftruncate (int fd, off_t length); +# if !@HAVE_FTRUNCATE@ +_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); # endif +_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); +_GL_CXXALIASWARN (ftruncate); #elif defined GNULIB_POSIXCHECK # undef ftruncate -# define ftruncate(f,l) \ - (GL_LINK_WARNING ("ftruncate is unportable - " \ - "use gnulib module ftruncate for portability"), \ - ftruncate (f, l)) +# if HAVE_RAW_DECL_FTRUNCATE +_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " + "use gnulib module ftruncate for portability"); +# endif #endif #if @GNULIB_GETCWD@ -/* Include the headers that might declare getcwd so that they will not - cause confusion if included after this file. */ -# include <stdlib.h> -# if @REPLACE_GETCWD@ /* Get the name of the current working directory, and put it in SIZE bytes of BUF. Return BUF if successful, or NULL if the directory couldn't be determined @@ -291,15 +516,24 @@ extern int ftruncate (int fd, off_t length); extension: If BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ -# define getcwd rpl_getcwd -extern char * getcwd (char *buf, size_t size); +# if @REPLACE_GETCWD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getcwd rpl_getcwd +# endif +_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); +_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); +# else +/* Need to cast, because on mingw, the second parameter is + int size. */ +_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif +_GL_CXXALIASWARN (getcwd); #elif defined GNULIB_POSIXCHECK # undef getcwd -# define getcwd(b,s) \ - (GL_LINK_WARNING ("getcwd is unportable - " \ - "use gnulib module getcwd for portability"), \ - getcwd (b, s)) +# if HAVE_RAW_DECL_GETCWD +_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " + "use gnulib module getcwd for portability"); +# endif #endif @@ -315,28 +549,65 @@ extern char * getcwd (char *buf, size_t size); If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ # if !@HAVE_GETDOMAINNAME@ -extern int getdomainname(char *name, size_t len); +_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); # endif +/* Need to cast, because on MacOS X 10.5 systems, the second parameter is + int len. */ +_GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len)); +_GL_CXXALIASWARN (getdomainname); #elif defined GNULIB_POSIXCHECK # undef getdomainname -# define getdomainname(n,l) \ - (GL_LINK_WARNING ("getdomainname is unportable - " \ - "use gnulib module getdomainname for portability"), \ - getdomainname (n, l)) +# if HAVE_RAW_DECL_GETDOMAINNAME +_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " + "use gnulib module getdomainname for portability"); +# endif #endif #if @GNULIB_GETDTABLESIZE@ +/* Return the maximum number of file descriptors in the current process. + In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ # if !@HAVE_GETDTABLESIZE@ -/* Return the maximum number of file descriptors in the current process. */ -extern int getdtablesize (void); +_GL_FUNCDECL_SYS (getdtablesize, int, (void)); # endif +_GL_CXXALIAS_SYS (getdtablesize, int, (void)); +_GL_CXXALIASWARN (getdtablesize); #elif defined GNULIB_POSIXCHECK # undef getdtablesize -# define getdtablesize() \ - (GL_LINK_WARNING ("getdtablesize is unportable - " \ - "use gnulib module getdtablesize for portability"), \ - getdtablesize ()) +# if HAVE_RAW_DECL_GETDTABLESIZE +_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " + "use gnulib module getdtablesize for portability"); +# endif +#endif + + +#if @GNULIB_GETGROUPS@ +/* Return the supplemental groups that the current process belongs to. + It is unspecified whether the effective group id is in the list. + If N is 0, return the group count; otherwise, N describes how many + entries are available in GROUPS. Return -1 and set errno if N is + not 0 and not large enough. Fails with ENOSYS on some systems. */ +# if @REPLACE_GETGROUPS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getgroups +# define getgroups rpl_getgroups +# endif +_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); +_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); +# else +# if !@HAVE_GETGROUPS@ +_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); +# endif +_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); +# endif +_GL_CXXALIASWARN (getgroups); +#elif defined GNULIB_POSIXCHECK +# undef getgroups +# if HAVE_RAW_DECL_GETGROUPS +_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " + "use gnulib module getgroups for portability"); +# endif #endif @@ -349,21 +620,57 @@ extern int getdtablesize (void); If the host name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ # if @UNISTD_H_HAVE_WINSOCK2_H@ -# undef gethostname -# define gethostname rpl_gethostname -# endif -# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@ -extern int gethostname(char *name, size_t len); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gethostname +# define gethostname rpl_gethostname +# endif +_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); +# else +# if !@HAVE_GETHOSTNAME@ +_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Solaris 10 systems, the second parameter is + int len. */ +_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif +_GL_CXXALIASWARN (gethostname); #elif @UNISTD_H_HAVE_WINSOCK2_H@ # undef gethostname # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname #elif defined GNULIB_POSIXCHECK # undef gethostname -# define gethostname(n,l) \ - (GL_LINK_WARNING ("gethostname is unportable - " \ - "use gnulib module gethostname for portability"), \ - gethostname (n, l)) +# if HAVE_RAW_DECL_GETHOSTNAME +_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " + "use gnulib module gethostname for portability"); +# endif +#endif + + +#if @GNULIB_GETLOGIN@ +/* Returns the user's login name, or NULL if it cannot be found. Upon error, + returns NULL with errno set. + + See <http://www.opengroup.org/susv3xsh/getlogin.html>. + + Most programs don't need to use this function, because the information is + available through environment variables: + ${LOGNAME-$USER} on Unix platforms, + $USERNAME on native Windows platforms. + */ +# if !@HAVE_GETLOGIN@ +_GL_FUNCDECL_SYS (getlogin, char *, (void)); +# endif +_GL_CXXALIAS_SYS (getlogin, char *, (void)); +_GL_CXXALIASWARN (getlogin); +#elif defined GNULIB_POSIXCHECK +# undef getlogin +# if HAVE_RAW_DECL_GETLOGIN +_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " + "use gnulib module getlogin for portability"); +# endif #endif @@ -376,123 +683,184 @@ extern int gethostname(char *name, size_t len); provided (this case is hopefully rare but is left open by the POSIX spec). See <http://www.opengroup.org/susv3xsh/getlogin.html>. + + Most programs don't need to use this function, because the information is + available through environment variables: + ${LOGNAME-$USER} on Unix platforms, + $USERNAME on native Windows platforms. */ # if !@HAVE_DECL_GETLOGIN_R@ -extern int getlogin_r (char *name, size_t size); +_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) + _GL_ARG_NONNULL ((1))); # endif +/* Need to cast, because on Solaris 10 systems, the second argument is + int size. */ +_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); +_GL_CXXALIASWARN (getlogin_r); #elif defined GNULIB_POSIXCHECK # undef getlogin_r -# define getlogin_r(n,s) \ - (GL_LINK_WARNING ("getlogin_r is unportable - " \ - "use gnulib module getlogin_r for portability"), \ - getlogin_r (n, s)) +# if HAVE_RAW_DECL_GETLOGIN_R +_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " + "use gnulib module getlogin_r for portability"); +# endif #endif #if @GNULIB_GETPAGESIZE@ # if @REPLACE_GETPAGESIZE@ -# define getpagesize rpl_getpagesize -extern int getpagesize (void); -# elif !@HAVE_GETPAGESIZE@ -/* This is for POSIX systems. */ -# if !defined getpagesize && defined _SC_PAGESIZE -# if ! (defined __VMS && __VMS_VER < 70000000) -# define getpagesize() sysconf (_SC_PAGESIZE) -# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getpagesize rpl_getpagesize # endif +_GL_FUNCDECL_RPL (getpagesize, int, (void)); +_GL_CXXALIAS_RPL (getpagesize, int, (void)); +# else +# if !@HAVE_GETPAGESIZE@ +# if !defined getpagesize +/* This is for POSIX systems. */ +# if !defined _gl_getpagesize && defined _SC_PAGESIZE +# if ! (defined __VMS && __VMS_VER < 70000000) +# define _gl_getpagesize() sysconf (_SC_PAGESIZE) +# endif +# endif /* This is for older VMS. */ -# if !defined getpagesize && defined __VMS -# ifdef __ALPHA -# define getpagesize() 8192 -# else -# define getpagesize() 512 -# endif -# endif +# if !defined _gl_getpagesize && defined __VMS +# ifdef __ALPHA +# define _gl_getpagesize() 8192 +# else +# define _gl_getpagesize() 512 +# endif +# endif /* This is for BeOS. */ -# if !defined getpagesize && @HAVE_OS_H@ -# include <OS.h> -# if defined B_PAGE_SIZE -# define getpagesize() B_PAGE_SIZE -# endif -# endif +# if !defined _gl_getpagesize && @HAVE_OS_H@ +# include <OS.h> +# if defined B_PAGE_SIZE +# define _gl_getpagesize() B_PAGE_SIZE +# endif +# endif /* This is for AmigaOS4.0. */ -# if !defined getpagesize && defined __amigaos4__ -# define getpagesize() 2048 -# endif +# if !defined _gl_getpagesize && defined __amigaos4__ +# define _gl_getpagesize() 2048 +# endif /* This is for older Unix systems. */ -# if !defined getpagesize && @HAVE_SYS_PARAM_H@ -# include <sys/param.h> -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define CLSIZE 1 +# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define _gl_getpagesize() EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define CLSIZE 1 +# endif +# define _gl_getpagesize() (NBPG * CLSIZE) +# else +# ifdef NBPC +# define _gl_getpagesize() NBPC +# endif +# endif # endif -# define getpagesize() (NBPG * CLSIZE) +# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getpagesize() _gl_getpagesize () # else -# ifdef NBPC -# define getpagesize() NBPC -# endif +static inline int +getpagesize () +{ + return _gl_getpagesize (); +} # endif # endif # endif +/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ +_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); +# endif +# if @HAVE_DECL_GETPAGESIZE@ +_GL_CXXALIASWARN (getpagesize); # endif #elif defined GNULIB_POSIXCHECK # undef getpagesize -# define getpagesize() \ - (GL_LINK_WARNING ("getpagesize is unportable - " \ - "use gnulib module getpagesize for portability"), \ - getpagesize ()) +# if HAVE_RAW_DECL_GETPAGESIZE +_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " + "use gnulib module getpagesize for portability"); +# endif #endif #if @GNULIB_GETUSERSHELL@ -# if !@HAVE_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ -extern char *getusershell (void); +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (getusershell, char *, (void)); +# endif +_GL_CXXALIAS_SYS (getusershell, char *, (void)); +_GL_CXXALIASWARN (getusershell); +#elif defined GNULIB_POSIXCHECK +# undef getusershell +# if HAVE_RAW_DECL_GETUSERSHELL +_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " + "use gnulib module getusershell for portability"); +# endif +#endif + +#if @GNULIB_GETUSERSHELL@ /* Rewind to pointer that is advanced at each getusershell() call. */ -extern void setusershell (void); +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (setusershell, void, (void)); +# endif +_GL_CXXALIAS_SYS (setusershell, void, (void)); +_GL_CXXALIASWARN (setusershell); +#elif defined GNULIB_POSIXCHECK +# undef setusershell +# if HAVE_RAW_DECL_SETUSERSHELL +_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " + "use gnulib module getusershell for portability"); +# endif +#endif + +#if @GNULIB_GETUSERSHELL@ /* Free the pointer that is advanced at each getusershell() call and associated resources. */ -extern void endusershell (void); +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (endusershell, void, (void)); # endif +_GL_CXXALIAS_SYS (endusershell, void, (void)); +_GL_CXXALIASWARN (endusershell); #elif defined GNULIB_POSIXCHECK -# undef getusershell -# define getusershell() \ - (GL_LINK_WARNING ("getusershell is unportable - " \ - "use gnulib module getusershell for portability"), \ - getusershell ()) -# undef setusershell -# define setusershell() \ - (GL_LINK_WARNING ("setusershell is unportable - " \ - "use gnulib module getusershell for portability"), \ - setusershell ()) # undef endusershell -# define endusershell() \ - (GL_LINK_WARNING ("endusershell is unportable - " \ - "use gnulib module getusershell for portability"), \ - endusershell ()) +# if HAVE_RAW_DECL_ENDUSERSHELL +_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " + "use gnulib module getusershell for portability"); +# endif #endif #if @GNULIB_LCHOWN@ -# if @REPLACE_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/lchown.html>. */ -# define lchown rpl_lchown -extern int lchown (char const *file, uid_t owner, gid_t group); +# if @REPLACE_LCHOWN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lchown +# define lchown rpl_lchown +# endif +_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); +# else +# if !@HAVE_LCHOWN@ +_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); # endif +_GL_CXXALIASWARN (lchown); #elif defined GNULIB_POSIXCHECK # undef lchown -# define lchown(f,u,g) \ - (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ - "systems - use gnulib module lchown for portability"), \ - lchown (f, u, g)) +# if HAVE_RAW_DECL_LCHOWN +_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " + "use gnulib module lchown for portability"); +# endif #endif @@ -501,33 +869,150 @@ extern int lchown (char const *file, uid_t owner, gid_t group); Return 0 if successful, otherwise -1 and errno set. See POSIX:2001 specification <http://www.opengroup.org/susv3xsh/link.html>. */ -# if !@HAVE_LINK@ -extern int link (const char *path1, const char *path2); +# if @REPLACE_LINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define link rpl_link +# endif +_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); +# else +# if !@HAVE_LINK@ +_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); # endif +_GL_CXXALIASWARN (link); #elif defined GNULIB_POSIXCHECK # undef link -# define link(path1,path2) \ - (GL_LINK_WARNING ("link is unportable - " \ - "use gnulib module link for portability"), \ - link (path1, path2)) +# if HAVE_RAW_DECL_LINK +_GL_WARN_ON_USE (link, "link is unportable - " + "use gnulib module link for portability"); +# endif +#endif + + +#if @GNULIB_LINKAT@ +/* Create a new hard link for an existing file, relative to two + directories. FLAG controls whether symlinks are followed. + Return 0 if successful, otherwise -1 and errno set. */ +# if @REPLACE_LINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef linkat +# define linkat rpl_linkat +# endif +_GL_FUNCDECL_RPL (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag)); +# else +# if !@HAVE_LINKAT@ +_GL_FUNCDECL_SYS (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag) + _GL_ARG_NONNULL ((2, 4))); +# endif +_GL_CXXALIAS_SYS (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag)); +# endif +_GL_CXXALIASWARN (linkat); +#elif defined GNULIB_POSIXCHECK +# undef linkat +# if HAVE_RAW_DECL_LINKAT +_GL_WARN_ON_USE (linkat, "linkat is unportable - " + "use gnulib module linkat for portability"); +# endif #endif #if @GNULIB_LSEEK@ -# if @REPLACE_LSEEK@ /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. Return the new offset if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/lseek.html>. */ -# define lseek rpl_lseek - extern off_t lseek (int fd, off_t offset, int whence); +# if @REPLACE_LSEEK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define lseek rpl_lseek +# endif +_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); +_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); +# else +_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); # endif +_GL_CXXALIASWARN (lseek); #elif defined GNULIB_POSIXCHECK # undef lseek -# define lseek(f,o,w) \ - (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ - "systems - use gnulib module lseek for portability"), \ - lseek (f, o, w)) +# if HAVE_RAW_DECL_LSEEK +_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " + "systems - use gnulib module lseek for portability"); +# endif +#endif + + +#if @GNULIB_PIPE2@ +/* Create a pipe, applying the given flags when opening the read-end of the + pipe and the write-end of the pipe. + The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + Store the read-end as fd[0] and the write-end as fd[1]. + Return 0 upon success, or -1 with errno set upon failure. + See also the Linux man page at + <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ +# if @HAVE_PIPE2@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define pipe2 rpl_pipe2 +# endif +_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); +# else +_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); +# endif +_GL_CXXALIASWARN (pipe2); +#elif defined GNULIB_POSIXCHECK +# undef pipe2 +# if HAVE_RAW_DECL_PIPE2 +_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " + "use gnulib module pipe2 for portability"); +# endif +#endif + + +#if @GNULIB_PREAD@ +/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. + Return the number of bytes placed into BUF if successful, otherwise + set errno and return -1. 0 indicates EOF. See the POSIX:2001 + specification <http://www.opengroup.org/susv3xsh/pread.html>. */ +# if @REPLACE_PREAD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define pread rpl_pread +# endif +_GL_FUNCDECL_RPL (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset)); +# else +# if !@HAVE_PREAD@ +_GL_FUNCDECL_SYS (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset)); +# endif +_GL_CXXALIASWARN (pread); +#elif defined GNULIB_POSIXCHECK +# undef pread +# if HAVE_RAW_DECL_PREAD +_GL_WARN_ON_USE (pread, "pread is unportable - " + "use gnulib module pread for portability"); +# endif #endif @@ -537,15 +1022,70 @@ extern int link (const char *path1, const char *path2); successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/readlink.html>. */ -# if !@HAVE_READLINK@ -extern int readlink (const char *file, char *buf, size_t bufsize); +# if @REPLACE_READLINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define readlink rpl_readlink +# endif +_GL_FUNCDECL_RPL (readlink, ssize_t, + (const char *file, char *buf, size_t bufsize) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (readlink, ssize_t, + (const char *file, char *buf, size_t bufsize)); +# else +# if !@HAVE_READLINK@ +_GL_FUNCDECL_SYS (readlink, ssize_t, + (const char *file, char *buf, size_t bufsize) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (readlink, ssize_t, + (const char *file, char *buf, size_t bufsize)); # endif +_GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK # undef readlink -# define readlink(f,b,s) \ - (GL_LINK_WARNING ("readlink is unportable - " \ - "use gnulib module readlink for portability"), \ - readlink (f, b, s)) +# if HAVE_RAW_DECL_READLINK +_GL_WARN_ON_USE (readlink, "readlink is unportable - " + "use gnulib module readlink for portability"); +# endif +#endif + + +#if @GNULIB_READLINKAT@ +# if !@HAVE_READLINKAT@ +_GL_FUNCDECL_SYS (readlinkat, ssize_t, + (int fd, char const *file, char *buf, size_t len) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (readlinkat, ssize_t, + (int fd, char const *file, char *buf, size_t len)); +_GL_CXXALIASWARN (readlinkat); +#elif defined GNULIB_POSIXCHECK +# undef readlinkat +# if HAVE_RAW_DECL_READLINKAT +_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " + "use gnulib module symlinkat for portability"); +# endif +#endif + + +#if @GNULIB_RMDIR@ +/* Remove the directory DIR. */ +# if @REPLACE_RMDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define rmdir rpl_rmdir +# endif +_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); +# else +_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); +# endif +_GL_CXXALIASWARN (rmdir); +#elif defined GNULIB_POSIXCHECK +# undef rmdir +# if HAVE_RAW_DECL_RMDIR +_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " + "use gnulib module rmdir for portability"); +# endif #endif @@ -554,36 +1094,197 @@ extern int readlink (const char *file, char *buf, size_t bufsize); Returns the number of seconds left to sleep. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/sleep.html>. */ -# if !@HAVE_SLEEP@ -extern unsigned int sleep (unsigned int n); +# if @REPLACE_SLEEP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sleep +# define sleep rpl_sleep +# endif +_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); +_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); +# else +# if !@HAVE_SLEEP@ +_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); +# endif +_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); # endif +_GL_CXXALIASWARN (sleep); #elif defined GNULIB_POSIXCHECK # undef sleep -# define sleep(n) \ - (GL_LINK_WARNING ("sleep is unportable - " \ - "use gnulib module sleep for portability"), \ - sleep (n)) +# if HAVE_RAW_DECL_SLEEP +_GL_WARN_ON_USE (sleep, "sleep is unportable - " + "use gnulib module sleep for portability"); +# endif #endif -#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ -/* Write up to COUNT bytes starting at BUF to file descriptor FD. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/write.html>. */ -# undef write -# define write rpl_write -extern ssize_t write (int fd, const void *buf, size_t count); +#if @GNULIB_SYMLINK@ +# if @REPLACE_SYMLINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef symlink +# define symlink rpl_symlink +# endif +_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); +# else +# if !@HAVE_SYMLINK@ +_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); +# endif +_GL_CXXALIASWARN (symlink); +#elif defined GNULIB_POSIXCHECK +# undef symlink +# if HAVE_RAW_DECL_SYMLINK +_GL_WARN_ON_USE (symlink, "symlink is not portable - " + "use gnulib module symlink for portability"); +# endif #endif -#ifdef FCHDIR_REPLACEMENT -/* gnulib internal function. */ -extern void _gl_unregister_fd (int fd); +#if @GNULIB_SYMLINKAT@ +# if !@HAVE_SYMLINKAT@ +_GL_FUNCDECL_SYS (symlinkat, int, + (char const *contents, int fd, char const *file) + _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS (symlinkat, int, + (char const *contents, int fd, char const *file)); +_GL_CXXALIASWARN (symlinkat); +#elif defined GNULIB_POSIXCHECK +# undef symlinkat +# if HAVE_RAW_DECL_SYMLINKAT +_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " + "use gnulib module symlinkat for portability"); +# endif #endif -#ifdef __cplusplus -} +#if @GNULIB_TTYNAME_R@ +/* Store at most BUFLEN characters of the pathname of the terminal FD is + open on in BUF. Return 0 on success, otherwise an error number. */ +# if @REPLACE_TTYNAME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ttyname_r +# define ttyname_r rpl_ttyname_r +# endif +_GL_FUNCDECL_RPL (ttyname_r, int, + (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (ttyname_r, int, + (int fd, char *buf, size_t buflen)); +# else +# if !@HAVE_TTYNAME_R@ +_GL_FUNCDECL_SYS (ttyname_r, int, + (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (ttyname_r, int, + (int fd, char *buf, size_t buflen)); +# endif +_GL_CXXALIASWARN (ttyname_r); +#elif defined GNULIB_POSIXCHECK +# undef ttyname_r +# if HAVE_RAW_DECL_TTYNAME_R +_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " + "use gnulib module ttyname_r for portability"); +# endif +#endif + + +#if @GNULIB_UNLINK@ +# if @REPLACE_UNLINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unlink +# define unlink rpl_unlink +# endif +_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (unlink, int, (char const *file)); +# else +_GL_CXXALIAS_SYS (unlink, int, (char const *file)); +# endif +_GL_CXXALIASWARN (unlink); +#elif defined GNULIB_POSIXCHECK +# undef unlink +# if HAVE_RAW_DECL_UNLINK +_GL_WARN_ON_USE (unlink, "unlink is not portable - " + "use gnulib module unlink for portability"); +# endif +#endif + + +#if @GNULIB_UNLINKAT@ +# if @REPLACE_UNLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unlinkat +# define unlinkat rpl_unlinkat +# endif +_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); +# else +# if !@HAVE_UNLINKAT@ +_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); +# endif +_GL_CXXALIASWARN (unlinkat); +#elif defined GNULIB_POSIXCHECK +# undef unlinkat +# if HAVE_RAW_DECL_UNLINKAT +_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @GNULIB_USLEEP@ +/* Pause the execution of the current thread for N microseconds. + Returns 0 on completion, or -1 on range error. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/sleep.html>. */ +# if @REPLACE_USLEEP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef usleep +# define usleep rpl_usleep +# endif +_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); +_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); +# else +# if !@HAVE_USLEEP@ +_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); +# endif +_GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); +# endif +_GL_CXXALIASWARN (usleep); +#elif defined GNULIB_POSIXCHECK +# undef usleep +# if HAVE_RAW_DECL_USLEEP +_GL_WARN_ON_USE (usleep, "usleep is unportable - " + "use gnulib module usleep for portability"); +# endif +#endif + + +#if @GNULIB_WRITE@ +/* Write up to COUNT bytes starting at BUF to file descriptor FD. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/write.html>. */ +# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef write +# define write rpl_write +# endif +_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); +# else +/* Need to cast, because on mingw, the third parameter is + unsigned int count + and the return type is 'int'. */ +_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (write); #endif diff --git a/lib/unistdio.h b/lib/unistdio.h index d9eca02..8eb6922 100644 --- a/lib/unistdio.h +++ b/lib/unistdio.h @@ -1,5 +1,5 @@ /* Elementary Unicode string functions. - Copyright (C) 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -62,192 +62,192 @@ extern "C" { /* ASCII format string, result in locale dependent encoded 'char *'. */ extern int ulc_sprintf (char *buf, - const char *format, ...); + const char *format, ...); extern int ulc_snprintf (char *buf, size_t size, - const char *format, ...); + const char *format, ...); extern int ulc_asprintf (char **resultp, - const char *format, ...); + const char *format, ...); extern char * ulc_asnprintf (char *resultbuf, size_t *lengthp, - const char *format, ...); + const char *format, ...); extern int ulc_vsprintf (char *buf, - const char *format, va_list ap); + const char *format, va_list ap); extern int ulc_vsnprintf (char *buf, size_t size, - const char *format, va_list ap); + const char *format, va_list ap); extern int ulc_vasprintf (char **resultp, - const char *format, va_list ap); + const char *format, va_list ap); extern char * ulc_vasnprintf (char *resultbuf, size_t *lengthp, - const char *format, va_list ap); + const char *format, va_list ap); /* ASCII format string, result in UTF-8 format. */ extern int u8_sprintf (uint8_t *buf, - const char *format, ...); + const char *format, ...); extern int u8_snprintf (uint8_t *buf, size_t size, - const char *format, ...); + const char *format, ...); extern int u8_asprintf (uint8_t **resultp, - const char *format, ...); + const char *format, ...); extern uint8_t * u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, - const char *format, ...); + const char *format, ...); extern int u8_vsprintf (uint8_t *buf, - const char *format, va_list ap); + const char *format, va_list ap); extern int u8_vsnprintf (uint8_t *buf, size_t size, - const char *format, va_list ap); + const char *format, va_list ap); extern int u8_vasprintf (uint8_t **resultp, - const char *format, va_list ap); + const char *format, va_list ap); extern uint8_t * u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, - const char *format, va_list ap); + const char *format, va_list ap); /* UTF-8 format string, result in UTF-8 format. */ extern int u8_u8_sprintf (uint8_t *buf, - const uint8_t *format, ...); + const uint8_t *format, ...); extern int u8_u8_snprintf (uint8_t *buf, size_t size, - const uint8_t *format, ...); + const uint8_t *format, ...); extern int u8_u8_asprintf (uint8_t **resultp, - const uint8_t *format, ...); + const uint8_t *format, ...); extern uint8_t * u8_u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, - const uint8_t *format, ...); + const uint8_t *format, ...); extern int u8_u8_vsprintf (uint8_t *buf, - const uint8_t *format, va_list ap); + const uint8_t *format, va_list ap); extern int u8_u8_vsnprintf (uint8_t *buf, size_t size, - const uint8_t *format, va_list ap); + const uint8_t *format, va_list ap); extern int u8_u8_vasprintf (uint8_t **resultp, - const uint8_t *format, va_list ap); + const uint8_t *format, va_list ap); extern uint8_t * u8_u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, - const uint8_t *format, va_list ap); + const uint8_t *format, va_list ap); /* ASCII format string, result in UTF-16 format. */ extern int u16_sprintf (uint16_t *buf, - const char *format, ...); + const char *format, ...); extern int u16_snprintf (uint16_t *buf, size_t size, - const char *format, ...); + const char *format, ...); extern int u16_asprintf (uint16_t **resultp, - const char *format, ...); + const char *format, ...); extern uint16_t * u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, - const char *format, ...); + const char *format, ...); extern int u16_vsprintf (uint16_t *buf, - const char *format, va_list ap); + const char *format, va_list ap); extern int u16_vsnprintf (uint16_t *buf, size_t size, - const char *format, va_list ap); + const char *format, va_list ap); extern int u16_vasprintf (uint16_t **resultp, - const char *format, va_list ap); + const char *format, va_list ap); extern uint16_t * u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, - const char *format, va_list ap); + const char *format, va_list ap); /* UTF-16 format string, result in UTF-16 format. */ extern int u16_u16_sprintf (uint16_t *buf, - const uint16_t *format, ...); + const uint16_t *format, ...); extern int u16_u16_snprintf (uint16_t *buf, size_t size, - const uint16_t *format, ...); + const uint16_t *format, ...); extern int u16_u16_asprintf (uint16_t **resultp, - const uint16_t *format, ...); + const uint16_t *format, ...); extern uint16_t * u16_u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, - const uint16_t *format, ...); + const uint16_t *format, ...); extern int u16_u16_vsprintf (uint16_t *buf, - const uint16_t *format, va_list ap); + const uint16_t *format, va_list ap); extern int u16_u16_vsnprintf (uint16_t *buf, size_t size, - const uint16_t *format, va_list ap); + const uint16_t *format, va_list ap); extern int u16_u16_vasprintf (uint16_t **resultp, - const uint16_t *format, va_list ap); + const uint16_t *format, va_list ap); extern uint16_t * u16_u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, - const uint16_t *format, va_list ap); + const uint16_t *format, va_list ap); /* ASCII format string, result in UTF-32 format. */ extern int u32_sprintf (uint32_t *buf, - const char *format, ...); + const char *format, ...); extern int u32_snprintf (uint32_t *buf, size_t size, - const char *format, ...); + const char *format, ...); extern int u32_asprintf (uint32_t **resultp, - const char *format, ...); + const char *format, ...); extern uint32_t * u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, - const char *format, ...); + const char *format, ...); extern int u32_vsprintf (uint32_t *buf, - const char *format, va_list ap); + const char *format, va_list ap); extern int u32_vsnprintf (uint32_t *buf, size_t size, - const char *format, va_list ap); + const char *format, va_list ap); extern int u32_vasprintf (uint32_t **resultp, - const char *format, va_list ap); + const char *format, va_list ap); extern uint32_t * u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, - const char *format, va_list ap); + const char *format, va_list ap); /* UTF-32 format string, result in UTF-32 format. */ extern int u32_u32_sprintf (uint32_t *buf, - const uint32_t *format, ...); + const uint32_t *format, ...); extern int u32_u32_snprintf (uint32_t *buf, size_t size, - const uint32_t *format, ...); + const uint32_t *format, ...); extern int u32_u32_asprintf (uint32_t **resultp, - const uint32_t *format, ...); + const uint32_t *format, ...); extern uint32_t * u32_u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, - const uint32_t *format, ...); + const uint32_t *format, ...); extern int u32_u32_vsprintf (uint32_t *buf, - const uint32_t *format, va_list ap); + const uint32_t *format, va_list ap); extern int u32_u32_vsnprintf (uint32_t *buf, size_t size, - const uint32_t *format, va_list ap); + const uint32_t *format, va_list ap); extern int u32_u32_vasprintf (uint32_t **resultp, - const uint32_t *format, va_list ap); + const uint32_t *format, va_list ap); extern uint32_t * u32_u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, - const uint32_t *format, va_list ap); + const uint32_t *format, va_list ap); /* ASCII format string, output to FILE in locale dependent encoding. */ extern int ulc_fprintf (FILE *stream, - const char *format, ...); + const char *format, ...); extern int ulc_vfprintf (FILE *stream, - const char *format, va_list ap); + const char *format, va_list ap); #ifdef __cplusplus } diff --git a/lib/unistdio/u-asnprintf.h b/lib/unistdio/u-asnprintf.h index 8fd08d7..693e35e 100644 --- a/lib/unistdio/u-asnprintf.h +++ b/lib/unistdio/u-asnprintf.h @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-asprintf.h b/lib/unistdio/u-asprintf.h index ba82fab..b7f5cb2 100644 --- a/lib/unistdio/u-asprintf.h +++ b/lib/unistdio/u-asprintf.h @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-printf-args.c b/lib/unistdio/u-printf-args.c index 22fbc08..b357f3c 100644 --- a/lib/unistdio/u-printf-args.c +++ b/lib/unistdio/u-printf-args.c @@ -1,5 +1,6 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-printf-args.h b/lib/unistdio/u-printf-args.h index 7b2255a..4e099fc 100644 --- a/lib/unistdio/u-printf-args.h +++ b/lib/unistdio/u-printf-args.h @@ -1,5 +1,6 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-printf-parse.h b/lib/unistdio/u-printf-parse.h index 11a953f..0f593f8 100644 --- a/lib/unistdio/u-printf-parse.h +++ b/lib/unistdio/u-printf-parse.h @@ -1,5 +1,6 @@ /* Parse printf format string. - Copyright (C) 1999, 2002, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005, 2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-snprintf.h b/lib/unistdio/u-snprintf.h index 1665bc2..391709b 100644 --- a/lib/unistdio/u-snprintf.h +++ b/lib/unistdio/u-snprintf.h @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-sprintf.h b/lib/unistdio/u-sprintf.h index 8a1b554..94f3c82 100644 --- a/lib/unistdio/u-sprintf.h +++ b/lib/unistdio/u-sprintf.h @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-vasprintf.h b/lib/unistdio/u-vasprintf.h index 965bfbf..e67c4cb 100644 --- a/lib/unistdio/u-vasprintf.h +++ b/lib/unistdio/u-vasprintf.h @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u-vsnprintf.h b/lib/unistdio/u-vsnprintf.h index 481a22f..2b2e0d5 100644 --- a/lib/unistdio/u-vsnprintf.h +++ b/lib/unistdio/u-vsnprintf.h @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -31,13 +31,13 @@ VSNPRINTF (DCHAR_T *buf, size_t size, const FCHAR_T *format, va_list args) if (result != buf) { if (size != 0) - { - /* The result did not fit into the buffer. Copy the initial segment - into the buffer, truncating it if necessary. */ - size_t n = (length < size ? length : size - 1); - DCHAR_CPY (buf, result, n); - buf[n] = '\0'; - } + { + /* The result did not fit into the buffer. Copy the initial segment + into the buffer, truncating it if necessary. */ + size_t n = (length < size ? length : size - 1); + DCHAR_CPY (buf, result, n); + buf[n] = '\0'; + } free (result); } diff --git a/lib/unistdio/u-vsprintf.h b/lib/unistdio/u-vsprintf.h index 36ebd9f..0caf073 100644 --- a/lib/unistdio/u-vsprintf.h +++ b/lib/unistdio/u-vsprintf.h @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-asnprintf.c b/lib/unistdio/u16-asnprintf.c index bbe4bac..0705dd9 100644 --- a/lib/unistdio/u16-asnprintf.c +++ b/lib/unistdio/u16-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-asprintf.c b/lib/unistdio/u16-asprintf.c index 79f3969..f7710bb 100644 --- a/lib/unistdio/u16-asprintf.c +++ b/lib/unistdio/u16-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-printf-parse.c b/lib/unistdio/u16-printf-parse.c index 3a8acd3..fbc1083 100644 --- a/lib/unistdio/u16-printf-parse.c +++ b/lib/unistdio/u16-printf-parse.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-snprintf.c b/lib/unistdio/u16-snprintf.c index afed8a7..c2b99a0 100644 --- a/lib/unistdio/u16-snprintf.c +++ b/lib/unistdio/u16-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-sprintf.c b/lib/unistdio/u16-sprintf.c index 4860365..b0e0799 100644 --- a/lib/unistdio/u16-sprintf.c +++ b/lib/unistdio/u16-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-asnprintf.c b/lib/unistdio/u16-u16-asnprintf.c index 64c257c..bfb184a 100644 --- a/lib/unistdio/u16-u16-asnprintf.c +++ b/lib/unistdio/u16-u16-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-asprintf.c b/lib/unistdio/u16-u16-asprintf.c index 38469c6..84f1d66 100644 --- a/lib/unistdio/u16-u16-asprintf.c +++ b/lib/unistdio/u16-u16-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-snprintf.c b/lib/unistdio/u16-u16-snprintf.c index 7229add..d1642e9 100644 --- a/lib/unistdio/u16-u16-snprintf.c +++ b/lib/unistdio/u16-u16-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-sprintf.c b/lib/unistdio/u16-u16-sprintf.c index 1c517c3..5804367 100644 --- a/lib/unistdio/u16-u16-sprintf.c +++ b/lib/unistdio/u16-u16-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-vasnprintf.c b/lib/unistdio/u16-u16-vasnprintf.c index e33851e..5c356bf 100644 --- a/lib/unistdio/u16-u16-vasnprintf.c +++ b/lib/unistdio/u16-u16-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to UTF-16 strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-vasprintf.c b/lib/unistdio/u16-u16-vasprintf.c index 3d8fc50..6202a8b 100644 --- a/lib/unistdio/u16-u16-vasprintf.c +++ b/lib/unistdio/u16-u16-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-vsnprintf.c b/lib/unistdio/u16-u16-vsnprintf.c index 6bbf825..2bf5c0e 100644 --- a/lib/unistdio/u16-u16-vsnprintf.c +++ b/lib/unistdio/u16-u16-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-u16-vsprintf.c b/lib/unistdio/u16-u16-vsprintf.c index 1a7e93c..b87f17e 100644 --- a/lib/unistdio/u16-u16-vsprintf.c +++ b/lib/unistdio/u16-u16-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-vasnprintf.c b/lib/unistdio/u16-vasnprintf.c index 3ce19d4..05d0adf 100644 --- a/lib/unistdio/u16-vasnprintf.c +++ b/lib/unistdio/u16-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to UTF-16 strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-vasprintf.c b/lib/unistdio/u16-vasprintf.c index b63dd18..f917f68 100644 --- a/lib/unistdio/u16-vasprintf.c +++ b/lib/unistdio/u16-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-vsnprintf.c b/lib/unistdio/u16-vsnprintf.c index b06ca09..0b8bfce 100644 --- a/lib/unistdio/u16-vsnprintf.c +++ b/lib/unistdio/u16-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u16-vsprintf.c b/lib/unistdio/u16-vsprintf.c index 4811bc1..7026a68 100644 --- a/lib/unistdio/u16-vsprintf.c +++ b/lib/unistdio/u16-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-asnprintf.c b/lib/unistdio/u32-asnprintf.c index dad1ae4..c4eefd6 100644 --- a/lib/unistdio/u32-asnprintf.c +++ b/lib/unistdio/u32-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-asprintf.c b/lib/unistdio/u32-asprintf.c index 11e23f0..6773032 100644 --- a/lib/unistdio/u32-asprintf.c +++ b/lib/unistdio/u32-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-printf-parse.c b/lib/unistdio/u32-printf-parse.c index a577256..bc3c7f2 100644 --- a/lib/unistdio/u32-printf-parse.c +++ b/lib/unistdio/u32-printf-parse.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-snprintf.c b/lib/unistdio/u32-snprintf.c index 7d67017..0636eef 100644 --- a/lib/unistdio/u32-snprintf.c +++ b/lib/unistdio/u32-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-sprintf.c b/lib/unistdio/u32-sprintf.c index 6f930d0..207078b 100644 --- a/lib/unistdio/u32-sprintf.c +++ b/lib/unistdio/u32-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-asnprintf.c b/lib/unistdio/u32-u32-asnprintf.c index b3a0274..bd37c80 100644 --- a/lib/unistdio/u32-u32-asnprintf.c +++ b/lib/unistdio/u32-u32-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-asprintf.c b/lib/unistdio/u32-u32-asprintf.c index 91a96fc..edc16e7 100644 --- a/lib/unistdio/u32-u32-asprintf.c +++ b/lib/unistdio/u32-u32-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-snprintf.c b/lib/unistdio/u32-u32-snprintf.c index cf88529..a36c123 100644 --- a/lib/unistdio/u32-u32-snprintf.c +++ b/lib/unistdio/u32-u32-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-sprintf.c b/lib/unistdio/u32-u32-sprintf.c index ccf6d02..eb322fc 100644 --- a/lib/unistdio/u32-u32-sprintf.c +++ b/lib/unistdio/u32-u32-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-vasnprintf.c b/lib/unistdio/u32-u32-vasnprintf.c index b272af3..17ae282 100644 --- a/lib/unistdio/u32-u32-vasnprintf.c +++ b/lib/unistdio/u32-u32-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to UTF-32 strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-vasprintf.c b/lib/unistdio/u32-u32-vasprintf.c index bacc7c1..678e2fd 100644 --- a/lib/unistdio/u32-u32-vasprintf.c +++ b/lib/unistdio/u32-u32-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-vsnprintf.c b/lib/unistdio/u32-u32-vsnprintf.c index 7f43623..c42678b 100644 --- a/lib/unistdio/u32-u32-vsnprintf.c +++ b/lib/unistdio/u32-u32-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-u32-vsprintf.c b/lib/unistdio/u32-u32-vsprintf.c index 46d299a..6a18598 100644 --- a/lib/unistdio/u32-u32-vsprintf.c +++ b/lib/unistdio/u32-u32-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-vasnprintf.c b/lib/unistdio/u32-vasnprintf.c index 6aac623..86a3564 100644 --- a/lib/unistdio/u32-vasnprintf.c +++ b/lib/unistdio/u32-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to UTF-32 strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-vasprintf.c b/lib/unistdio/u32-vasprintf.c index e6883e3..ef4ed97 100644 --- a/lib/unistdio/u32-vasprintf.c +++ b/lib/unistdio/u32-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-vsnprintf.c b/lib/unistdio/u32-vsnprintf.c index a55e1c7..ba47a3c 100644 --- a/lib/unistdio/u32-vsnprintf.c +++ b/lib/unistdio/u32-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u32-vsprintf.c b/lib/unistdio/u32-vsprintf.c index a850e45..26b1e95 100644 --- a/lib/unistdio/u32-vsprintf.c +++ b/lib/unistdio/u32-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-asnprintf.c b/lib/unistdio/u8-asnprintf.c index b8e7a27..839e6e2 100644 --- a/lib/unistdio/u8-asnprintf.c +++ b/lib/unistdio/u8-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-asprintf.c b/lib/unistdio/u8-asprintf.c index 22b0170..8004b96 100644 --- a/lib/unistdio/u8-asprintf.c +++ b/lib/unistdio/u8-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-printf-parse.c b/lib/unistdio/u8-printf-parse.c index a355548..6b87299 100644 --- a/lib/unistdio/u8-printf-parse.c +++ b/lib/unistdio/u8-printf-parse.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-snprintf.c b/lib/unistdio/u8-snprintf.c index 8729054..ce0f7de 100644 --- a/lib/unistdio/u8-snprintf.c +++ b/lib/unistdio/u8-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-sprintf.c b/lib/unistdio/u8-sprintf.c index 330feae..2467fbb 100644 --- a/lib/unistdio/u8-sprintf.c +++ b/lib/unistdio/u8-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-asnprintf.c b/lib/unistdio/u8-u8-asnprintf.c index 9379c72..cdcd6c8 100644 --- a/lib/unistdio/u8-u8-asnprintf.c +++ b/lib/unistdio/u8-u8-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-asprintf.c b/lib/unistdio/u8-u8-asprintf.c index 5974527..8e34f3d 100644 --- a/lib/unistdio/u8-u8-asprintf.c +++ b/lib/unistdio/u8-u8-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-snprintf.c b/lib/unistdio/u8-u8-snprintf.c index 26dfac0..615c5cb 100644 --- a/lib/unistdio/u8-u8-snprintf.c +++ b/lib/unistdio/u8-u8-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-sprintf.c b/lib/unistdio/u8-u8-sprintf.c index 53b3c96..57c5642 100644 --- a/lib/unistdio/u8-u8-sprintf.c +++ b/lib/unistdio/u8-u8-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-vasnprintf.c b/lib/unistdio/u8-u8-vasnprintf.c index 7535d4c..588947d 100644 --- a/lib/unistdio/u8-u8-vasnprintf.c +++ b/lib/unistdio/u8-u8-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to UTF-8 strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-vasprintf.c b/lib/unistdio/u8-u8-vasprintf.c index bb28dc5..6a3732d 100644 --- a/lib/unistdio/u8-u8-vasprintf.c +++ b/lib/unistdio/u8-u8-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-vsnprintf.c b/lib/unistdio/u8-u8-vsnprintf.c index f9e9922..2ebb19a 100644 --- a/lib/unistdio/u8-u8-vsnprintf.c +++ b/lib/unistdio/u8-u8-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-u8-vsprintf.c b/lib/unistdio/u8-u8-vsprintf.c index 9e66018..ca4c656 100644 --- a/lib/unistdio/u8-u8-vsprintf.c +++ b/lib/unistdio/u8-u8-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-vasnprintf.c b/lib/unistdio/u8-vasnprintf.c index 0067e6c..304c54c 100644 --- a/lib/unistdio/u8-vasnprintf.c +++ b/lib/unistdio/u8-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to UTF-8 strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-vasprintf.c b/lib/unistdio/u8-vasprintf.c index 304d496..5b7f719 100644 --- a/lib/unistdio/u8-vasprintf.c +++ b/lib/unistdio/u8-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-vsnprintf.c b/lib/unistdio/u8-vsnprintf.c index 87388e2..4f6f1fa 100644 --- a/lib/unistdio/u8-vsnprintf.c +++ b/lib/unistdio/u8-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/u8-vsprintf.c b/lib/unistdio/u8-vsprintf.c index aa0b52d..7397d28 100644 --- a/lib/unistdio/u8-vsprintf.c +++ b/lib/unistdio/u8-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-asnprintf.c b/lib/unistdio/ulc-asnprintf.c index 31d3f22..5a79c8c 100644 --- a/lib/unistdio/ulc-asnprintf.c +++ b/lib/unistdio/ulc-asnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-asprintf.c b/lib/unistdio/ulc-asprintf.c index 4f760e1..a97a3fe 100644 --- a/lib/unistdio/ulc-asprintf.c +++ b/lib/unistdio/ulc-asprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-fprintf.c b/lib/unistdio/ulc-fprintf.c index ac8ab6f..fb2b9e2 100644 --- a/lib/unistdio/ulc-fprintf.c +++ b/lib/unistdio/ulc-fprintf.c @@ -1,5 +1,5 @@ /* Formatted output to a stream. - Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -55,11 +55,11 @@ ulc_fprintf (FILE *fp, const char *format, ...) if (fwrite (output, 1, len, fp) < len) { if (output != buf) - { - int saved_errno = errno; - free (output); - errno = saved_errno; - } + { + int saved_errno = errno; + free (output); + errno = saved_errno; + } return -1; } diff --git a/lib/unistdio/ulc-printf-parse.c b/lib/unistdio/ulc-printf-parse.c index 81af369..a2e22b2 100644 --- a/lib/unistdio/ulc-printf-parse.c +++ b/lib/unistdio/ulc-printf-parse.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-snprintf.c b/lib/unistdio/ulc-snprintf.c index f774ac0..9b57ada 100644 --- a/lib/unistdio/ulc-snprintf.c +++ b/lib/unistdio/ulc-snprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-sprintf.c b/lib/unistdio/ulc-sprintf.c index 466ffb4..a9f3c4e 100644 --- a/lib/unistdio/ulc-sprintf.c +++ b/lib/unistdio/ulc-sprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-vasnprintf.c b/lib/unistdio/ulc-vasnprintf.c index e89b7ff..ef652b9 100644 --- a/lib/unistdio/ulc-vasnprintf.c +++ b/lib/unistdio/ulc-vasnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-vasprintf.c b/lib/unistdio/ulc-vasprintf.c index 8773ab4..24c7723 100644 --- a/lib/unistdio/ulc-vasprintf.c +++ b/lib/unistdio/ulc-vasprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-vfprintf.c b/lib/unistdio/ulc-vfprintf.c index 586fe13..d714010 100644 --- a/lib/unistdio/ulc-vfprintf.c +++ b/lib/unistdio/ulc-vfprintf.c @@ -1,5 +1,5 @@ /* Formatted output to a stream. - Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -52,11 +52,11 @@ ulc_vfprintf (FILE *fp, const char *format, va_list args) if (fwrite (output, 1, len, fp) < len) { if (output != buf) - { - int saved_errno = errno; - free (output); - errno = saved_errno; - } + { + int saved_errno = errno; + free (output); + errno = saved_errno; + } return -1; } diff --git a/lib/unistdio/ulc-vsnprintf.c b/lib/unistdio/ulc-vsnprintf.c index c166535..7a43eb2 100644 --- a/lib/unistdio/ulc-vsnprintf.c +++ b/lib/unistdio/ulc-vsnprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistdio/ulc-vsprintf.c b/lib/unistdio/ulc-vsprintf.c index 0cccc05..9b19a33 100644 --- a/lib/unistdio/ulc-vsprintf.c +++ b/lib/unistdio/ulc-vsprintf.c @@ -1,5 +1,6 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/unistr.h b/lib/unistr.h index 01ecc37..4d3c325 100644 --- a/lib/unistr.h +++ b/lib/unistr.h @@ -1,5 +1,5 @@ /* Elementary Unicode string functions. - Copyright (C) 2001-2002, 2005-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -19,6 +19,9 @@ #include "unitypes.h" +/* Get common macros for C. */ +#include <unistring/cdefs.h> + /* Get inline if available. */ #include <unistring/inline.h> @@ -84,32 +87,32 @@ extern const uint32_t * /* Convert an UTF-8 string to an UTF-16 string. */ extern uint16_t * u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf, - size_t *lengthp); + size_t *lengthp); /* Convert an UTF-8 string to an UCS-4 string. */ extern uint32_t * u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf, - size_t *lengthp); + size_t *lengthp); /* Convert an UTF-16 string to an UTF-8 string. */ extern uint8_t * u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf, - size_t *lengthp); + size_t *lengthp); /* Convert an UTF-16 string to an UCS-4 string. */ extern uint32_t * u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf, - size_t *lengthp); + size_t *lengthp); /* Convert an UCS-4 string to an UTF-8 string. */ extern uint8_t * u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf, - size_t *lengthp); + size_t *lengthp); /* Convert an UCS-4 string to an UTF-16 string. */ extern uint16_t * u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf, - size_t *lengthp); + size_t *lengthp); /* Elementary string functions. */ @@ -186,7 +189,8 @@ extern int u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n); # else static inline int -u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_) +u32_mbtouc_unsafe (ucs4_t *puc, + const uint32_t *s, size_t n _GL_UNUSED_PARAMETER) { uint32_t c = *s; @@ -256,7 +260,7 @@ extern int u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n); # else static inline int -u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_) +u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER) { uint32_t c = *s; @@ -354,12 +358,12 @@ u32_uctomb (uint32_t *s, ucs4_t uc, int n) if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000)) { if (n > 0) - { - *s = uc; - return 1; - } + { + *s = uc; + return 1; + } else - return -2; + return -2; } else return -1; @@ -528,8 +532,8 @@ extern uint16_t * extern uint32_t * u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n); -/* Copy no more than N units of SRC to DEST, returning the address of - the last unit written into DEST. */ +/* Copy no more than N units of SRC to DEST. Return a pointer past the last + non-NUL unit written into DEST. */ /* Similar to stpncpy(). */ extern uint8_t * u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n); diff --git a/lib/unistr/u-cmp2.h b/lib/unistr/u-cmp2.h index ae3750c..6058c4a 100644 --- a/lib/unistr/u-cmp2.h +++ b/lib/unistr/u-cmp2.h @@ -1,5 +1,5 @@ /* Compare pieces of UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -23,9 +23,9 @@ FUNC (const UNIT *s1, size_t n1, const UNIT *s2, size_t n2) if (cmp == 0) { if (n1 < n2) - cmp = -1; + cmp = -1; else if (n1 > n2) - cmp = 1; + cmp = 1; } return cmp; diff --git a/lib/unistr/u-cpy-alloc.h b/lib/unistr/u-cpy-alloc.h index dace3e2..f36a8d0 100644 --- a/lib/unistr/u-cpy-alloc.h +++ b/lib/unistr/u-cpy-alloc.h @@ -1,5 +1,6 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,7 +31,7 @@ FUNC (const UNIT *s, size_t n) UNIT *destptr = dest; for (; n > 0; n--) - *destptr++ = *s++; + *destptr++ = *s++; #else memcpy ((char *) dest, (const char *) s, n * sizeof (UNIT)); #endif diff --git a/lib/unistr/u-cpy.h b/lib/unistr/u-cpy.h index c660eae..6dad952 100644 --- a/lib/unistr/u-cpy.h +++ b/lib/unistr/u-cpy.h @@ -1,5 +1,5 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-endswith.h b/lib/unistr/u-endswith.h index 739bfbb..094a87f 100644 --- a/lib/unistr/u-endswith.h +++ b/lib/unistr/u-endswith.h @@ -1,5 +1,5 @@ /* Substring test for UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-move.h b/lib/unistr/u-move.h index 77b6788..d8d58b0 100644 --- a/lib/unistr/u-move.h +++ b/lib/unistr/u-move.h @@ -1,5 +1,5 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -27,7 +27,7 @@ FUNC (UNIT *dest, const UNIT *src, size_t n) const UNIT *srcptr = src; for (; n > 0; n--) - *destptr++ = *srcptr++; + *destptr++ = *srcptr++; } else if (dest > src) { @@ -35,7 +35,7 @@ FUNC (UNIT *dest, const UNIT *src, size_t n) const UNIT *srcptr = src + n - 1; for (; n > 0; n--) - *destptr-- = *srcptr--; + *destptr-- = *srcptr--; } #else memmove ((char *) dest, (const char *) src, n * sizeof (UNIT)); diff --git a/lib/unistr/u-set.h b/lib/unistr/u-set.h index a093e7f..de78a8e 100644 --- a/lib/unistr/u-set.h +++ b/lib/unistr/u-set.h @@ -1,5 +1,5 @@ /* Fill UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -23,17 +23,17 @@ FUNC (UNIT *s, ucs4_t uc, size_t n) if (n > 0) { if (IS_SINGLE_UNIT (uc)) - { - UNIT *ptr = s; + { + UNIT *ptr = s; - for (; n > 0; n--) - *ptr++ = uc; - } + for (; n > 0; n--) + *ptr++ = uc; + } else - { - errno = EILSEQ; - return NULL; - } + { + errno = EILSEQ; + return NULL; + } } return s; } diff --git a/lib/unistr/u-startswith.h b/lib/unistr/u-startswith.h index 0486ef8..1696651 100644 --- a/lib/unistr/u-startswith.h +++ b/lib/unistr/u-startswith.h @@ -1,5 +1,5 @@ /* Substring test for UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -23,8 +23,8 @@ FUNC (const UNIT *str, const UNIT *prefix) UNIT uc1 = *str++; UNIT uc2 = *prefix++; if (uc2 == 0) - return true; + return true; if (uc1 != uc2) - return false; + return false; } } diff --git a/lib/unistr/u-stpcpy.h b/lib/unistr/u-stpcpy.h index b13e816..483f3c2 100644 --- a/lib/unistr/u-stpcpy.h +++ b/lib/unistr/u-stpcpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-stpncpy.h b/lib/unistr/u-stpncpy.h index 09bf434..4d6dd3c 100644 --- a/lib/unistr/u-stpncpy.h +++ b/lib/unistr/u-stpncpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -23,8 +23,12 @@ FUNC (UNIT *dest, const UNIT *src, size_t n) /* This behavior is rarely useful, but it is here for consistency with strncpy and wcsncpy. */ - for (; n > 0; n--) - *dest++ = 0; + { + UNIT *destptr = dest; - return dest - 1; + for (; n > 0; n--) + *destptr++ = 0; + } + + return dest; } diff --git a/lib/unistr/u-strcat.h b/lib/unistr/u-strcat.h index e86bbf9..84430fc 100644 --- a/lib/unistr/u-strcat.h +++ b/lib/unistr/u-strcat.h @@ -1,5 +1,5 @@ /* Concatenate UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strcoll.h b/lib/unistr/u-strcoll.h index af404a0..9ec5c60 100644 --- a/lib/unistr/u-strcoll.h +++ b/lib/unistr/u-strcoll.h @@ -1,6 +1,6 @@ /* Compare UTF-8/UTF-16/UTF-32 strings using the collation rules of the current locale. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -32,48 +32,54 @@ FUNC (const UNIT *s1, const UNIT *s2) { sl2 = U_STRCONV_TO_LOCALE (s2); if (sl2 != NULL) - { - /* Compare sl1 and sl2. */ - errno = 0; - result = strcoll (sl1, sl2); - if (errno == 0) - { - /* strcoll succeeded. */ - free (sl1); - free (sl2); - } - else - { - /* strcoll failed. */ - final_errno = errno; - free (sl1); - free (sl2); - result = U_STRCMP (s1, s2); - } - } + { + /* Compare sl1 and sl2. */ + errno = 0; + result = strcoll (sl1, sl2); + if (errno == 0) + { + /* strcoll succeeded. */ + free (sl1); + free (sl2); + /* The conversion to locale encoding can do transliteration or + map some characters to question marks. Therefore sl1 and sl2 + may be equal when s1 and s2 were in fact different. Return a + nonzero result in this case. */ + if (result == 0) + result = U_STRCMP (s1, s2); + } + else + { + /* strcoll failed. */ + final_errno = errno; + free (sl1); + free (sl2); + result = U_STRCMP (s1, s2); + } + } else - { - /* s1 could be converted to locale encoding, s2 not. */ - final_errno = errno; - free (sl1); - result = -1; - } + { + /* s1 could be converted to locale encoding, s2 not. */ + final_errno = errno; + free (sl1); + result = -1; + } } else { final_errno = errno; sl2 = U_STRCONV_TO_LOCALE (s2); if (sl2 != NULL) - { - /* s2 could be converted to locale encoding, s1 not. */ - free (sl2); - result = 1; - } + { + /* s2 could be converted to locale encoding, s1 not. */ + free (sl2); + result = 1; + } else - { - /* Neither s1 nor s2 could be converted to locale encoding. */ - result = U_STRCMP (s1, s2); - } + { + /* Neither s1 nor s2 could be converted to locale encoding. */ + result = U_STRCMP (s1, s2); + } } errno = final_errno; diff --git a/lib/unistr/u-strcpy.h b/lib/unistr/u-strcpy.h index 153f60e..b059aea 100644 --- a/lib/unistr/u-strcpy.h +++ b/lib/unistr/u-strcpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strcspn.h b/lib/unistr/u-strcspn.h index de32656..77b9550 100644 --- a/lib/unistr/u-strcspn.h +++ b/lib/unistr/u-strcspn.h @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -26,11 +26,11 @@ FUNC (const UNIT *str, const UNIT *reject) int count = U_STRMBTOUC (&uc, reject); if (count >= 0 && reject[count] == 0) { - const UNIT *found = U_STRCHR (str, uc); - if (found != NULL) - return found - str; - else - return U_STRLEN (str); + const UNIT *found = U_STRCHR (str, uc); + if (found != NULL) + return found - str; + else + return U_STRLEN (str); } } /* General case. */ @@ -39,15 +39,15 @@ FUNC (const UNIT *str, const UNIT *reject) for (;;) { - ucs4_t uc; - int count = U_STRMBTOUC (&uc, ptr); - if (count == 0) - return ptr - str; - if (count < 0) - break; - if (U_STRCHR (reject, uc)) - return ptr - str; - ptr += count; + ucs4_t uc; + int count = U_STRMBTOUC (&uc, ptr); + if (count == 0) + return ptr - str; + if (count < 0) + break; + if (U_STRCHR (reject, uc)) + return ptr - str; + ptr += count; } return U_STRLEN (str); } diff --git a/lib/unistr/u-strdup.h b/lib/unistr/u-strdup.h index 71e527a..a92e1ef 100644 --- a/lib/unistr/u-strdup.h +++ b/lib/unistr/u-strdup.h @@ -1,5 +1,6 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,7 +32,7 @@ FUNC (const UNIT *s) UNIT *destptr = dest; for (; n > 0; n--) - *destptr++ = *s++; + *destptr++ = *s++; #else memcpy ((char *) dest, (const char *) s, n * sizeof (UNIT)); #endif diff --git a/lib/unistr/u-strlen.h b/lib/unistr/u-strlen.h index 51dcae0..a54d614 100644 --- a/lib/unistr/u-strlen.h +++ b/lib/unistr/u-strlen.h @@ -1,5 +1,5 @@ /* Determine length of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strncat.h b/lib/unistr/u-strncat.h index 40b442e..e5c9a04 100644 --- a/lib/unistr/u-strncat.h +++ b/lib/unistr/u-strncat.h @@ -1,5 +1,5 @@ /* Concatenate UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strncpy.h b/lib/unistr/u-strncpy.h index 3d441b5..55a4f67 100644 --- a/lib/unistr/u-strncpy.h +++ b/lib/unistr/u-strncpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strnlen.h b/lib/unistr/u-strnlen.h index 6a1d2ad..9bcc3da 100644 --- a/lib/unistr/u-strnlen.h +++ b/lib/unistr/u-strnlen.h @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strpbrk.h b/lib/unistr/u-strpbrk.h index 2ff4618..34aabc5 100644 --- a/lib/unistr/u-strpbrk.h +++ b/lib/unistr/u-strpbrk.h @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,13 +33,13 @@ FUNC (const UNIT *str, const UNIT *accept) for (;;) { - ucs4_t uc; - int count = U_STRMBTOUC (&uc, ptr); - if (count <= 0) - break; - if (U_STRCHR (accept, uc)) - return (UNIT *) ptr; - ptr += count; + ucs4_t uc; + int count = U_STRMBTOUC (&uc, ptr); + if (count <= 0) + break; + if (U_STRCHR (accept, uc)) + return (UNIT *) ptr; + ptr += count; } return NULL; } diff --git a/lib/unistr/u-strspn.h b/lib/unistr/u-strspn.h index 6502ce4..d6669af 100644 --- a/lib/unistr/u-strspn.h +++ b/lib/unistr/u-strspn.h @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -26,11 +26,11 @@ FUNC (const UNIT *str, const UNIT *accept) int count = U_STRMBTOUC (&uc, accept); if (count >= 0 && accept[count] == 0) { - const UNIT *ptr = str; - for (; *ptr != 0; ptr += count) - if (U_CMP (ptr, accept, count) != 0) - break; - return ptr - str; + const UNIT *ptr = str; + for (; *ptr != 0; ptr += count) + if (U_CMP (ptr, accept, count) != 0) + break; + return ptr - str; } } /* General case. */ @@ -39,15 +39,15 @@ FUNC (const UNIT *str, const UNIT *accept) for (;;) { - ucs4_t uc; - int count = U_STRMBTOUC (&uc, ptr); - if (count == 0) - return ptr - str; - if (count < 0) - break; - if (!U_STRCHR (accept, uc)) - return ptr - str; - ptr += count; + ucs4_t uc; + int count = U_STRMBTOUC (&uc, ptr); + if (count == 0) + return ptr - str; + if (count < 0) + break; + if (!U_STRCHR (accept, uc)) + return ptr - str; + ptr += count; } return U_STRLEN (str); } diff --git a/lib/unistr/u-strstr.h b/lib/unistr/u-strstr.h index 55b5a31..df32be8 100644 --- a/lib/unistr/u-strstr.h +++ b/lib/unistr/u-strstr.h @@ -1,5 +1,5 @@ /* Substring test for UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -32,17 +32,17 @@ FUNC (const UNIT *haystack, const UNIT *needle) for (; *haystack != 0; haystack++) if (*haystack == first) { - /* Compare with needle's remaining units. */ - const UNIT *hptr = haystack + 1; - const UNIT *nptr = needle + 1; - for (;;) - { - if (*hptr != *nptr) - break; - hptr++; nptr++; - if (*nptr == 0) - return (UNIT *) haystack; - } + /* Compare with needle's remaining units. */ + const UNIT *hptr = haystack + 1; + const UNIT *nptr = needle + 1; + for (;;) + { + if (*hptr != *nptr) + break; + hptr++; nptr++; + if (*nptr == 0) + return (UNIT *) haystack; + } } return NULL; diff --git a/lib/unistr/u-strtok.h b/lib/unistr/u-strtok.h index 7ed57d6..7fdef57 100644 --- a/lib/unistr/u-strtok.h +++ b/lib/unistr/u-strtok.h @@ -1,5 +1,5 @@ /* Tokenize UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -22,7 +22,7 @@ FUNC (UNIT *str, const UNIT *delim, UNIT **ptr) { str = *ptr; if (str == NULL) - return NULL; /* reminder that end of token sequence has been reached */ + return NULL; /* reminder that end of token sequence has been reached */ } /* Skip leading delimiters. */ @@ -40,9 +40,9 @@ FUNC (UNIT *str, const UNIT *delim, UNIT **ptr) UNIT *token_end = U_STRPBRK (str, delim); if (token_end) { - /* NUL-terminate the token. */ - *token_end = 0; - *ptr = token_end + 1; + /* NUL-terminate the token. */ + *token_end = 0; + *ptr = token_end + 1; } else *ptr = NULL; diff --git a/lib/unistr/u16-check.c b/lib/unistr/u16-check.c index 380cec2..4f18383 100644 --- a/lib/unistr/u16-check.c +++ b/lib/unistr/u16-check.c @@ -1,5 +1,5 @@ /* Check UTF-16 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,19 +31,19 @@ u16_check (const uint16_t *s, size_t n) uint16_t c = *s; if (c < 0xd800 || c >= 0xe000) - { - s++; - continue; - } + { + s++; + continue; + } if (c < 0xdc00) - { - if (s + 2 <= s_end - && s[1] >= 0xdc00 && s[1] < 0xe000) - { - s += 2; - continue; - } - } + { + if (s + 2 <= s_end + && s[1] >= 0xdc00 && s[1] < 0xe000) + { + s += 2; + continue; + } + } /* invalid or incomplete multibyte character */ return s; } diff --git a/lib/unistr/u16-chr.c b/lib/unistr/u16-chr.c index 2d7d797..13deef4 100644 --- a/lib/unistr/u16-chr.c +++ b/lib/unistr/u16-chr.c @@ -1,5 +1,6 @@ /* Search character in piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,27 +31,27 @@ u16_chr (const uint16_t *s, size_t n, ucs4_t uc) uint16_t c0 = uc; for (; n > 0; s++, n--) - { - if (*s == c0) - return (uint16_t *) s; - } + { + if (*s == c0) + return (uint16_t *) s; + } } else switch (u16_uctomb_aux (c, uc, 2)) { case 2: - if (n > 1) - { - uint16_t c0 = c[0]; - uint16_t c1 = c[1]; - - for (n--; n > 0; s++, n--) - { - if (*s == c0 && s[1] == c1) - return (uint16_t *) s; - } - } - break; + if (n > 1) + { + uint16_t c0 = c[0]; + uint16_t c1 = c[1]; + + for (n--; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1) + return (uint16_t *) s; + } + } + break; } return NULL; } diff --git a/lib/unistr/u16-cmp.c b/lib/unistr/u16-cmp.c index 0130d27..b71c1c3 100644 --- a/lib/unistr/u16-cmp.c +++ b/lib/unistr/u16-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-16 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,22 +31,22 @@ u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n) uint16_t c1 = *s1++; uint16_t c2 = *s2++; if (c1 == c2) - { - n--; - continue; - } + { + n--; + continue; + } if (c1 < 0xd800 || c1 >= 0xe000) - { - if (!(c2 < 0xd800 || c2 >= 0xe000)) - /* c2 is a surrogate, but c1 is not. */ - return -1; - } + { + if (!(c2 < 0xd800 || c2 >= 0xe000)) + /* c2 is a surrogate, but c1 is not. */ + return -1; + } else - { - if (c2 < 0xd800 || c2 >= 0xe000) - /* c1 is a surrogate, but c2 is not. */ - return 1; - } + { + if (c2 < 0xd800 || c2 >= 0xe000) + /* c1 is a surrogate, but c2 is not. */ + return 1; + } return (int)c1 - (int)c2; /* > 0 if c1 > c2, < 0 if c1 < c2. */ } diff --git a/lib/unistr/u16-cmp2.c b/lib/unistr/u16-cmp2.c index 766dcd2..8c2a8d6 100644 --- a/lib/unistr/u16-cmp2.c +++ b/lib/unistr/u16-cmp2.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-cpy-alloc.c b/lib/unistr/u16-cpy-alloc.c index 047977e..33984f9 100644 --- a/lib/unistr/u16-cpy-alloc.c +++ b/lib/unistr/u16-cpy-alloc.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-cpy.c b/lib/unistr/u16-cpy.c index 13e04b8..614d24c 100644 --- a/lib/unistr/u16-cpy.c +++ b/lib/unistr/u16-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-endswith.c b/lib/unistr/u16-endswith.c index d9abf46..27dcd5a 100644 --- a/lib/unistr/u16-endswith.c +++ b/lib/unistr/u16-endswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-16 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mblen.c b/lib/unistr/u16-mblen.c index 6bb35ac..9e7a93a 100644 --- a/lib/unistr/u16-mblen.c +++ b/lib/unistr/u16-mblen.c @@ -1,5 +1,6 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -29,19 +30,19 @@ u16_mblen (const uint16_t *s, size_t n) uint16_t c = *s; if (c < 0xd800 || c >= 0xe000) - return (c != 0 ? 1 : 0); + return (c != 0 ? 1 : 0); #if CONFIG_UNICODE_SAFETY if (c < 0xdc00) - { - if (n >= 2 - && s[1] >= 0xdc00 && s[1] < 0xe000) - return 2; - } + { + if (n >= 2 + && s[1] >= 0xdc00 && s[1] < 0xe000) + return 2; + } #else - { - if (n >= 2) - return 2; - } + { + if (n >= 2) + return 2; + } #endif } /* invalid or incomplete multibyte character */ diff --git a/lib/unistr/u16-mbsnlen.c b/lib/unistr/u16-mbsnlen.c index 881958e..601d81d 100644 --- a/lib/unistr/u16-mbsnlen.c +++ b/lib/unistr/u16-mbsnlen.c @@ -1,5 +1,5 @@ /* Count characters in UTF-16 string. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -28,12 +28,15 @@ u16_mbsnlen (const uint16_t *s, size_t n) characters = 0; while (n > 0) { - int count = u16_mblen (s, n); + ucs4_t uc; + int count = u16_mbtoucr (&uc, s, n); + characters++; + if (count == -2) + break; if (count <= 0) - count = 1; + count = 1; s += count; n -= count; - characters++; } return characters; } diff --git a/lib/unistr/u16-mbtouc-aux.c b/lib/unistr/u16-mbtouc-aux.c index 5f35b86..bee77fc 100644 --- a/lib/unistr/u16-mbtouc-aux.c +++ b/lib/unistr/u16-mbtouc-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-16 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -30,18 +30,18 @@ u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n) if (c < 0xdc00) { if (n >= 2) - { - if (s[1] >= 0xdc00 && s[1] < 0xe000) - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } - /* invalid multibyte character */ - } + { + if (s[1] >= 0xdc00 && s[1] < 0xe000) + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } + /* invalid multibyte character */ + } else - { - /* incomplete multibyte character */ - } + { + /* incomplete multibyte character */ + } } /* invalid multibyte character */ *puc = 0xfffd; diff --git a/lib/unistr/u16-mbtouc-unsafe-aux.c b/lib/unistr/u16-mbtouc-unsafe-aux.c index 9906e30..f2d7225 100644 --- a/lib/unistr/u16-mbtouc-unsafe-aux.c +++ b/lib/unistr/u16-mbtouc-unsafe-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-16 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -32,20 +32,20 @@ u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n) #endif { if (n >= 2) - { + { #if CONFIG_UNICODE_SAFETY - if (s[1] >= 0xdc00 && s[1] < 0xe000) + if (s[1] >= 0xdc00 && s[1] < 0xe000) #endif - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } - /* invalid multibyte character */ - } + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } + /* invalid multibyte character */ + } else - { - /* incomplete multibyte character */ - } + { + /* incomplete multibyte character */ + } } /* invalid multibyte character */ *puc = 0xfffd; diff --git a/lib/unistr/u16-mbtouc-unsafe.c b/lib/unistr/u16-mbtouc-unsafe.c index cc858d8..a5a3638 100644 --- a/lib/unistr/u16-mbtouc-unsafe.c +++ b/lib/unistr/u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -43,20 +43,20 @@ u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n) #endif { if (n >= 2) - { + { #if CONFIG_UNICODE_SAFETY - if (s[1] >= 0xdc00 && s[1] < 0xe000) + if (s[1] >= 0xdc00 && s[1] < 0xe000) #endif - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } - /* invalid multibyte character */ - } + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } + /* invalid multibyte character */ + } else - { - /* incomplete multibyte character */ - } + { + /* incomplete multibyte character */ + } } /* invalid multibyte character */ *puc = 0xfffd; diff --git a/lib/unistr/u16-mbtouc.c b/lib/unistr/u16-mbtouc.c index 2691db8..26b6089 100644 --- a/lib/unistr/u16-mbtouc.c +++ b/lib/unistr/u16-mbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -40,18 +40,18 @@ u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n) if (c < 0xdc00) { if (n >= 2) - { - if (s[1] >= 0xdc00 && s[1] < 0xe000) - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } - /* invalid multibyte character */ - } + { + if (s[1] >= 0xdc00 && s[1] < 0xe000) + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } + /* invalid multibyte character */ + } else - { - /* incomplete multibyte character */ - } + { + /* incomplete multibyte character */ + } } /* invalid multibyte character */ *puc = 0xfffd; diff --git a/lib/unistr/u16-mbtoucr.c b/lib/unistr/u16-mbtoucr.c index a1bd8ee..00b7b70 100644 --- a/lib/unistr/u16-mbtoucr.c +++ b/lib/unistr/u16-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string, returning an error code. - Copyright (C) 1999-2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -33,20 +33,20 @@ u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n) if (c < 0xdc00) { if (n >= 2) - { - if (s[1] >= 0xdc00 && s[1] < 0xe000) - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } - /* invalid multibyte character */ - } + { + if (s[1] >= 0xdc00 && s[1] < 0xe000) + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } + /* invalid multibyte character */ + } else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } } /* invalid multibyte character */ *puc = 0xfffd; diff --git a/lib/unistr/u16-move.c b/lib/unistr/u16-move.c index 2bf8c61..f6efb88 100644 --- a/lib/unistr/u16-move.c +++ b/lib/unistr/u16-move.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-next.c b/lib/unistr/u16-next.c index 7c49f72..8245f11 100644 --- a/lib/unistr/u16-next.c +++ b/lib/unistr/u16-next.c @@ -1,5 +1,5 @@ /* Iterate over next character in UTF-16 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,7 +31,7 @@ u16_next (ucs4_t *puc, const uint16_t *s) else { if (count < 0) - *puc = 0xfffd; + *puc = 0xfffd; return NULL; } } diff --git a/lib/unistr/u16-prev.c b/lib/unistr/u16-prev.c index 3beecf0..4c902ad 100644 --- a/lib/unistr/u16-prev.c +++ b/lib/unistr/u16-prev.c @@ -1,5 +1,5 @@ /* Iterate over previous character in UTF-16 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -29,25 +29,25 @@ u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start) uint16_t c_1 = s[-1]; if (c_1 < 0xd800 || c_1 >= 0xe000) - { - *puc = c_1; - return s - 1; - } + { + *puc = c_1; + return s - 1; + } #if CONFIG_UNICODE_SAFETY if (c_1 >= 0xdc00) #endif - if (s - 1 != start) - { - uint16_t c_2 = s[-2]; + if (s - 1 != start) + { + uint16_t c_2 = s[-2]; #if CONFIG_UNICODE_SAFETY - if (c_2 >= 0xd800 && c_2 < 0xdc00) + if (c_2 >= 0xd800 && c_2 < 0xdc00) #endif - { - *puc = 0x10000 + ((c_2 - 0xd800) << 10) + (c_1 - 0xdc00); - return s - 2; - } - } + { + *puc = 0x10000 + ((c_2 - 0xd800) << 10) + (c_1 - 0xdc00); + return s - 2; + } + } } return NULL; } diff --git a/lib/unistr/u16-set.c b/lib/unistr/u16-set.c index 9ef307f..7bad3d6 100644 --- a/lib/unistr/u16-set.c +++ b/lib/unistr/u16-set.c @@ -1,5 +1,5 @@ /* Fill UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-startswith.c b/lib/unistr/u16-startswith.c index 2f39d74..22a5d5f 100644 --- a/lib/unistr/u16-startswith.c +++ b/lib/unistr/u16-startswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-16 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-stpcpy.c b/lib/unistr/u16-stpcpy.c index 9207edc..59467f7 100644 --- a/lib/unistr/u16-stpcpy.c +++ b/lib/unistr/u16-stpcpy.c @@ -1,5 +1,6 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-stpncpy.c b/lib/unistr/u16-stpncpy.c index 30ef7e3..49c616e 100644 --- a/lib/unistr/u16-stpncpy.c +++ b/lib/unistr/u16-stpncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strcat.c b/lib/unistr/u16-strcat.c index bb88f1b..8b35868 100644 --- a/lib/unistr/u16-strcat.c +++ b/lib/unistr/u16-strcat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-16 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strchr.c b/lib/unistr/u16-strchr.c index 673152f..1f8719f 100644 --- a/lib/unistr/u16-strchr.c +++ b/lib/unistr/u16-strchr.c @@ -1,5 +1,6 @@ /* Search character in UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,33 +31,33 @@ u16_strchr (const uint16_t *s, ucs4_t uc) uint16_t c0 = uc; for (;; s++) - { - if (*s == c0) - break; - if (*s == 0) - goto notfound; - } + { + if (*s == c0) + break; + if (*s == 0) + goto notfound; + } return (uint16_t *) s; } else switch (u16_uctomb_aux (c, uc, 2)) { case 2: - if (*s == 0) - goto notfound; - { - uint16_t c0 = c[0]; - uint16_t c1 = c[1]; - - for (;; s++) - { - if (s[1] == 0) - goto notfound; - if (*s == c0 && s[1] == c1) - break; - } - return (uint16_t *) s; - } + if (*s == 0) + goto notfound; + { + uint16_t c0 = c[0]; + uint16_t c1 = c[1]; + + for (;; s++) + { + if (s[1] == 0) + goto notfound; + if (*s == c0 && s[1] == c1) + break; + } + return (uint16_t *) s; + } } notfound: return NULL; diff --git a/lib/unistr/u16-strcmp.c b/lib/unistr/u16-strcmp.c index c161c65..b781211 100644 --- a/lib/unistr/u16-strcmp.c +++ b/lib/unistr/u16-strcmp.c @@ -1,5 +1,5 @@ /* Compare UTF-16 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,19 +31,19 @@ u16_strcmp (const uint16_t *s1, const uint16_t *s2) uint16_t c1 = *s1++; uint16_t c2 = *s2++; if (c1 != 0 && c1 == c2) - continue; + continue; if (c1 < 0xd800 || c1 >= 0xe000) - { - if (!(c2 < 0xd800 || c2 >= 0xe000)) - /* c2 is a surrogate, but c1 is not. */ - return -1; - } + { + if (!(c2 < 0xd800 || c2 >= 0xe000)) + /* c2 is a surrogate, but c1 is not. */ + return -1; + } else - { - if (c2 < 0xd800 || c2 >= 0xe000) - /* c1 is a surrogate, but c2 is not. */ - return 1; - } + { + if (c2 < 0xd800 || c2 >= 0xe000) + /* c1 is a surrogate, but c2 is not. */ + return 1; + } return (int)c1 - (int)c2; /* > 0 if c1 > c2, < 0 if c1 < c2. */ } diff --git a/lib/unistr/u16-strcoll.c b/lib/unistr/u16-strcoll.c index 280ba83..5a504bf 100644 --- a/lib/unistr/u16-strcoll.c +++ b/lib/unistr/u16-strcoll.c @@ -1,5 +1,5 @@ /* Compare UTF-16 strings using the collation rules of the current locale. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strcpy.c b/lib/unistr/u16-strcpy.c index 92c3e7e..ecde75d 100644 --- a/lib/unistr/u16-strcpy.c +++ b/lib/unistr/u16-strcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strcspn.c b/lib/unistr/u16-strcspn.c index 2f5ba43..b18bb37 100644 --- a/lib/unistr/u16-strcspn.c +++ b/lib/unistr/u16-strcspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strdup.c b/lib/unistr/u16-strdup.c index 22242c2..4a94451 100644 --- a/lib/unistr/u16-strdup.c +++ b/lib/unistr/u16-strdup.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strlen.c b/lib/unistr/u16-strlen.c index 9c05541..da613c2 100644 --- a/lib/unistr/u16-strlen.c +++ b/lib/unistr/u16-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strmblen.c b/lib/unistr/u16-strmblen.c index e7f3625..f07ca0b 100644 --- a/lib/unistr/u16-strmblen.c +++ b/lib/unistr/u16-strmblen.c @@ -1,5 +1,6 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -32,7 +33,7 @@ u16_strmblen (const uint16_t *s) if (c < 0xdc00) { if (s[1] >= 0xdc00 && s[1] < 0xe000) - return 2; + return 2; } #else if (s[1] != 0) diff --git a/lib/unistr/u16-strmbtouc.c b/lib/unistr/u16-strmbtouc.c index 78d482e..9aa5d43 100644 --- a/lib/unistr/u16-strmbtouc.c +++ b/lib/unistr/u16-strmbtouc.c @@ -1,5 +1,6 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -40,10 +41,10 @@ u16_strmbtouc (ucs4_t *puc, const uint16_t *s) #else if (s[1] != 0) #endif - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } } /* invalid or incomplete multibyte character */ return -1; diff --git a/lib/unistr/u16-strncat.c b/lib/unistr/u16-strncat.c index 9e14388..7082716 100644 --- a/lib/unistr/u16-strncat.c +++ b/lib/unistr/u16-strncat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-16 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strncmp.c b/lib/unistr/u16-strncmp.c index 7278b6f..3ed59c3 100644 --- a/lib/unistr/u16-strncmp.c +++ b/lib/unistr/u16-strncmp.c @@ -1,5 +1,5 @@ /* Compare UTF-16 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,22 +31,22 @@ u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n) uint16_t c1 = *s1++; uint16_t c2 = *s2++; if (c1 != 0 && c1 == c2) - { - n--; - continue; - } + { + n--; + continue; + } if (c1 < 0xd800 || c1 >= 0xe000) - { - if (!(c2 < 0xd800 || c2 >= 0xe000)) - /* c2 is a surrogate, but c1 is not. */ - return -1; - } + { + if (!(c2 < 0xd800 || c2 >= 0xe000)) + /* c2 is a surrogate, but c1 is not. */ + return -1; + } else - { - if (c2 < 0xd800 || c2 >= 0xe000) - /* c1 is a surrogate, but c2 is not. */ - return 1; - } + { + if (c2 < 0xd800 || c2 >= 0xe000) + /* c1 is a surrogate, but c2 is not. */ + return 1; + } return (int)c1 - (int)c2; /* > 0 if c1 > c2, < 0 if c1 < c2, = 0 if c1 and c2 are both 0. */ } diff --git a/lib/unistr/u16-strncpy.c b/lib/unistr/u16-strncpy.c index 65676aa..bd2eb6f 100644 --- a/lib/unistr/u16-strncpy.c +++ b/lib/unistr/u16-strncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strnlen.c b/lib/unistr/u16-strnlen.c index 1cd80c4..49e6d58 100644 --- a/lib/unistr/u16-strnlen.c +++ b/lib/unistr/u16-strnlen.c @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strpbrk.c b/lib/unistr/u16-strpbrk.c index 6360581..45353fa 100644 --- a/lib/unistr/u16-strpbrk.c +++ b/lib/unistr/u16-strpbrk.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strrchr.c b/lib/unistr/u16-strrchr.c index b3c7ab0..3cf3de2 100644 --- a/lib/unistr/u16-strrchr.c +++ b/lib/unistr/u16-strrchr.c @@ -1,5 +1,6 @@ /* Search character in UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,32 +34,32 @@ u16_strrchr (const uint16_t *s, ucs4_t uc) uint16_t c0 = uc; for (;; s++) - { - if (*s == c0) - result = (uint16_t *) s; - if (*s == 0) - break; - } + { + if (*s == c0) + result = (uint16_t *) s; + if (*s == 0) + break; + } } else switch (u16_uctomb_aux (c, uc, 2)) { case 2: - if (*s) - { - uint16_t c0 = c[0]; - uint16_t c1 = c[1]; + if (*s) + { + uint16_t c0 = c[0]; + uint16_t c1 = c[1]; - /* FIXME: Maybe walking the string via u16_mblen is a win? */ - for (;; s++) - { - if (s[1] == 0) - break; - if (*s == c0 && s[1] == c1) - result = (uint16_t *) s; - } - } - break; + /* FIXME: Maybe walking the string via u16_mblen is a win? */ + for (;; s++) + { + if (s[1] == 0) + break; + if (*s == c0 && s[1] == c1) + result = (uint16_t *) s; + } + } + break; } return result; } diff --git a/lib/unistr/u16-strspn.c b/lib/unistr/u16-strspn.c index 04ba8e6..ab812eb 100644 --- a/lib/unistr/u16-strspn.c +++ b/lib/unistr/u16-strspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strstr.c b/lib/unistr/u16-strstr.c index bc61233..54a74d6 100644 --- a/lib/unistr/u16-strstr.c +++ b/lib/unistr/u16-strstr.c @@ -1,5 +1,5 @@ /* Substring test for UTF-16 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strtok.c b/lib/unistr/u16-strtok.c index dd9b247..f84c465 100644 --- a/lib/unistr/u16-strtok.c +++ b/lib/unistr/u16-strtok.c @@ -1,5 +1,5 @@ /* Tokenize UTF-16 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-to-u32.c b/lib/unistr/u16-to-u32.c index 2f39dcd..3544cde 100644 --- a/lib/unistr/u16-to-u32.c +++ b/lib/unistr/u16-to-u32.c @@ -1,5 +1,5 @@ /* Convert UTF-16 string to UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -58,57 +58,57 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) int count; /* Fetch a Unicode character from the input string. */ - count = u16_mbtouc (&uc, s, s_end - s); + count = u16_mbtoucr (&uc, s, s_end - s); if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } s += count; /* Store it in the output string. */ if (length + 1 > allocated) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 1 > allocated) - allocated = length + 1; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 1 > allocated) + allocated = length + 1; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + } result[length++] = uc; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -117,7 +117,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unistr/u16-to-u8.c b/lib/unistr/u16-to-u8.c index 38b27ec..f92cc93 100644 --- a/lib/unistr/u16-to-u8.c +++ b/lib/unistr/u16-to-u8.c @@ -1,5 +1,5 @@ /* Convert UTF-16 string to UTF-8 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -58,68 +58,68 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) int count; /* Fetch a Unicode character from the input string. */ - count = u16_mbtouc (&uc, s, s_end - s); + count = u16_mbtoucr (&uc, s, s_end - s); if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } s += count; /* Store it in the output string. */ count = u8_uctomb (result + length, uc, allocated - length); if (count == -1) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } if (count == -2) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 6 > allocated) - allocated = length + 6; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - count = u8_uctomb (result + length, uc, allocated - length); - if (count < 0) - abort (); - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 6 > allocated) + allocated = length + 6; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + count = u8_uctomb (result + length, uc, allocated - length); + if (count < 0) + abort (); + } length += count; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -128,7 +128,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unistr/u16-uctomb-aux.c b/lib/unistr/u16-uctomb-aux.c index 384452b..e2acc9e 100644 --- a/lib/unistr/u16-uctomb-aux.c +++ b/lib/unistr/u16-uctomb-aux.c @@ -1,5 +1,5 @@ /* Conversion UCS-4 to UTF-16. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,29 +30,29 @@ u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n) else if (uc < 0x10000) { if (uc >= 0xe000) - { - if (n >= 1) - { - s[0] = uc; - return 1; - } - } + { + if (n >= 1) + { + s[0] = uc; + return 1; + } + } else - return -1; + return -1; } else { if (uc < 0x110000) - { - if (n >= 2) - { - s[0] = 0xd800 + ((uc - 0x10000) >> 10); - s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff); - return 2; - } - } + { + if (n >= 2) + { + s[0] = 0xd800 + ((uc - 0x10000) >> 10); + s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff); + return 2; + } + } else - return -1; + return -1; } return -2; } diff --git a/lib/unistr/u16-uctomb.c b/lib/unistr/u16-uctomb.c index 6ac5ada..cbc1abc 100644 --- a/lib/unistr/u16-uctomb.c +++ b/lib/unistr/u16-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-16 string. - Copyright (C) 2002, 2005-2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,38 +33,38 @@ u16_uctomb (uint16_t *s, ucs4_t uc, int n) if (uc < 0xd800) { if (n > 0) - { - s[0] = uc; - return 1; - } + { + s[0] = uc; + return 1; + } /* else return -2, below. */ } else if (uc < 0x10000) { if (uc >= 0xe000) - { - if (n >= 1) - { - s[0] = uc; - return 1; - } - } + { + if (n >= 1) + { + s[0] = uc; + return 1; + } + } else - return -1; + return -1; } else { if (uc < 0x110000) - { - if (n >= 2) - { - s[0] = 0xd800 + ((uc - 0x10000) >> 10); - s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff); - return 2; - } - } + { + if (n >= 2) + { + s[0] = 0xd800 + ((uc - 0x10000) >> 10); + s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff); + return 2; + } + } else - return -1; + return -1; } return -2; } diff --git a/lib/unistr/u32-check.c b/lib/unistr/u32-check.c index 87e9127..8c5f518 100644 --- a/lib/unistr/u32-check.c +++ b/lib/unistr/u32-check.c @@ -1,5 +1,5 @@ /* Check UTF-32 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,10 +30,10 @@ u32_check (const uint32_t *s, size_t n) uint32_t c = *s; if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) - s++; + s++; else - /* invalid Unicode character */ - return s; + /* invalid Unicode character */ + return s; } return NULL; } diff --git a/lib/unistr/u32-chr.c b/lib/unistr/u32-chr.c index 5a594b2..1900288 100644 --- a/lib/unistr/u32-chr.c +++ b/lib/unistr/u32-chr.c @@ -1,5 +1,5 @@ /* Search character in piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -26,7 +26,7 @@ u32_chr (const uint32_t *s, size_t n, ucs4_t uc) for (; n > 0; s++, n--) { if (*s == uc) - return (uint32_t *) s; + return (uint32_t *) s; } return NULL; } diff --git a/lib/unistr/u32-cmp.c b/lib/unistr/u32-cmp.c index a273b10..36496f7 100644 --- a/lib/unistr/u32-cmp.c +++ b/lib/unistr/u32-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -28,10 +28,10 @@ u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n) uint32_t uc1 = *s1++; uint32_t uc2 = *s2++; if (uc1 == uc2) - { - n--; - continue; - } + { + n--; + continue; + } /* Note that uc1 and uc2 each have at most 31 bits. */ return (int)uc1 - (int)uc2; /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */ diff --git a/lib/unistr/u32-cmp2.c b/lib/unistr/u32-cmp2.c index 6924c48..3247602 100644 --- a/lib/unistr/u32-cmp2.c +++ b/lib/unistr/u32-cmp2.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-cpy-alloc.c b/lib/unistr/u32-cpy-alloc.c index f9c6960..b9ebefe 100644 --- a/lib/unistr/u32-cpy-alloc.c +++ b/lib/unistr/u32-cpy-alloc.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-cpy.c b/lib/unistr/u32-cpy.c index 2493b65..747430b 100644 --- a/lib/unistr/u32-cpy.c +++ b/lib/unistr/u32-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-endswith.c b/lib/unistr/u32-endswith.c index d77fa8c..cee0d93 100644 --- a/lib/unistr/u32-endswith.c +++ b/lib/unistr/u32-endswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-32 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mblen.c b/lib/unistr/u32-mblen.c index a48c8b2..4530fe4 100644 --- a/lib/unistr/u32-mblen.c +++ b/lib/unistr/u32-mblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,7 +30,7 @@ u32_mblen (const uint32_t *s, size_t n) #if CONFIG_UNICODE_SAFETY if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) #endif - return (c != 0 ? 1 : 0); + return (c != 0 ? 1 : 0); } /* invalid or incomplete multibyte character */ return -1; diff --git a/lib/unistr/u32-mbsnlen.c b/lib/unistr/u32-mbsnlen.c index b7a5d18..0a71293 100644 --- a/lib/unistr/u32-mbsnlen.c +++ b/lib/unistr/u32-mbsnlen.c @@ -1,5 +1,5 @@ /* Count characters in UTF-32 string. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbtouc-unsafe.c b/lib/unistr/u32-mbtouc-unsafe.c index 4bd9e81..8dbbfe4 100644 --- a/lib/unistr/u32-mbtouc-unsafe.c +++ b/lib/unistr/u32-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbtouc.c b/lib/unistr/u32-mbtouc.c index 4eeef58..05f7c77 100644 --- a/lib/unistr/u32-mbtouc.c +++ b/lib/unistr/u32-mbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbtoucr.c b/lib/unistr/u32-mbtoucr.c index 7d7993c..83f7782 100644 --- a/lib/unistr/u32-mbtoucr.c +++ b/lib/unistr/u32-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string, returning an error code. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-move.c b/lib/unistr/u32-move.c index d6c08f4..6362d85 100644 --- a/lib/unistr/u32-move.c +++ b/lib/unistr/u32-move.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-next.c b/lib/unistr/u32-next.c index c529295..987fb02 100644 --- a/lib/unistr/u32-next.c +++ b/lib/unistr/u32-next.c @@ -1,5 +1,5 @@ /* Iterate over next character in UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -32,7 +32,7 @@ u32_next (ucs4_t *puc, const uint32_t *s) { #if CONFIG_UNICODE_SAFETY if (count < 0) - *puc = 0xfffd; + *puc = 0xfffd; #endif return NULL; } diff --git a/lib/unistr/u32-prev.c b/lib/unistr/u32-prev.c index bc20c93..f20b1b7 100644 --- a/lib/unistr/u32-prev.c +++ b/lib/unistr/u32-prev.c @@ -1,5 +1,5 @@ /* Iterate over previous character in UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,10 +30,10 @@ u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start) #if CONFIG_UNICODE_SAFETY if (c_1 < 0xd800 || (c_1 >= 0xe000 && c_1 < 0x110000)) #endif - { - *puc = c_1; - return s - 1; - } + { + *puc = c_1; + return s - 1; + } } return NULL; } diff --git a/lib/unistr/u32-set.c b/lib/unistr/u32-set.c index de10e09..5c517cd 100644 --- a/lib/unistr/u32-set.c +++ b/lib/unistr/u32-set.c @@ -1,5 +1,5 @@ /* Fill UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-startswith.c b/lib/unistr/u32-startswith.c index 0f9a185..7fcb597 100644 --- a/lib/unistr/u32-startswith.c +++ b/lib/unistr/u32-startswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-32 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-stpcpy.c b/lib/unistr/u32-stpcpy.c index 5df8233..3cbfa92 100644 --- a/lib/unistr/u32-stpcpy.c +++ b/lib/unistr/u32-stpcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-stpncpy.c b/lib/unistr/u32-stpncpy.c index 19a0894..e55891e 100644 --- a/lib/unistr/u32-stpncpy.c +++ b/lib/unistr/u32-stpncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcat.c b/lib/unistr/u32-strcat.c index cd4737f..4e26bb4 100644 --- a/lib/unistr/u32-strcat.c +++ b/lib/unistr/u32-strcat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strchr.c b/lib/unistr/u32-strchr.c index 57a3a3c..b5df7b7 100644 --- a/lib/unistr/u32-strchr.c +++ b/lib/unistr/u32-strchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -26,9 +26,9 @@ u32_strchr (const uint32_t *s, ucs4_t uc) for (;; s++) { if (*s == uc) - break; + break; if (*s == 0) - goto notfound; + goto notfound; } return (uint32_t *) s; notfound: diff --git a/lib/unistr/u32-strcmp.c b/lib/unistr/u32-strcmp.c index b82d5ed..5f336ce 100644 --- a/lib/unistr/u32-strcmp.c +++ b/lib/unistr/u32-strcmp.c @@ -1,5 +1,5 @@ /* Compare UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -28,7 +28,7 @@ u32_strcmp (const uint32_t *s1, const uint32_t *s2) uint32_t uc1 = *s1++; uint32_t uc2 = *s2++; if (uc1 != 0 && uc1 == uc2) - continue; + continue; /* Note that uc1 and uc2 each have at most 31 bits. */ return (int)uc1 - (int)uc2; /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */ diff --git a/lib/unistr/u32-strcoll.c b/lib/unistr/u32-strcoll.c index d5e1482..9748855 100644 --- a/lib/unistr/u32-strcoll.c +++ b/lib/unistr/u32-strcoll.c @@ -1,5 +1,5 @@ /* Compare UTF-32 strings using the collation rules of the current locale. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcpy.c b/lib/unistr/u32-strcpy.c index e500100..f3c70e6 100644 --- a/lib/unistr/u32-strcpy.c +++ b/lib/unistr/u32-strcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcspn.c b/lib/unistr/u32-strcspn.c index f93ab2e..595d32e 100644 --- a/lib/unistr/u32-strcspn.c +++ b/lib/unistr/u32-strcspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -36,8 +36,8 @@ FUNC (const UNIT *str, const UNIT *reject) ucs4_t uc = reject[0]; const UNIT *ptr = str; for (; *ptr != 0; ptr++) - if (*ptr == uc) - break; + if (*ptr == uc) + break; return ptr - str; } /* General case. */ @@ -45,7 +45,7 @@ FUNC (const UNIT *str, const UNIT *reject) const UNIT *ptr = str; for (; *ptr != 0; ptr++) if (U_STRCHR (reject, *ptr)) - break; + break; return ptr - str; } } diff --git a/lib/unistr/u32-strdup.c b/lib/unistr/u32-strdup.c index 66e9393..da4cc5a 100644 --- a/lib/unistr/u32-strdup.c +++ b/lib/unistr/u32-strdup.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strlen.c b/lib/unistr/u32-strlen.c index eb64cc2..95d32ab 100644 --- a/lib/unistr/u32-strlen.c +++ b/lib/unistr/u32-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strmblen.c b/lib/unistr/u32-strmblen.c index 4dde3ff..54b78d7 100644 --- a/lib/unistr/u32-strmblen.c +++ b/lib/unistr/u32-strmblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strmbtouc.c b/lib/unistr/u32-strmbtouc.c index e94ac30..4c067b9 100644 --- a/lib/unistr/u32-strmbtouc.c +++ b/lib/unistr/u32-strmbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strncat.c b/lib/unistr/u32-strncat.c index 86f895b..c9260b0 100644 --- a/lib/unistr/u32-strncat.c +++ b/lib/unistr/u32-strncat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strncmp.c b/lib/unistr/u32-strncmp.c index 026ce50..dcbb935 100644 --- a/lib/unistr/u32-strncmp.c +++ b/lib/unistr/u32-strncmp.c @@ -1,5 +1,5 @@ /* Compare UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -28,10 +28,10 @@ u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n) uint32_t uc1 = *s1++; uint32_t uc2 = *s2++; if (uc1 != 0 && uc1 == uc2) - { - n--; - continue; - } + { + n--; + continue; + } /* Note that uc1 and uc2 each have at most 31 bits. */ return (int)uc1 - (int)uc2; /* > 0 if uc1 > uc2, < 0 if uc1 < uc2, = 0 if uc1 and uc2 are both 0. */ diff --git a/lib/unistr/u32-strncpy.c b/lib/unistr/u32-strncpy.c index c8f409b..9a54f97 100644 --- a/lib/unistr/u32-strncpy.c +++ b/lib/unistr/u32-strncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strnlen.c b/lib/unistr/u32-strnlen.c index 2ead8f2..8102ac7 100644 --- a/lib/unistr/u32-strnlen.c +++ b/lib/unistr/u32-strnlen.c @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strpbrk.c b/lib/unistr/u32-strpbrk.c index 9579a1b..2c4b6bc 100644 --- a/lib/unistr/u32-strpbrk.c +++ b/lib/unistr/u32-strpbrk.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -35,8 +35,8 @@ FUNC (const UNIT *str, const UNIT *accept) ucs4_t uc = accept[0]; const UNIT *ptr = str; for (; *ptr != 0; ptr++) - if (*ptr == uc) - return (UNIT *) ptr; + if (*ptr == uc) + return (UNIT *) ptr; return NULL; } /* General case. */ @@ -44,7 +44,7 @@ FUNC (const UNIT *str, const UNIT *accept) const UNIT *ptr = str; for (; *ptr != 0; ptr++) if (U_STRCHR (accept, *ptr)) - return (UNIT *) ptr; + return (UNIT *) ptr; return NULL; } } diff --git a/lib/unistr/u32-strrchr.c b/lib/unistr/u32-strrchr.c index b4641f3..f0030e5 100644 --- a/lib/unistr/u32-strrchr.c +++ b/lib/unistr/u32-strrchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,9 +30,9 @@ u32_strrchr (const uint32_t *s, ucs4_t uc) for (;; s++) { if (*s == uc) - result = (uint32_t *) s; + result = (uint32_t *) s; if (*s == 0) - break; + break; } return result; } diff --git a/lib/unistr/u32-strspn.c b/lib/unistr/u32-strspn.c index 6f80202..e2571d5 100644 --- a/lib/unistr/u32-strspn.c +++ b/lib/unistr/u32-strspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -35,8 +35,8 @@ FUNC (const UNIT *str, const UNIT *accept) ucs4_t uc = accept[0]; const UNIT *ptr = str; for (; *ptr != 0; ptr++) - if (*ptr != uc) - break; + if (*ptr != uc) + break; return ptr - str; } /* General case. */ @@ -44,7 +44,7 @@ FUNC (const UNIT *str, const UNIT *accept) const UNIT *ptr = str; for (; *ptr != 0; ptr++) if (!U_STRCHR (accept, *ptr)) - break; + break; return ptr - str; } } diff --git a/lib/unistr/u32-strstr.c b/lib/unistr/u32-strstr.c index 285746d..cad06fc 100644 --- a/lib/unistr/u32-strstr.c +++ b/lib/unistr/u32-strstr.c @@ -1,5 +1,5 @@ /* Substring test for UTF-32 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strtok.c b/lib/unistr/u32-strtok.c index 3f21919..067122f 100644 --- a/lib/unistr/u32-strtok.c +++ b/lib/unistr/u32-strtok.c @@ -1,5 +1,5 @@ /* Tokenize UTF-32 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-to-u16.c b/lib/unistr/u32-to-u16.c index 3a32162..be32770 100644 --- a/lib/unistr/u32-to-u16.c +++ b/lib/unistr/u32-to-u16.c @@ -1,5 +1,5 @@ /* Convert UTF-32 string to UTF-16 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -60,60 +60,60 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) /* Fetch a Unicode character from the input string. */ uc = *s++; /* No need to call the safe variant u32_mbtouc, because - u16_uctomb will verify uc anyway. */ + u16_uctomb will verify uc anyway. */ /* Store it in the output string. */ count = u16_uctomb (result + length, uc, allocated - length); if (count == -1) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } if (count == -2) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 2 > allocated) - allocated = length + 2; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - count = u16_uctomb (result + length, uc, allocated - length); - if (count < 0) - abort (); - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 2 > allocated) + allocated = length + 2; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + count = u16_uctomb (result + length, uc, allocated - length); + if (count < 0) + abort (); + } length += count; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -122,7 +122,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unistr/u32-to-u8.c b/lib/unistr/u32-to-u8.c index 4dce896..36710d3 100644 --- a/lib/unistr/u32-to-u8.c +++ b/lib/unistr/u32-to-u8.c @@ -1,5 +1,5 @@ /* Convert UTF-32 string to UTF-8 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -60,60 +60,60 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) /* Fetch a Unicode character from the input string. */ uc = *s++; /* No need to call the safe variant u32_mbtouc, because - u8_uctomb will verify uc anyway. */ + u8_uctomb will verify uc anyway. */ /* Store it in the output string. */ count = u8_uctomb (result + length, uc, allocated - length); if (count == -1) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } if (count == -2) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 6 > allocated) - allocated = length + 6; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - count = u8_uctomb (result + length, uc, allocated - length); - if (count < 0) - abort (); - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 6 > allocated) + allocated = length + 6; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + count = u8_uctomb (result + length, uc, allocated - length); + if (count < 0) + abort (); + } length += count; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -122,7 +122,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unistr/u32-uctomb.c b/lib/unistr/u32-uctomb.c index 583b3b6..3ac58b4 100644 --- a/lib/unistr/u32-uctomb.c +++ b/lib/unistr/u32-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-32 string. - Copyright (C) 2002, 2005-2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,12 +33,12 @@ u32_uctomb (uint32_t *s, ucs4_t uc, int n) if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000)) { if (n > 0) - { - *s = uc; - return 1; - } + { + *s = uc; + return 1; + } else - return -2; + return -2; } else return -1; diff --git a/lib/unistr/u8-check.c b/lib/unistr/u8-check.c index 53897fc..368042b 100644 --- a/lib/unistr/u8-check.c +++ b/lib/unistr/u8-check.c @@ -1,5 +1,5 @@ /* Check UTF-8 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,73 +31,73 @@ u8_check (const uint8_t *s, size_t n) uint8_t c = *s; if (c < 0x80) - { - s++; - continue; - } + { + s++; + continue; + } if (c >= 0xc2) - { - if (c < 0xe0) - { - if (s + 2 <= s_end - && (s[1] ^ 0x80) < 0x40) - { - s += 2; - continue; - } - } - else if (c < 0xf0) - { - if (s + 3 <= s_end - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) - { - s += 3; - continue; - } - } - else if (c < 0xf8) - { - if (s + 4 <= s_end - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + { + if (c < 0xe0) + { + if (s + 2 <= s_end + && (s[1] ^ 0x80) < 0x40) + { + s += 2; + continue; + } + } + else if (c < 0xf0) + { + if (s + 3 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) + { + s += 3; + continue; + } + } + else if (c < 0xf8) + { + if (s + 4 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) - { - s += 4; - continue; - } - } + ) + { + s += 4; + continue; + } + } #if 0 - else if (c < 0xfc) - { - if (s + 5 <= s_end - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) - { - s += 5; - continue; - } - } - else if (c < 0xfe) - { - if (s + 6 <= s_end - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) - { - s += 6; - continue; - } - } + else if (c < 0xfc) + { + if (s + 5 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) + { + s += 5; + continue; + } + } + else if (c < 0xfe) + { + if (s + 6 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) + { + s += 6; + continue; + } + } #endif - } + } /* invalid or incomplete multibyte character */ return s; } diff --git a/lib/unistr/u8-chr.c b/lib/unistr/u8-chr.c index 2c4d768..435d1be 100644 --- a/lib/unistr/u8-chr.c +++ b/lib/unistr/u8-chr.c @@ -1,5 +1,6 @@ /* Search character in piece of UTF-8 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,58 +31,58 @@ u8_chr (const uint8_t *s, size_t n, ucs4_t uc) uint8_t c0 = uc; for (; n > 0; s++, n--) - { - if (*s == c0) - return (uint8_t *) s; - } + { + if (*s == c0) + return (uint8_t *) s; + } } else switch (u8_uctomb_aux (c, uc, 6)) { case 2: - if (n > 1) - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; + if (n > 1) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; - for (n--; n > 0; s++, n--) - { - if (*s == c0 && s[1] == c1) - return (uint8_t *) s; - } - } - break; + for (n--; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1) + return (uint8_t *) s; + } + } + break; case 3: - if (n > 2) - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; + if (n > 2) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; - for (n -= 2; n > 0; s++, n--) - { - if (*s == c0 && s[1] == c1 && s[2] == c2) - return (uint8_t *) s; - } - } - break; + for (n -= 2; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1 && s[2] == c2) + return (uint8_t *) s; + } + } + break; case 4: - if (n > 3) - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; - uint8_t c3 = c[3]; + if (n > 3) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; + uint8_t c3 = c[3]; - for (n -= 3; n > 0; s++, n--) - { - if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) - return (uint8_t *) s; - } - } - break; + for (n -= 3; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) + return (uint8_t *) s; + } + } + break; } return NULL; } diff --git a/lib/unistr/u8-cmp.c b/lib/unistr/u8-cmp.c index 77b2402..d021b1a 100644 --- a/lib/unistr/u8-cmp.c +++ b/lib/unistr/u8-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-cmp2.c b/lib/unistr/u8-cmp2.c index 99cee9f..8a97db4 100644 --- a/lib/unistr/u8-cmp2.c +++ b/lib/unistr/u8-cmp2.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-cpy-alloc.c b/lib/unistr/u8-cpy-alloc.c index b2dcc5d..1884516 100644 --- a/lib/unistr/u8-cpy-alloc.c +++ b/lib/unistr/u8-cpy-alloc.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-cpy.c b/lib/unistr/u8-cpy.c index bf3a55b..2f29200 100644 --- a/lib/unistr/u8-cpy.c +++ b/lib/unistr/u8-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-endswith.c b/lib/unistr/u8-endswith.c index e40613a..833b3e1 100644 --- a/lib/unistr/u8-endswith.c +++ b/lib/unistr/u8-endswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-mblen.c b/lib/unistr/u8-mblen.c index 1981bef..f6a2027 100644 --- a/lib/unistr/u8-mblen.c +++ b/lib/unistr/u8-mblen.c @@ -1,5 +1,6 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -29,69 +30,69 @@ u8_mblen (const uint8_t *s, size_t n) uint8_t c = *s; if (c < 0x80) - return (c != 0 ? 1 : 0); + return (c != 0 ? 1 : 0); if (c >= 0xc2) - { - if (c < 0xe0) - { - if (n >= 2 + { + if (c < 0xe0) + { + if (n >= 2 #if CONFIG_UNICODE_SAFETY - && (s[1] ^ 0x80) < 0x40 + && (s[1] ^ 0x80) < 0x40 #endif - ) - return 2; - } - else if (c < 0xf0) - { - if (n >= 3 + ) + return 2; + } + else if (c < 0xf0) + { + if (n >= 3 #if CONFIG_UNICODE_SAFETY - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0) + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0) #endif - ) - return 3; - } - else if (c < 0xf8) - { - if (n >= 4 + ) + return 3; + } + else if (c < 0xf8) + { + if (n >= 4 #if CONFIG_UNICODE_SAFETY - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif #endif - ) - return 4; - } + ) + return 4; + } #if 0 - else if (c < 0xfc) - { - if (n >= 5 + else if (c < 0xfc) + { + if (n >= 5 #if CONFIG_UNICODE_SAFETY - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88) + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88) #endif - ) - return 5; - } - else if (c < 0xfe) - { - if (n >= 6 + ) + return 5; + } + else if (c < 0xfe) + { + if (n >= 6 #if CONFIG_UNICODE_SAFETY - && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84) + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84) #endif - ) - return 6; - } + ) + return 6; + } #endif - } + } } /* invalid or incomplete multibyte character */ return -1; diff --git a/lib/unistr/u8-mbsnlen.c b/lib/unistr/u8-mbsnlen.c index 29af297..9ddc42e 100644 --- a/lib/unistr/u8-mbsnlen.c +++ b/lib/unistr/u8-mbsnlen.c @@ -1,5 +1,5 @@ /* Count characters in UTF-8 string. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -28,12 +28,15 @@ u8_mbsnlen (const uint8_t *s, size_t n) characters = 0; while (n > 0) { - int count = u8_mblen (s, n); + ucs4_t uc; + int count = u8_mbtoucr (&uc, s, n); + characters++; + if (count == -2) + break; if (count <= 0) - count = 1; + count = 1; s += count; n -= count; - characters++; } return characters; } diff --git a/lib/unistr/u8-mbtouc-aux.c b/lib/unistr/u8-mbtouc-aux.c index 53d02bf..c997589 100644 --- a/lib/unistr/u8-mbtouc-aux.c +++ b/lib/unistr/u8-mbtouc-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-8 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -30,124 +30,124 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n) if (c >= 0xc2) { if (c < 0xe0) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x1f) << 6) - | (unsigned int) (s[1] ^ 0x80); - return 2; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf0) - { - if (n >= 3) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 3) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf8) - { - if (n >= 4) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + { + if (n >= 4) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + ) + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #if 0 else if (c < 0xfc) - { - if (n >= 5) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 5) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xfe) - { - if (n >= 6) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 6) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #endif } /* invalid multibyte character */ diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c b/lib/unistr/u8-mbtouc-unsafe-aux.c index 43e4a36..47590e3 100644 --- a/lib/unistr/u8-mbtouc-unsafe-aux.c +++ b/lib/unistr/u8-mbtouc-unsafe-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-8 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -30,134 +30,134 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n) if (c >= 0xc2) { if (c < 0xe0) - { - if (n >= 2) - { + { + if (n >= 2) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40) #endif - { - *puc = ((unsigned int) (c & 0x1f) << 6) - | (unsigned int) (s[1] ^ 0x80); - return 2; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf0) - { - if (n >= 3) - { + { + if (n >= 3) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) #endif - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf8) - { - if (n >= 4) - { + { + if (n >= 4) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) + ) #endif - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #if 0 else if (c < 0xfc) - { - if (n >= 5) - { + { + if (n >= 5) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) #endif - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xfe) - { - if (n >= 6) - { + { + if (n >= 6) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) #endif - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #endif } /* invalid multibyte character */ diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c index 4661569..41583f9 100644 --- a/lib/unistr/u8-mbtouc-unsafe.c +++ b/lib/unistr/u8-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -41,134 +41,134 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) else if (c >= 0xc2) { if (c < 0xe0) - { - if (n >= 2) - { + { + if (n >= 2) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40) #endif - { - *puc = ((unsigned int) (c & 0x1f) << 6) - | (unsigned int) (s[1] ^ 0x80); - return 2; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf0) - { - if (n >= 3) - { + { + if (n >= 3) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) #endif - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf8) - { - if (n >= 4) - { + { + if (n >= 4) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) + ) #endif - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #if 0 else if (c < 0xfc) - { - if (n >= 5) - { + { + if (n >= 5) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) #endif - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xfe) - { - if (n >= 6) - { + { + if (n >= 6) + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) #endif - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #endif } /* invalid multibyte character */ diff --git a/lib/unistr/u8-mbtouc.c b/lib/unistr/u8-mbtouc.c index ff624f1..96cd5b7 100644 --- a/lib/unistr/u8-mbtouc.c +++ b/lib/unistr/u8-mbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -40,124 +40,124 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) else if (c >= 0xc2) { if (c < 0xe0) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x1f) << 6) - | (unsigned int) (s[1] ^ 0x80); - return 2; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf0) - { - if (n >= 3) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 3) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xf8) - { - if (n >= 4) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + { + if (n >= 4) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + ) + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #if 0 else if (c < 0xfc) - { - if (n >= 5) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 5) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } else if (c < 0xfe) - { - if (n >= 6) - { - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return n; - } - } + { + if (n >= 6) + { + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return n; + } + } #endif } /* invalid multibyte character */ diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c index dd83352..a749c48 100644 --- a/lib/unistr/u8-mbtoucr.c +++ b/lib/unistr/u8-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string, returning an error code. - Copyright (C) 1999-2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -33,250 +33,250 @@ u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n) else if (c >= 0xc2) { if (c < 0xe0) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x1f) << 6) - | (unsigned int) (s[1] ^ 0x80); - return 2; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } else if (c < 0xf0) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) - { - if (n >= 3) - { - if ((s[2] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } else if (c < 0xf8) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) - { - if (n >= 3) - { - if ((s[2] ^ 0x80) < 0x40) - { - if (n >= 4) - { - if ((s[3] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } + ) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + if (n >= 4) + { + if ((s[3] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } #if 0 else if (c < 0xfc) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) - { - if (n >= 3) - { - if ((s[2] ^ 0x80) < 0x40) - { - if (n >= 4) - { - if ((s[3] ^ 0x80) < 0x40) - { - if (n >= 5) - { - if ((s[4] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + if (n >= 4) + { + if ((s[3] ^ 0x80) < 0x40) + { + if (n >= 5) + { + if ((s[4] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } else if (c < 0xfe) - { - if (n >= 2) - { - if ((s[1] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) - { - if (n >= 3) - { - if ((s[2] ^ 0x80) < 0x40) - { - if (n >= 4) - { - if ((s[3] ^ 0x80) < 0x40) - { - if (n >= 5) - { - if ((s[4] ^ 0x80) < 0x40) - { - if (n >= 6) - { - if ((s[5] ^ 0x80) < 0x40) - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } - /* invalid multibyte character */ - } - else - { - /* incomplete multibyte character */ - *puc = 0xfffd; - return -2; - } - } + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + if (n >= 4) + { + if ((s[3] ^ 0x80) < 0x40) + { + if (n >= 5) + { + if ((s[4] ^ 0x80) < 0x40) + { + if (n >= 6) + { + if ((s[5] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } #endif } /* invalid multibyte character */ diff --git a/lib/unistr/u8-move.c b/lib/unistr/u8-move.c index 5a30be8..5c48411 100644 --- a/lib/unistr/u8-move.c +++ b/lib/unistr/u8-move.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-next.c b/lib/unistr/u8-next.c index ecf4f80..34249aa 100644 --- a/lib/unistr/u8-next.c +++ b/lib/unistr/u8-next.c @@ -1,5 +1,5 @@ /* Iterate over next character in UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,7 +31,7 @@ u8_next (ucs4_t *puc, const uint8_t *s) else { if (count < 0) - *puc = 0xfffd; + *puc = 0xfffd; return NULL; } } diff --git a/lib/unistr/u8-prev.c b/lib/unistr/u8-prev.c index 245d22f..97a27f5 100644 --- a/lib/unistr/u8-prev.c +++ b/lib/unistr/u8-prev.c @@ -1,5 +1,5 @@ /* Iterate over previous character in UTF-8 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -29,65 +29,65 @@ u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start) uint8_t c_1 = s[-1]; if (c_1 < 0x80) - { - *puc = c_1; - return s - 1; - } + { + *puc = c_1; + return s - 1; + } #if CONFIG_UNICODE_SAFETY if ((c_1 ^ 0x80) < 0x40) #endif - if (s - 1 != start) - { - uint8_t c_2 = s[-2]; + if (s - 1 != start) + { + uint8_t c_2 = s[-2]; - if (c_2 >= 0xc2 && c_2 < 0xe0) - { - *puc = ((unsigned int) (c_2 & 0x1f) << 6) - | (unsigned int) (c_1 ^ 0x80); - return s - 2; - } + if (c_2 >= 0xc2 && c_2 < 0xe0) + { + *puc = ((unsigned int) (c_2 & 0x1f) << 6) + | (unsigned int) (c_1 ^ 0x80); + return s - 2; + } #if CONFIG_UNICODE_SAFETY - if ((c_2 ^ 0x80) < 0x40) + if ((c_2 ^ 0x80) < 0x40) #endif - if (s - 2 != start) - { - uint8_t c_3 = s[-3]; + if (s - 2 != start) + { + uint8_t c_3 = s[-3]; - if (c_3 >= 0xe0 && c_3 < 0xf0 + if (c_3 >= 0xe0 && c_3 < 0xf0 #if CONFIG_UNICODE_SAFETY - && (c_3 >= 0xe1 || c_2 >= 0xa0) - && (c_3 != 0xed || c_2 < 0xa0) + && (c_3 >= 0xe1 || c_2 >= 0xa0) + && (c_3 != 0xed || c_2 < 0xa0) #endif - ) - { - *puc = ((unsigned int) (c_3 & 0x0f) << 12) - | ((unsigned int) (c_2 ^ 0x80) << 6) - | (unsigned int) (c_1 ^ 0x80); - return s - 3; - } + ) + { + *puc = ((unsigned int) (c_3 & 0x0f) << 12) + | ((unsigned int) (c_2 ^ 0x80) << 6) + | (unsigned int) (c_1 ^ 0x80); + return s - 3; + } #if CONFIG_UNICODE_SAFETY - if ((c_3 ^ 0x80) < 0x40) + if ((c_3 ^ 0x80) < 0x40) #endif - if (s - 3 != start) - { - uint8_t c_4 = s[-4]; + if (s - 3 != start) + { + uint8_t c_4 = s[-4]; - if (c_4 >= 0xf0 && c_4 < 0xf8 + if (c_4 >= 0xf0 && c_4 < 0xf8 #if CONFIG_UNICODE_SAFETY - && (c_4 >= 0xf1 || c_3 >= 0x90) - && (c_4 < 0xf4 || (c_4 == 0xf4 && c_3 < 0x90)) + && (c_4 >= 0xf1 || c_3 >= 0x90) + && (c_4 < 0xf4 || (c_4 == 0xf4 && c_3 < 0x90)) #endif - ) - { - *puc = ((unsigned int) (c_4 & 0x07) << 18) - | ((unsigned int) (c_3 ^ 0x80) << 12) - | ((unsigned int) (c_2 ^ 0x80) << 6) - | (unsigned int) (c_1 ^ 0x80); - return s - 4; - } - } - } - } + ) + { + *puc = ((unsigned int) (c_4 & 0x07) << 18) + | ((unsigned int) (c_3 ^ 0x80) << 12) + | ((unsigned int) (c_2 ^ 0x80) << 6) + | (unsigned int) (c_1 ^ 0x80); + return s - 4; + } + } + } + } } return NULL; } diff --git a/lib/unistr/u8-set.c b/lib/unistr/u8-set.c index 5bb4fd7..3cca23b 100644 --- a/lib/unistr/u8-set.c +++ b/lib/unistr/u8-set.c @@ -1,5 +1,5 @@ /* Fill UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,12 +33,12 @@ FUNC (UNIT *s, ucs4_t uc, size_t n) if (n > 0) { if (IS_SINGLE_UNIT (uc)) - memset ((char *) s, uc, n); + memset ((char *) s, uc, n); else - { - errno = EILSEQ; - return NULL; - } + { + errno = EILSEQ; + return NULL; + } } return s; } diff --git a/lib/unistr/u8-startswith.c b/lib/unistr/u8-startswith.c index 671e3d9..4cc436a 100644 --- a/lib/unistr/u8-startswith.c +++ b/lib/unistr/u8-startswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-stpcpy.c b/lib/unistr/u8-stpcpy.c index a5c15c5..0faba41 100644 --- a/lib/unistr/u8-stpcpy.c +++ b/lib/unistr/u8-stpcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-stpncpy.c b/lib/unistr/u8-stpncpy.c index 87f254d..a456bea 100644 --- a/lib/unistr/u8-stpncpy.c +++ b/lib/unistr/u8-stpncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strcat.c b/lib/unistr/u8-strcat.c index 25ec5d3..2b54bad 100644 --- a/lib/unistr/u8-strcat.c +++ b/lib/unistr/u8-strcat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strchr.c b/lib/unistr/u8-strchr.c index 370a793..3be14c7 100644 --- a/lib/unistr/u8-strchr.c +++ b/lib/unistr/u8-strchr.c @@ -1,5 +1,6 @@ /* Search character in UTF-8 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -30,70 +31,70 @@ u8_strchr (const uint8_t *s, ucs4_t uc) uint8_t c0 = uc; for (;; s++) - { - if (*s == c0) - break; - if (*s == 0) - goto notfound; - } + { + if (*s == c0) + break; + if (*s == 0) + goto notfound; + } return (uint8_t *) s; } else switch (u8_uctomb_aux (c, uc, 6)) { case 2: - if (*s == 0) - goto notfound; - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; + if (*s == 0) + goto notfound; + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; - for (;; s++) - { - if (s[1] == 0) - goto notfound; - if (*s == c0 && s[1] == c1) - break; - } - return (uint8_t *) s; - } + for (;; s++) + { + if (s[1] == 0) + goto notfound; + if (*s == c0 && s[1] == c1) + break; + } + return (uint8_t *) s; + } case 3: - if (*s == 0 || s[1] == 0) - goto notfound; - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; + if (*s == 0 || s[1] == 0) + goto notfound; + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; - for (;; s++) - { - if (s[2] == 0) - goto notfound; - if (*s == c0 && s[1] == c1 && s[2] == c2) - break; - } - return (uint8_t *) s; - } + for (;; s++) + { + if (s[2] == 0) + goto notfound; + if (*s == c0 && s[1] == c1 && s[2] == c2) + break; + } + return (uint8_t *) s; + } case 4: - if (*s == 0 || s[1] == 0 || s[2] == 0) - goto notfound; - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; - uint8_t c3 = c[3]; + if (*s == 0 || s[1] == 0 || s[2] == 0) + goto notfound; + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; + uint8_t c3 = c[3]; - for (;; s++) - { - if (s[3] == 0) - goto notfound; - if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) - break; - } - return (uint8_t *) s; - } + for (;; s++) + { + if (s[3] == 0) + goto notfound; + if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) + break; + } + return (uint8_t *) s; + } } notfound: return NULL; diff --git a/lib/unistr/u8-strcmp.c b/lib/unistr/u8-strcmp.c index 58b4b8c..82a4414 100644 --- a/lib/unistr/u8-strcmp.c +++ b/lib/unistr/u8-strcmp.c @@ -1,5 +1,5 @@ /* Compare UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strcoll.c b/lib/unistr/u8-strcoll.c index ca08609..9ffa135 100644 --- a/lib/unistr/u8-strcoll.c +++ b/lib/unistr/u8-strcoll.c @@ -1,5 +1,5 @@ /* Compare UTF-8 strings using the collation rules of the current locale. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strcpy.c b/lib/unistr/u8-strcpy.c index b93c8cb..9662de5 100644 --- a/lib/unistr/u8-strcpy.c +++ b/lib/unistr/u8-strcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strcspn.c b/lib/unistr/u8-strcspn.c index a43b53f..4b5b8e0 100644 --- a/lib/unistr/u8-strcspn.c +++ b/lib/unistr/u8-strcspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strdup.c b/lib/unistr/u8-strdup.c index feaa872..58a3077 100644 --- a/lib/unistr/u8-strdup.c +++ b/lib/unistr/u8-strdup.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strlen.c b/lib/unistr/u8-strlen.c index cf5b9ce..b8bebf0 100644 --- a/lib/unistr/u8-strlen.c +++ b/lib/unistr/u8-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strmblen.c b/lib/unistr/u8-strmblen.c index 52db99d..52242c5 100644 --- a/lib/unistr/u8-strmblen.c +++ b/lib/unistr/u8-strmblen.c @@ -1,5 +1,6 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -31,64 +32,64 @@ u8_strmblen (const uint8_t *s) if (c >= 0xc2) { if (c < 0xe0) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40) #else - if (s[1] != 0) + if (s[1] != 0) #endif - return 2; - } + return 2; + } else if (c < 0xf0) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) #else - if (s[1] != 0 && s[2] != 0) + if (s[1] != 0 && s[2] != 0) #endif - return 3; - } + return 3; + } else if (c < 0xf8) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) + ) #else - if (s[1] != 0 && s[2] != 0 && s[3] != 0) + if (s[1] != 0 && s[2] != 0 && s[3] != 0) #endif - return 4; - } + return 4; + } #if 0 else if (c < 0xfc) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) #else - if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0) + if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0) #endif - return 5; - } + return 5; + } else if (c < 0xfe) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) #else - if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0 && s[5] != 0) + if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0 && s[5] != 0) #endif - return 6; - } + return 6; + } #endif } /* invalid or incomplete multibyte character */ diff --git a/lib/unistr/u8-strmbtouc.c b/lib/unistr/u8-strmbtouc.c index bc2fdb0..67016c6 100644 --- a/lib/unistr/u8-strmbtouc.c +++ b/lib/unistr/u8-strmbtouc.c @@ -1,5 +1,6 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2000, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software + Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -34,94 +35,94 @@ u8_strmbtouc (ucs4_t *puc, const uint8_t *s) if (c >= 0xc2) { if (c < 0xe0) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40) #else - if (s[1] != 0) + if (s[1] != 0) #endif - { - *puc = ((unsigned int) (c & 0x1f) << 6) - | (unsigned int) (s[1] ^ 0x80); - return 2; - } - } + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + } else if (c < 0xf0) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) #else - if (s[1] != 0 && s[2] != 0) + if (s[1] != 0 && s[2] != 0) #endif - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - } + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + } else if (c < 0xf8) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) + ) #else - if (s[1] != 0 && s[2] != 0 && s[3] != 0) + if (s[1] != 0 && s[2] != 0 && s[3] != 0) #endif - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - } + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + } #if 0 else if (c < 0xfc) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) #else - if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0) + if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0) #endif - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - } + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + } else if (c < 0xfe) - { + { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) #else - if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0 && s[5] != 0) + if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0 && s[5] != 0) #endif - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - } + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + } #endif } /* invalid or incomplete multibyte character */ diff --git a/lib/unistr/u8-strncat.c b/lib/unistr/u8-strncat.c index d965460..4780350 100644 --- a/lib/unistr/u8-strncat.c +++ b/lib/unistr/u8-strncat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strncmp.c b/lib/unistr/u8-strncmp.c index 5aad7e7..286450b 100644 --- a/lib/unistr/u8-strncmp.c +++ b/lib/unistr/u8-strncmp.c @@ -1,5 +1,5 @@ /* Compare UTF-8 strings. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strncpy.c b/lib/unistr/u8-strncpy.c index f478fab..5ef757b 100644 --- a/lib/unistr/u8-strncpy.c +++ b/lib/unistr/u8-strncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strnlen.c b/lib/unistr/u8-strnlen.c index 32ce7b8..e732ea2 100644 --- a/lib/unistr/u8-strnlen.c +++ b/lib/unistr/u8-strnlen.c @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strpbrk.c b/lib/unistr/u8-strpbrk.c index 1538faa..ec6dc27 100644 --- a/lib/unistr/u8-strpbrk.c +++ b/lib/unistr/u8-strpbrk.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strrchr.c b/lib/unistr/u8-strrchr.c index 309f323..6d8e297 100644 --- a/lib/unistr/u8-strrchr.c +++ b/lib/unistr/u8-strrchr.c @@ -1,5 +1,6 @@ /* Search character in UTF-8 string. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, + Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,69 +34,69 @@ u8_strrchr (const uint8_t *s, ucs4_t uc) uint8_t c0 = uc; for (;; s++) - { - if (*s == c0) - result = (uint8_t *) s; - if (*s == 0) - break; - } + { + if (*s == c0) + result = (uint8_t *) s; + if (*s == 0) + break; + } } else switch (u8_uctomb_aux (c, uc, 6)) { case 2: - if (*s) - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; + if (*s) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; - /* FIXME: Maybe walking the string via u8_mblen is a win? */ - for (;; s++) - { - if (s[1] == 0) - break; - if (*s == c0 && s[1] == c1) - result = (uint8_t *) s; - } - } - break; + /* FIXME: Maybe walking the string via u8_mblen is a win? */ + for (;; s++) + { + if (s[1] == 0) + break; + if (*s == c0 && s[1] == c1) + result = (uint8_t *) s; + } + } + break; case 3: - if (*s && s[1]) - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; + if (*s && s[1]) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; - /* FIXME: Maybe walking the string via u8_mblen is a win? */ - for (;; s++) - { - if (s[2] == 0) - break; - if (*s == c0 && s[1] == c1 && s[2] == c2) - result = (uint8_t *) s; - } - } - break; + /* FIXME: Maybe walking the string via u8_mblen is a win? */ + for (;; s++) + { + if (s[2] == 0) + break; + if (*s == c0 && s[1] == c1 && s[2] == c2) + result = (uint8_t *) s; + } + } + break; case 4: - if (*s && s[1] && s[2]) - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; - uint8_t c3 = c[3]; + if (*s && s[1] && s[2]) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; + uint8_t c3 = c[3]; - /* FIXME: Maybe walking the string via u8_mblen is a win? */ - for (;; s++) - { - if (s[3] == 0) - break; - if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) - result = (uint8_t *) s; - } - } - break; + /* FIXME: Maybe walking the string via u8_mblen is a win? */ + for (;; s++) + { + if (s[3] == 0) + break; + if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) + result = (uint8_t *) s; + } + } + break; } return result; } diff --git a/lib/unistr/u8-strspn.c b/lib/unistr/u8-strspn.c index 582c825..7747815 100644 --- a/lib/unistr/u8-strspn.c +++ b/lib/unistr/u8-strspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strstr.c b/lib/unistr/u8-strstr.c index b5cbf24..cce37ad 100644 --- a/lib/unistr/u8-strstr.c +++ b/lib/unistr/u8-strstr.c @@ -1,5 +1,5 @@ /* Substring test for UTF-8 strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strtok.c b/lib/unistr/u8-strtok.c index a8d3821..e5c7203 100644 --- a/lib/unistr/u8-strtok.c +++ b/lib/unistr/u8-strtok.c @@ -1,5 +1,5 @@ /* Tokenize UTF-8 string. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-to-u16.c b/lib/unistr/u8-to-u16.c index 03c6600..3745c2b 100644 --- a/lib/unistr/u8-to-u16.c +++ b/lib/unistr/u8-to-u16.c @@ -1,5 +1,5 @@ /* Convert UTF-8 string to UTF-16 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -58,68 +58,68 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) int count; /* Fetch a Unicode character from the input string. */ - count = u8_mbtouc (&uc, s, s_end - s); + count = u8_mbtoucr (&uc, s, s_end - s); if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } s += count; /* Store it in the output string. */ count = u16_uctomb (result + length, uc, allocated - length); if (count == -1) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } if (count == -2) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 2 > allocated) - allocated = length + 2; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - count = u16_uctomb (result + length, uc, allocated - length); - if (count < 0) - abort (); - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 2 > allocated) + allocated = length + 2; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + count = u16_uctomb (result + length, uc, allocated - length); + if (count < 0) + abort (); + } length += count; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -128,7 +128,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unistr/u8-to-u32.c b/lib/unistr/u8-to-u32.c index 2a0ad39..de2a35e 100644 --- a/lib/unistr/u8-to-u32.c +++ b/lib/unistr/u8-to-u32.c @@ -1,5 +1,5 @@ /* Convert UTF-8 string to UTF-32 string. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -58,57 +58,57 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) int count; /* Fetch a Unicode character from the input string. */ - count = u8_mbtouc (&uc, s, s_end - s); + count = u8_mbtoucr (&uc, s, s_end - s); if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = EILSEQ; - return NULL; - } + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = EILSEQ; + return NULL; + } s += count; /* Store it in the output string. */ if (length + 1 > allocated) - { - DST_UNIT *memory; - - allocated = (allocated > 0 ? 2 * allocated : 12); - if (length + 1 > allocated) - allocated = length + 1; - if (result == resultbuf || result == NULL) - memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); - else - memory = - (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); - - if (memory == NULL) - { - if (!(result == resultbuf || result == NULL)) - free (result); - errno = ENOMEM; - return NULL; - } - if (result == resultbuf && length > 0) - memcpy ((char *) memory, (char *) result, - length * sizeof (DST_UNIT)); - result = memory; - } + { + DST_UNIT *memory; + + allocated = (allocated > 0 ? 2 * allocated : 12); + if (length + 1 > allocated) + allocated = length + 1; + if (result == resultbuf || result == NULL) + memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT)); + else + memory = + (DST_UNIT *) realloc (result, allocated * sizeof (DST_UNIT)); + + if (memory == NULL) + { + if (!(result == resultbuf || result == NULL)) + free (result); + errno = ENOMEM; + return NULL; + } + if (result == resultbuf && length > 0) + memcpy ((char *) memory, (char *) result, + length * sizeof (DST_UNIT)); + result = memory; + } result[length++] = uc; } if (length == 0) { if (result == NULL) - { - /* Return a non-NULL value. NULL means error. */ - result = (DST_UNIT *) malloc (1); - if (result == NULL) - { - errno = ENOMEM; - return NULL; - } - } + { + /* Return a non-NULL value. NULL means error. */ + result = (DST_UNIT *) malloc (1); + if (result == NULL) + { + errno = ENOMEM; + return NULL; + } + } } else if (result != resultbuf && length < allocated) { @@ -117,7 +117,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT)); if (memory != NULL) - result = memory; + result = memory; } *lengthp = length; diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c index c42fa50..695921d 100644 --- a/lib/unistr/u8-uctomb-aux.c +++ b/lib/unistr/u8-uctomb-aux.c @@ -1,5 +1,5 @@ /* Conversion UCS-4 to UTF-8. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,9 +33,9 @@ u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n) else if (uc < 0x10000) { if (uc < 0xd800 || uc >= 0xe000) - count = 3; + count = 3; else - return -1; + return -1; } #if 0 else if (uc < 0x200000) diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c index 3392166..fd33c05 100644 --- a/lib/unistr/u8-uctomb.c +++ b/lib/unistr/u8-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-8 string. - Copyright (C) 2002, 2005-2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -33,10 +33,10 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n) if (uc < 0x80) { if (n > 0) - { - s[0] = uc; - return 1; - } + { + s[0] = uc; + return 1; + } /* else return -2, below. */ } else @@ -44,43 +44,43 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n) int count; if (uc < 0x800) - count = 2; + count = 2; else if (uc < 0x10000) - { - if (uc < 0xd800 || uc >= 0xe000) - count = 3; - else - return -1; - } + { + if (uc < 0xd800 || uc >= 0xe000) + count = 3; + else + return -1; + } #if 0 else if (uc < 0x200000) - count = 4; + count = 4; else if (uc < 0x4000000) - count = 5; + count = 5; else if (uc <= 0x7fffffff) - count = 6; + count = 6; #else else if (uc < 0x110000) - count = 4; + count = 4; #endif else - return -1; + return -1; if (n >= count) - { - switch (count) /* note: code falls through cases! */ - { + { + switch (count) /* note: code falls through cases! */ + { #if 0 - case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000; - case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000; + case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000; + case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000; #endif - case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; - case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; - case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; - /*case 1:*/ s[0] = uc; - } - return count; - } + case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; + case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; + case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; + /*case 1:*/ s[0] = uc; + } + return count; + } } return -2; } diff --git a/lib/unistring/cdefs.in.h b/lib/unistring/cdefs.in.h new file mode 100644 index 0000000..2be62c2 --- /dev/null +++ b/lib/unistring/cdefs.in.h @@ -0,0 +1,22 @@ +/* Common macro definitions for C include files. + 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 Lesser 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 + 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 <http://www.gnu.org/licenses/>. */ + +#ifndef _UNISTRING_CDEFS_H +#define _UNISTRING_CDEFS_H + +/* The definition of _GL_UNUSED_PARAMETER is copied here. */ + +#endif /* _UNISTRING_CDEFS_H */ diff --git a/lib/unitypes.h b/lib/unitypes.h index 515f7ad..376ffc2 100644 --- a/lib/unitypes.h +++ b/lib/unitypes.h @@ -1,5 +1,5 @@ /* Elementary types for the GNU UniString library. - Copyright (C) 2002, 2005-2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniwbrk.h b/lib/uniwbrk.h index c6ad971..25cf33a 100644 --- a/lib/uniwbrk.h +++ b/lib/uniwbrk.h @@ -1,5 +1,5 @@ /* Word breaks in Unicode strings. - Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwbrk/u-wordbreaks.h b/lib/uniwbrk/u-wordbreaks.h index 5ef4e8c..b0fd301 100644 --- a/lib/uniwbrk/u-wordbreaks.h +++ b/lib/uniwbrk/u-wordbreaks.h @@ -1,5 +1,5 @@ /* Word breaks in UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -23,105 +23,105 @@ FUNC (const UNIT *s, size_t n, char *p) const UNIT *s_end = s + n; /* Word break property of the last character. - -1 at the very beginning of the string. */ + -1 at the very beginning of the string. */ int last_char_prop = -1; /* Format and Extend characters are ignored; this means, the mostly used - unit is the complex character (= character with subsequent ignored - characters). - Word break property of the last complex character. - -1 at the very beginning of the string. */ + unit is the complex character (= character with subsequent ignored + characters). + Word break property of the last complex character. + -1 at the very beginning of the string. */ int last_compchar_prop = -1; char *last_compchar_ptr = NULL; /* For recognizing rules involving 3 complex characters: - Word break property of the second-to-last complex character. - -1 at the very beginning of the string. */ + Word break property of the second-to-last complex character. + -1 at the very beginning of the string. */ int secondlast_compchar_prop = -1; /* Don't break inside multibyte characters. */ memset (p, 0, n); while (s < s_end) - { - ucs4_t uc; - int count = U_MBTOUC_UNSAFE (&uc, s, s_end - s); - int prop = uc_wordbreak_property (uc); + { + ucs4_t uc; + int count = U_MBTOUC_UNSAFE (&uc, s, s_end - s); + int prop = uc_wordbreak_property (uc); - /* No break at the start of the string. */ - if (last_char_prop >= 0) - { - /* No break between CR and LF. */ - if (last_char_prop == WBP_CR && prop == WBP_LF) - /* *p = 0 */; - /* Break before and after newlines. */ - else if (last_char_prop >= WBP_NEWLINE - /* same as: - last_char_prop == WBP_CR - || last_char_prop == WBP_LF - || last_char_prop == WBP_NEWLINE */ - || prop >= WBP_NEWLINE - /* same as: - prop == WBP_CR - || prop == WBP_LF - || prop == WBP_NEWLINE */) - *p = 1; - /* Ignore Format and Extend characters. */ - else if (!(prop == WBP_EXTEND || prop == WBP_FORMAT)) - { - /* No break in these situations (see UAX #29): + /* No break at the start of the string. */ + if (last_char_prop >= 0) + { + /* No break between CR and LF. */ + if (last_char_prop == WBP_CR && prop == WBP_LF) + /* *p = 0 */; + /* Break before and after newlines. */ + else if (last_char_prop >= WBP_NEWLINE + /* same as: + last_char_prop == WBP_CR + || last_char_prop == WBP_LF + || last_char_prop == WBP_NEWLINE */ + || prop >= WBP_NEWLINE + /* same as: + prop == WBP_CR + || prop == WBP_LF + || prop == WBP_NEWLINE */) + *p = 1; + /* Ignore Format and Extend characters. */ + else if (!(prop == WBP_EXTEND || prop == WBP_FORMAT)) + { + /* No break in these situations (see UAX #29): - secondlast last current + secondlast last current - ALetter (MidLetter | MidNumLet) × ALetter (WB7) - ALetter × (MidLetter | MidNumLet) ALetter (WB6) - Numeric (MidNum | MidNumLet) × Numeric (WB11) - Numeric × (MidNum | MidNumLet) Numeric (WB12) - ALetter × ALetter (WB5) - ALetter × Numeric (WB9) - Numeric × ALetter (WB10) - Numeric × Numeric (WB8) - Katakana × Katakana (WB13) - (ALetter | Numeric | Katakana) × ExtendNumLet (WB13a) - ExtendNumLet × ExtendNumLet (WB13a) - ExtendNumLet × (ALetter | Numeric | Katakana) (WB13b) - */ - /* No break across certain punctuation. Also, disable word - breaks that were recognized earlier (due to lookahead of - only one complex character). */ - if ((prop == WBP_ALETTER - && (last_compchar_prop == WBP_MIDLETTER - || last_compchar_prop == WBP_MIDNUMLET) - && secondlast_compchar_prop == WBP_ALETTER) - || (prop == WBP_NUMERIC - && (last_compchar_prop == WBP_MIDNUM - || last_compchar_prop == WBP_MIDNUMLET) - && secondlast_compchar_prop == WBP_NUMERIC)) - { - *last_compchar_ptr = 0; - /* *p = 0; */ - } - else - { - /* Perform a single table lookup. */ - if (uniwbrk_table[last_compchar_prop][prop]) - *p = 1; - /* else *p = 0; */ - } - } - } + ALetter (MidLetter | MidNumLet) × ALetter (WB7) + ALetter × (MidLetter | MidNumLet) ALetter (WB6) + Numeric (MidNum | MidNumLet) × Numeric (WB11) + Numeric × (MidNum | MidNumLet) Numeric (WB12) + ALetter × ALetter (WB5) + ALetter × Numeric (WB9) + Numeric × ALetter (WB10) + Numeric × Numeric (WB8) + Katakana × Katakana (WB13) + (ALetter | Numeric | Katakana) × ExtendNumLet (WB13a) + ExtendNumLet × ExtendNumLet (WB13a) + ExtendNumLet × (ALetter | Numeric | Katakana) (WB13b) + */ + /* No break across certain punctuation. Also, disable word + breaks that were recognized earlier (due to lookahead of + only one complex character). */ + if ((prop == WBP_ALETTER + && (last_compchar_prop == WBP_MIDLETTER + || last_compchar_prop == WBP_MIDNUMLET) + && secondlast_compchar_prop == WBP_ALETTER) + || (prop == WBP_NUMERIC + && (last_compchar_prop == WBP_MIDNUM + || last_compchar_prop == WBP_MIDNUMLET) + && secondlast_compchar_prop == WBP_NUMERIC)) + { + *last_compchar_ptr = 0; + /* *p = 0; */ + } + else + { + /* Perform a single table lookup. */ + if (uniwbrk_table[last_compchar_prop][prop]) + *p = 1; + /* else *p = 0; */ + } + } + } - last_char_prop = prop; - /* Ignore Format and Extend characters, except at the start of the string. */ - if (last_compchar_prop < 0 || !(prop == WBP_EXTEND || prop == WBP_FORMAT)) - { - secondlast_compchar_prop = last_compchar_prop; - last_compchar_prop = prop; - last_compchar_ptr = p; - } + last_char_prop = prop; + /* Ignore Format and Extend characters, except at the start of the string. */ + if (last_compchar_prop < 0 || !(prop == WBP_EXTEND || prop == WBP_FORMAT)) + { + secondlast_compchar_prop = last_compchar_prop; + last_compchar_prop = prop; + last_compchar_ptr = p; + } - s += count; - p += count; - } + s += count; + p += count; + } } } diff --git a/lib/uniwbrk/u16-wordbreaks.c b/lib/uniwbrk/u16-wordbreaks.c index 3398fd3..ea2a53d 100644 --- a/lib/uniwbrk/u16-wordbreaks.c +++ b/lib/uniwbrk/u16-wordbreaks.c @@ -1,5 +1,5 @@ /* Word breaks in UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwbrk/u32-wordbreaks.c b/lib/uniwbrk/u32-wordbreaks.c index 6763fb9..86a2616 100644 --- a/lib/uniwbrk/u32-wordbreaks.c +++ b/lib/uniwbrk/u32-wordbreaks.c @@ -1,5 +1,5 @@ /* Word breaks in UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwbrk/u8-wordbreaks.c b/lib/uniwbrk/u8-wordbreaks.c index 59d2076..c7edfe9 100644 --- a/lib/uniwbrk/u8-wordbreaks.c +++ b/lib/uniwbrk/u8-wordbreaks.c @@ -1,5 +1,5 @@ /* Word breaks in UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -50,28 +50,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -98,20 +98,20 @@ main (int argc, char * argv[]) u8_wordbreaks ((uint8_t *) input, length, breaks); for (i = 0; i < length; i++) - { - switch (breaks[i]) - { - case 1: - /* U+2027 in UTF-8 encoding */ - putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout); - break; - case 0: - break; - default: - abort (); - } - putc (input[i], stdout); - } + { + switch (breaks[i]) + { + case 1: + /* U+2027 in UTF-8 encoding */ + putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout); + break; + case 0: + break; + default: + abort (); + } + putc (input[i], stdout); + } free (breaks); diff --git a/lib/uniwbrk/ulc-wordbreaks.c b/lib/uniwbrk/ulc-wordbreaks.c index cb6e131..6e17026 100644 --- a/lib/uniwbrk/ulc-wordbreaks.c +++ b/lib/uniwbrk/ulc-wordbreaks.c @@ -1,5 +1,5 @@ /* Word breaks in strings. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -49,60 +49,60 @@ ulc_wordbreaks (const char *s, size_t n, char *p) const char *encoding = locale_charset (); if (is_utf8_encoding (encoding)) - u8_wordbreaks ((const uint8_t *) s, n, p); + u8_wordbreaks ((const uint8_t *) s, n, p); else - { - /* Convert the string to UTF-8 and build a translation table - from offsets into s to offsets into the translated string. */ - size_t *offsets = (size_t *) malloc (n * sizeof (size_t)); - - if (offsets != NULL) - { - uint8_t *t; - size_t m; - - t = u8_conv_from_encoding (encoding, iconveh_question_mark, - s, n, offsets, NULL, &m); - if (t != NULL) - { - char *q = (char *) (m > 0 ? malloc (m) : NULL); - - if (m == 0 || q != NULL) - { - size_t i; - - /* Determine the word breaks of the UTF-8 string. */ - u8_wordbreaks (t, m, q); - - /* Translate the result back to the original string. */ - memset (p, 0, n); - for (i = 0; i < n; i++) - if (offsets[i] != (size_t)(-1)) - p[i] = q[offsets[i]]; - - free (q); - free (t); - free (offsets); - return; - } - free (t); - } - free (offsets); - } - - /* Impossible to convert. */ + { + /* Convert the string to UTF-8 and build a translation table + from offsets into s to offsets into the translated string. */ + size_t *offsets = (size_t *) malloc (n * sizeof (size_t)); + + if (offsets != NULL) + { + uint8_t *t; + size_t m; + + t = u8_conv_from_encoding (encoding, iconveh_question_mark, + s, n, offsets, NULL, &m); + if (t != NULL) + { + char *q = (char *) (m > 0 ? malloc (m) : NULL); + + if (m == 0 || q != NULL) + { + size_t i; + + /* Determine the word breaks of the UTF-8 string. */ + u8_wordbreaks (t, m, q); + + /* Translate the result back to the original string. */ + memset (p, 0, n); + for (i = 0; i < n; i++) + if (offsets[i] != (size_t)(-1)) + p[i] = q[offsets[i]]; + + free (q); + free (t); + free (offsets); + return; + } + free (t); + } + free (offsets); + } + + /* Impossible to convert. */ #if C_CTYPE_ASCII - if (is_all_ascii (s, n)) - { - /* ASCII is a subset of UTF-8. */ - u8_wordbreaks ((const uint8_t *) s, n, p); - return; - } + if (is_all_ascii (s, n)) + { + /* ASCII is a subset of UTF-8. */ + u8_wordbreaks ((const uint8_t *) s, n, p); + return; + } #endif - /* We have a non-ASCII string and cannot convert it. - Don't produce any word breaks. */ - memset (p, 0, n); - } + /* We have a non-ASCII string and cannot convert it. + Don't produce any word breaks. */ + memset (p, 0, n); + } } } @@ -127,28 +127,28 @@ read_file (FILE *stream) while (! feof (stream)) { if (size + BUFSIZE > alloc) - { - alloc = alloc + alloc / 2; - if (alloc < size + BUFSIZE) - alloc = size + BUFSIZE; - buf = realloc (buf, alloc); - if (buf == NULL) - { - fprintf (stderr, "out of memory\n"); - exit (1); - } - } + { + alloc = alloc + alloc / 2; + if (alloc < size + BUFSIZE) + alloc = size + BUFSIZE; + buf = realloc (buf, alloc); + if (buf == NULL) + { + fprintf (stderr, "out of memory\n"); + exit (1); + } + } count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) - { - if (ferror (stream)) - { - perror ("fread"); - exit (1); - } - } + { + if (ferror (stream)) + { + perror ("fread"); + exit (1); + } + } else - size += count; + size += count; } buf = realloc (buf, size + 1); if (buf == NULL) @@ -176,19 +176,19 @@ main (int argc, char * argv[]) ulc_wordbreaks (input, length, breaks); for (i = 0; i < length; i++) - { - switch (breaks[i]) - { - case 1: - putc ('|', stdout); - break; - case 0: - break; - default: - abort (); - } - putc (input[i], stdout); - } + { + switch (breaks[i]) + { + case 1: + putc ('|', stdout); + break; + case 0: + break; + default: + abort (); + } + putc (input[i], stdout); + } free (breaks); diff --git a/lib/uniwbrk/wbrkprop.h b/lib/uniwbrk/wbrkprop.h index 3b50e17..77fd61d 100644 --- a/lib/uniwbrk/wbrkprop.h +++ b/lib/uniwbrk/wbrkprop.h @@ -2,7 +2,7 @@ /* Line breaking properties of Unicode characters. */ /* Generated automatically by gen-uni-tables for Unicode 5.1.0. */ -/* Copyright (C) 2000-2002, 2004, 2007-2009 Free Software Foundation, Inc. +/* Copyright (C) 2000-2002, 2004, 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/uniwbrk/wbrktable.c b/lib/uniwbrk/wbrktable.c index 81a2323..ff25fb3 100644 --- a/lib/uniwbrk/wbrktable.c +++ b/lib/uniwbrk/wbrktable.c @@ -1,5 +1,5 @@ /* Word break auxiliary table. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -22,22 +22,22 @@ /* This table contains the following rules (see UAX #29): - last current + last current - ALetter × ALetter (WB5) - ALetter × Numeric (WB9) - Numeric × ALetter (WB10) - Numeric × Numeric (WB8) - Katakana × Katakana (WB13) + ALetter × ALetter (WB5) + ALetter × Numeric (WB9) + Numeric × ALetter (WB10) + Numeric × Numeric (WB8) + Katakana × Katakana (WB13) (ALetter | Numeric | Katakana) × ExtendNumLet (WB13a) - ExtendNumLet × ExtendNumLet (WB13a) - ExtendNumLet × (ALetter | Numeric | Katakana) (WB13b) + ExtendNumLet × ExtendNumLet (WB13a) + ExtendNumLet × (ALetter | Numeric | Katakana) (WB13b) */ const unsigned char uniwbrk_table[10][8] = { /* current: OTHER MIDNUMLET NUMERIC */ - /* KATAKANA MIDLETTER EXTENDNUMLET */ - /* ALETTER MIDNUM */ + /* KATAKANA MIDLETTER EXTENDNUMLET */ + /* ALETTER MIDNUM */ /* last */ /* WBP_OTHER */ { 1, 1, 1, 1, 1, 1, 1, 1 }, /* WBP_KATAKANA */ { 1, 0, 1, 1, 1, 1, 1, 0 }, diff --git a/lib/uniwbrk/wbrktable.h b/lib/uniwbrk/wbrktable.h index 14efee9..8a13378 100644 --- a/lib/uniwbrk/wbrktable.h +++ b/lib/uniwbrk/wbrktable.h @@ -1,5 +1,5 @@ /* Word break auxiliary table. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwbrk/wordbreak-property.c b/lib/uniwbrk/wordbreak-property.c index 4d0a212..9d98b0b 100644 --- a/lib/uniwbrk/wordbreak-property.c +++ b/lib/uniwbrk/wordbreak-property.c @@ -1,5 +1,5 @@ /* Word break property. - Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -30,15 +30,15 @@ uc_wordbreak_property (ucs4_t uc) { int lookup1 = uniwbrkprop.level1[index1]; if (lookup1 >= 0) - { - unsigned int index2 = (uc >> wbrkprop_header_2) & wbrkprop_header_3; - int lookup2 = uniwbrkprop.level2[lookup1 + index2]; - if (lookup2 >= 0) - { - unsigned int index3 = uc & wbrkprop_header_4; - return uniwbrkprop.level3[lookup2 + index3]; - } - } + { + unsigned int index2 = (uc >> wbrkprop_header_2) & wbrkprop_header_3; + int lookup2 = uniwbrkprop.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = uc & wbrkprop_header_4; + return uniwbrkprop.level3[lookup2 + index3]; + } + } } return WBP_OTHER; } diff --git a/lib/uniwidth.h b/lib/uniwidth.h index 4f867b3..4e18162 100644 --- a/lib/uniwidth.h +++ b/lib/uniwidth.h @@ -1,5 +1,6 @@ /* Display width functions. - Copyright (C) 2001-2002, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005, 2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/uniwidth/cjk.h b/lib/uniwidth/cjk.h index 6124e1a..5d8ef12 100644 --- a/lib/uniwidth/cjk.h +++ b/lib/uniwidth/cjk.h @@ -1,5 +1,5 @@ /* Test for CJK encoding. - Copyright (C) 2001-2002, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwidth/u16-strwidth.c b/lib/uniwidth/u16-strwidth.c index e938bd2..01dc33b 100644 --- a/lib/uniwidth/u16-strwidth.c +++ b/lib/uniwidth/u16-strwidth.c @@ -1,5 +1,5 @@ /* Determine display width of UTF-16 string. - Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwidth/u16-width.c b/lib/uniwidth/u16-width.c index b866b3c..49a1204 100644 --- a/lib/uniwidth/u16-width.c +++ b/lib/uniwidth/u16-width.c @@ -1,5 +1,5 @@ /* Determine display width of UTF-16 string. - Copyright (C) 2001-2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -36,11 +36,11 @@ u16_width (const uint16_t *s, size_t n, const char *encoding) s += u16_mbtouc_unsafe (&uc, s, s_end - s); if (uc == 0) - break; /* end of string reached */ + break; /* end of string reached */ w = uc_width (uc, encoding); if (w >= 0) /* ignore control characters in the string */ - width += w; + width += w; } return width; diff --git a/lib/uniwidth/u32-strwidth.c b/lib/uniwidth/u32-strwidth.c index ee4eb4a..c21e6aa 100644 --- a/lib/uniwidth/u32-strwidth.c +++ b/lib/uniwidth/u32-strwidth.c @@ -1,5 +1,5 @@ /* Determine display width of UTF-32 string. - Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwidth/u32-width.c b/lib/uniwidth/u32-width.c index f928fa4..32c4133 100644 --- a/lib/uniwidth/u32-width.c +++ b/lib/uniwidth/u32-width.c @@ -1,5 +1,5 @@ /* Determine display width of UTF-32 string. - Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -32,11 +32,11 @@ u32_width (const uint32_t *s, size_t n, const char *encoding) int w; if (uc == 0) - break; /* end of string reached */ + break; /* end of string reached */ w = uc_width (uc, encoding); if (w >= 0) /* ignore control characters in the string */ - width += w; + width += w; } return width; diff --git a/lib/uniwidth/u8-strwidth.c b/lib/uniwidth/u8-strwidth.c index 961f26b..d3404b3 100644 --- a/lib/uniwidth/u8-strwidth.c +++ b/lib/uniwidth/u8-strwidth.c @@ -1,5 +1,5 @@ /* Determine display width of UTF-8 string. - Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/uniwidth/u8-width.c b/lib/uniwidth/u8-width.c index ad0d49d..fd27cab 100644 --- a/lib/uniwidth/u8-width.c +++ b/lib/uniwidth/u8-width.c @@ -1,5 +1,5 @@ /* Determine display width of UTF-8 string. - Copyright (C) 2001-2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -36,11 +36,11 @@ u8_width (const uint8_t *s, size_t n, const char *encoding) s += u8_mbtouc_unsafe (&uc, s, s_end - s); if (uc == 0) - break; /* end of string reached */ + break; /* end of string reached */ w = uc_width (uc, encoding); if (w >= 0) /* ignore control characters in the string */ - width += w; + width += w; } return width; diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c index 25ff0c7..c88fdb6 100644 --- a/lib/uniwidth/width.c +++ b/lib/uniwidth/width.c @@ -1,5 +1,5 @@ /* Determine display width of Unicode character. - Copyright (C) 2001-2002, 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -310,26 +310,26 @@ uc_width (ucs4_t uc, const char *encoding) { int ind = nonspacing_table_ind[uc >> 9]; if (ind >= 0) - if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) - { - if (uc > 0 && uc < 0xa0) - return -1; - else - return 0; - } + if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) + { + if (uc > 0 && uc < 0xa0) + return -1; + else + return 0; + } } else if ((uc >> 9) == (0xe0000 >> 9)) { if (uc >= 0xe0100) - { - if (uc <= 0xe01ef) - return 0; - } + { + if (uc <= 0xe01ef) + return 0; + } else - { - if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001) - return 0; - } + { + if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001) + return 0; + } } /* Test for double-width character. * Generated from "grep '^....;[WF]' EastAsianWidth.txt" @@ -337,17 +337,17 @@ uc_width (ucs4_t uc, const char *encoding) */ if (uc >= 0x1100 && ((uc < 0x1160) /* Hangul Jamo */ - || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */ - || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */ - && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00)) - || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */ - || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */ - || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */ - || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */ - || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */ - || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */ - || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */ - || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */ + || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */ + || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */ + && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00)) + || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */ + || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */ + || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */ + || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */ + || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */ + || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */ + || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */ + || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */ ) ) return 2; /* In ancient CJK encodings, Cyrillic and most other characters are diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index 35db978..daaec6a 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -67,13 +67,13 @@ # endif #endif -#include <locale.h> /* localeconv() */ -#include <stdio.h> /* snprintf(), sprintf() */ -#include <stdlib.h> /* abort(), malloc(), realloc(), free() */ -#include <string.h> /* memcpy(), strlen() */ -#include <errno.h> /* errno */ -#include <limits.h> /* CHAR_BIT */ -#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ +#include <locale.h> /* localeconv() */ +#include <stdio.h> /* snprintf(), sprintf() */ +#include <stdlib.h> /* abort(), malloc(), realloc(), free() */ +#include <string.h> /* memcpy(), strlen() */ +#include <errno.h> /* errno */ +#include <limits.h> /* CHAR_BIT */ +#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if HAVE_NL_LANGINFO # include <langinfo.h> #endif @@ -148,8 +148,14 @@ # define USE_SNPRINTF 1 # if HAVE_DECL__SNWPRINTF /* On Windows, the function swprintf() has a different signature than - on Unix; we use the _snwprintf() function instead. */ -# define SNPRINTF _snwprintf + on Unix; we use the function _snwprintf() or - on mingw - snwprintf() + instead. The mingw function snwprintf() has fewer bugs than the + MSVCRT function _snwprintf(), so prefer that. */ +# if defined __MINGW32__ +# define SNPRINTF snwprintf +# else +# define SNPRINTF _snwprintf +# endif # else /* Unix. */ # define SNPRINTF swprintf @@ -167,8 +173,15 @@ # define USE_SNPRINTF 0 # endif # if HAVE_DECL__SNPRINTF - /* Windows. */ -# define SNPRINTF _snprintf + /* Windows. The mingw function snprintf() has fewer bugs than the MSVCRT + function _snprintf(), so prefer that. */ +# if defined __MINGW32__ +# define SNPRINTF snprintf + /* Here we need to call the native snprintf, not rpl_snprintf. */ +# undef snprintf +# else +# define SNPRINTF _snprintf +# endif # else /* Unix. */ # define SNPRINTF snprintf @@ -194,7 +207,7 @@ #undef remainder #define remainder rem -#if !USE_SNPRINTF && !WIDE_CHAR_VERSION +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && !WIDE_CHAR_VERSION # if (HAVE_STRNLEN && !defined _AIX) # define local_strnlen strnlen # else @@ -210,7 +223,7 @@ local_strnlen (const char *string, size_t maxlen) # endif #endif -#if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T && (WIDE_CHAR_VERSION || DCHAR_IS_TCHAR) +#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T # if HAVE_WCSLEN # define local_wcslen wcslen # else @@ -233,7 +246,7 @@ local_wcslen (const wchar_t *s) # endif #endif -#if !USE_SNPRINTF && HAVE_WCHAR_T && WIDE_CHAR_VERSION +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && HAVE_WCHAR_T && WIDE_CHAR_VERSION # if HAVE_WCSNLEN # define local_wcsnlen wcsnlen # else @@ -257,14 +270,14 @@ local_wcsnlen (const wchar_t *s, size_t maxlen) # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 static char -decimal_point_char () +decimal_point_char (void) { const char *point; /* Determine it in a multithread-safe way. We know nl_langinfo is - multithread-safe on glibc systems, but is not required to be multithread- - safe by POSIX. sprintf(), however, is multithread-safe. localeconv() - is rarely multithread-safe. */ -# if HAVE_NL_LANGINFO && __GLIBC__ + multithread-safe on glibc systems and MacOS X systems, but is not required + to be multithread-safe by POSIX. sprintf(), however, is multithread-safe. + localeconv() is rarely multithread-safe. */ +# if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__)) point = nl_langinfo (RADIXCHAR); # elif 1 char pointbuf[5]; @@ -364,26 +377,26 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) dlen = len1 + len2; dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); if (dp == NULL) - return NULL; + return NULL; for (k = len2; k > 0; ) - dp[--k] = 0; + dp[--k] = 0; for (i = 0; i < len1; i++) - { - mp_limb_t digit1 = p1[i]; - mp_twolimb_t carry = 0; - for (j = 0; j < len2; j++) - { - mp_limb_t digit2 = p2[j]; - carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; - carry += dp[i + j]; - dp[i + j] = (mp_limb_t) carry; - carry = carry >> GMP_LIMB_BITS; - } - dp[i + len2] = (mp_limb_t) carry; - } + { + mp_limb_t digit1 = p1[i]; + mp_twolimb_t carry = 0; + for (j = 0; j < len2; j++) + { + mp_limb_t digit2 = p2[j]; + carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; + carry += dp[i + j]; + dp[i + j] = (mp_limb_t) carry; + carry = carry >> GMP_LIMB_BITS; + } + dp[i + len2] = (mp_limb_t) carry; + } /* Normalise. */ while (dlen > 0 && dp[dlen - 1] == 0) - dlen--; + dlen--; dest->nlimbs = dlen; dest->limbs = dp; } @@ -477,12 +490,12 @@ divide (mpn_t a, mpn_t b, mpn_t *q) for (;;) { if (b_len == 0) - /* Division by zero. */ - abort (); + /* Division by zero. */ + abort (); if (b_ptr[b_len - 1] == 0) - b_len--; + b_len--; else - break; + break; } /* Here m = a_len >= 0 and n = b_len > 0. */ @@ -499,261 +512,261 @@ divide (mpn_t a, mpn_t b, mpn_t *q) else if (b_len == 1) { /* n=1: single precision division. - beta^(m-1) <= a < beta^m ==> beta^(m-2) <= a/b < beta^m */ + beta^(m-1) <= a < beta^m ==> beta^(m-2) <= a/b < beta^m */ r_ptr = roomptr; q_ptr = roomptr + 1; { - mp_limb_t den = b_ptr[0]; - mp_limb_t remainder = 0; - const mp_limb_t *sourceptr = a_ptr + a_len; - mp_limb_t *destptr = q_ptr + a_len; - size_t count; - for (count = a_len; count > 0; count--) - { - mp_twolimb_t num = - ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; - *--destptr = num / den; - remainder = num % den; - } - /* Normalise and store r. */ - if (remainder > 0) - { - r_ptr[0] = remainder; - r_len = 1; - } - else - r_len = 0; - /* Normalise q. */ - q_len = a_len; - if (q_ptr[q_len - 1] == 0) - q_len--; + mp_limb_t den = b_ptr[0]; + mp_limb_t remainder = 0; + const mp_limb_t *sourceptr = a_ptr + a_len; + mp_limb_t *destptr = q_ptr + a_len; + size_t count; + for (count = a_len; count > 0; count--) + { + mp_twolimb_t num = + ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; + *--destptr = num / den; + remainder = num % den; + } + /* Normalise and store r. */ + if (remainder > 0) + { + r_ptr[0] = remainder; + r_len = 1; + } + else + r_len = 0; + /* Normalise q. */ + q_len = a_len; + if (q_ptr[q_len - 1] == 0) + q_len--; } } else { /* n>1: multiple precision division. - beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> - beta^(m-n-1) <= a/b < beta^(m-n+1). */ + beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> + beta^(m-n-1) <= a/b < beta^(m-n+1). */ /* Determine s. */ size_t s; { - mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ - s = 31; - if (msd >= 0x10000) - { - msd = msd >> 16; - s -= 16; - } - if (msd >= 0x100) - { - msd = msd >> 8; - s -= 8; - } - if (msd >= 0x10) - { - msd = msd >> 4; - s -= 4; - } - if (msd >= 0x4) - { - msd = msd >> 2; - s -= 2; - } - if (msd >= 0x2) - { - msd = msd >> 1; - s -= 1; - } + mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ + s = 31; + if (msd >= 0x10000) + { + msd = msd >> 16; + s -= 16; + } + if (msd >= 0x100) + { + msd = msd >> 8; + s -= 8; + } + if (msd >= 0x10) + { + msd = msd >> 4; + s -= 4; + } + if (msd >= 0x4) + { + msd = msd >> 2; + s -= 2; + } + if (msd >= 0x2) + { + msd = msd >> 1; + s -= 1; + } } /* 0 <= s < GMP_LIMB_BITS. - Copy b, shifting it left by s bits. */ + Copy b, shifting it left by s bits. */ if (s > 0) - { - tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); - if (tmp_roomptr == NULL) - { - free (roomptr); - return NULL; - } - { - const mp_limb_t *sourceptr = b_ptr; - mp_limb_t *destptr = tmp_roomptr; - mp_twolimb_t accu = 0; - size_t count; - for (count = b_len; count > 0; count--) - { - accu += (mp_twolimb_t) *sourceptr++ << s; - *destptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - /* accu must be zero, since that was how s was determined. */ - if (accu != 0) - abort (); - } - b_ptr = tmp_roomptr; - } + { + tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); + if (tmp_roomptr == NULL) + { + free (roomptr); + return NULL; + } + { + const mp_limb_t *sourceptr = b_ptr; + mp_limb_t *destptr = tmp_roomptr; + mp_twolimb_t accu = 0; + size_t count; + for (count = b_len; count > 0; count--) + { + accu += (mp_twolimb_t) *sourceptr++ << s; + *destptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + /* accu must be zero, since that was how s was determined. */ + if (accu != 0) + abort (); + } + b_ptr = tmp_roomptr; + } /* Copy a, shifting it left by s bits, yields r. - Memory layout: - At the beginning: r = roomptr[0..a_len], - at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ + Memory layout: + At the beginning: r = roomptr[0..a_len], + at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ r_ptr = roomptr; if (s == 0) - { - memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); - r_ptr[a_len] = 0; - } + { + memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); + r_ptr[a_len] = 0; + } else - { - const mp_limb_t *sourceptr = a_ptr; - mp_limb_t *destptr = r_ptr; - mp_twolimb_t accu = 0; - size_t count; - for (count = a_len; count > 0; count--) - { - accu += (mp_twolimb_t) *sourceptr++ << s; - *destptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - *destptr++ = (mp_limb_t) accu; - } + { + const mp_limb_t *sourceptr = a_ptr; + mp_limb_t *destptr = r_ptr; + mp_twolimb_t accu = 0; + size_t count; + for (count = a_len; count > 0; count--) + { + accu += (mp_twolimb_t) *sourceptr++ << s; + *destptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + *destptr++ = (mp_limb_t) accu; + } q_ptr = roomptr + b_len; q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ { - size_t j = a_len - b_len; /* m-n */ - mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ - mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ - mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ - ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; - /* Division loop, traversed m-n+1 times. - j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ - for (;;) - { - mp_limb_t q_star; - mp_limb_t c1; - if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ - { - /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ - mp_twolimb_t num = - ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) - | r_ptr[j + b_len - 1]; - q_star = num / b_msd; - c1 = num % b_msd; - } - else - { - /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ - q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ - /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta - <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta - <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) - {<= beta !}. - If yes, jump directly to the subtraction loop. - (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta - <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ - if (r_ptr[j + b_len] > b_msd - || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) - /* r[j+n] >= b[n-1]+1 or - r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a - carry. */ - goto subtract; - } - /* q_star = q*, - c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta). */ - { - mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */ - ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2]; - mp_twolimb_t c3 = /* b[n-2] * q* */ - (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star; - /* While c2 < c3, increase c2 and decrease c3. - Consider c3-c2. While it is > 0, decrease it by - b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 - this can happen only twice. */ - if (c3 > c2) - { - q_star = q_star - 1; /* q* := q* - 1 */ - if (c3 - c2 > b_msdd) - q_star = q_star - 1; /* q* := q* - 1 */ - } - } - if (q_star > 0) - subtract: - { - /* Subtract r := r - b * q* * beta^j. */ - mp_limb_t cr; - { - const mp_limb_t *sourceptr = b_ptr; - mp_limb_t *destptr = r_ptr + j; - mp_twolimb_t carry = 0; - size_t count; - for (count = b_len; count > 0; count--) - { - /* Here 0 <= carry <= q*. */ - carry = - carry - + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ - + (mp_limb_t) ~(*destptr); - /* Here 0 <= carry <= beta*q* + beta-1. */ - *destptr++ = ~(mp_limb_t) carry; - carry = carry >> GMP_LIMB_BITS; /* <= q* */ - } - cr = (mp_limb_t) carry; - } - /* Subtract cr from r_ptr[j + b_len], then forget about - r_ptr[j + b_len]. */ - if (cr > r_ptr[j + b_len]) - { - /* Subtraction gave a carry. */ - q_star = q_star - 1; /* q* := q* - 1 */ - /* Add b back. */ - { - const mp_limb_t *sourceptr = b_ptr; - mp_limb_t *destptr = r_ptr + j; - mp_limb_t carry = 0; - size_t count; - for (count = b_len; count > 0; count--) - { - mp_limb_t source1 = *sourceptr++; - mp_limb_t source2 = *destptr; - *destptr++ = source1 + source2 + carry; - carry = - (carry - ? source1 >= (mp_limb_t) ~source2 - : source1 > (mp_limb_t) ~source2); - } - } - /* Forget about the carry and about r[j+n]. */ - } - } - /* q* is determined. Store it as q[j]. */ - q_ptr[j] = q_star; - if (j == 0) - break; - j--; - } + size_t j = a_len - b_len; /* m-n */ + mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ + mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ + mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ + ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; + /* Division loop, traversed m-n+1 times. + j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ + for (;;) + { + mp_limb_t q_star; + mp_limb_t c1; + if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ + { + /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ + mp_twolimb_t num = + ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) + | r_ptr[j + b_len - 1]; + q_star = num / b_msd; + c1 = num % b_msd; + } + else + { + /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ + q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ + /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta + <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta + <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) + {<= beta !}. + If yes, jump directly to the subtraction loop. + (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta + <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ + if (r_ptr[j + b_len] > b_msd + || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) + /* r[j+n] >= b[n-1]+1 or + r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a + carry. */ + goto subtract; + } + /* q_star = q*, + c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta). */ + { + mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */ + ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2]; + mp_twolimb_t c3 = /* b[n-2] * q* */ + (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star; + /* While c2 < c3, increase c2 and decrease c3. + Consider c3-c2. While it is > 0, decrease it by + b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 + this can happen only twice. */ + if (c3 > c2) + { + q_star = q_star - 1; /* q* := q* - 1 */ + if (c3 - c2 > b_msdd) + q_star = q_star - 1; /* q* := q* - 1 */ + } + } + if (q_star > 0) + subtract: + { + /* Subtract r := r - b * q* * beta^j. */ + mp_limb_t cr; + { + const mp_limb_t *sourceptr = b_ptr; + mp_limb_t *destptr = r_ptr + j; + mp_twolimb_t carry = 0; + size_t count; + for (count = b_len; count > 0; count--) + { + /* Here 0 <= carry <= q*. */ + carry = + carry + + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ + + (mp_limb_t) ~(*destptr); + /* Here 0 <= carry <= beta*q* + beta-1. */ + *destptr++ = ~(mp_limb_t) carry; + carry = carry >> GMP_LIMB_BITS; /* <= q* */ + } + cr = (mp_limb_t) carry; + } + /* Subtract cr from r_ptr[j + b_len], then forget about + r_ptr[j + b_len]. */ + if (cr > r_ptr[j + b_len]) + { + /* Subtraction gave a carry. */ + q_star = q_star - 1; /* q* := q* - 1 */ + /* Add b back. */ + { + const mp_limb_t *sourceptr = b_ptr; + mp_limb_t *destptr = r_ptr + j; + mp_limb_t carry = 0; + size_t count; + for (count = b_len; count > 0; count--) + { + mp_limb_t source1 = *sourceptr++; + mp_limb_t source2 = *destptr; + *destptr++ = source1 + source2 + carry; + carry = + (carry + ? source1 >= (mp_limb_t) ~source2 + : source1 > (mp_limb_t) ~source2); + } + } + /* Forget about the carry and about r[j+n]. */ + } + } + /* q* is determined. Store it as q[j]. */ + q_ptr[j] = q_star; + if (j == 0) + break; + j--; + } } r_len = b_len; /* Normalise q. */ if (q_ptr[q_len - 1] == 0) - q_len--; + q_len--; # if 0 /* Not needed here, since we need r only to compare it with b/2, and - b is shifted left by s bits. */ + b is shifted left by s bits. */ /* Shift r right by s bits. */ if (s > 0) - { - mp_limb_t ptr = r_ptr + r_len; - mp_twolimb_t accu = 0; - size_t count; - for (count = r_len; count > 0; count--) - { - accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; - accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); - *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); - } - } + { + mp_limb_t ptr = r_ptr + r_len; + mp_twolimb_t accu = 0; + size_t count; + for (count = r_len; count > 0; count--) + { + accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; + accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); + *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); + } + } # endif /* Normalise r. */ while (r_len > 0 && r_ptr[r_len - 1] == 0) - r_len--; + r_len--; } /* Compare r << 1 with b. */ if (r_len > b_len) @@ -762,17 +775,17 @@ divide (mpn_t a, mpn_t b, mpn_t *q) size_t i; for (i = b_len;;) { - mp_limb_t r_i = - (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) - | (i < r_len ? r_ptr[i] << 1 : 0); - mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); - if (r_i > b_i) - goto increment_q; - if (r_i < b_i) - goto keep_q; - if (i == 0) - break; - i--; + mp_limb_t r_i = + (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) + | (i < r_len ? r_ptr[i] << 1 : 0); + mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); + if (r_i > b_i) + goto increment_q; + if (r_i < b_i) + goto keep_q; + if (i == 0) + break; + i--; } } if (q_len > 0 && ((q_ptr[0] & 1) != 0)) @@ -781,8 +794,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q) { size_t i; for (i = 0; i < q_len; i++) - if (++(q_ptr[i]) != 0) - goto keep_q; + if (++(q_ptr[i]) != 0) + goto keep_q; q_ptr[q_len++] = 1; } keep_q: @@ -811,36 +824,36 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes) { char *d_ptr = c_ptr; for (; extra_zeroes > 0; extra_zeroes--) - *d_ptr++ = '0'; + *d_ptr++ = '0'; while (a_len > 0) - { - /* Divide a by 10^9, in-place. */ - mp_limb_t remainder = 0; - mp_limb_t *ptr = a_ptr + a_len; - size_t count; - for (count = a_len; count > 0; count--) - { - mp_twolimb_t num = - ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; - *ptr = num / 1000000000; - remainder = num % 1000000000; - } - /* Store the remainder as 9 decimal digits. */ - for (count = 9; count > 0; count--) - { - *d_ptr++ = '0' + (remainder % 10); - remainder = remainder / 10; - } - /* Normalize a. */ - if (a_ptr[a_len - 1] == 0) - a_len--; - } + { + /* Divide a by 10^9, in-place. */ + mp_limb_t remainder = 0; + mp_limb_t *ptr = a_ptr + a_len; + size_t count; + for (count = a_len; count > 0; count--) + { + mp_twolimb_t num = + ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; + *ptr = num / 1000000000; + remainder = num % 1000000000; + } + /* Store the remainder as 9 decimal digits. */ + for (count = 9; count > 0; count--) + { + *d_ptr++ = '0' + (remainder % 10); + remainder = remainder / 10; + } + /* Normalize a. */ + if (a_ptr[a_len - 1] == 0) + a_len--; + } /* Remove leading zeroes. */ while (d_ptr > c_ptr && d_ptr[-1] == '0') - d_ptr--; + d_ptr--; /* But keep at least one zero. */ if (d_ptr == c_ptr) - *d_ptr++ = '0'; + *d_ptr++ = '0'; /* Terminate the string. */ *d_ptr = '\0'; } @@ -885,12 +898,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp) hi = (int) y; y -= hi; if (!(y >= 0.0L && y < 1.0L)) - abort (); + abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0L && y < 1.0L)) - abort (); + abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # else @@ -900,7 +913,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp) d = (int) y; y -= d; if (!(y >= 0.0L && y < 1.0L)) - abort (); + abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; } # endif @@ -912,12 +925,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp) hi = (int) y; y -= hi; if (!(y >= 0.0L && y < 1.0L)) - abort (); + abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0L && y < 1.0L)) - abort (); + abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } #if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess @@ -973,12 +986,12 @@ decode_double (double x, int *ep, mpn_t *mp) hi = (int) y; y -= hi; if (!(y >= 0.0 && y < 1.0)) - abort (); + abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0 && y < 1.0)) - abort (); + abort (); m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # else @@ -988,7 +1001,7 @@ decode_double (double x, int *ep, mpn_t *mp) d = (int) y; y -= d; if (!(y >= 0.0 && y < 1.0)) - abort (); + abort (); m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; } # endif @@ -1000,12 +1013,12 @@ decode_double (double x, int *ep, mpn_t *mp) hi = (int) y; y -= hi; if (!(y >= 0.0 && y < 1.0)) - abort (); + abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0 && y < 1.0)) - abort (); + abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } if (!(y == 0.0)) @@ -1063,8 +1076,8 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) abs_n = (n >= 0 ? n : -n); abs_s = (s >= 0 ? s : -s); pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 - + abs_s / GMP_LIMB_BITS + 1) - * sizeof (mp_limb_t)); + + abs_s / GMP_LIMB_BITS + 1) + * sizeof (mp_limb_t)); if (pow5_ptr == NULL) { free (memory); @@ -1077,26 +1090,26 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) if (abs_n > 0) { static mp_limb_t const small_pow5[13 + 1] = - { - 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, - 48828125, 244140625, 1220703125 - }; + { + 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, + 48828125, 244140625, 1220703125 + }; unsigned int n13; for (n13 = 0; n13 <= abs_n; n13 += 13) - { - mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; - size_t j; - mp_twolimb_t carry = 0; - for (j = 0; j < pow5_len; j++) - { - mp_limb_t digit2 = pow5_ptr[j]; - carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; - pow5_ptr[j] = (mp_limb_t) carry; - carry = carry >> GMP_LIMB_BITS; - } - if (carry > 0) - pow5_ptr[pow5_len++] = (mp_limb_t) carry; - } + { + mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; + size_t j; + mp_twolimb_t carry = 0; + for (j = 0; j < pow5_len; j++) + { + mp_limb_t digit2 = pow5_ptr[j]; + carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; + pow5_ptr[j] = (mp_limb_t) carry; + carry = carry >> GMP_LIMB_BITS; + } + if (carry > 0) + pow5_ptr[pow5_len++] = (mp_limb_t) carry; + } } s_limbs = abs_s / GMP_LIMB_BITS; s_bits = abs_s % GMP_LIMB_BITS; @@ -1104,129 +1117,129 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) { /* Multiply with 2^|s|. */ if (s_bits > 0) - { - mp_limb_t *ptr = pow5_ptr; - mp_twolimb_t accu = 0; - size_t count; - for (count = pow5_len; count > 0; count--) - { - accu += (mp_twolimb_t) *ptr << s_bits; - *ptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - if (accu > 0) - { - *ptr = (mp_limb_t) accu; - pow5_len++; - } - } + { + mp_limb_t *ptr = pow5_ptr; + mp_twolimb_t accu = 0; + size_t count; + for (count = pow5_len; count > 0; count--) + { + accu += (mp_twolimb_t) *ptr << s_bits; + *ptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + if (accu > 0) + { + *ptr = (mp_limb_t) accu; + pow5_len++; + } + } if (s_limbs > 0) - { - size_t count; - for (count = pow5_len; count > 0;) - { - count--; - pow5_ptr[s_limbs + count] = pow5_ptr[count]; - } - for (count = s_limbs; count > 0;) - { - count--; - pow5_ptr[count] = 0; - } - pow5_len += s_limbs; - } + { + size_t count; + for (count = pow5_len; count > 0;) + { + count--; + pow5_ptr[s_limbs + count] = pow5_ptr[count]; + } + for (count = s_limbs; count > 0;) + { + count--; + pow5_ptr[count] = 0; + } + pow5_len += s_limbs; + } pow5.limbs = pow5_ptr; pow5.nlimbs = pow5_len; if (n >= 0) - { - /* Multiply m with pow5. No division needed. */ - z_memory = multiply (m, pow5, &z); - } + { + /* Multiply m with pow5. No division needed. */ + z_memory = multiply (m, pow5, &z); + } else - { - /* Divide m by pow5 and round. */ - z_memory = divide (m, pow5, &z); - } + { + /* Divide m by pow5 and round. */ + z_memory = divide (m, pow5, &z); + } } else { pow5.limbs = pow5_ptr; pow5.nlimbs = pow5_len; if (n >= 0) - { - /* n >= 0, s < 0. - Multiply m with pow5, then divide by 2^|s|. */ - mpn_t numerator; - mpn_t denominator; - void *tmp_memory; - tmp_memory = multiply (m, pow5, &numerator); - if (tmp_memory == NULL) - { - free (pow5_ptr); - free (memory); - return NULL; - } - /* Construct 2^|s|. */ - { - mp_limb_t *ptr = pow5_ptr + pow5_len; - size_t i; - for (i = 0; i < s_limbs; i++) - ptr[i] = 0; - ptr[s_limbs] = (mp_limb_t) 1 << s_bits; - denominator.limbs = ptr; - denominator.nlimbs = s_limbs + 1; - } - z_memory = divide (numerator, denominator, &z); - free (tmp_memory); - } + { + /* n >= 0, s < 0. + Multiply m with pow5, then divide by 2^|s|. */ + mpn_t numerator; + mpn_t denominator; + void *tmp_memory; + tmp_memory = multiply (m, pow5, &numerator); + if (tmp_memory == NULL) + { + free (pow5_ptr); + free (memory); + return NULL; + } + /* Construct 2^|s|. */ + { + mp_limb_t *ptr = pow5_ptr + pow5_len; + size_t i; + for (i = 0; i < s_limbs; i++) + ptr[i] = 0; + ptr[s_limbs] = (mp_limb_t) 1 << s_bits; + denominator.limbs = ptr; + denominator.nlimbs = s_limbs + 1; + } + z_memory = divide (numerator, denominator, &z); + free (tmp_memory); + } else - { - /* n < 0, s > 0. - Multiply m with 2^s, then divide by pow5. */ - mpn_t numerator; - mp_limb_t *num_ptr; - num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) - * sizeof (mp_limb_t)); - if (num_ptr == NULL) - { - free (pow5_ptr); - free (memory); - return NULL; - } - { - mp_limb_t *destptr = num_ptr; - { - size_t i; - for (i = 0; i < s_limbs; i++) - *destptr++ = 0; - } - if (s_bits > 0) - { - const mp_limb_t *sourceptr = m.limbs; - mp_twolimb_t accu = 0; - size_t count; - for (count = m.nlimbs; count > 0; count--) - { - accu += (mp_twolimb_t) *sourceptr++ << s_bits; - *destptr++ = (mp_limb_t) accu; - accu = accu >> GMP_LIMB_BITS; - } - if (accu > 0) - *destptr++ = (mp_limb_t) accu; - } - else - { - const mp_limb_t *sourceptr = m.limbs; - size_t count; - for (count = m.nlimbs; count > 0; count--) - *destptr++ = *sourceptr++; - } - numerator.limbs = num_ptr; - numerator.nlimbs = destptr - num_ptr; - } - z_memory = divide (numerator, pow5, &z); - free (num_ptr); - } + { + /* n < 0, s > 0. + Multiply m with 2^s, then divide by pow5. */ + mpn_t numerator; + mp_limb_t *num_ptr; + num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) + * sizeof (mp_limb_t)); + if (num_ptr == NULL) + { + free (pow5_ptr); + free (memory); + return NULL; + } + { + mp_limb_t *destptr = num_ptr; + { + size_t i; + for (i = 0; i < s_limbs; i++) + *destptr++ = 0; + } + if (s_bits > 0) + { + const mp_limb_t *sourceptr = m.limbs; + mp_twolimb_t accu = 0; + size_t count; + for (count = m.nlimbs; count > 0; count--) + { + accu += (mp_twolimb_t) *sourceptr++ << s_bits; + *destptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + if (accu > 0) + *destptr++ = (mp_limb_t) accu; + } + else + { + const mp_limb_t *sourceptr = m.limbs; + size_t count; + for (count = m.nlimbs; count > 0; count--) + *destptr++ = *sourceptr++; + } + numerator.limbs = num_ptr; + numerator.nlimbs = destptr - num_ptr; + } + z_memory = divide (numerator, pow5, &z); + free (num_ptr); + } } free (pow5_ptr); free (memory); @@ -1298,35 +1311,35 @@ floorlog10l (long double x) if (y < 0.5L) { while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) - { - y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); - exp -= GMP_LIMB_BITS; - } + { + y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); + exp -= GMP_LIMB_BITS; + } if (y < (1.0L / (1 << 16))) - { - y *= 1.0L * (1 << 16); - exp -= 16; - } + { + y *= 1.0L * (1 << 16); + exp -= 16; + } if (y < (1.0L / (1 << 8))) - { - y *= 1.0L * (1 << 8); - exp -= 8; - } + { + y *= 1.0L * (1 << 8); + exp -= 8; + } if (y < (1.0L / (1 << 4))) - { - y *= 1.0L * (1 << 4); - exp -= 4; - } + { + y *= 1.0L * (1 << 4); + exp -= 4; + } if (y < (1.0L / (1 << 2))) - { - y *= 1.0L * (1 << 2); - exp -= 2; - } + { + y *= 1.0L * (1 << 2); + exp -= 2; + } if (y < (1.0L / (1 << 1))) - { - y *= 1.0L * (1 << 1); - exp -= 1; - } + { + y *= 1.0L * (1 << 1); + exp -= 1; + } } if (!(y >= 0.5L && y < 1.0L)) abort (); @@ -1389,35 +1402,35 @@ floorlog10 (double x) if (y < 0.5) { while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) - { - y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); - exp -= GMP_LIMB_BITS; - } + { + y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); + exp -= GMP_LIMB_BITS; + } if (y < (1.0 / (1 << 16))) - { - y *= 1.0 * (1 << 16); - exp -= 16; - } + { + y *= 1.0 * (1 << 16); + exp -= 16; + } if (y < (1.0 / (1 << 8))) - { - y *= 1.0 * (1 << 8); - exp -= 8; - } + { + y *= 1.0 * (1 << 8); + exp -= 8; + } if (y < (1.0 / (1 << 4))) - { - y *= 1.0 * (1 << 4); - exp -= 4; - } + { + y *= 1.0 * (1 << 4); + exp -= 4; + } if (y < (1.0 / (1 << 2))) - { - y *= 1.0 * (1 << 2); - exp -= 2; - } + { + y *= 1.0 * (1 << 2); + exp -= 2; + } if (y < (1.0 / (1 << 1))) - { - y *= 1.0 * (1 << 1); - exp -= 1; - } + { + y *= 1.0 * (1 << 1); + exp -= 1; + } } if (!(y >= 0.5 && y < 1.0)) abort (); @@ -1474,9 +1487,261 @@ is_borderline (const char *digits, size_t precision) #endif +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 + +/* Use a different function name, to make it possible that the 'wchar_t' + parametrization and the 'char' parametrization get compiled in the same + translation unit. */ +# if WIDE_CHAR_VERSION +# define MAX_ROOM_NEEDED wmax_room_needed +# else +# define MAX_ROOM_NEEDED max_room_needed +# endif + +/* Returns the number of TCHAR_T units needed as temporary space for the result + of sprintf or SNPRINTF of a single conversion directive. */ +static inline size_t +MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, + arg_type type, int flags, size_t width, int has_precision, + size_t precision, int pad_ourselves) +{ + size_t tmp_length; + + switch (conversion) + { + case 'd': case 'i': case 'u': +# if HAVE_LONG_LONG_INT + if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long long) * CHAR_BIT + * 0.30103 /* binary -> decimal */ + ) + + 1; /* turn floor into ceil */ + else +# endif + if (type == TYPE_LONGINT || type == TYPE_ULONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long) * CHAR_BIT + * 0.30103 /* binary -> decimal */ + ) + + 1; /* turn floor into ceil */ + else + tmp_length = + (unsigned int) (sizeof (unsigned int) * CHAR_BIT + * 0.30103 /* binary -> decimal */ + ) + + 1; /* turn floor into ceil */ + if (tmp_length < precision) + tmp_length = precision; + /* Multiply by 2, as an estimate for FLAG_GROUP. */ + tmp_length = xsum (tmp_length, tmp_length); + /* Add 1, to account for a leading sign. */ + tmp_length = xsum (tmp_length, 1); + break; + + case 'o': +# if HAVE_LONG_LONG_INT + if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long long) * CHAR_BIT + * 0.333334 /* binary -> octal */ + ) + + 1; /* turn floor into ceil */ + else +# endif + if (type == TYPE_LONGINT || type == TYPE_ULONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long) * CHAR_BIT + * 0.333334 /* binary -> octal */ + ) + + 1; /* turn floor into ceil */ + else + tmp_length = + (unsigned int) (sizeof (unsigned int) * CHAR_BIT + * 0.333334 /* binary -> octal */ + ) + + 1; /* turn floor into ceil */ + if (tmp_length < precision) + tmp_length = precision; + /* Add 1, to account for a leading sign. */ + tmp_length = xsum (tmp_length, 1); + break; + + case 'x': case 'X': +# if HAVE_LONG_LONG_INT + if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long long) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + else +# endif + if (type == TYPE_LONGINT || type == TYPE_ULONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + else + tmp_length = + (unsigned int) (sizeof (unsigned int) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + if (tmp_length < precision) + tmp_length = precision; + /* Add 2, to account for a leading sign or alternate form. */ + tmp_length = xsum (tmp_length, 2); + break; + + case 'f': case 'F': + if (type == TYPE_LONGDOUBLE) + tmp_length = + (unsigned int) (LDBL_MAX_EXP + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 10; /* sign, decimal point etc. */ + else + tmp_length = + (unsigned int) (DBL_MAX_EXP + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 10; /* sign, decimal point etc. */ + tmp_length = xsum (tmp_length, precision); + break; + + case 'e': case 'E': case 'g': case 'G': + tmp_length = + 12; /* sign, decimal point, exponent etc. */ + tmp_length = xsum (tmp_length, precision); + break; + + case 'a': case 'A': + if (type == TYPE_LONGDOUBLE) + tmp_length = + (unsigned int) (LDBL_DIG + * 0.831 /* decimal -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + else + tmp_length = + (unsigned int) (DBL_DIG + * 0.831 /* decimal -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + if (tmp_length < precision) + tmp_length = precision; + /* Account for sign, decimal point etc. */ + tmp_length = xsum (tmp_length, 12); + break; + + case 'c': +# if HAVE_WINT_T && !WIDE_CHAR_VERSION + if (type == TYPE_WIDE_CHAR) + tmp_length = MB_CUR_MAX; + else +# endif + tmp_length = 1; + break; + + case 's': +# if HAVE_WCHAR_T + if (type == TYPE_WIDE_STRING) + { +# if WIDE_CHAR_VERSION + /* ISO C says about %ls in fwprintf: + "If the precision is not specified or is greater than the size + of the array, the array shall contain a null wide character." + So if there is a precision, we must not use wcslen. */ + const wchar_t *arg = ap->arg[arg_index].a.a_wide_string; + + if (has_precision) + tmp_length = local_wcsnlen (arg, precision); + else + tmp_length = local_wcslen (arg); +# else + /* ISO C says about %ls in fprintf: + "If a precision is specified, no more than that many bytes are + written (including shift sequences, if any), and the array + shall contain a null wide character if, to equal the multibyte + character sequence length given by the precision, the function + would need to access a wide character one past the end of the + array." + So if there is a precision, we must not use wcslen. */ + /* This case has already been handled separately in VASNPRINTF. */ + abort (); +# endif + } + else +# endif + { +# if WIDE_CHAR_VERSION + /* ISO C says about %s in fwprintf: + "If the precision is not specified or is greater than the size + of the converted array, the converted array shall contain a + null wide character." + So if there is a precision, we must not use strlen. */ + /* This case has already been handled separately in VASNPRINTF. */ + abort (); +# else + /* ISO C says about %s in fprintf: + "If the precision is not specified or greater than the size of + the array, the array shall contain a null character." + So if there is a precision, we must not use strlen. */ + const char *arg = ap->arg[arg_index].a.a_string; + + if (has_precision) + tmp_length = local_strnlen (arg, precision); + else + tmp_length = strlen (arg); +# endif + } + break; + + case 'p': + tmp_length = + (unsigned int) (sizeof (void *) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1 /* turn floor into ceil */ + + 2; /* account for leading 0x */ + break; + + default: + abort (); + } + + if (!pad_ourselves) + { +# if ENABLE_UNISTDIO + /* Padding considers the number of characters, therefore the number of + elements after padding may be + > max (tmp_length, width) + but is certainly + <= tmp_length + width. */ + tmp_length = xsum (tmp_length, width); +# else + /* Padding considers the number of elements, says POSIX. */ + if (tmp_length < width) + tmp_length = width; +# endif + } + + tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ + + return tmp_length; +} + +#endif + DCHAR_T * VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, - const FCHAR_T *format, va_list args) + const FCHAR_T *format, va_list args) { DIRECTIVES d; arguments a; @@ -1486,8 +1751,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, return NULL; #define CLEANUP() \ - free (d.dir); \ - if (a.arg) \ + free (d.dir); \ + if (a.arg) \ free (a.arg); if (PRINTF_FETCHARGS (args, &a) < 0) @@ -1516,30 +1781,30 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #if HAVE_ALLOCA if (buf_neededlength < 4000 / sizeof (TCHAR_T)) { - buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); - buf_malloced = NULL; + buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); + buf_malloced = NULL; } else #endif { - size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); - if (size_overflow_p (buf_memsize)) - goto out_of_memory_1; - buf = (TCHAR_T *) malloc (buf_memsize); - if (buf == NULL) - goto out_of_memory_1; - buf_malloced = buf; + size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); + if (size_overflow_p (buf_memsize)) + goto out_of_memory_1; + buf = (TCHAR_T *) malloc (buf_memsize); + if (buf == NULL) + goto out_of_memory_1; + buf_malloced = buf; } if (resultbuf != NULL) { - result = resultbuf; - allocated = *lengthp; + result = resultbuf; + allocated = *lengthp; } else { - result = NULL; - allocated = 0; + result = NULL; + allocated = 0; } length = 0; /* Invariants: @@ -1549,3881 +1814,3692 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Ensures that allocated >= needed. Aborts through a jump to out_of_memory if needed is SIZE_MAX or otherwise too big. */ #define ENSURE_ALLOCATION(needed) \ - if ((needed) > allocated) \ - { \ - size_t memory_size; \ - DCHAR_T *memory; \ - \ - allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ - if ((needed) > allocated) \ - allocated = (needed); \ - memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ - if (size_overflow_p (memory_size)) \ - goto out_of_memory; \ - if (result == resultbuf || result == NULL) \ - memory = (DCHAR_T *) malloc (memory_size); \ - else \ - memory = (DCHAR_T *) realloc (result, memory_size); \ - if (memory == NULL) \ - goto out_of_memory; \ - if (result == resultbuf && length > 0) \ - DCHAR_CPY (memory, result, length); \ - result = memory; \ + if ((needed) > allocated) \ + { \ + size_t memory_size; \ + DCHAR_T *memory; \ + \ + allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ + if ((needed) > allocated) \ + allocated = (needed); \ + memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ + if (size_overflow_p (memory_size)) \ + goto out_of_memory; \ + if (result == resultbuf || result == NULL) \ + memory = (DCHAR_T *) malloc (memory_size); \ + else \ + memory = (DCHAR_T *) realloc (result, memory_size); \ + if (memory == NULL) \ + goto out_of_memory; \ + if (result == resultbuf && length > 0) \ + DCHAR_CPY (memory, result, length); \ + result = memory; \ } for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) { - if (cp != dp->dir_start) - { - size_t n = dp->dir_start - cp; - size_t augmented_length = xsum (length, n); - - ENSURE_ALLOCATION (augmented_length); - /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we - need that the format string contains only ASCII characters - if FCHAR_T and DCHAR_T are not the same type. */ - if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) - { - DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); - length = augmented_length; - } - else - { - do - result[length++] = (unsigned char) *cp++; - while (--n > 0); - } - } - if (i == d.count) - break; - - /* Execute a single directive. */ - if (dp->conversion == '%') - { - size_t augmented_length; - - if (!(dp->arg_index == ARG_NONE)) - abort (); - augmented_length = xsum (length, 1); - ENSURE_ALLOCATION (augmented_length); - result[length] = '%'; - length = augmented_length; - } - else - { - if (!(dp->arg_index != ARG_NONE)) - abort (); - - if (dp->conversion == 'n') - { - switch (a.arg[dp->arg_index].type) - { - case TYPE_COUNT_SCHAR_POINTER: - *a.arg[dp->arg_index].a.a_count_schar_pointer = length; - break; - case TYPE_COUNT_SHORT_POINTER: - *a.arg[dp->arg_index].a.a_count_short_pointer = length; - break; - case TYPE_COUNT_INT_POINTER: - *a.arg[dp->arg_index].a.a_count_int_pointer = length; - break; - case TYPE_COUNT_LONGINT_POINTER: - *a.arg[dp->arg_index].a.a_count_longint_pointer = length; - break; + if (cp != dp->dir_start) + { + size_t n = dp->dir_start - cp; + size_t augmented_length = xsum (length, n); + + ENSURE_ALLOCATION (augmented_length); + /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we + need that the format string contains only ASCII characters + if FCHAR_T and DCHAR_T are not the same type. */ + if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) + { + DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); + length = augmented_length; + } + else + { + do + result[length++] = (unsigned char) *cp++; + while (--n > 0); + } + } + if (i == d.count) + break; + + /* Execute a single directive. */ + if (dp->conversion == '%') + { + size_t augmented_length; + + if (!(dp->arg_index == ARG_NONE)) + abort (); + augmented_length = xsum (length, 1); + ENSURE_ALLOCATION (augmented_length); + result[length] = '%'; + length = augmented_length; + } + else + { + if (!(dp->arg_index != ARG_NONE)) + abort (); + + if (dp->conversion == 'n') + { + switch (a.arg[dp->arg_index].type) + { + case TYPE_COUNT_SCHAR_POINTER: + *a.arg[dp->arg_index].a.a_count_schar_pointer = length; + break; + case TYPE_COUNT_SHORT_POINTER: + *a.arg[dp->arg_index].a.a_count_short_pointer = length; + break; + case TYPE_COUNT_INT_POINTER: + *a.arg[dp->arg_index].a.a_count_int_pointer = length; + break; + case TYPE_COUNT_LONGINT_POINTER: + *a.arg[dp->arg_index].a.a_count_longint_pointer = length; + break; #if HAVE_LONG_LONG_INT - case TYPE_COUNT_LONGLONGINT_POINTER: - *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; - break; + case TYPE_COUNT_LONGLONGINT_POINTER: + *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; + break; #endif - default: - abort (); - } - } + default: + abort (); + } + } #if ENABLE_UNISTDIO - /* The unistdio extensions. */ - else if (dp->conversion == 'U') - { - arg_type type = a.arg[dp->arg_index].type; - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 0; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - - switch (type) - { - case TYPE_U8_STRING: - { - const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; - const uint8_t *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only PRECISION characters, from the left. */ - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count = u8_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of - characters. */ - arg_end = arg; - characters = 0; - for (;;) - { - int count = u8_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + u8_strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } + /* The unistdio extensions. */ + else if (dp->conversion == 'U') + { + arg_type type = a.arg[dp->arg_index].type; + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } + + has_precision = 0; + precision = 0; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } + + switch (type) + { + case TYPE_U8_STRING: + { + const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; + const uint8_t *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only PRECISION characters, from the left. */ + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count = u8_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of + characters. */ + arg_end = arg; + characters = 0; + for (;;) + { + int count = u8_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + u8_strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } + + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } # if DCHAR_IS_UINT8_T - { - size_t n = arg_end - arg; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_CPY (result + length, arg, n); - length += n; - } + { + size_t n = arg_end - arg; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_CPY (result + length, arg, n); + length += n; + } # else - { /* Convert. */ - DCHAR_T *converted = result + length; - size_t converted_len = allocated - length; + { /* Convert. */ + DCHAR_T *converted = result + length; + size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR - /* Convert from UTF-8 to locale encoding. */ - converted = - u8_conv_to_encoding (locale_charset (), - iconveh_question_mark, - arg, arg_end - arg, NULL, - converted, &converted_len); + /* Convert from UTF-8 to locale encoding. */ + converted = + u8_conv_to_encoding (locale_charset (), + iconveh_question_mark, + arg, arg_end - arg, NULL, + converted, &converted_len); # else - /* Convert from UTF-8 to UTF-16/UTF-32. */ - converted = - U8_TO_DCHAR (arg, arg_end - arg, - converted, &converted_len); + /* Convert from UTF-8 to UTF-16/UTF-32. */ + converted = + U8_TO_DCHAR (arg, arg_end - arg, + converted, &converted_len); # endif - if (converted == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - if (converted != result + length) - { - ENSURE_ALLOCATION (xsum (length, converted_len)); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } - length += converted_len; - } + if (converted == NULL) + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + if (converted != result + length) + { + ENSURE_ALLOCATION (xsum (length, converted_len)); + DCHAR_CPY (result + length, converted, converted_len); + free (converted); + } + length += converted_len; + } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - break; - - case TYPE_U16_STRING: - { - const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; - const uint16_t *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only PRECISION characters, from the left. */ - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count = u16_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of - characters. */ - arg_end = arg; - characters = 0; - for (;;) - { - int count = u16_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + u16_strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + break; + + case TYPE_U16_STRING: + { + const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; + const uint16_t *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only PRECISION characters, from the left. */ + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count = u16_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of + characters. */ + arg_end = arg; + characters = 0; + for (;;) + { + int count = u16_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + u16_strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } + + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } # if DCHAR_IS_UINT16_T - { - size_t n = arg_end - arg; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_CPY (result + length, arg, n); - length += n; - } + { + size_t n = arg_end - arg; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_CPY (result + length, arg, n); + length += n; + } # else - { /* Convert. */ - DCHAR_T *converted = result + length; - size_t converted_len = allocated - length; + { /* Convert. */ + DCHAR_T *converted = result + length; + size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR - /* Convert from UTF-16 to locale encoding. */ - converted = - u16_conv_to_encoding (locale_charset (), - iconveh_question_mark, - arg, arg_end - arg, NULL, - converted, &converted_len); + /* Convert from UTF-16 to locale encoding. */ + converted = + u16_conv_to_encoding (locale_charset (), + iconveh_question_mark, + arg, arg_end - arg, NULL, + converted, &converted_len); # else - /* Convert from UTF-16 to UTF-8/UTF-32. */ - converted = - U16_TO_DCHAR (arg, arg_end - arg, - converted, &converted_len); + /* Convert from UTF-16 to UTF-8/UTF-32. */ + converted = + U16_TO_DCHAR (arg, arg_end - arg, + converted, &converted_len); # endif - if (converted == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - if (converted != result + length) - { - ENSURE_ALLOCATION (xsum (length, converted_len)); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } - length += converted_len; - } + if (converted == NULL) + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + if (converted != result + length) + { + ENSURE_ALLOCATION (xsum (length, converted_len)); + DCHAR_CPY (result + length, converted, converted_len); + free (converted); + } + length += converted_len; + } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - break; - - case TYPE_U32_STRING: - { - const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; - const uint32_t *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only PRECISION characters, from the left. */ - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count = u32_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of - characters. */ - arg_end = arg; - characters = 0; - for (;;) - { - int count = u32_strmblen (arg_end); - if (count == 0) - break; - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + u32_strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + break; + + case TYPE_U32_STRING: + { + const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; + const uint32_t *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only PRECISION characters, from the left. */ + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count = u32_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of + characters. */ + arg_end = arg; + characters = 0; + for (;;) + { + int count = u32_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + u32_strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } + + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } # if DCHAR_IS_UINT32_T - { - size_t n = arg_end - arg; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_CPY (result + length, arg, n); - length += n; - } + { + size_t n = arg_end - arg; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_CPY (result + length, arg, n); + length += n; + } # else - { /* Convert. */ - DCHAR_T *converted = result + length; - size_t converted_len = allocated - length; + { /* Convert. */ + DCHAR_T *converted = result + length; + size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR - /* Convert from UTF-32 to locale encoding. */ - converted = - u32_conv_to_encoding (locale_charset (), - iconveh_question_mark, - arg, arg_end - arg, NULL, - converted, &converted_len); + /* Convert from UTF-32 to locale encoding. */ + converted = + u32_conv_to_encoding (locale_charset (), + iconveh_question_mark, + arg, arg_end - arg, NULL, + converted, &converted_len); # else - /* Convert from UTF-32 to UTF-8/UTF-16. */ - converted = - U32_TO_DCHAR (arg, arg_end - arg, - converted, &converted_len); + /* Convert from UTF-32 to UTF-8/UTF-16. */ + converted = + U32_TO_DCHAR (arg, arg_end - arg, + converted, &converted_len); # endif - if (converted == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - if (converted != result + length) - { - ENSURE_ALLOCATION (xsum (length, converted_len)); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } - length += converted_len; - } + if (converted == NULL) + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + if (converted != result + length) + { + ENSURE_ALLOCATION (xsum (length, converted_len)); + DCHAR_CPY (result + length, converted, converted_len); + free (converted); + } + length += converted_len; + } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - break; - - default: - abort (); - } - } + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + break; + + default: + abort (); + } + } #endif -#if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T - else if (dp->conversion == 's' +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T + else if (dp->conversion == 's' # if WIDE_CHAR_VERSION - && a.arg[dp->arg_index].type != TYPE_WIDE_STRING + && a.arg[dp->arg_index].type != TYPE_WIDE_STRING # else - && a.arg[dp->arg_index].type == TYPE_WIDE_STRING + && a.arg[dp->arg_index].type == TYPE_WIDE_STRING # endif - ) - { - /* The normal handling of the 's' directive below requires - allocating a temporary buffer. The determination of its - length (tmp_length), in the case when a precision is - specified, below requires a conversion between a char[] - string and a wchar_t[] wide string. It could be done, but - we have no guarantee that the implementation of sprintf will - use the exactly same algorithm. Without this guarantee, it - is possible to have buffer overrun bugs. In order to avoid - such bugs, we implement the entire processing of the 's' - directive ourselves. */ - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 6; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } + ) + { + /* The normal handling of the 's' directive below requires + allocating a temporary buffer. The determination of its + length (tmp_length), in the case when a precision is + specified, below requires a conversion between a char[] + string and a wchar_t[] wide string. It could be done, but + we have no guarantee that the implementation of sprintf will + use the exactly same algorithm. Without this guarantee, it + is possible to have buffer overrun bugs. In order to avoid + such bugs, we implement the entire processing of the 's' + directive ourselves. */ + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } + + has_precision = 0; + precision = 6; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } # if WIDE_CHAR_VERSION - /* %s in vasnwprintf. See the specification of fwprintf. */ - { - const char *arg = a.arg[dp->arg_index].a.a_string; - const char *arg_end; - size_t characters; - - if (has_precision) - { - /* Use only as many bytes as needed to produce PRECISION - wide characters, from the left. */ + /* %s in vasnwprintf. See the specification of fwprintf. */ + { + const char *arg = a.arg[dp->arg_index].a.a_string; + const char *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only as many bytes as needed to produce PRECISION + wide characters, from the left. */ # if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - arg_end = arg; - characters = 0; - for (; precision > 0; precision--) - { - int count; + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count; # if HAVE_MBRTOWC - count = mbrlen (arg_end, MB_CUR_MAX, &state); + count = mbrlen (arg_end, MB_CUR_MAX, &state); # else - count = mblen (arg_end, MB_CUR_MAX); + count = mblen (arg_end, MB_CUR_MAX); # endif - if (count == 0) - /* Found the terminating NUL. */ - break; - if (count < 0) - { - /* Invalid or incomplete multibyte character. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else if (has_width) - { - /* Use the entire string, and count the number of wide - characters. */ + if (count == 0) + /* Found the terminating NUL. */ + break; + if (count < 0) + { + /* Invalid or incomplete multibyte character. */ + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of wide + characters. */ # if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - arg_end = arg; - characters = 0; - for (;;) - { - int count; + arg_end = arg; + characters = 0; + for (;;) + { + int count; # if HAVE_MBRTOWC - count = mbrlen (arg_end, MB_CUR_MAX, &state); + count = mbrlen (arg_end, MB_CUR_MAX, &state); # else - count = mblen (arg_end, MB_CUR_MAX); + count = mblen (arg_end, MB_CUR_MAX); # endif - if (count == 0) - /* Found the terminating NUL. */ - break; - if (count < 0) - { - /* Invalid or incomplete multibyte character. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end += count; - characters++; - } - } - else - { - /* Use the entire string. */ - arg_end = arg + strlen (arg); - /* The number of characters doesn't matter. */ - characters = 0; - } - - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - - if (has_precision || has_width) - { - /* We know the number of wide characters in advance. */ - size_t remaining; + if (count == 0) + /* Found the terminating NUL. */ + break; + if (count < 0) + { + /* Invalid or incomplete multibyte character. */ + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } + + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + + if (has_precision || has_width) + { + /* We know the number of wide characters in advance. */ + size_t remaining; # if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - ENSURE_ALLOCATION (xsum (length, characters)); - for (remaining = characters; remaining > 0; remaining--) - { - wchar_t wc; - int count; + ENSURE_ALLOCATION (xsum (length, characters)); + for (remaining = characters; remaining > 0; remaining--) + { + wchar_t wc; + int count; # if HAVE_MBRTOWC - count = mbrtowc (&wc, arg, arg_end - arg, &state); + count = mbrtowc (&wc, arg, arg_end - arg, &state); # else - count = mbtowc (&wc, arg, arg_end - arg); + count = mbtowc (&wc, arg, arg_end - arg); # endif - if (count <= 0) - /* mbrtowc not consistent with mbrlen, or mbtowc - not consistent with mblen. */ - abort (); - result[length++] = wc; - arg += count; - } - if (!(arg == arg_end)) - abort (); - } - else - { + if (count <= 0) + /* mbrtowc not consistent with mbrlen, or mbtowc + not consistent with mblen. */ + abort (); + result[length++] = wc; + arg += count; + } + if (!(arg == arg_end)) + abort (); + } + else + { # if HAVE_MBRTOWC - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - while (arg < arg_end) - { - wchar_t wc; - int count; + while (arg < arg_end) + { + wchar_t wc; + int count; # if HAVE_MBRTOWC - count = mbrtowc (&wc, arg, arg_end - arg, &state); + count = mbrtowc (&wc, arg, arg_end - arg, &state); # else - count = mbtowc (&wc, arg, arg_end - arg); + count = mbtowc (&wc, arg, arg_end - arg); # endif - if (count <= 0) - /* mbrtowc not consistent with mbrlen, or mbtowc - not consistent with mblen. */ - abort (); - ENSURE_ALLOCATION (xsum (length, 1)); - result[length++] = wc; - arg += count; - } - } - - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - characters; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } + if (count <= 0) + /* mbrtowc not consistent with mbrlen, or mbtowc + not consistent with mblen. */ + abort (); + ENSURE_ALLOCATION (xsum (length, 1)); + result[length++] = wc; + arg += count; + } + } + + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } # else - /* %ls in vasnprintf. See the specification of fprintf. */ - { - const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; - const wchar_t *arg_end; - size_t characters; + /* %ls in vasnprintf. See the specification of fprintf. */ + { + const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; + const wchar_t *arg_end; + size_t characters; # if !DCHAR_IS_TCHAR - /* This code assumes that TCHAR_T is 'char'. */ - typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1]; - TCHAR_T *tmpsrc; - DCHAR_T *tmpdst; - size_t tmpdst_len; + /* This code assumes that TCHAR_T is 'char'. */ + typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1]; + TCHAR_T *tmpsrc; + DCHAR_T *tmpdst; + size_t tmpdst_len; # endif - size_t w; - - if (has_precision) - { - /* Use only as many wide characters as needed to produce - at most PRECISION bytes, from the left. */ -# if HAVE_WCRTOMB - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + size_t w; + + if (has_precision) + { + /* Use only as many wide characters as needed to produce + at most PRECISION bytes, from the left. */ +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - arg_end = arg; - characters = 0; - while (precision > 0) - { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg_end == 0) - /* Found the terminating null wide character. */ - break; -# if HAVE_WCRTOMB - count = wcrtomb (buf, *arg_end, &state); + arg_end = arg; + characters = 0; + while (precision > 0) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; + + if (*arg_end == 0) + /* Found the terminating null wide character. */ + break; +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + count = wcrtomb (cbuf, *arg_end, &state); # else - count = wctomb (buf, *arg_end); + count = wctomb (cbuf, *arg_end); # endif - if (count < 0) - { - /* Cannot convert. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - if (precision < count) - break; - arg_end++; - characters += count; - precision -= count; - } - } + if (count < 0) + { + /* Cannot convert. */ + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + if (precision < count) + break; + arg_end++; + characters += count; + precision -= count; + } + } # if DCHAR_IS_TCHAR - else if (has_width) + else if (has_width) # else - else + else # endif - { - /* Use the entire string, and count the number of - bytes. */ -# if HAVE_WCRTOMB - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + { + /* Use the entire string, and count the number of + bytes. */ +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - arg_end = arg; - characters = 0; - for (;;) - { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg_end == 0) - /* Found the terminating null wide character. */ - break; -# if HAVE_WCRTOMB - count = wcrtomb (buf, *arg_end, &state); + arg_end = arg; + characters = 0; + for (;;) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; + + if (*arg_end == 0) + /* Found the terminating null wide character. */ + break; +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + count = wcrtomb (cbuf, *arg_end, &state); # else - count = wctomb (buf, *arg_end); + count = wctomb (cbuf, *arg_end); # endif - if (count < 0) - { - /* Cannot convert. */ - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EILSEQ; - return NULL; - } - arg_end++; - characters += count; - } - } + if (count < 0) + { + /* Cannot convert. */ + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end++; + characters += count; + } + } # if DCHAR_IS_TCHAR - else - { - /* Use the entire string. */ - arg_end = arg + local_wcslen (arg); - /* The number of bytes doesn't matter. */ - characters = 0; - } + else + { + /* Use the entire string. */ + arg_end = arg + local_wcslen (arg); + /* The number of bytes doesn't matter. */ + characters = 0; + } # endif # if !DCHAR_IS_TCHAR - /* Convert the string into a piece of temporary memory. */ - tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); - if (tmpsrc == NULL) - goto out_of_memory; - { - TCHAR_T *tmpptr = tmpsrc; - size_t remaining; -# if HAVE_WCRTOMB - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + /* Convert the string into a piece of temporary memory. */ + tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); + if (tmpsrc == NULL) + goto out_of_memory; + { + TCHAR_T *tmpptr = tmpsrc; + size_t remaining; +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - for (remaining = characters; remaining > 0; ) - { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); -# if HAVE_WCRTOMB - count = wcrtomb (buf, *arg, &state); + for (remaining = characters; remaining > 0; ) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; + + if (*arg == 0) + abort (); +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + count = wcrtomb (cbuf, *arg, &state); # else - count = wctomb (buf, *arg); + count = wctomb (cbuf, *arg); # endif - if (count <= 0) - /* Inconsistency. */ - abort (); - memcpy (tmpptr, buf, count); - tmpptr += count; - arg++; - remaining -= count; - } - if (!(arg == arg_end)) - abort (); - } - - /* Convert from TCHAR_T[] to DCHAR_T[]. */ - tmpdst = - DCHAR_CONV_FROM_ENCODING (locale_charset (), - iconveh_question_mark, - tmpsrc, characters, - NULL, - NULL, &tmpdst_len); - if (tmpdst == NULL) - { - int saved_errno = errno; - free (tmpsrc); - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - free (tmpsrc); + if (count <= 0) + /* Inconsistency. */ + abort (); + memcpy (tmpptr, cbuf, count); + tmpptr += count; + arg++; + remaining -= count; + } + if (!(arg == arg_end)) + abort (); + } + + /* Convert from TCHAR_T[] to DCHAR_T[]. */ + tmpdst = + DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + tmpsrc, characters, + NULL, + NULL, &tmpdst_len); + if (tmpdst == NULL) + { + int saved_errno = errno; + free (tmpsrc); + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + free (tmpsrc); # endif - if (has_width) - { + if (has_width) + { # if ENABLE_UNISTDIO - /* Outside POSIX, it's preferrable to compare the width - against the number of _characters_ of the converted - value. */ - w = DCHAR_MBSNLEN (result + length, characters); + /* Outside POSIX, it's preferrable to compare the width + against the number of _characters_ of the converted + value. */ + w = DCHAR_MBSNLEN (result + length, characters); # else - /* The width is compared against the number of _bytes_ - of the converted value, says POSIX. */ - w = characters; + /* The width is compared against the number of _bytes_ + of the converted value, says POSIX. */ + w = characters; # endif - } - else - /* w doesn't matter. */ - w = 0; - - if (has_width && width > w - && !(dp->flags & FLAG_LEFT)) - { - size_t n = width - w; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } + } + else + /* w doesn't matter. */ + w = 0; + + if (has_width && width > w + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - w; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } # if DCHAR_IS_TCHAR - if (has_precision || has_width) - { - /* We know the number of bytes in advance. */ - size_t remaining; -# if HAVE_WCRTOMB - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + if (has_precision || has_width) + { + /* We know the number of bytes in advance. */ + size_t remaining; +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - ENSURE_ALLOCATION (xsum (length, characters)); - for (remaining = characters; remaining > 0; ) - { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); -# if HAVE_WCRTOMB - count = wcrtomb (buf, *arg, &state); + ENSURE_ALLOCATION (xsum (length, characters)); + for (remaining = characters; remaining > 0; ) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; + + if (*arg == 0) + abort (); +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + count = wcrtomb (cbuf, *arg, &state); # else - count = wctomb (buf, *arg); + count = wctomb (cbuf, *arg); # endif - if (count <= 0) - /* Inconsistency. */ - abort (); - memcpy (result + length, buf, count); - length += count; - arg++; - remaining -= count; - } - if (!(arg == arg_end)) - abort (); - } - else - { -# if HAVE_WCRTOMB - mbstate_t state; - memset (&state, '\0', sizeof (mbstate_t)); + if (count <= 0) + /* Inconsistency. */ + abort (); + memcpy (result + length, cbuf, count); + length += count; + arg++; + remaining -= count; + } + if (!(arg == arg_end)) + abort (); + } + else + { +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + mbstate_t state; + memset (&state, '\0', sizeof (mbstate_t)); # endif - while (arg < arg_end) - { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); -# if HAVE_WCRTOMB - count = wcrtomb (buf, *arg, &state); + while (arg < arg_end) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; + + if (*arg == 0) + abort (); +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t + count = wcrtomb (cbuf, *arg, &state); # else - count = wctomb (buf, *arg); + count = wctomb (cbuf, *arg); # endif - if (count <= 0) - /* Inconsistency. */ - abort (); - ENSURE_ALLOCATION (xsum (length, count)); - memcpy (result + length, buf, count); - length += count; - arg++; - } - } + if (count <= 0) + { + /* Cannot convert. */ + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + ENSURE_ALLOCATION (xsum (length, count)); + memcpy (result + length, cbuf, count); + length += count; + arg++; + } + } # else - ENSURE_ALLOCATION (xsum (length, tmpdst_len)); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - length += tmpdst_len; + ENSURE_ALLOCATION (xsum (length, tmpdst_len)); + DCHAR_CPY (result + length, tmpdst, tmpdst_len); + free (tmpdst); + length += tmpdst_len; # endif - if (has_width && width > w - && (dp->flags & FLAG_LEFT)) - { - size_t n = width - w; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } - } - } + if (has_width && width > w + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - w; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + } # endif #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL - else if ((dp->conversion == 'a' || dp->conversion == 'A') + else if ((dp->conversion == 'a' || dp->conversion == 'A') # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) - && (0 + && (0 # if NEED_PRINTF_DOUBLE - || a.arg[dp->arg_index].type == TYPE_DOUBLE + || a.arg[dp->arg_index].type == TYPE_DOUBLE # endif # if NEED_PRINTF_LONG_DOUBLE - || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE + || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE # endif - ) + ) # endif - ) - { - arg_type type = a.arg[dp->arg_index].type; - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - size_t tmp_length; - DCHAR_T tmpbuf[700]; - DCHAR_T *tmp; - DCHAR_T *pad_ptr; - DCHAR_T *p; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 0; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - - /* Allocate a temporary buffer of sufficient size. */ - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) ((LDBL_DIG + 1) - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) ((DBL_DIG + 1) - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); - - if (tmp_length < width) - tmp_length = width; - - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - - if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) - tmp = tmpbuf; - else - { - size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); - - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (DCHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } - - pad_ptr = NULL; - p = tmp; - if (type == TYPE_LONGDOUBLE) - { + ) + { + arg_type type = a.arg[dp->arg_index].type; + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + size_t tmp_length; + DCHAR_T tmpbuf[700]; + DCHAR_T *tmp; + DCHAR_T *pad_ptr; + DCHAR_T *p; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } + + has_precision = 0; + precision = 0; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } + + /* Allocate a temporary buffer of sufficient size. */ + if (type == TYPE_LONGDOUBLE) + tmp_length = + (unsigned int) ((LDBL_DIG + 1) + * 0.831 /* decimal -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + else + tmp_length = + (unsigned int) ((DBL_DIG + 1) + * 0.831 /* decimal -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + if (tmp_length < precision) + tmp_length = precision; + /* Account for sign, decimal point etc. */ + tmp_length = xsum (tmp_length, 12); + + if (tmp_length < width) + tmp_length = width; + + tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ + + if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) + tmp = tmpbuf; + else + { + size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); + + if (size_overflow_p (tmp_memsize)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + tmp = (DCHAR_T *) malloc (tmp_memsize); + if (tmp == NULL) + /* Out of memory. */ + goto out_of_memory; + } + + pad_ptr = NULL; + p = tmp; + if (type == TYPE_LONGDOUBLE) + { # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE - long double arg = a.arg[dp->arg_index].a.a_longdouble; - - if (isnanl (arg)) - { - if (dp->conversion == 'A') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - DECL_LONG_DOUBLE_ROUNDING - - BEGIN_LONG_DOUBLE_ROUNDING (); - - if (signbit (arg)) /* arg < 0.0L or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0L && arg + arg == arg) - { - if (dp->conversion == 'A') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { - int exponent; - long double mantissa; - - if (arg > 0.0L) - mantissa = printf_frexpl (arg, &exponent); - else - { - exponent = 0; - mantissa = 0.0L; - } - - if (has_precision - && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) - { - /* Round the mantissa. */ - long double tail = mantissa; - size_t q; - - for (q = precision; ; q--) - { - int digit = (int) tail; - tail -= digit; - if (q == 0) - { - if (digit & 1 ? tail >= 0.5L : tail > 0.5L) - tail = 1 - tail; - else - tail = - tail; - break; - } - tail *= 16.0L; - } - if (tail != 0.0L) - for (q = precision; q > 0; q--) - tail *= 0.0625L; - mantissa += tail; - } - - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - { - int digit; - - digit = (int) mantissa; - mantissa -= digit; - *p++ = '0' + digit; - if ((flags & FLAG_ALT) - || mantissa > 0.0L || precision > 0) - { - *p++ = decimal_point_char (); - /* This loop terminates because we assume - that FLT_RADIX is a power of 2. */ - while (mantissa > 0.0L) - { - mantissa *= 16.0L; - digit = (int) mantissa; - mantissa -= digit; - *p++ = digit - + (digit < 10 - ? '0' - : dp->conversion - 10); - if (precision > 0) - precision--; - } - while (precision > 0) - { - *p++ = '0'; - precision--; - } - } - } - *p++ = dp->conversion - 'A' + 'P'; + long double arg = a.arg[dp->arg_index].a.a_longdouble; + + if (isnanl (arg)) + { + if (dp->conversion == 'A') + { + *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; + } + else + { + *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; + } + } + else + { + int sign = 0; + DECL_LONG_DOUBLE_ROUNDING + + BEGIN_LONG_DOUBLE_ROUNDING (); + + if (signbit (arg)) /* arg < 0.0L or negative zero */ + { + sign = -1; + arg = -arg; + } + + if (sign < 0) + *p++ = '-'; + else if (flags & FLAG_SHOWSIGN) + *p++ = '+'; + else if (flags & FLAG_SPACE) + *p++ = ' '; + + if (arg > 0.0L && arg + arg == arg) + { + if (dp->conversion == 'A') + { + *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; + } + else + { + *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; + } + } + else + { + int exponent; + long double mantissa; + + if (arg > 0.0L) + mantissa = printf_frexpl (arg, &exponent); + else + { + exponent = 0; + mantissa = 0.0L; + } + + if (has_precision + && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) + { + /* Round the mantissa. */ + long double tail = mantissa; + size_t q; + + for (q = precision; ; q--) + { + int digit = (int) tail; + tail -= digit; + if (q == 0) + { + if (digit & 1 ? tail >= 0.5L : tail > 0.5L) + tail = 1 - tail; + else + tail = - tail; + break; + } + tail *= 16.0L; + } + if (tail != 0.0L) + for (q = precision; q > 0; q--) + tail *= 0.0625L; + mantissa += tail; + } + + *p++ = '0'; + *p++ = dp->conversion - 'A' + 'X'; + pad_ptr = p; + { + int digit; + + digit = (int) mantissa; + mantissa -= digit; + *p++ = '0' + digit; + if ((flags & FLAG_ALT) + || mantissa > 0.0L || precision > 0) + { + *p++ = decimal_point_char (); + /* This loop terminates because we assume + that FLT_RADIX is a power of 2. */ + while (mantissa > 0.0L) + { + mantissa *= 16.0L; + digit = (int) mantissa; + mantissa -= digit; + *p++ = digit + + (digit < 10 + ? '0' + : dp->conversion - 10); + if (precision > 0) + precision--; + } + while (precision > 0) + { + *p++ = '0'; + precision--; + } + } + } + *p++ = dp->conversion - 'A' + 'P'; # if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; + { + static const wchar_t decimal_format[] = + { '%', '+', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; # else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } # endif - } + } - END_LONG_DOUBLE_ROUNDING (); - } + END_LONG_DOUBLE_ROUNDING (); + } # else - abort (); + abort (); # endif - } - else - { + } + else + { # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE - double arg = a.arg[dp->arg_index].a.a_double; - - if (isnand (arg)) - { - if (dp->conversion == 'A') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - - if (signbit (arg)) /* arg < 0.0 or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0 && arg + arg == arg) - { - if (dp->conversion == 'A') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { - int exponent; - double mantissa; - - if (arg > 0.0) - mantissa = printf_frexp (arg, &exponent); - else - { - exponent = 0; - mantissa = 0.0; - } - - if (has_precision - && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) - { - /* Round the mantissa. */ - double tail = mantissa; - size_t q; - - for (q = precision; ; q--) - { - int digit = (int) tail; - tail -= digit; - if (q == 0) - { - if (digit & 1 ? tail >= 0.5 : tail > 0.5) - tail = 1 - tail; - else - tail = - tail; - break; - } - tail *= 16.0; - } - if (tail != 0.0) - for (q = precision; q > 0; q--) - tail *= 0.0625; - mantissa += tail; - } - - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - { - int digit; - - digit = (int) mantissa; - mantissa -= digit; - *p++ = '0' + digit; - if ((flags & FLAG_ALT) - || mantissa > 0.0 || precision > 0) - { - *p++ = decimal_point_char (); - /* This loop terminates because we assume - that FLT_RADIX is a power of 2. */ - while (mantissa > 0.0) - { - mantissa *= 16.0; - digit = (int) mantissa; - mantissa -= digit; - *p++ = digit - + (digit < 10 - ? '0' - : dp->conversion - 10); - if (precision > 0) - precision--; - } - while (precision > 0) - { - *p++ = '0'; - precision--; - } - } - } - *p++ = dp->conversion - 'A' + 'P'; + double arg = a.arg[dp->arg_index].a.a_double; + + if (isnand (arg)) + { + if (dp->conversion == 'A') + { + *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; + } + else + { + *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; + } + } + else + { + int sign = 0; + + if (signbit (arg)) /* arg < 0.0 or negative zero */ + { + sign = -1; + arg = -arg; + } + + if (sign < 0) + *p++ = '-'; + else if (flags & FLAG_SHOWSIGN) + *p++ = '+'; + else if (flags & FLAG_SPACE) + *p++ = ' '; + + if (arg > 0.0 && arg + arg == arg) + { + if (dp->conversion == 'A') + { + *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; + } + else + { + *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; + } + } + else + { + int exponent; + double mantissa; + + if (arg > 0.0) + mantissa = printf_frexp (arg, &exponent); + else + { + exponent = 0; + mantissa = 0.0; + } + + if (has_precision + && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) + { + /* Round the mantissa. */ + double tail = mantissa; + size_t q; + + for (q = precision; ; q--) + { + int digit = (int) tail; + tail -= digit; + if (q == 0) + { + if (digit & 1 ? tail >= 0.5 : tail > 0.5) + tail = 1 - tail; + else + tail = - tail; + break; + } + tail *= 16.0; + } + if (tail != 0.0) + for (q = precision; q > 0; q--) + tail *= 0.0625; + mantissa += tail; + } + + *p++ = '0'; + *p++ = dp->conversion - 'A' + 'X'; + pad_ptr = p; + { + int digit; + + digit = (int) mantissa; + mantissa -= digit; + *p++ = '0' + digit; + if ((flags & FLAG_ALT) + || mantissa > 0.0 || precision > 0) + { + *p++ = decimal_point_char (); + /* This loop terminates because we assume + that FLT_RADIX is a power of 2. */ + while (mantissa > 0.0) + { + mantissa *= 16.0; + digit = (int) mantissa; + mantissa -= digit; + *p++ = digit + + (digit < 10 + ? '0' + : dp->conversion - 10); + if (precision > 0) + precision--; + } + while (precision > 0) + { + *p++ = '0'; + precision--; + } + } + } + *p++ = dp->conversion - 'A' + 'P'; # if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; + { + static const wchar_t decimal_format[] = + { '%', '+', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; # else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } # endif - } - } + } + } # else - abort (); + abort (); # endif - } - /* The generated string now extends from tmp to p, with the - zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) - { - size_t pad = width - (p - tmp); - DCHAR_T *end = p + pad; - - if (flags & FLAG_LEFT) - { - /* Pad with spaces on the right. */ - for (; pad > 0; pad--) - *p++ = ' '; - } - else if ((flags & FLAG_ZERO) && pad_ptr != NULL) - { - /* Pad with zeroes. */ - DCHAR_T *q = end; - - while (p > pad_ptr) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = '0'; - } - else - { - /* Pad with spaces on the left. */ - DCHAR_T *q = end; - - while (p > tmp) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = ' '; - } - - p = end; - } - - { - size_t count = p - tmp; - - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); - - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); - - ENSURE_ALLOCATION (n); - } - - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } - } + } + /* The generated string now extends from tmp to p, with the + zero padding insertion point being at pad_ptr. */ + if (has_width && p - tmp < width) + { + size_t pad = width - (p - tmp); + DCHAR_T *end = p + pad; + + if (flags & FLAG_LEFT) + { + /* Pad with spaces on the right. */ + for (; pad > 0; pad--) + *p++ = ' '; + } + else if ((flags & FLAG_ZERO) && pad_ptr != NULL) + { + /* Pad with zeroes. */ + DCHAR_T *q = end; + + while (p > pad_ptr) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = '0'; + } + else + { + /* Pad with spaces on the left. */ + DCHAR_T *q = end; + + while (p > tmp) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = ' '; + } + + p = end; + } + + { + size_t count = p - tmp; + + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); + + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); + + ENSURE_ALLOCATION (n); + } + + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; + } + } #endif #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL - else if ((dp->conversion == 'f' || dp->conversion == 'F' - || dp->conversion == 'e' || dp->conversion == 'E' - || dp->conversion == 'g' || dp->conversion == 'G' - || dp->conversion == 'a' || dp->conversion == 'A') - && (0 + else if ((dp->conversion == 'f' || dp->conversion == 'F' + || dp->conversion == 'e' || dp->conversion == 'E' + || dp->conversion == 'g' || dp->conversion == 'G' + || dp->conversion == 'a' || dp->conversion == 'A') + && (0 # if NEED_PRINTF_DOUBLE - || a.arg[dp->arg_index].type == TYPE_DOUBLE + || a.arg[dp->arg_index].type == TYPE_DOUBLE # elif NEED_PRINTF_INFINITE_DOUBLE - || (a.arg[dp->arg_index].type == TYPE_DOUBLE - /* The systems (mingw) which produce wrong output - for Inf, -Inf, and NaN also do so for -0.0. - Therefore we treat this case here as well. */ - && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) + || (a.arg[dp->arg_index].type == TYPE_DOUBLE + /* The systems (mingw) which produce wrong output + for Inf, -Inf, and NaN also do so for -0.0. + Therefore we treat this case here as well. */ + && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) # endif # if NEED_PRINTF_LONG_DOUBLE - || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE + || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE # elif NEED_PRINTF_INFINITE_LONG_DOUBLE - || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE - /* Some systems produce wrong output for Inf, - -Inf, and NaN. Some systems in this category - (IRIX 5.3) also do so for -0.0. Therefore we - treat this case here as well. */ - && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) + || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE + /* Some systems produce wrong output for Inf, + -Inf, and NaN. Some systems in this category + (IRIX 5.3) also do so for -0.0. Therefore we + treat this case here as well. */ + && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) # endif - )) - { + )) + { # if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) - arg_type type = a.arg[dp->arg_index].type; + arg_type type = a.arg[dp->arg_index].type; # endif - int flags = dp->flags; - int has_width; - size_t width; - int has_precision; - size_t precision; - size_t tmp_length; - DCHAR_T tmpbuf[700]; - DCHAR_T *tmp; - DCHAR_T *pad_ptr; - DCHAR_T *p; - - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } - - has_precision = 0; - precision = 0; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } - - /* POSIX specifies the default precision to be 6 for %f, %F, - %e, %E, but not for %g, %G. Implementations appear to use - the same default precision also for %g, %G. But for %a, %A, - the default precision is 0. */ - if (!has_precision) - if (!(dp->conversion == 'a' || dp->conversion == 'A')) - precision = 6; - - /* Allocate a temporary buffer of sufficient size. */ + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + size_t tmp_length; + DCHAR_T tmpbuf[700]; + DCHAR_T *tmp; + DCHAR_T *pad_ptr; + DCHAR_T *p; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } + + has_precision = 0; + precision = 0; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } + + /* POSIX specifies the default precision to be 6 for %f, %F, + %e, %E, but not for %g, %G. Implementations appear to use + the same default precision also for %g, %G. But for %a, %A, + the default precision is 0. */ + if (!has_precision) + if (!(dp->conversion == 'a' || dp->conversion == 'A')) + precision = 6; + + /* Allocate a temporary buffer of sufficient size. */ # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE - tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); + tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); # elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE - tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); + tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); # elif NEED_PRINTF_LONG_DOUBLE - tmp_length = LDBL_DIG + 1; + tmp_length = LDBL_DIG + 1; # elif NEED_PRINTF_DOUBLE - tmp_length = DBL_DIG + 1; + tmp_length = DBL_DIG + 1; # else - tmp_length = 0; + tmp_length = 0; # endif - if (tmp_length < precision) - tmp_length = precision; + if (tmp_length < precision) + tmp_length = precision; # if NEED_PRINTF_LONG_DOUBLE # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - if (type == TYPE_LONGDOUBLE) + if (type == TYPE_LONGDOUBLE) # endif - if (dp->conversion == 'f' || dp->conversion == 'F') - { - long double arg = a.arg[dp->arg_index].a.a_longdouble; - if (!(isnanl (arg) || arg + arg == arg)) - { - /* arg is finite and nonzero. */ - int exponent = floorlog10l (arg < 0 ? -arg : arg); - if (exponent >= 0 && tmp_length < exponent + precision) - tmp_length = exponent + precision; - } - } + if (dp->conversion == 'f' || dp->conversion == 'F') + { + long double arg = a.arg[dp->arg_index].a.a_longdouble; + if (!(isnanl (arg) || arg + arg == arg)) + { + /* arg is finite and nonzero. */ + int exponent = floorlog10l (arg < 0 ? -arg : arg); + if (exponent >= 0 && tmp_length < exponent + precision) + tmp_length = exponent + precision; + } + } # endif # if NEED_PRINTF_DOUBLE # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE - if (type == TYPE_DOUBLE) + if (type == TYPE_DOUBLE) # endif - if (dp->conversion == 'f' || dp->conversion == 'F') - { - double arg = a.arg[dp->arg_index].a.a_double; - if (!(isnand (arg) || arg + arg == arg)) - { - /* arg is finite and nonzero. */ - int exponent = floorlog10 (arg < 0 ? -arg : arg); - if (exponent >= 0 && tmp_length < exponent + precision) - tmp_length = exponent + precision; - } - } + if (dp->conversion == 'f' || dp->conversion == 'F') + { + double arg = a.arg[dp->arg_index].a.a_double; + if (!(isnand (arg) || arg + arg == arg)) + { + /* arg is finite and nonzero. */ + int exponent = floorlog10 (arg < 0 ? -arg : arg); + if (exponent >= 0 && tmp_length < exponent + precision) + tmp_length = exponent + precision; + } + } # endif - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); + /* Account for sign, decimal point etc. */ + tmp_length = xsum (tmp_length, 12); - if (tmp_length < width) - tmp_length = width; + if (tmp_length < width) + tmp_length = width; - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ + tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) - tmp = tmpbuf; - else - { - size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); + if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) + tmp = tmpbuf; + else + { + size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (DCHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } + if (size_overflow_p (tmp_memsize)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + tmp = (DCHAR_T *) malloc (tmp_memsize); + if (tmp == NULL) + /* Out of memory. */ + goto out_of_memory; + } - pad_ptr = NULL; - p = tmp; + pad_ptr = NULL; + p = tmp; # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - if (type == TYPE_LONGDOUBLE) + if (type == TYPE_LONGDOUBLE) # endif - { - long double arg = a.arg[dp->arg_index].a.a_longdouble; - - if (isnanl (arg)) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - DECL_LONG_DOUBLE_ROUNDING - - BEGIN_LONG_DOUBLE_ROUNDING (); - - if (signbit (arg)) /* arg < 0.0L or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0L && arg + arg == arg) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { + { + long double arg = a.arg[dp->arg_index].a.a_longdouble; + + if (isnanl (arg)) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; + } + else + { + *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; + } + } + else + { + int sign = 0; + DECL_LONG_DOUBLE_ROUNDING + + BEGIN_LONG_DOUBLE_ROUNDING (); + + if (signbit (arg)) /* arg < 0.0L or negative zero */ + { + sign = -1; + arg = -arg; + } + + if (sign < 0) + *p++ = '-'; + else if (flags & FLAG_SHOWSIGN) + *p++ = '+'; + else if (flags & FLAG_SPACE) + *p++ = ' '; + + if (arg > 0.0L && arg + arg == arg) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; + } + else + { + *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; + } + } + else + { # if NEED_PRINTF_LONG_DOUBLE - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - char *digits; - size_t ndigits; - - digits = - scale10_round_decimal_long_double (arg, precision); - if (digits == NULL) - { - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - ndigits = strlen (digits); - - if (ndigits > precision) - do - { - --ndigits; - *p++ = digits[ndigits]; - } - while (ndigits > precision); - else - *p++ = '0'; - /* Here ndigits <= precision. */ - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > ndigits; precision--) - *p++ = '0'; - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - int exponent; - - if (arg == 0.0L) - { - exponent = 0; - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else - { - /* arg > 0.0L. */ - int adjusted; - char *digits; - size_t ndigits; - - exponent = floorlog10l (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_long_double (arg, - (int)precision - exponent); - if (digits == NULL) - { - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - ndigits = strlen (digits); - - if (ndigits == precision + 1) - break; - if (ndigits < precision - || ndigits > precision + 2) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits == precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision+1. */ - if (is_borderline (digits, precision)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_long_double (arg, - (int)precision - exponent + 1); - if (digits2 == NULL) - { - free (digits); - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - if (strlen (digits2) == precision + 1) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision+1. */ - - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - - *p++ = dp->conversion; /* 'e' or 'E' */ + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + char *digits; + size_t ndigits; + + digits = + scale10_round_decimal_long_double (arg, precision); + if (digits == NULL) + { + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + ndigits = strlen (digits); + + if (ndigits > precision) + do + { + --ndigits; + *p++ = digits[ndigits]; + } + while (ndigits > precision); + else + *p++ = '0'; + /* Here ndigits <= precision. */ + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > ndigits; precision--) + *p++ = '0'; + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + int exponent; + + if (arg == 0.0L) + { + exponent = 0; + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else + { + /* arg > 0.0L. */ + int adjusted; + char *digits; + size_t ndigits; + + exponent = floorlog10l (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_long_double (arg, + (int)precision - exponent); + if (digits == NULL) + { + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + ndigits = strlen (digits); + + if (ndigits == precision + 1) + break; + if (ndigits < precision + || ndigits > precision + 2) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits == precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + /* Here ndigits = precision+1. */ + if (is_borderline (digits, precision)) + { + /* Maybe the exponent guess was too high + and a smaller exponent can be reached + by turning a 10...0 into 9...9x. */ + char *digits2 = + scale10_round_decimal_long_double (arg, + (int)precision - exponent + 1); + if (digits2 == NULL) + { + free (digits); + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + if (strlen (digits2) == precision + 1) + { + free (digits); + digits = digits2; + exponent -= 1; + } + else + free (digits2); + } + /* Here ndigits = precision+1. */ + + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + + *p++ = dp->conversion; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', '.', '2', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; + { + static const wchar_t decimal_format[] = + { '%', '+', '.', '2', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; # else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+.2d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+.2d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+.2d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+.2d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } # endif - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - if (precision == 0) - precision = 1; - /* precision >= 1. */ - - if (arg == 0.0L) - /* The exponent is 0, >= -4, < precision. - Use fixed-point notation. */ - { - size_t ndigits = precision; - /* Number of trailing zeroes that have to be - dropped. */ - size_t nzeroes = - (flags & FLAG_ALT ? 0 : precision - 1); - - --ndigits; - *p++ = '0'; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = '0'; - } - } - } - else - { - /* arg > 0.0L. */ - int exponent; - int adjusted; - char *digits; - size_t ndigits; - size_t nzeroes; - - exponent = floorlog10l (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_long_double (arg, - (int)(precision - 1) - exponent); - if (digits == NULL) - { - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - ndigits = strlen (digits); - - if (ndigits == precision) - break; - if (ndigits < precision - 1 - || ndigits > precision + 1) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits < precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision. */ - if (is_borderline (digits, precision - 1)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_long_double (arg, - (int)(precision - 1) - exponent + 1); - if (digits2 == NULL) - { - free (digits); - END_LONG_DOUBLE_ROUNDING (); - goto out_of_memory; - } - if (strlen (digits2) == precision) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision. */ - - /* Determine the number of trailing zeroes - that have to be dropped. */ - nzeroes = 0; - if ((flags & FLAG_ALT) == 0) - while (nzeroes < ndigits - && digits[nzeroes] == '0') - nzeroes++; - - /* The exponent is now determined. */ - if (exponent >= -4 - && exponent < (long)precision) - { - /* Fixed-point notation: - max(exponent,0)+1 digits, then the - decimal point, then the remaining - digits without trailing zeroes. */ - if (exponent >= 0) - { - size_t count = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - size_t count = -exponent - 1; - *p++ = '0'; - *p++ = decimal_point_char (); - for (; count > 0; count--) - *p++ = '0'; - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - /* Exponential notation. */ - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + if (precision == 0) + precision = 1; + /* precision >= 1. */ + + if (arg == 0.0L) + /* The exponent is 0, >= -4, < precision. + Use fixed-point notation. */ + { + size_t ndigits = precision; + /* Number of trailing zeroes that have to be + dropped. */ + size_t nzeroes = + (flags & FLAG_ALT ? 0 : precision - 1); + + --ndigits; + *p++ = '0'; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = '0'; + } + } + } + else + { + /* arg > 0.0L. */ + int exponent; + int adjusted; + char *digits; + size_t ndigits; + size_t nzeroes; + + exponent = floorlog10l (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_long_double (arg, + (int)(precision - 1) - exponent); + if (digits == NULL) + { + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + ndigits = strlen (digits); + + if (ndigits == precision) + break; + if (ndigits < precision - 1 + || ndigits > precision + 1) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits < precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + /* Here ndigits = precision. */ + if (is_borderline (digits, precision - 1)) + { + /* Maybe the exponent guess was too high + and a smaller exponent can be reached + by turning a 10...0 into 9...9x. */ + char *digits2 = + scale10_round_decimal_long_double (arg, + (int)(precision - 1) - exponent + 1); + if (digits2 == NULL) + { + free (digits); + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + if (strlen (digits2) == precision) + { + free (digits); + digits = digits2; + exponent -= 1; + } + else + free (digits2); + } + /* Here ndigits = precision. */ + + /* Determine the number of trailing zeroes + that have to be dropped. */ + nzeroes = 0; + if ((flags & FLAG_ALT) == 0) + while (nzeroes < ndigits + && digits[nzeroes] == '0') + nzeroes++; + + /* The exponent is now determined. */ + if (exponent >= -4 + && exponent < (long)precision) + { + /* Fixed-point notation: + max(exponent,0)+1 digits, then the + decimal point, then the remaining + digits without trailing zeroes. */ + if (exponent >= 0) + { + size_t count = exponent + 1; + /* Note: count <= precision = ndigits. */ + for (; count > 0; count--) + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + size_t count = -exponent - 1; + *p++ = '0'; + *p++ = decimal_point_char (); + for (; count > 0; count--) + *p++ = '0'; + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + /* Exponential notation. */ + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - { '%', '+', '.', '2', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; + { + static const wchar_t decimal_format[] = + { '%', '+', '.', '2', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; # else - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, "%+.2d", exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, "%+.2d", exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+.2d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+.2d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } # endif - } + } - free (digits); - } - } - else - abort (); + free (digits); + } + } + else + abort (); # else - /* arg is finite. */ - if (!(arg == 0.0L)) - abort (); - - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - *p++ = dp->conversion; /* 'e' or 'E' */ - *p++ = '+'; - *p++ = '0'; - *p++ = '0'; - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - *p++ = '0'; - if (flags & FLAG_ALT) - { - size_t ndigits = - (precision > 0 ? precision - 1 : 0); - *p++ = decimal_point_char (); - for (; ndigits > 0; --ndigits) - *p++ = '0'; - } - } - else if (dp->conversion == 'a' || dp->conversion == 'A') - { - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - *p++ = dp->conversion - 'A' + 'P'; - *p++ = '+'; - *p++ = '0'; - } - else - abort (); + /* arg is finite. */ + if (!(arg == 0.0L)) + abort (); + + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + *p++ = dp->conversion; /* 'e' or 'E' */ + *p++ = '+'; + *p++ = '0'; + *p++ = '0'; + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + *p++ = '0'; + if (flags & FLAG_ALT) + { + size_t ndigits = + (precision > 0 ? precision - 1 : 0); + *p++ = decimal_point_char (); + for (; ndigits > 0; --ndigits) + *p++ = '0'; + } + } + else if (dp->conversion == 'a' || dp->conversion == 'A') + { + *p++ = '0'; + *p++ = dp->conversion - 'A' + 'X'; + pad_ptr = p; + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + *p++ = dp->conversion - 'A' + 'P'; + *p++ = '+'; + *p++ = '0'; + } + else + abort (); # endif - } + } - END_LONG_DOUBLE_ROUNDING (); - } - } + END_LONG_DOUBLE_ROUNDING (); + } + } # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - else + else # endif # endif # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE - { - double arg = a.arg[dp->arg_index].a.a_double; - - if (isnand (arg)) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; - } - else - { - *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; - } - } - else - { - int sign = 0; - - if (signbit (arg)) /* arg < 0.0 or negative zero */ - { - sign = -1; - arg = -arg; - } - - if (sign < 0) - *p++ = '-'; - else if (flags & FLAG_SHOWSIGN) - *p++ = '+'; - else if (flags & FLAG_SPACE) - *p++ = ' '; - - if (arg > 0.0 && arg + arg == arg) - { - if (dp->conversion >= 'A' && dp->conversion <= 'Z') - { - *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; - } - else - { - *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; - } - } - else - { + { + double arg = a.arg[dp->arg_index].a.a_double; + + if (isnand (arg)) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; + } + else + { + *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; + } + } + else + { + int sign = 0; + + if (signbit (arg)) /* arg < 0.0 or negative zero */ + { + sign = -1; + arg = -arg; + } + + if (sign < 0) + *p++ = '-'; + else if (flags & FLAG_SHOWSIGN) + *p++ = '+'; + else if (flags & FLAG_SPACE) + *p++ = ' '; + + if (arg > 0.0 && arg + arg == arg) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; + } + else + { + *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; + } + } + else + { # if NEED_PRINTF_DOUBLE - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - char *digits; - size_t ndigits; - - digits = - scale10_round_decimal_double (arg, precision); - if (digits == NULL) - goto out_of_memory; - ndigits = strlen (digits); - - if (ndigits > precision) - do - { - --ndigits; - *p++ = digits[ndigits]; - } - while (ndigits > precision); - else - *p++ = '0'; - /* Here ndigits <= precision. */ - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > ndigits; precision--) - *p++ = '0'; - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - int exponent; - - if (arg == 0.0) - { - exponent = 0; - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else - { - /* arg > 0.0. */ - int adjusted; - char *digits; - size_t ndigits; - - exponent = floorlog10 (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_double (arg, - (int)precision - exponent); - if (digits == NULL) - goto out_of_memory; - ndigits = strlen (digits); - - if (ndigits == precision + 1) - break; - if (ndigits < precision - || ndigits > precision + 2) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits == precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision+1. */ - if (is_borderline (digits, precision)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_double (arg, - (int)precision - exponent + 1); - if (digits2 == NULL) - { - free (digits); - goto out_of_memory; - } - if (strlen (digits2) == precision + 1) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision+1. */ - - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - while (ndigits > 0) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - - free (digits); - } - - *p++ = dp->conversion; /* 'e' or 'E' */ + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + char *digits; + size_t ndigits; + + digits = + scale10_round_decimal_double (arg, precision); + if (digits == NULL) + goto out_of_memory; + ndigits = strlen (digits); + + if (ndigits > precision) + do + { + --ndigits; + *p++ = digits[ndigits]; + } + while (ndigits > precision); + else + *p++ = '0'; + /* Here ndigits <= precision. */ + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > ndigits; precision--) + *p++ = '0'; + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + int exponent; + + if (arg == 0.0) + { + exponent = 0; + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else + { + /* arg > 0.0. */ + int adjusted; + char *digits; + size_t ndigits; + + exponent = floorlog10 (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_double (arg, + (int)precision - exponent); + if (digits == NULL) + goto out_of_memory; + ndigits = strlen (digits); + + if (ndigits == precision + 1) + break; + if (ndigits < precision + || ndigits > precision + 2) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits == precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + /* Here ndigits = precision+1. */ + if (is_borderline (digits, precision)) + { + /* Maybe the exponent guess was too high + and a smaller exponent can be reached + by turning a 10...0 into 9...9x. */ + char *digits2 = + scale10_round_decimal_double (arg, + (int)precision - exponent + 1); + if (digits2 == NULL) + { + free (digits); + goto out_of_memory; + } + if (strlen (digits2) == precision + 1) + { + free (digits); + digits = digits2; + exponent -= 1; + } + else + free (digits2); + } + /* Here ndigits = precision+1. */ + + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + + *p++ = dp->conversion; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ + { + static const wchar_t decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - { '%', '+', '.', '3', 'd', '\0' }; + { '%', '+', '.', '3', 'd', '\0' }; # else - { '%', '+', '.', '2', 'd', '\0' }; + { '%', '+', '.', '2', 'd', '\0' }; # endif - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; # else - { - static const char decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ + { + static const char decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - "%+.3d"; + "%+.3d"; # else - "%+.2d"; + "%+.2d"; # endif - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, decimal_format, exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, decimal_format, exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } - } + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, decimal_format, exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, decimal_format, exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } + } # endif - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - if (precision == 0) - precision = 1; - /* precision >= 1. */ - - if (arg == 0.0) - /* The exponent is 0, >= -4, < precision. - Use fixed-point notation. */ - { - size_t ndigits = precision; - /* Number of trailing zeroes that have to be - dropped. */ - size_t nzeroes = - (flags & FLAG_ALT ? 0 : precision - 1); - - --ndigits; - *p++ = '0'; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = '0'; - } - } - } - else - { - /* arg > 0.0. */ - int exponent; - int adjusted; - char *digits; - size_t ndigits; - size_t nzeroes; - - exponent = floorlog10 (arg); - adjusted = 0; - for (;;) - { - digits = - scale10_round_decimal_double (arg, - (int)(precision - 1) - exponent); - if (digits == NULL) - goto out_of_memory; - ndigits = strlen (digits); - - if (ndigits == precision) - break; - if (ndigits < precision - 1 - || ndigits > precision + 1) - /* The exponent was not guessed - precisely enough. */ - abort (); - if (adjusted) - /* None of two values of exponent is - the right one. Prevent an endless - loop. */ - abort (); - free (digits); - if (ndigits < precision) - exponent -= 1; - else - exponent += 1; - adjusted = 1; - } - /* Here ndigits = precision. */ - if (is_borderline (digits, precision - 1)) - { - /* Maybe the exponent guess was too high - and a smaller exponent can be reached - by turning a 10...0 into 9...9x. */ - char *digits2 = - scale10_round_decimal_double (arg, - (int)(precision - 1) - exponent + 1); - if (digits2 == NULL) - { - free (digits); - goto out_of_memory; - } - if (strlen (digits2) == precision) - { - free (digits); - digits = digits2; - exponent -= 1; - } - else - free (digits2); - } - /* Here ndigits = precision. */ - - /* Determine the number of trailing zeroes - that have to be dropped. */ - nzeroes = 0; - if ((flags & FLAG_ALT) == 0) - while (nzeroes < ndigits - && digits[nzeroes] == '0') - nzeroes++; - - /* The exponent is now determined. */ - if (exponent >= -4 - && exponent < (long)precision) - { - /* Fixed-point notation: - max(exponent,0)+1 digits, then the - decimal point, then the remaining - digits without trailing zeroes. */ - if (exponent >= 0) - { - size_t count = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - size_t count = -exponent - 1; - *p++ = '0'; - *p++ = decimal_point_char (); - for (; count > 0; count--) - *p++ = '0'; - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - } - else - { - /* Exponential notation. */ - *p++ = digits[--ndigits]; - if ((flags & FLAG_ALT) || ndigits > nzeroes) - { - *p++ = decimal_point_char (); - while (ndigits > nzeroes) - { - --ndigits; - *p++ = digits[ndigits]; - } - } - *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + if (precision == 0) + precision = 1; + /* precision >= 1. */ + + if (arg == 0.0) + /* The exponent is 0, >= -4, < precision. + Use fixed-point notation. */ + { + size_t ndigits = precision; + /* Number of trailing zeroes that have to be + dropped. */ + size_t nzeroes = + (flags & FLAG_ALT ? 0 : precision - 1); + + --ndigits; + *p++ = '0'; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = '0'; + } + } + } + else + { + /* arg > 0.0. */ + int exponent; + int adjusted; + char *digits; + size_t ndigits; + size_t nzeroes; + + exponent = floorlog10 (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_double (arg, + (int)(precision - 1) - exponent); + if (digits == NULL) + goto out_of_memory; + ndigits = strlen (digits); + + if (ndigits == precision) + break; + if (ndigits < precision - 1 + || ndigits > precision + 1) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits < precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + /* Here ndigits = precision. */ + if (is_borderline (digits, precision - 1)) + { + /* Maybe the exponent guess was too high + and a smaller exponent can be reached + by turning a 10...0 into 9...9x. */ + char *digits2 = + scale10_round_decimal_double (arg, + (int)(precision - 1) - exponent + 1); + if (digits2 == NULL) + { + free (digits); + goto out_of_memory; + } + if (strlen (digits2) == precision) + { + free (digits); + digits = digits2; + exponent -= 1; + } + else + free (digits2); + } + /* Here ndigits = precision. */ + + /* Determine the number of trailing zeroes + that have to be dropped. */ + nzeroes = 0; + if ((flags & FLAG_ALT) == 0) + while (nzeroes < ndigits + && digits[nzeroes] == '0') + nzeroes++; + + /* The exponent is now determined. */ + if (exponent >= -4 + && exponent < (long)precision) + { + /* Fixed-point notation: + max(exponent,0)+1 digits, then the + decimal point, then the remaining + digits without trailing zeroes. */ + if (exponent >= 0) + { + size_t count = exponent + 1; + /* Note: count <= precision = ndigits. */ + for (; count > 0; count--) + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + size_t count = -exponent - 1; + *p++ = '0'; + *p++ = decimal_point_char (); + for (; count > 0; count--) + *p++ = '0'; + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + /* Exponential notation. */ + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION - { - static const wchar_t decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ + { + static const wchar_t decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - { '%', '+', '.', '3', 'd', '\0' }; + { '%', '+', '.', '3', 'd', '\0' }; # else - { '%', '+', '.', '2', 'd', '\0' }; + { '%', '+', '.', '2', 'd', '\0' }; # endif - SNPRINTF (p, 6 + 1, decimal_format, exponent); - } - while (*p != '\0') - p++; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; # else - { - static const char decimal_format[] = - /* Produce the same number of exponent digits - as the native printf implementation. */ + { + static const char decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - "%+.3d"; + "%+.3d"; # else - "%+.2d"; + "%+.2d"; # endif - if (sizeof (DCHAR_T) == 1) - { - sprintf ((char *) p, decimal_format, exponent); - while (*p != '\0') - p++; - } - else - { - char expbuf[6 + 1]; - const char *ep; - sprintf (expbuf, decimal_format, exponent); - for (ep = expbuf; (*p = *ep) != '\0'; ep++) - p++; - } - } + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, decimal_format, exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, decimal_format, exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } + } # endif - } + } - free (digits); - } - } - else - abort (); + free (digits); + } + } + else + abort (); # else - /* arg is finite. */ - if (!(arg == 0.0)) - abort (); - - pad_ptr = p; - - if (dp->conversion == 'f' || dp->conversion == 'F') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - } - else if (dp->conversion == 'e' || dp->conversion == 'E') - { - *p++ = '0'; - if ((flags & FLAG_ALT) || precision > 0) - { - *p++ = decimal_point_char (); - for (; precision > 0; precision--) - *p++ = '0'; - } - *p++ = dp->conversion; /* 'e' or 'E' */ - *p++ = '+'; - /* Produce the same number of exponent digits as - the native printf implementation. */ + /* arg is finite. */ + if (!(arg == 0.0)) + abort (); + + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + *p++ = dp->conversion; /* 'e' or 'E' */ + *p++ = '+'; + /* Produce the same number of exponent digits as + the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - *p++ = '0'; + *p++ = '0'; # endif - *p++ = '0'; - *p++ = '0'; - } - else if (dp->conversion == 'g' || dp->conversion == 'G') - { - *p++ = '0'; - if (flags & FLAG_ALT) - { - size_t ndigits = - (precision > 0 ? precision - 1 : 0); - *p++ = decimal_point_char (); - for (; ndigits > 0; --ndigits) - *p++ = '0'; - } - } - else - abort (); + *p++ = '0'; + *p++ = '0'; + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + *p++ = '0'; + if (flags & FLAG_ALT) + { + size_t ndigits = + (precision > 0 ? precision - 1 : 0); + *p++ = decimal_point_char (); + for (; ndigits > 0; --ndigits) + *p++ = '0'; + } + } + else + abort (); # endif - } - } - } + } + } + } # endif - /* The generated string now extends from tmp to p, with the - zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) - { - size_t pad = width - (p - tmp); - DCHAR_T *end = p + pad; - - if (flags & FLAG_LEFT) - { - /* Pad with spaces on the right. */ - for (; pad > 0; pad--) - *p++ = ' '; - } - else if ((flags & FLAG_ZERO) && pad_ptr != NULL) - { - /* Pad with zeroes. */ - DCHAR_T *q = end; - - while (p > pad_ptr) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = '0'; - } - else - { - /* Pad with spaces on the left. */ - DCHAR_T *q = end; - - while (p > tmp) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = ' '; - } - - p = end; - } - - { - size_t count = p - tmp; - - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); - - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); - - ENSURE_ALLOCATION (n); - } - - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } - } + /* The generated string now extends from tmp to p, with the + zero padding insertion point being at pad_ptr. */ + if (has_width && p - tmp < width) + { + size_t pad = width - (p - tmp); + DCHAR_T *end = p + pad; + + if (flags & FLAG_LEFT) + { + /* Pad with spaces on the right. */ + for (; pad > 0; pad--) + *p++ = ' '; + } + else if ((flags & FLAG_ZERO) && pad_ptr != NULL) + { + /* Pad with zeroes. */ + DCHAR_T *q = end; + + while (p > pad_ptr) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = '0'; + } + else + { + /* Pad with spaces on the left. */ + DCHAR_T *q = end; + + while (p > tmp) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = ' '; + } + + p = end; + } + + { + size_t count = p - tmp; + + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); + + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); + + ENSURE_ALLOCATION (n); + } + + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; + } + } #endif - else - { - arg_type type = a.arg[dp->arg_index].type; - int flags = dp->flags; -#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - int has_width; - size_t width; + else + { + arg_type type = a.arg[dp->arg_index].type; + int flags = dp->flags; +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION + int has_width; + size_t width; #endif -#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION - int has_precision; - size_t precision; +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION + int has_precision; + size_t precision; #endif #if NEED_PRINTF_UNBOUNDED_PRECISION - int prec_ourselves; + int prec_ourselves; #else -# define prec_ourselves 0 +# define prec_ourselves 0 #endif #if NEED_PRINTF_FLAG_LEFTADJUST -# define pad_ourselves 1 +# define pad_ourselves 1 #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - int pad_ourselves; + int pad_ourselves; #else -# define pad_ourselves 0 +# define pad_ourselves 0 #endif - TCHAR_T *fbp; - unsigned int prefix_count; - int prefixes[2] IF_LINT (= { 0 }); + TCHAR_T *fbp; + unsigned int prefix_count; + int prefixes[2] IF_LINT (= { 0 }); #if !USE_SNPRINTF - size_t tmp_length; - TCHAR_T tmpbuf[700]; - TCHAR_T *tmp; + size_t tmp_length; + TCHAR_T tmpbuf[700]; + TCHAR_T *tmp; #endif -#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - has_width = 0; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - if (arg < 0) - { - /* "A negative field width is taken as a '-' flag - followed by a positive field width." */ - flags |= FLAG_LEFT; - width = (unsigned int) (-arg); - } - else - width = arg; - } - else - { - const FCHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - has_width = 1; - } +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } #endif -#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION - has_precision = 0; - precision = 6; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - /* "A negative precision is taken as if the precision - were omitted." */ - if (arg >= 0) - { - precision = arg; - has_precision = 1; - } - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; - - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - has_precision = 1; - } - } +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION + has_precision = 0; + precision = 6; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } #endif - /* Decide whether to handle the precision ourselves. */ + /* Decide whether to handle the precision ourselves. */ #if NEED_PRINTF_UNBOUNDED_PRECISION - switch (dp->conversion) - { - case 'd': case 'i': case 'u': - case 'o': - case 'x': case 'X': case 'p': - prec_ourselves = has_precision && (precision > 0); - break; - default: - prec_ourselves = 0; - break; - } + switch (dp->conversion) + { + case 'd': case 'i': case 'u': + case 'o': + case 'x': case 'X': case 'p': + prec_ourselves = has_precision && (precision > 0); + break; + default: + prec_ourselves = 0; + break; + } #endif - /* Decide whether to perform the padding ourselves. */ + /* Decide whether to perform the padding ourselves. */ #if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) - switch (dp->conversion) - { + switch (dp->conversion) + { # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO - /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need - to perform the padding after this conversion. Functions - with unistdio extensions perform the padding based on - character count rather than element count. */ - case 'c': case 's': + /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need + to perform the padding after this conversion. Functions + with unistdio extensions perform the padding based on + character count rather than element count. */ + case 'c': case 's': # endif # if NEED_PRINTF_FLAG_ZERO - case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': - case 'a': case 'A': + case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': + case 'a': case 'A': # endif - pad_ourselves = 1; - break; - default: - pad_ourselves = prec_ourselves; - break; - } + pad_ourselves = 1; + break; + default: + pad_ourselves = prec_ourselves; + break; + } #endif #if !USE_SNPRINTF - /* Allocate a temporary buffer of sufficient size for calling - sprintf. */ - { - switch (dp->conversion) - { - - case 'd': case 'i': case 'u': -# if HAVE_LONG_LONG_INT - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT - * 0.30103 /* binary -> decimal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - if (type == TYPE_LONGINT || type == TYPE_ULONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long) * CHAR_BIT - * 0.30103 /* binary -> decimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (sizeof (unsigned int) * CHAR_BIT - * 0.30103 /* binary -> decimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Multiply by 2, as an estimate for FLAG_GROUP. */ - tmp_length = xsum (tmp_length, tmp_length); - /* Add 1, to account for a leading sign. */ - tmp_length = xsum (tmp_length, 1); - break; - - case 'o': -# if HAVE_LONG_LONG_INT - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT - * 0.333334 /* binary -> octal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - if (type == TYPE_LONGINT || type == TYPE_ULONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long) * CHAR_BIT - * 0.333334 /* binary -> octal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (sizeof (unsigned int) * CHAR_BIT - * 0.333334 /* binary -> octal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Add 1, to account for a leading sign. */ - tmp_length = xsum (tmp_length, 1); - break; - - case 'x': case 'X': -# if HAVE_LONG_LONG_INT - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - if (type == TYPE_LONGINT || type == TYPE_ULONGINT) - tmp_length = - (unsigned int) (sizeof (unsigned long) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (sizeof (unsigned int) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Add 2, to account for a leading sign or alternate form. */ - tmp_length = xsum (tmp_length, 2); - break; - - case 'f': case 'F': - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) (LDBL_MAX_EXP - * 0.30103 /* binary -> decimal */ - * 2 /* estimate for FLAG_GROUP */ - ) - + 1 /* turn floor into ceil */ - + 10; /* sign, decimal point etc. */ - else - tmp_length = - (unsigned int) (DBL_MAX_EXP - * 0.30103 /* binary -> decimal */ - * 2 /* estimate for FLAG_GROUP */ - ) - + 1 /* turn floor into ceil */ - + 10; /* sign, decimal point etc. */ - tmp_length = xsum (tmp_length, precision); - break; - - case 'e': case 'E': case 'g': case 'G': - tmp_length = - 12; /* sign, decimal point, exponent etc. */ - tmp_length = xsum (tmp_length, precision); - break; - - case 'a': case 'A': - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) (LDBL_DIG - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else - tmp_length = - (unsigned int) (DBL_DIG - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); - break; - - case 'c': -# if HAVE_WINT_T && !WIDE_CHAR_VERSION - if (type == TYPE_WIDE_CHAR) - tmp_length = MB_CUR_MAX; - else -# endif - tmp_length = 1; - break; - - case 's': -# if HAVE_WCHAR_T - if (type == TYPE_WIDE_STRING) - { -# if WIDE_CHAR_VERSION - /* ISO C says about %ls in fwprintf: - "If the precision is not specified or is greater - than the size of the array, the array shall - contain a null wide character." - So if there is a precision, we must not use - wcslen. */ - const wchar_t *arg = - a.arg[dp->arg_index].a.a_wide_string; - - if (has_precision) - tmp_length = local_wcsnlen (arg, precision); - else - tmp_length = local_wcslen (arg); -# else - /* ISO C says about %ls in fprintf: - "If a precision is specified, no more than that - many bytes are written (including shift - sequences, if any), and the array shall contain - a null wide character if, to equal the - multibyte character sequence length given by - the precision, the function would need to - access a wide character one past the end of the - array." - So if there is a precision, we must not use - wcslen. */ - /* This case has already been handled above. */ - abort (); -# endif - } - else -# endif - { -# if WIDE_CHAR_VERSION - /* ISO C says about %s in fwprintf: - "If the precision is not specified or is greater - than the size of the converted array, the - converted array shall contain a null wide - character." - So if there is a precision, we must not use - strlen. */ - /* This case has already been handled above. */ - abort (); -# else - /* ISO C says about %s in fprintf: - "If the precision is not specified or greater - than the size of the array, the array shall - contain a null character." - So if there is a precision, we must not use - strlen. */ - const char *arg = a.arg[dp->arg_index].a.a_string; - - if (has_precision) - tmp_length = local_strnlen (arg, precision); - else - tmp_length = strlen (arg); -# endif - } - break; - - case 'p': - tmp_length = - (unsigned int) (sizeof (void *) * CHAR_BIT - * 0.25 /* binary -> hexadecimal */ - ) - + 1 /* turn floor into ceil */ - + 2; /* account for leading 0x */ - break; - - default: - abort (); - } - - if (!pad_ourselves) - { -# if ENABLE_UNISTDIO - /* Padding considers the number of characters, therefore - the number of elements after padding may be - > max (tmp_length, width) - but is certainly - <= tmp_length + width. */ - tmp_length = xsum (tmp_length, width); -# else - /* Padding considers the number of elements, - says POSIX. */ - if (tmp_length < width) - tmp_length = width; -# endif - } - - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - } - - if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) - tmp = tmpbuf; - else - { - size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); - - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (TCHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } + /* Allocate a temporary buffer of sufficient size for calling + sprintf. */ + tmp_length = + MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, + flags, width, has_precision, precision, + pad_ourselves); + + if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) + tmp = tmpbuf; + else + { + size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); + + if (size_overflow_p (tmp_memsize)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + tmp = (TCHAR_T *) malloc (tmp_memsize); + if (tmp == NULL) + /* Out of memory. */ + goto out_of_memory; + } #endif - /* Construct the format string for calling snprintf or - sprintf. */ - fbp = buf; - *fbp++ = '%'; + /* Construct the format string for calling snprintf or + sprintf. */ + fbp = buf; + *fbp++ = '%'; #if NEED_PRINTF_FLAG_GROUPING - /* The underlying implementation doesn't support the ' flag. - Produce no grouping characters in this case; this is - acceptable because the grouping is locale dependent. */ + /* The underlying implementation doesn't support the ' flag. + Produce no grouping characters in this case; this is + acceptable because the grouping is locale dependent. */ #else - if (flags & FLAG_GROUP) - *fbp++ = '\''; + if (flags & FLAG_GROUP) + *fbp++ = '\''; #endif - if (flags & FLAG_LEFT) - *fbp++ = '-'; - if (flags & FLAG_SHOWSIGN) - *fbp++ = '+'; - if (flags & FLAG_SPACE) - *fbp++ = ' '; - if (flags & FLAG_ALT) - *fbp++ = '#'; - if (!pad_ourselves) - { - if (flags & FLAG_ZERO) - *fbp++ = '0'; - if (dp->width_start != dp->width_end) - { - size_t n = dp->width_end - dp->width_start; - /* The width specification is known to consist only - of standard ASCII characters. */ - if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) - { - memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); - fbp += n; - } - else - { - const FCHAR_T *mp = dp->width_start; - do - *fbp++ = (unsigned char) *mp++; - while (--n > 0); - } - } - } - if (!prec_ourselves) - { - if (dp->precision_start != dp->precision_end) - { - size_t n = dp->precision_end - dp->precision_start; - /* The precision specification is known to consist only - of standard ASCII characters. */ - if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) - { - memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); - fbp += n; - } - else - { - const FCHAR_T *mp = dp->precision_start; - do - *fbp++ = (unsigned char) *mp++; - while (--n > 0); - } - } - } - - switch (type) - { + if (flags & FLAG_LEFT) + *fbp++ = '-'; + if (flags & FLAG_SHOWSIGN) + *fbp++ = '+'; + if (flags & FLAG_SPACE) + *fbp++ = ' '; + if (flags & FLAG_ALT) + *fbp++ = '#'; + if (!pad_ourselves) + { + if (flags & FLAG_ZERO) + *fbp++ = '0'; + if (dp->width_start != dp->width_end) + { + size_t n = dp->width_end - dp->width_start; + /* The width specification is known to consist only + of standard ASCII characters. */ + if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) + { + memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); + fbp += n; + } + else + { + const FCHAR_T *mp = dp->width_start; + do + *fbp++ = (unsigned char) *mp++; + while (--n > 0); + } + } + } + if (!prec_ourselves) + { + if (dp->precision_start != dp->precision_end) + { + size_t n = dp->precision_end - dp->precision_start; + /* The precision specification is known to consist only + of standard ASCII characters. */ + if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) + { + memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); + fbp += n; + } + else + { + const FCHAR_T *mp = dp->precision_start; + do + *fbp++ = (unsigned char) *mp++; + while (--n > 0); + } + } + } + + switch (type) + { #if HAVE_LONG_LONG_INT - case TYPE_LONGLONGINT: - case TYPE_ULONGLONGINT: + case TYPE_LONGLONGINT: + case TYPE_ULONGLONGINT: # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - *fbp++ = 'I'; - *fbp++ = '6'; - *fbp++ = '4'; - break; + *fbp++ = 'I'; + *fbp++ = '6'; + *fbp++ = '4'; + break; # else - *fbp++ = 'l'; - /*FALLTHROUGH*/ + *fbp++ = 'l'; + /*FALLTHROUGH*/ # endif #endif - case TYPE_LONGINT: - case TYPE_ULONGINT: + case TYPE_LONGINT: + case TYPE_ULONGINT: #if HAVE_WINT_T - case TYPE_WIDE_CHAR: + case TYPE_WIDE_CHAR: #endif #if HAVE_WCHAR_T - case TYPE_WIDE_STRING: + case TYPE_WIDE_STRING: #endif - *fbp++ = 'l'; - break; - case TYPE_LONGDOUBLE: - *fbp++ = 'L'; - break; - default: - break; - } + *fbp++ = 'l'; + break; + case TYPE_LONGDOUBLE: + *fbp++ = 'L'; + break; + default: + break; + } #if NEED_PRINTF_DIRECTIVE_F - if (dp->conversion == 'F') - *fbp = 'f'; - else + if (dp->conversion == 'F') + *fbp = 'f'; + else #endif - *fbp = dp->conversion; + *fbp = dp->conversion; #if USE_SNPRINTF # if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) - fbp[1] = '%'; - fbp[2] = 'n'; - fbp[3] = '\0'; + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0'; # else - /* On glibc2 systems from glibc >= 2.3 - probably also older - ones - we know that snprintf's returns value conforms to - ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. - Therefore we can avoid using %n in this situation. - On glibc2 systems from 2004-10-18 or newer, the use of %n - in format strings in writable memory may crash the program - (if compiled with _FORTIFY_SOURCE=2), so we should avoid it - in this situation. */ - /* On native Win32 systems (such as mingw), we can avoid using - %n because: - - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, - snprintf does not write more than the specified number - of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes - '4', '5', '6' into buf, not '4', '5', '\0'.) - - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf - allows us to recognize the case of an insufficient - buffer size: it returns -1 in this case. - On native Win32 systems (such as mingw) where the OS is - Windows Vista, the use of %n in format strings by default - crashes the program. See - <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and - <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx> - So we should avoid %n in this situation. */ - fbp[1] = '\0'; + /* On glibc2 systems from glibc >= 2.3 - probably also older + ones - we know that snprintf's returns value conforms to + ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. + Therefore we can avoid using %n in this situation. + On glibc2 systems from 2004-10-18 or newer, the use of %n + in format strings in writable memory may crash the program + (if compiled with _FORTIFY_SOURCE=2), so we should avoid it + in this situation. */ + /* On native Win32 systems (such as mingw), we can avoid using + %n because: + - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, + snprintf does not write more than the specified number + of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes + '4', '5', '6' into buf, not '4', '5', '\0'.) + - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf + allows us to recognize the case of an insufficient + buffer size: it returns -1 in this case. + On native Win32 systems (such as mingw) where the OS is + Windows Vista, the use of %n in format strings by default + crashes the program. See + <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and + <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx> + So we should avoid %n in this situation. */ + fbp[1] = '\0'; # endif #else - fbp[1] = '\0'; + fbp[1] = '\0'; #endif - /* Construct the arguments for calling snprintf or sprintf. */ - prefix_count = 0; - if (!pad_ourselves && dp->width_arg_index != ARG_NONE) - { - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; - } - if (!prec_ourselves && dp->precision_arg_index != ARG_NONE) - { - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; - } + /* Construct the arguments for calling snprintf or sprintf. */ + prefix_count = 0; + if (!pad_ourselves && dp->width_arg_index != ARG_NONE) + { + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; + } + if (!prec_ourselves && dp->precision_arg_index != ARG_NONE) + { + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; + } #if USE_SNPRINTF - /* The SNPRINTF result is appended after result[0..length]. - The latter is an array of DCHAR_T; SNPRINTF appends an - array of TCHAR_T to it. This is possible because - sizeof (TCHAR_T) divides sizeof (DCHAR_T) and - alignof (TCHAR_T) <= alignof (DCHAR_T). */ + /* The SNPRINTF result is appended after result[0..length]. + The latter is an array of DCHAR_T; SNPRINTF appends an + array of TCHAR_T to it. This is possible because + sizeof (TCHAR_T) divides sizeof (DCHAR_T) and + alignof (TCHAR_T) <= alignof (DCHAR_T). */ # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) - /* Ensure that maxlen below will be >= 2. Needed on BeOS, - where an snprintf() with maxlen==1 acts like sprintf(). */ - ENSURE_ALLOCATION (xsum (length, - (2 + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR)); - /* Prepare checking whether snprintf returns the count - via %n. */ - *(TCHAR_T *) (result + length) = '\0'; + /* Ensure that maxlen below will be >= 2. Needed on BeOS, + where an snprintf() with maxlen==1 acts like sprintf(). */ + ENSURE_ALLOCATION (xsum (length, + (2 + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR)); + /* Prepare checking whether snprintf returns the count + via %n. */ + *(TCHAR_T *) (result + length) = '\0'; #endif - for (;;) - { - int count = -1; + for (;;) + { + int count = -1; #if USE_SNPRINTF - int retcount = 0; - size_t maxlen = allocated - length; - /* SNPRINTF can fail if its second argument is - > INT_MAX. */ - if (maxlen > INT_MAX / TCHARS_PER_DCHAR) - maxlen = INT_MAX / TCHARS_PER_DCHAR; - maxlen = maxlen * TCHARS_PER_DCHAR; + int retcount = 0; + size_t maxlen = allocated - length; + /* SNPRINTF can fail if its second argument is + > INT_MAX. */ + if (maxlen > INT_MAX / TCHARS_PER_DCHAR) + maxlen = INT_MAX / TCHARS_PER_DCHAR; + maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ - switch (prefix_count) \ - { \ - case 0: \ - retcount = SNPRINTF ((TCHAR_T *) (result + length), \ - maxlen, buf, \ - arg, &count); \ - break; \ - case 1: \ - retcount = SNPRINTF ((TCHAR_T *) (result + length), \ - maxlen, buf, \ - prefixes[0], arg, &count); \ - break; \ - case 2: \ - retcount = SNPRINTF ((TCHAR_T *) (result + length), \ - maxlen, buf, \ - prefixes[0], prefixes[1], arg, \ - &count); \ - break; \ - default: \ - abort (); \ - } + switch (prefix_count) \ + { \ + case 0: \ + retcount = SNPRINTF ((TCHAR_T *) (result + length), \ + maxlen, buf, \ + arg, &count); \ + break; \ + case 1: \ + retcount = SNPRINTF ((TCHAR_T *) (result + length), \ + maxlen, buf, \ + prefixes[0], arg, &count); \ + break; \ + case 2: \ + retcount = SNPRINTF ((TCHAR_T *) (result + length), \ + maxlen, buf, \ + prefixes[0], prefixes[1], arg, \ + &count); \ + break; \ + default: \ + abort (); \ + } #else # define SNPRINTF_BUF(arg) \ - switch (prefix_count) \ - { \ - case 0: \ - count = sprintf (tmp, buf, arg); \ - break; \ - case 1: \ - count = sprintf (tmp, buf, prefixes[0], arg); \ - break; \ - case 2: \ - count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ - arg); \ - break; \ - default: \ - abort (); \ - } + switch (prefix_count) \ + { \ + case 0: \ + count = sprintf (tmp, buf, arg); \ + break; \ + case 1: \ + count = sprintf (tmp, buf, prefixes[0], arg); \ + break; \ + case 2: \ + count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ + arg); \ + break; \ + default: \ + abort (); \ + } #endif - switch (type) - { - case TYPE_SCHAR: - { - int arg = a.arg[dp->arg_index].a.a_schar; - SNPRINTF_BUF (arg); - } - break; - case TYPE_UCHAR: - { - unsigned int arg = a.arg[dp->arg_index].a.a_uchar; - SNPRINTF_BUF (arg); - } - break; - case TYPE_SHORT: - { - int arg = a.arg[dp->arg_index].a.a_short; - SNPRINTF_BUF (arg); - } - break; - case TYPE_USHORT: - { - unsigned int arg = a.arg[dp->arg_index].a.a_ushort; - SNPRINTF_BUF (arg); - } - break; - case TYPE_INT: - { - int arg = a.arg[dp->arg_index].a.a_int; - SNPRINTF_BUF (arg); - } - break; - case TYPE_UINT: - { - unsigned int arg = a.arg[dp->arg_index].a.a_uint; - SNPRINTF_BUF (arg); - } - break; - case TYPE_LONGINT: - { - long int arg = a.arg[dp->arg_index].a.a_longint; - SNPRINTF_BUF (arg); - } - break; - case TYPE_ULONGINT: - { - unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; - SNPRINTF_BUF (arg); - } - break; + errno = 0; + switch (type) + { + case TYPE_SCHAR: + { + int arg = a.arg[dp->arg_index].a.a_schar; + SNPRINTF_BUF (arg); + } + break; + case TYPE_UCHAR: + { + unsigned int arg = a.arg[dp->arg_index].a.a_uchar; + SNPRINTF_BUF (arg); + } + break; + case TYPE_SHORT: + { + int arg = a.arg[dp->arg_index].a.a_short; + SNPRINTF_BUF (arg); + } + break; + case TYPE_USHORT: + { + unsigned int arg = a.arg[dp->arg_index].a.a_ushort; + SNPRINTF_BUF (arg); + } + break; + case TYPE_INT: + { + int arg = a.arg[dp->arg_index].a.a_int; + SNPRINTF_BUF (arg); + } + break; + case TYPE_UINT: + { + unsigned int arg = a.arg[dp->arg_index].a.a_uint; + SNPRINTF_BUF (arg); + } + break; + case TYPE_LONGINT: + { + long int arg = a.arg[dp->arg_index].a.a_longint; + SNPRINTF_BUF (arg); + } + break; + case TYPE_ULONGINT: + { + unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; + SNPRINTF_BUF (arg); + } + break; #if HAVE_LONG_LONG_INT - case TYPE_LONGLONGINT: - { - long long int arg = a.arg[dp->arg_index].a.a_longlongint; - SNPRINTF_BUF (arg); - } - break; - case TYPE_ULONGLONGINT: - { - unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; - SNPRINTF_BUF (arg); - } - break; + case TYPE_LONGLONGINT: + { + long long int arg = a.arg[dp->arg_index].a.a_longlongint; + SNPRINTF_BUF (arg); + } + break; + case TYPE_ULONGLONGINT: + { + unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; + SNPRINTF_BUF (arg); + } + break; #endif - case TYPE_DOUBLE: - { - double arg = a.arg[dp->arg_index].a.a_double; - SNPRINTF_BUF (arg); - } - break; - case TYPE_LONGDOUBLE: - { - long double arg = a.arg[dp->arg_index].a.a_longdouble; - SNPRINTF_BUF (arg); - } - break; - case TYPE_CHAR: - { - int arg = a.arg[dp->arg_index].a.a_char; - SNPRINTF_BUF (arg); - } - break; + case TYPE_DOUBLE: + { + double arg = a.arg[dp->arg_index].a.a_double; + SNPRINTF_BUF (arg); + } + break; + case TYPE_LONGDOUBLE: + { + long double arg = a.arg[dp->arg_index].a.a_longdouble; + SNPRINTF_BUF (arg); + } + break; + case TYPE_CHAR: + { + int arg = a.arg[dp->arg_index].a.a_char; + SNPRINTF_BUF (arg); + } + break; #if HAVE_WINT_T - case TYPE_WIDE_CHAR: - { - wint_t arg = a.arg[dp->arg_index].a.a_wide_char; - SNPRINTF_BUF (arg); - } - break; + case TYPE_WIDE_CHAR: + { + wint_t arg = a.arg[dp->arg_index].a.a_wide_char; + SNPRINTF_BUF (arg); + } + break; #endif - case TYPE_STRING: - { - const char *arg = a.arg[dp->arg_index].a.a_string; - SNPRINTF_BUF (arg); - } - break; + case TYPE_STRING: + { + const char *arg = a.arg[dp->arg_index].a.a_string; + SNPRINTF_BUF (arg); + } + break; #if HAVE_WCHAR_T - case TYPE_WIDE_STRING: - { - const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; - SNPRINTF_BUF (arg); - } - break; + case TYPE_WIDE_STRING: + { + const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; + SNPRINTF_BUF (arg); + } + break; #endif - case TYPE_POINTER: - { - void *arg = a.arg[dp->arg_index].a.a_pointer; - SNPRINTF_BUF (arg); - } - break; - default: - abort (); - } + case TYPE_POINTER: + { + void *arg = a.arg[dp->arg_index].a.a_pointer; + SNPRINTF_BUF (arg); + } + break; + default: + abort (); + } #if USE_SNPRINTF - /* Portability: Not all implementations of snprintf() - are ISO C 99 compliant. Determine the number of - bytes that snprintf() has produced or would have - produced. */ - if (count >= 0) - { - /* Verify that snprintf() has NUL-terminated its - result. */ - if (count < maxlen - && ((TCHAR_T *) (result + length)) [count] != '\0') - abort (); - /* Portability hack. */ - if (retcount > count) - count = retcount; - } - else - { - /* snprintf() doesn't understand the '%n' - directive. */ - if (fbp[1] != '\0') - { - /* Don't use the '%n' directive; instead, look - at the snprintf() return value. */ - fbp[1] = '\0'; - continue; - } - else - { - /* Look at the snprintf() return value. */ - if (retcount < 0) - { - /* HP-UX 10.20 snprintf() is doubly deficient: - It doesn't understand the '%n' directive, - *and* it returns -1 (rather than the length - that would have been required) when the - buffer is too small. */ - size_t bigger_need = - xsum (xtimes (allocated, 2), 12); - ENSURE_ALLOCATION (bigger_need); - continue; - } - else - count = retcount; - } - } + /* Portability: Not all implementations of snprintf() + are ISO C 99 compliant. Determine the number of + bytes that snprintf() has produced or would have + produced. */ + if (count >= 0) + { + /* Verify that snprintf() has NUL-terminated its + result. */ + if (count < maxlen + && ((TCHAR_T *) (result + length)) [count] != '\0') + abort (); + /* Portability hack. */ + if (retcount > count) + count = retcount; + } + else + { + /* snprintf() doesn't understand the '%n' + directive. */ + if (fbp[1] != '\0') + { + /* Don't use the '%n' directive; instead, look + at the snprintf() return value. */ + fbp[1] = '\0'; + continue; + } + else + { + /* Look at the snprintf() return value. */ + if (retcount < 0) + { +# if !HAVE_SNPRINTF_RETVAL_C99 + /* HP-UX 10.20 snprintf() is doubly deficient: + It doesn't understand the '%n' directive, + *and* it returns -1 (rather than the length + that would have been required) when the + buffer is too small. + But a failure at this point can also come + from other reasons than a too small buffer, + such as an invalid wide string argument to + the %ls directive, or possibly an invalid + floating-point argument. */ + size_t tmp_length = + MAX_ROOM_NEEDED (&a, dp->arg_index, + dp->conversion, type, flags, + width, has_precision, + precision, pad_ourselves); + + if (maxlen < tmp_length) + { + /* Make more room. But try to do through + this reallocation only once. */ + size_t bigger_need = + xsum (length, + xsum (tmp_length, + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR); + /* And always grow proportionally. + (There may be several arguments, each + needing a little more room than the + previous one.) */ + size_t bigger_need2 = + xsum (xtimes (allocated, 2), 12); + if (bigger_need < bigger_need2) + bigger_need = bigger_need2; + ENSURE_ALLOCATION (bigger_need); + continue; + } +# endif + } + else + count = retcount; + } + } #endif - /* Attempt to handle failure. */ - if (count < 0) - { - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = EINVAL; - return NULL; - } + /* Attempt to handle failure. */ + if (count < 0) + { + /* SNPRINTF or sprintf failed. Save and use the errno + that it has set, if any. */ + int saved_errno = errno; + + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = + (saved_errno != 0 + ? saved_errno + : (dp->conversion == 'c' || dp->conversion == 's' + ? EILSEQ + : EINVAL)); + return NULL; + } #if USE_SNPRINTF - /* Handle overflow of the allocated buffer. - If such an overflow occurs, a C99 compliant snprintf() - returns a count >= maxlen. However, a non-compliant - snprintf() function returns only count = maxlen - 1. To - cover both cases, test whether count >= maxlen - 1. */ - if ((unsigned int) count + 1 >= maxlen) - { - /* If maxlen already has attained its allowed maximum, - allocating more memory will not increase maxlen. - Instead of looping, bail out. */ - if (maxlen == INT_MAX / TCHARS_PER_DCHAR) - goto overflow; - else - { - /* Need at least (count + 1) * sizeof (TCHAR_T) - bytes. (The +1 is for the trailing NUL.) - But ask for (count + 2) * sizeof (TCHAR_T) - bytes, so that in the next round, we likely get - maxlen > (unsigned int) count + 1 - and so we don't get here again. - And allocate proportionally, to avoid looping - eternally if snprintf() reports a too small - count. */ - size_t n = - xmax (xsum (length, - ((unsigned int) count + 2 - + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR), - xtimes (allocated, 2)); - - ENSURE_ALLOCATION (n); - continue; - } - } + /* Handle overflow of the allocated buffer. + If such an overflow occurs, a C99 compliant snprintf() + returns a count >= maxlen. However, a non-compliant + snprintf() function returns only count = maxlen - 1. To + cover both cases, test whether count >= maxlen - 1. */ + if ((unsigned int) count + 1 >= maxlen) + { + /* If maxlen already has attained its allowed maximum, + allocating more memory will not increase maxlen. + Instead of looping, bail out. */ + if (maxlen == INT_MAX / TCHARS_PER_DCHAR) + goto overflow; + else + { + /* Need at least (count + 1) * sizeof (TCHAR_T) + bytes. (The +1 is for the trailing NUL.) + But ask for (count + 2) * sizeof (TCHAR_T) + bytes, so that in the next round, we likely get + maxlen > (unsigned int) count + 1 + and so we don't get here again. + And allocate proportionally, to avoid looping + eternally if snprintf() reports a too small + count. */ + size_t n = + xmax (xsum (length, + ((unsigned int) count + 2 + + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR), + xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); + continue; + } + } #endif #if NEED_PRINTF_UNBOUNDED_PRECISION - if (prec_ourselves) - { - /* Handle the precision. */ - TCHAR_T *prec_ptr = + if (prec_ourselves) + { + /* Handle the precision. */ + TCHAR_T *prec_ptr = # if USE_SNPRINTF - (TCHAR_T *) (result + length); + (TCHAR_T *) (result + length); # else - tmp; + tmp; # endif - size_t prefix_count; - size_t move; - - prefix_count = 0; - /* Put the additional zeroes after the sign. */ - if (count >= 1 - && (*prec_ptr == '-' || *prec_ptr == '+' - || *prec_ptr == ' ')) - prefix_count = 1; - /* Put the additional zeroes after the 0x prefix if - (flags & FLAG_ALT) || (dp->conversion == 'p'). */ - else if (count >= 2 - && prec_ptr[0] == '0' - && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) - prefix_count = 2; - - move = count - prefix_count; - if (precision > move) - { - /* Insert zeroes. */ - size_t insert = precision - move; - TCHAR_T *prec_end; + size_t prefix_count; + size_t move; + + prefix_count = 0; + /* Put the additional zeroes after the sign. */ + if (count >= 1 + && (*prec_ptr == '-' || *prec_ptr == '+' + || *prec_ptr == ' ')) + prefix_count = 1; + /* Put the additional zeroes after the 0x prefix if + (flags & FLAG_ALT) || (dp->conversion == 'p'). */ + else if (count >= 2 + && prec_ptr[0] == '0' + && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) + prefix_count = 2; + + move = count - prefix_count; + if (precision > move) + { + /* Insert zeroes. */ + size_t insert = precision - move; + TCHAR_T *prec_end; # if USE_SNPRINTF - size_t n = - xsum (length, - (count + insert + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR); - length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; - ENSURE_ALLOCATION (n); - length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; - prec_ptr = (TCHAR_T *) (result + length); + size_t n = + xsum (length, + (count + insert + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR); + length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; + ENSURE_ALLOCATION (n); + length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; + prec_ptr = (TCHAR_T *) (result + length); # endif - prec_end = prec_ptr + count; - prec_ptr += prefix_count; + prec_end = prec_ptr + count; + prec_ptr += prefix_count; - while (prec_end > prec_ptr) - { - prec_end--; - prec_end[insert] = prec_end[0]; - } + while (prec_end > prec_ptr) + { + prec_end--; + prec_end[insert] = prec_end[0]; + } - prec_end += insert; - do - *--prec_end = '0'; - while (prec_end > prec_ptr); + prec_end += insert; + do + *--prec_end = '0'; + while (prec_end > prec_ptr); - count += insert; - } - } + count += insert; + } + } #endif #if !USE_SNPRINTF - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); #endif #if !DCHAR_IS_TCHAR - /* Convert from TCHAR_T[] to DCHAR_T[]. */ - if (dp->conversion == 'c' || dp->conversion == 's') - { - /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING - TYPE_WIDE_STRING. - The result string is not certainly ASCII. */ - const TCHAR_T *tmpsrc; - DCHAR_T *tmpdst; - size_t tmpdst_len; - /* This code assumes that TCHAR_T is 'char'. */ - typedef int TCHAR_T_verify - [2 * (sizeof (TCHAR_T) == 1) - 1]; + /* Convert from TCHAR_T[] to DCHAR_T[]. */ + if (dp->conversion == 'c' || dp->conversion == 's') + { + /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING + TYPE_WIDE_STRING. + The result string is not certainly ASCII. */ + const TCHAR_T *tmpsrc; + DCHAR_T *tmpdst; + size_t tmpdst_len; + /* This code assumes that TCHAR_T is 'char'. */ + typedef int TCHAR_T_verify + [2 * (sizeof (TCHAR_T) == 1) - 1]; # if USE_SNPRINTF - tmpsrc = (TCHAR_T *) (result + length); + tmpsrc = (TCHAR_T *) (result + length); # else - tmpsrc = tmp; + tmpsrc = tmp; # endif - tmpdst = - DCHAR_CONV_FROM_ENCODING (locale_charset (), - iconveh_question_mark, - tmpsrc, count, - NULL, - NULL, &tmpdst_len); - if (tmpdst == NULL) - { - int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); - errno = saved_errno; - return NULL; - } - ENSURE_ALLOCATION (xsum (length, tmpdst_len)); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - count = tmpdst_len; - } - else - { - /* The result string is ASCII. - Simple 1:1 conversion. */ + tmpdst = + DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + tmpsrc, count, + NULL, + NULL, &tmpdst_len); + if (tmpdst == NULL) + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + ENSURE_ALLOCATION (xsum (length, tmpdst_len)); + DCHAR_CPY (result + length, tmpdst, tmpdst_len); + free (tmpdst); + count = tmpdst_len; + } + else + { + /* The result string is ASCII. + Simple 1:1 conversion. */ # if USE_SNPRINTF - /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a - no-op conversion, in-place on the array starting - at (result + length). */ - if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) + /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a + no-op conversion, in-place on the array starting + at (result + length). */ + if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) # endif - { - const TCHAR_T *tmpsrc; - DCHAR_T *tmpdst; - size_t n; + { + const TCHAR_T *tmpsrc; + DCHAR_T *tmpdst; + size_t n; # if USE_SNPRINTF - if (result == resultbuf) - { - tmpsrc = (TCHAR_T *) (result + length); - /* ENSURE_ALLOCATION will not move tmpsrc - (because it's part of resultbuf). */ - ENSURE_ALLOCATION (xsum (length, count)); - } - else - { - /* ENSURE_ALLOCATION will move the array - (because it uses realloc(). */ - ENSURE_ALLOCATION (xsum (length, count)); - tmpsrc = (TCHAR_T *) (result + length); - } + if (result == resultbuf) + { + tmpsrc = (TCHAR_T *) (result + length); + /* ENSURE_ALLOCATION will not move tmpsrc + (because it's part of resultbuf). */ + ENSURE_ALLOCATION (xsum (length, count)); + } + else + { + /* ENSURE_ALLOCATION will move the array + (because it uses realloc(). */ + ENSURE_ALLOCATION (xsum (length, count)); + tmpsrc = (TCHAR_T *) (result + length); + } # else - tmpsrc = tmp; - ENSURE_ALLOCATION (xsum (length, count)); + tmpsrc = tmp; + ENSURE_ALLOCATION (xsum (length, count)); # endif - tmpdst = result + length; - /* Copy backwards, because of overlapping. */ - tmpsrc += count; - tmpdst += count; - for (n = count; n > 0; n--) - *--tmpdst = (unsigned char) *--tmpsrc; - } - } + tmpdst = result + length; + /* Copy backwards, because of overlapping. */ + tmpsrc += count; + tmpdst += count; + for (n = count; n > 0; n--) + *--tmpdst = (unsigned char) *--tmpsrc; + } + } #endif #if DCHAR_IS_TCHAR && !USE_SNPRINTF - /* Make room for the result. */ - if (count > allocated - length) - { - /* Need at least count elements. But allocate - proportionally. */ - size_t n = - xmax (xsum (length, count), xtimes (allocated, 2)); - - ENSURE_ALLOCATION (n); - } + /* Make room for the result. */ + if (count > allocated - length) + { + /* Need at least count elements. But allocate + proportionally. */ + size_t n = + xmax (xsum (length, count), xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); + } #endif - /* Here count <= allocated - length. */ + /* Here count <= allocated - length. */ - /* Perform padding. */ + /* Perform padding. */ #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION - if (pad_ourselves && has_width) - { - size_t w; + if (pad_ourselves && has_width) + { + size_t w; # if ENABLE_UNISTDIO - /* Outside POSIX, it's preferrable to compare the width - against the number of _characters_ of the converted - value. */ - w = DCHAR_MBSNLEN (result + length, count); + /* Outside POSIX, it's preferrable to compare the width + against the number of _characters_ of the converted + value. */ + w = DCHAR_MBSNLEN (result + length, count); # else - /* The width is compared against the number of _bytes_ - of the converted value, says POSIX. */ - w = count; + /* The width is compared against the number of _bytes_ + of the converted value, says POSIX. */ + w = count; # endif - if (w < width) - { - size_t pad = width - w; - - /* Make room for the result. */ - if (xsum (count, pad) > allocated - length) - { - /* Need at least count + pad elements. But - allocate proportionally. */ - size_t n = - xmax (xsum3 (length, count, pad), - xtimes (allocated, 2)); + if (w < width) + { + size_t pad = width - w; + + /* Make room for the result. */ + if (xsum (count, pad) > allocated - length) + { + /* Need at least count + pad elements. But + allocate proportionally. */ + size_t n = + xmax (xsum3 (length, count, pad), + xtimes (allocated, 2)); # if USE_SNPRINTF - length += count; - ENSURE_ALLOCATION (n); - length -= count; + length += count; + ENSURE_ALLOCATION (n); + length -= count; # else - ENSURE_ALLOCATION (n); + ENSURE_ALLOCATION (n); # endif - } - /* Here count + pad <= allocated - length. */ + } + /* Here count + pad <= allocated - length. */ - { + { # if !DCHAR_IS_TCHAR || USE_SNPRINTF - DCHAR_T * const rp = result + length; + DCHAR_T * const rp = result + length; # else - DCHAR_T * const rp = tmp; + DCHAR_T * const rp = tmp; # endif - DCHAR_T *p = rp + count; - DCHAR_T *end = p + pad; - DCHAR_T *pad_ptr; + DCHAR_T *p = rp + count; + DCHAR_T *end = p + pad; + DCHAR_T *pad_ptr; # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO - if (dp->conversion == 'c' - || dp->conversion == 's') - /* No zero-padding for string directives. */ - pad_ptr = NULL; - else + if (dp->conversion == 'c' + || dp->conversion == 's') + /* No zero-padding for string directives. */ + pad_ptr = NULL; + else # endif - { - pad_ptr = (*rp == '-' ? rp + 1 : rp); - /* No zero-padding of "inf" and "nan". */ - if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') - || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) - pad_ptr = NULL; - } - /* The generated string now extends from rp to p, - with the zero padding insertion point being at - pad_ptr. */ - - count = count + pad; /* = end - rp */ - - if (flags & FLAG_LEFT) - { - /* Pad with spaces on the right. */ - for (; pad > 0; pad--) - *p++ = ' '; - } - else if ((flags & FLAG_ZERO) && pad_ptr != NULL) - { - /* Pad with zeroes. */ - DCHAR_T *q = end; - - while (p > pad_ptr) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = '0'; - } - else - { - /* Pad with spaces on the left. */ - DCHAR_T *q = end; - - while (p > rp) - *--q = *--p; - for (; pad > 0; pad--) - *p++ = ' '; - } - } - } - } + { + pad_ptr = (*rp == '-' ? rp + 1 : rp); + /* No zero-padding of "inf" and "nan". */ + if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') + || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) + pad_ptr = NULL; + } + /* The generated string now extends from rp to p, + with the zero padding insertion point being at + pad_ptr. */ + + count = count + pad; /* = end - rp */ + + if (flags & FLAG_LEFT) + { + /* Pad with spaces on the right. */ + for (; pad > 0; pad--) + *p++ = ' '; + } + else if ((flags & FLAG_ZERO) && pad_ptr != NULL) + { + /* Pad with zeroes. */ + DCHAR_T *q = end; + + while (p > pad_ptr) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = '0'; + } + else + { + /* Pad with spaces on the left. */ + DCHAR_T *q = end; + + while (p > rp) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = ' '; + } + } + } + } #endif - /* Here still count <= allocated - length. */ + /* Here still count <= allocated - length. */ #if !DCHAR_IS_TCHAR || USE_SNPRINTF - /* The snprintf() result did fit. */ + /* The snprintf() result did fit. */ #else - /* Append the sprintf() result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + /* Append the sprintf() result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); #endif #if !USE_SNPRINTF - if (tmp != tmpbuf) - free (tmp); + if (tmp != tmpbuf) + free (tmp); #endif #if NEED_PRINTF_DIRECTIVE_F - if (dp->conversion == 'F') - { - /* Convert the %f result to upper case for %F. */ - DCHAR_T *rp = result + length; - size_t rc; - for (rc = count; rc > 0; rc--, rp++) - if (*rp >= 'a' && *rp <= 'z') - *rp = *rp - 'a' + 'A'; - } + if (dp->conversion == 'F') + { + /* Convert the %f result to upper case for %F. */ + DCHAR_T *rp = result + length; + size_t rc; + for (rc = count; rc > 0; rc--, rp++) + if (*rp >= 'a' && *rp <= 'z') + *rp = *rp - 'a' + 'A'; + } #endif - length += count; - break; - } - } - } + length += count; + break; + } + } + } } /* Add the final NUL. */ @@ -5432,12 +5508,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (result != resultbuf && length + 1 < allocated) { - /* Shrink the allocated memory if possible. */ - DCHAR_T *memory; + /* Shrink the allocated memory if possible. */ + DCHAR_T *memory; - memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); - if (memory != NULL) - result = memory; + memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); + if (memory != NULL) + result = memory; } if (buf_malloced != NULL) @@ -5473,6 +5549,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } +#undef MAX_ROOM_NEEDED #undef TCHARS_PER_DCHAR #undef SNPRINTF #undef USE_SNPRINTF diff --git a/lib/verify.h b/lib/verify.h index e82fa02..7773c79 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -110,8 +110,8 @@ #if 4 <= __GNUC__ # define verify(R) \ - extern int (* verify_function__ (void)) \ - [__builtin_constant_p (R) && (R) ? 1 : -1] + extern int (* verify_function__ (void)) \ + [__builtin_constant_p (R) && (R) ? 1 : -1] #endif * In C++, any struct definition inside sizeof is invalid. diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 1f1f130..3e3a0c3 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -30,9 +30,9 @@ @PRAGMA_SYSTEM_HEADER@ #endif -#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H +#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H /* Special invocation convention: - - Inside uClibc header files. + - Inside glibc and uClibc header files. - On HP-UX 11.00 we have a sequence of nested includes <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> @@ -55,10 +55,13 @@ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> + included before <wchar.h>. + But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +#endif /* Include the original <wchar.h> if it exists. Some builds of uClibc lack it. */ @@ -72,19 +75,23 @@ #ifndef _GL_WCHAR_H #define _GL_WCHAR_H -/* The definition of GL_LINK_WARNING is copied here. */ +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -#ifdef __cplusplus -extern "C" { -#endif +/* The definition of _GL_ARG_NONNULL is copied here. */ +/* The definition of _GL_WARN_ON_USE is copied here. */ -/* Define wint_t. (Also done in wctype.in.h.) */ + +/* Define wint_t and WEOF. (Also done in wctype.in.h.) */ #if !@HAVE_WINT_T@ && !defined wint_t # define wint_t int # ifndef WEOF # define WEOF -1 # endif +#else +# ifndef WEOF +# define WEOF ((wint_t) -1) +# endif #endif @@ -102,209 +109,320 @@ typedef int rpl_mbstate_t; /* Convert a single-byte character to a wide character. */ #if @GNULIB_BTOWC@ # if @REPLACE_BTOWC@ -# undef btowc -# define btowc rpl_btowc -# endif -# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@ -extern wint_t btowc (int c); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef btowc +# define btowc rpl_btowc +# endif +_GL_FUNCDECL_RPL (btowc, wint_t, (int c)); +_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); +# else +# if !@HAVE_BTOWC@ +_GL_FUNCDECL_SYS (btowc, wint_t, (int c)); +# endif +_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); # endif +_GL_CXXALIASWARN (btowc); #elif defined GNULIB_POSIXCHECK # undef btowc -# define btowc(c) \ - (GL_LINK_WARNING ("btowc is unportable - " \ - "use gnulib module btowc for portability"), \ - btowc (c)) +# if HAVE_RAW_DECL_BTOWC +_GL_WARN_ON_USE (btowc, "btowc is unportable - " + "use gnulib module btowc for portability"); +# endif #endif /* Convert a wide character to a single-byte character. */ #if @GNULIB_WCTOB@ # if @REPLACE_WCTOB@ -# undef wctob -# define wctob rpl_wctob -# endif -# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wctob +# define wctob rpl_wctob +# endif +_GL_FUNCDECL_RPL (wctob, int, (wint_t wc)); +_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); +# else +# if !defined wctob && !@HAVE_DECL_WCTOB@ /* wctob is provided by gnulib, or wctob exists but is not declared. */ -extern int wctob (wint_t wc); +_GL_FUNCDECL_SYS (wctob, int, (wint_t wc)); +# endif +_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); # endif +_GL_CXXALIASWARN (wctob); #elif defined GNULIB_POSIXCHECK # undef wctob -# define wctob(w) \ - (GL_LINK_WARNING ("wctob is unportable - " \ - "use gnulib module wctob for portability"), \ - wctob (w)) +# if HAVE_RAW_DECL_WCTOB +_GL_WARN_ON_USE (wctob, "wctob is unportable - " + "use gnulib module wctob for portability"); +# endif #endif /* Test whether *PS is in the initial state. */ #if @GNULIB_MBSINIT@ # if @REPLACE_MBSINIT@ -# undef mbsinit -# define mbsinit rpl_mbsinit -# endif -# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@ -extern int mbsinit (const mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbsinit +# define mbsinit rpl_mbsinit +# endif +_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); +_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); +# else +# if !@HAVE_MBSINIT@ +_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); +# endif +_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); # endif +_GL_CXXALIASWARN (mbsinit); #elif defined GNULIB_POSIXCHECK # undef mbsinit -# define mbsinit(p) \ - (GL_LINK_WARNING ("mbsinit is unportable - " \ - "use gnulib module mbsinit for portability"), \ - mbsinit (p)) +# if HAVE_RAW_DECL_MBSINIT +_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " + "use gnulib module mbsinit for portability"); +# endif #endif /* Convert a multibyte character to a wide character. */ #if @GNULIB_MBRTOWC@ # if @REPLACE_MBRTOWC@ -# undef mbrtowc -# define mbrtowc rpl_mbrtowc -# endif -# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@ -extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbrtowc +# define mbrtowc rpl_mbrtowc +# endif +_GL_FUNCDECL_RPL (mbrtowc, size_t, + (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); +_GL_CXXALIAS_RPL (mbrtowc, size_t, + (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); +# else +# if !@HAVE_MBRTOWC@ +_GL_FUNCDECL_SYS (mbrtowc, size_t, + (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); +# endif +_GL_CXXALIAS_SYS (mbrtowc, size_t, + (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); # endif +_GL_CXXALIASWARN (mbrtowc); #elif defined GNULIB_POSIXCHECK # undef mbrtowc -# define mbrtowc(w,s,n,p) \ - (GL_LINK_WARNING ("mbrtowc is unportable - " \ - "use gnulib module mbrtowc for portability"), \ - mbrtowc (w, s, n, p)) +# if HAVE_RAW_DECL_MBRTOWC +_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " + "use gnulib module mbrtowc for portability"); +# endif #endif /* Recognize a multibyte character. */ #if @GNULIB_MBRLEN@ # if @REPLACE_MBRLEN@ -# undef mbrlen -# define mbrlen rpl_mbrlen -# endif -# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@ -extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbrlen +# define mbrlen rpl_mbrlen +# endif +_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); +_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); +# else +# if !@HAVE_MBRLEN@ +_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); +# endif +_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); # endif +_GL_CXXALIASWARN (mbrlen); #elif defined GNULIB_POSIXCHECK # undef mbrlen -# define mbrlen(s,n,p) \ - (GL_LINK_WARNING ("mbrlen is unportable - " \ - "use gnulib module mbrlen for portability"), \ - mbrlen (s, n, p)) +# if HAVE_RAW_DECL_MBRLEN +_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " + "use gnulib module mbrlen for portability"); +# endif #endif /* Convert a string to a wide string. */ #if @GNULIB_MBSRTOWCS@ # if @REPLACE_MBSRTOWCS@ -# undef mbsrtowcs -# define mbsrtowcs rpl_mbsrtowcs -# endif -# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@ -extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbsrtowcs +# define mbsrtowcs rpl_mbsrtowcs +# endif +_GL_FUNCDECL_RPL (mbsrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (mbsrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t len, + mbstate_t *ps)); +# else +# if !@HAVE_MBSRTOWCS@ +_GL_FUNCDECL_SYS (mbsrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbsrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t len, + mbstate_t *ps)); # endif +_GL_CXXALIASWARN (mbsrtowcs); #elif defined GNULIB_POSIXCHECK # undef mbsrtowcs -# define mbsrtowcs(d,s,l,p) \ - (GL_LINK_WARNING ("mbsrtowcs is unportable - " \ - "use gnulib module mbsrtowcs for portability"), \ - mbsrtowcs (d, s, l, p)) +# if HAVE_RAW_DECL_MBSRTOWCS +_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " + "use gnulib module mbsrtowcs for portability"); +# endif #endif /* Convert a string to a wide string. */ #if @GNULIB_MBSNRTOWCS@ # if @REPLACE_MBSNRTOWCS@ -# undef mbsnrtowcs -# define mbsnrtowcs rpl_mbsnrtowcs -# endif -# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@ -extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbsnrtowcs +# define mbsnrtowcs rpl_mbsnrtowcs +# endif +_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps)); +# else +# if !@HAVE_MBSNRTOWCS@ +_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, + (wchar_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps)); # endif +_GL_CXXALIASWARN (mbsnrtowcs); #elif defined GNULIB_POSIXCHECK # undef mbsnrtowcs -# define mbsnrtowcs(d,s,n,l,p) \ - (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \ - "use gnulib module mbsnrtowcs for portability"), \ - mbsnrtowcs (d, s, n, l, p)) +# if HAVE_RAW_DECL_MBSNRTOWCS +_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " + "use gnulib module mbsnrtowcs for portability"); +# endif #endif /* Convert a wide character to a multibyte character. */ #if @GNULIB_WCRTOMB@ # if @REPLACE_WCRTOMB@ -# undef wcrtomb -# define wcrtomb rpl_wcrtomb -# endif -# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@ -extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcrtomb +# define wcrtomb rpl_wcrtomb +# endif +_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); +_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); +# else +# if !@HAVE_WCRTOMB@ +_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); +# endif +_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); # endif +_GL_CXXALIASWARN (wcrtomb); #elif defined GNULIB_POSIXCHECK # undef wcrtomb -# define wcrtomb(s,w,p) \ - (GL_LINK_WARNING ("wcrtomb is unportable - " \ - "use gnulib module wcrtomb for portability"), \ - wcrtomb (s, w, p)) +# if HAVE_RAW_DECL_WCRTOMB +_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " + "use gnulib module wcrtomb for portability"); +# endif #endif /* Convert a wide string to a string. */ #if @GNULIB_WCSRTOMBS@ # if @REPLACE_WCSRTOMBS@ -# undef wcsrtombs -# define wcsrtombs rpl_wcsrtombs -# endif -# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@ -extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcsrtombs +# define wcsrtombs rpl_wcsrtombs +# endif +_GL_FUNCDECL_RPL (wcsrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (wcsrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t len, + mbstate_t *ps)); +# else +# if !@HAVE_WCSRTOMBS@ +_GL_FUNCDECL_SYS (wcsrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (wcsrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t len, + mbstate_t *ps)); # endif +_GL_CXXALIASWARN (wcsrtombs); #elif defined GNULIB_POSIXCHECK # undef wcsrtombs -# define wcsrtombs(d,s,l,p) \ - (GL_LINK_WARNING ("wcsrtombs is unportable - " \ - "use gnulib module wcsrtombs for portability"), \ - wcsrtombs (d, s, l, p)) +# if HAVE_RAW_DECL_WCSRTOMBS +_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " + "use gnulib module wcsrtombs for portability"); +# endif #endif /* Convert a wide string to a string. */ #if @GNULIB_WCSNRTOMBS@ # if @REPLACE_WCSNRTOMBS@ -# undef wcsnrtombs -# define wcsnrtombs rpl_wcsnrtombs -# endif -# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@ -extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcsnrtombs +# define wcsnrtombs rpl_wcsnrtombs +# endif +_GL_FUNCDECL_RPL (wcsnrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t srclen, size_t len, + mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (wcsnrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t srclen, size_t len, + mbstate_t *ps)); +# else +# if !@HAVE_WCSNRTOMBS@ +_GL_FUNCDECL_SYS (wcsnrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t srclen, size_t len, + mbstate_t *ps) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (wcsnrtombs, size_t, + (char *dest, const wchar_t **srcp, size_t srclen, size_t len, + mbstate_t *ps)); # endif +_GL_CXXALIASWARN (wcsnrtombs); #elif defined GNULIB_POSIXCHECK # undef wcsnrtombs -# define wcsnrtombs(d,s,n,l,p) \ - (GL_LINK_WARNING ("wcsnrtombs is unportable - " \ - "use gnulib module wcsnrtombs for portability"), \ - wcsnrtombs (d, s, n, l, p)) +# if HAVE_RAW_DECL_WCSNRTOMBS +_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " + "use gnulib module wcsnrtombs for portability"); +# endif #endif /* Return the number of screen columns needed for WC. */ #if @GNULIB_WCWIDTH@ # if @REPLACE_WCWIDTH@ -# undef wcwidth -# define wcwidth rpl_wcwidth -extern int wcwidth (wchar_t); +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcwidth +# define wcwidth rpl_wcwidth +# endif +_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t)); +_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); # else -# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ +# if !@HAVE_DECL_WCWIDTH@ /* wcwidth exists but is not declared. */ -extern int wcwidth (int /* actually wchar_t */); +_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t)); # endif +_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); # endif +_GL_CXXALIASWARN (wcwidth); #elif defined GNULIB_POSIXCHECK # undef wcwidth -# define wcwidth(w) \ - (GL_LINK_WARNING ("wcwidth is unportable - " \ - "use gnulib module wcwidth for portability"), \ - wcwidth (w)) +# if HAVE_RAW_DECL_WCWIDTH +_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " + "use gnulib module wcwidth for portability"); +# endif #endif -#ifdef __cplusplus -} -#endif - #endif /* _GL_WCHAR_H */ #endif /* _GL_WCHAR_H */ #endif diff --git a/lib/wctype.in.h b/lib/wctype.in.h index a583a04..8cfdfb0 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. - Copyright (C) 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2006-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -54,17 +54,27 @@ #ifndef _GL_WCTYPE_H #define _GL_WCTYPE_H -/* Define wint_t. (Also done in wchar.in.h.) */ +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Define wint_t and WEOF. (Also done in wchar.in.h.) */ #if !@HAVE_WINT_T@ && !defined wint_t # define wint_t int # ifndef WEOF # define WEOF -1 # endif +#else +# ifndef WEOF +# define WEOF ((wint_t) -1) +# endif #endif + /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. Linux libc5 has <wctype.h> and the functions but they are broken. - Assume all 12 functions are implemented the same way, or not at all. */ + Assume all 11 functions (all isw* except iswblank) are implemented the + same way, or not at all. */ #if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an @@ -72,21 +82,24 @@ refer to system functions like _iswctype that are not in the standard C library. Rather than try to get ancient buggy implementations like this to work, just disable them. */ -# undef iswalnum -# undef iswalpha -# undef iswblank -# undef iswcntrl -# undef iswdigit -# undef iswgraph -# undef iswlower -# undef iswprint -# undef iswpunct -# undef iswspace -# undef iswupper -# undef iswxdigit +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit +# undef towlower +# undef towupper /* Linux libc5 has <wctype.h> and the functions but they are broken. */ -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iswalnum rpl_iswalnum # define iswalpha rpl_iswalpha # define iswblank rpl_iswblank @@ -99,86 +112,266 @@ # define iswspace rpl_iswspace # define iswupper rpl_iswupper # define iswxdigit rpl_iswxdigit +# define towlower rpl_towlower +# define towupper rpl_towupper # endif +# endif static inline int -iswalnum (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswalnum +# else +iswalnum +# endif + (wint_t wc) { return ((wc >= '0' && wc <= '9') - || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); } static inline int -iswalpha (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswalpha +# else +iswalpha +# endif + (wint_t wc) { return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; } static inline int -iswblank (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswblank +# else +iswblank +# endif + (wint_t wc) { return wc == ' ' || wc == '\t'; } static inline int -iswcntrl (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswcntrl +# else +iswcntrl +# endif + (wint_t wc) { return (wc & ~0x1f) == 0 || wc == 0x7f; } static inline int -iswdigit (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswdigit +# else +iswdigit +# endif + (wint_t wc) { return wc >= '0' && wc <= '9'; } static inline int -iswgraph (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswgraph +# else +iswgraph +# endif + (wint_t wc) { return wc >= '!' && wc <= '~'; } static inline int -iswlower (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswlower +# else +iswlower +# endif + (wint_t wc) { return wc >= 'a' && wc <= 'z'; } static inline int -iswprint (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswprint +# else +iswprint +# endif + (wint_t wc) { return wc >= ' ' && wc <= '~'; } static inline int -iswpunct (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswpunct +# else +iswpunct +# endif + (wint_t wc) { return (wc >= '!' && wc <= '~' - && !((wc >= '0' && wc <= '9') - || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); + && !((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); } static inline int -iswspace (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswspace +# else +iswspace +# endif + (wint_t wc) { return (wc == ' ' || wc == '\t' - || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); + || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); } static inline int -iswupper (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswupper +# else +iswupper +# endif + (wint_t wc) { return wc >= 'A' && wc <= 'Z'; } static inline int -iswxdigit (wint_t wc) +# if @REPLACE_ISWCNTRL@ +rpl_iswxdigit +# else +iswxdigit +# endif + (wint_t wc) { return ((wc >= '0' && wc <= '9') - || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); } -# endif /* ! HAVE_ISWCNTRL */ +static inline wint_t +# if @REPLACE_ISWCNTRL@ +rpl_towlower +# else +towlower +# endif + (wint_t wc) +{ + return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); +} + +static inline wint_t +# if @REPLACE_ISWCNTRL@ +rpl_towupper +# else +towupper +# endif + (wint_t wc) +{ + return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); +} + +#elif ! @HAVE_ISWBLANK@ +/* Only the iswblank function is missing. */ + +static inline int +iswblank (wint_t wc) +{ + return wc == ' ' || wc == '\t'; +} + +#endif + +#if defined __MINGW32__ + +/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. + The functions towlower and towupper are implemented in the MSVCRT library + to take a wchar_t argument and return a wchar_t result. mingw declares + these functions to take a wint_t argument and return a wint_t result. + This means that: + 1. When the user passes an argument outside the range 0x0000..0xFFFF, the + function will look only at the lower 16 bits. This is allowed according + to POSIX. + 2. The return value is returned in the lower 16 bits of the result register. + The upper 16 bits are random: whatever happened to be in that part of the + result register. We need to fix this by adding a zero-extend from + wchar_t to wint_t after the call. */ + +static inline wint_t +rpl_towlower (wint_t wc) +{ + return (wint_t) (wchar_t) towlower (wc); +} +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towlower rpl_towlower +# endif + +static inline wint_t +rpl_towupper (wint_t wc) +{ + return (wint_t) (wchar_t) towupper (wc); +} +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towupper rpl_towupper +# endif + +#endif /* __MINGW32__ */ + +#if @REPLACE_ISWCNTRL@ +_GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswlower, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswprint, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswspace, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswupper, int, (wint_t wc)); +_GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); +#else +_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswlower, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswprint, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); +_GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); +#endif +_GL_CXXALIASWARN (iswalnum); +_GL_CXXALIASWARN (iswalpha); +_GL_CXXALIASWARN (iswblank); +_GL_CXXALIASWARN (iswcntrl); +_GL_CXXALIASWARN (iswdigit); +_GL_CXXALIASWARN (iswgraph); +_GL_CXXALIASWARN (iswlower); +_GL_CXXALIASWARN (iswprint); +_GL_CXXALIASWARN (iswpunct); +_GL_CXXALIASWARN (iswspace); +_GL_CXXALIASWARN (iswupper); +_GL_CXXALIASWARN (iswxdigit); + +#if @REPLACE_ISWCNTRL@ || defined __MINGW32__ +_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); +_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); +#else +_GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); +_GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); +#endif +_GL_CXXALIASWARN (towlower); +_GL_CXXALIASWARN (towupper); + #endif /* _GL_WCTYPE_H */ #endif /* _GL_WCTYPE_H */ diff --git a/lib/wcwidth.c b/lib/wcwidth.c index 8dea611..e5c27f5 100644 --- a/lib/wcwidth.c +++ b/lib/wcwidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a character. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -26,17 +26,16 @@ #include "streq.h" #include "uniwidth.h" -#undef wcwidth - int -rpl_wcwidth (wchar_t wc) +wcwidth (wchar_t wc) +#undef wcwidth { /* In UTF-8 locales, use a Unicode aware width function. */ const char *encoding = locale_charset (); if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0)) { /* We assume that in a UTF-8 locale, a wide character is the same as a - Unicode character. */ + Unicode character. */ return uc_width (wc, encoding); } else diff --git a/lib/xsize.h b/lib/xsize.h index 0b30045..3382280 100644 --- a/lib/xsize.h +++ b/lib/xsize.h @@ -1,6 +1,6 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008 Free Software Foundation, Inc. + Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/tests/Makefile.gnulib b/tests/Makefile.gnulib index f86db50..a59d9d4 100644 --- a/tests/Makefile.gnulib +++ b/tests/Makefile.gnulib @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -10,10 +10,11 @@ # # Generated by gnulib-tool. -AUTOMAKE_OPTIONS = 1.5 foreign +AUTOMAKE_OPTIONS = 1.5 foreign subdir-objects -SUBDIRS = +SUBDIRS = . TESTS = +XFAIL_TESTS = TESTS_ENVIRONMENT = noinst_PROGRAMS = check_PROGRAMS = @@ -30,6 +31,7 @@ DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = \ + -D@gltests_WITNESS@=1 \ -I. -I$(srcdir) \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib @@ -42,6 +44,8 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) EXTRA_libtests_a_SOURCES = AM_LIBTOOLFLAGS = --preserve-dup-deps +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' + ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt @@ -51,40 +55,80 @@ EXTRA_DIST += test-alloca-opt.c ## end gnulib module alloca-opt-tests +## begin gnulib module arg-nonnull + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += arg-nonnull.h +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/arg-nonnull.h, except that it has the copyright header cut off. +arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t + +ARG_NONNULL_H=arg-nonnull.h + +EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h + +## end gnulib module arg-nonnull + ## begin gnulib module array-mergesort-tests TESTS += test-array-mergesort check_PROGRAMS += test-array-mergesort -EXTRA_DIST += test-array-mergesort.c +EXTRA_DIST += test-array-mergesort.c macros.h ## end gnulib module array-mergesort-tests +## begin gnulib module c++defs + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += c++defs.h +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/c++defs.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += c++defs.h c++defs.h-t + +CXXDEFS_H=c++defs.h + +EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h + +## end gnulib module c++defs + ## begin gnulib module c-ctype-tests TESTS += test-c-ctype check_PROGRAMS += test-c-ctype -EXTRA_DIST += test-c-ctype.c +EXTRA_DIST += test-c-ctype.c macros.h ## end gnulib module c-ctype-tests ## begin gnulib module c-strcase-tests TESTS += test-c-strcase.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp -EXTRA_DIST += test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c +EXTRA_DIST += test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c macros.h ## end gnulib module c-strcase-tests -## begin gnulib module dup2-tests - -TESTS += test-dup2 -check_PROGRAMS += test-dup2 -EXTRA_DIST += test-dup2.c - -## end gnulib module dup2-tests - ## begin gnulib module environ-tests TESTS += test-environ @@ -114,52 +158,18 @@ EXTRA_libtests_a_SOURCES += error.c ## begin gnulib module exitfail +libtests_a_SOURCES += exitfail.c -EXTRA_DIST += exitfail.c exitfail.h - -EXTRA_libtests_a_SOURCES += exitfail.c +EXTRA_DIST += exitfail.h ## end gnulib module exitfail -## begin gnulib module fcntl - -BUILT_SOURCES += $(FCNTL_H) - -# We need the following in order to create <fcntl.h> when the system -# doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h - 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_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ - -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ - < $(srcdir)/fcntl.in.h; \ - } > $@-t - mv $@-t $@ -MOSTLYCLEANFILES += fcntl.h fcntl.h-t - -EXTRA_DIST += fcntl.in.h - -## end gnulib module fcntl - -## begin gnulib module fcntl-tests - -TESTS += test-fcntl -check_PROGRAMS += test-fcntl - -EXTRA_DIST += test-fcntl.c - -## end gnulib module fcntl-tests - ## begin gnulib module frexpl-nolibm-tests TESTS += test-frexpl-nolibm check_PROGRAMS += test-frexpl-nolibm test_frexpl_nolibm_SOURCES = test-frexpl.c - -EXTRA_DIST += test-frexpl.c +EXTRA_DIST += test-frexpl.c signature.h macros.h ## end gnulib module frexpl-nolibm-tests @@ -172,19 +182,36 @@ EXTRA_DIST += test-fseterr.c ## end gnulib module fseterr-tests +## begin gnulib module getpagesize + + +EXTRA_DIST += getpagesize.c + +EXTRA_libtests_a_SOURCES += getpagesize.c + +## end gnulib module getpagesize + ## begin gnulib module gettext-h libtests_a_SOURCES += gettext.h ## end gnulib module gettext-h +## begin gnulib module iconv-h-tests + +TESTS += test-iconv-h +check_PROGRAMS += test-iconv-h +EXTRA_DIST += test-iconv-h.c + +## end gnulib module iconv-h-tests + ## begin gnulib module iconv-tests TESTS += test-iconv check_PROGRAMS += test-iconv test_iconv_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += test-iconv.c +EXTRA_DIST += test-iconv.c signature.h macros.h ## end gnulib module iconv-tests @@ -200,7 +227,7 @@ EXTRA_DIST += intprops.h TESTS += test-isnand-nolibm check_PROGRAMS += test-isnand-nolibm -EXTRA_DIST += test-isnand-nolibm.c test-isnand.h nan.h +EXTRA_DIST += test-isnand-nolibm.c test-isnand.h nan.h macros.h ## end gnulib module isnand-nolibm-tests @@ -209,7 +236,7 @@ EXTRA_DIST += test-isnand-nolibm.c test-isnand.h nan.h TESTS += test-isnanf-nolibm check_PROGRAMS += test-isnanf-nolibm -EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h nan.h +EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h nan.h macros.h ## end gnulib module isnanf-nolibm-tests @@ -218,24 +245,31 @@ EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h nan.h TESTS += test-isnanl-nolibm check_PROGRAMS += test-isnanl-nolibm -EXTRA_DIST += test-isnanl-nolibm.c test-isnanl.h nan.h +EXTRA_DIST += test-isnanl-nolibm.c test-isnanl.h nan.h macros.h ## end gnulib module isnanl-nolibm-tests ## begin gnulib module locale -BUILT_SOURCES += $(LOCALE_H) +BUILT_SOURCES += locale.h # We need the following in order to create <locale.h> when the system # doesn't have one that provides all definitions. -locale.h: locale.in.h - rm -f $@-t $@ +locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ + -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ + -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ + -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ + -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/locale.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += locale.h locale.h-t @@ -247,7 +281,6 @@ EXTRA_DIST += locale.in.h TESTS += test-locale check_PROGRAMS += test-locale - EXTRA_DIST += test-locale.c ## end gnulib module locale-tests @@ -258,10 +291,19 @@ TESTS += test-localename check_PROGRAMS += test-localename test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ -EXTRA_DIST += test-localename.c +EXTRA_DIST += test-localename.c macros.h ## end gnulib module localename-tests +## begin gnulib module lock-tests + +TESTS += test-lock +check_PROGRAMS += test-lock +test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@ +EXTRA_DIST += test-lock.c + +## end gnulib module lock-tests + ## begin gnulib module malloca-tests TESTS += test-malloca @@ -275,7 +317,6 @@ EXTRA_DIST += test-malloca.c TESTS += test-math check_PROGRAMS += test-math - EXTRA_DIST += test-math.c ## end gnulib module math-tests @@ -284,24 +325,23 @@ EXTRA_DIST += test-math.c TESTS += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh TESTS_ENVIRONMENT += \ - EXEEXT='@EXEEXT@' \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-mbrtowc -EXTRA_DIST += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh test-mbrtowc.c +EXTRA_DIST += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh test-mbrtowc.c signature.h macros.h ## end gnulib module mbrtowc-tests ## begin gnulib module mbsinit-tests TESTS += test-mbsinit.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-mbsinit -EXTRA_DIST += test-mbsinit.sh test-mbsinit.c +EXTRA_DIST += test-mbsinit.sh test-mbsinit.c signature.h macros.h ## end gnulib module mbsinit-tests @@ -309,34 +349,15 @@ EXTRA_DIST += test-mbsinit.sh test-mbsinit.c TESTS += test-memchr check_PROGRAMS += test-memchr -EXTRA_DIST += test-memchr.c zerosize-ptr.h +EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h ## end gnulib module memchr-tests -## begin gnulib module open - - -EXTRA_DIST += open.c - -EXTRA_libtests_a_SOURCES += open.c - -## end gnulib module open - -## begin gnulib module open-tests - -TESTS += test-open -check_PROGRAMS += test-open - -EXTRA_DIST += test-open.c - -## end gnulib module open-tests - ## begin gnulib module printf-frexp-tests TESTS += test-printf-frexp check_PROGRAMS += test-printf-frexp - -EXTRA_DIST += test-printf-frexp.c +EXTRA_DIST += test-printf-frexp.c macros.h ## end gnulib module printf-frexp-tests @@ -344,8 +365,7 @@ EXTRA_DIST += test-printf-frexp.c TESTS += test-printf-frexpl check_PROGRAMS += test-printf-frexpl - -EXTRA_DIST += test-printf-frexpl.c +EXTRA_DIST += test-printf-frexpl.c macros.h ## end gnulib module printf-frexpl-tests @@ -355,6 +375,15 @@ libtests_a_SOURCES += progname.h progname.c ## end gnulib module progname +## begin gnulib module putenv + + +EXTRA_DIST += putenv.c + +EXTRA_libtests_a_SOURCES += putenv.c + +## end gnulib module putenv + ## begin gnulib module setenv @@ -364,12 +393,20 @@ EXTRA_libtests_a_SOURCES += setenv.c ## end gnulib module setenv +## begin gnulib module setenv-tests + +TESTS += test-setenv +check_PROGRAMS += test-setenv +EXTRA_DIST += test-setenv.c signature.h macros.h + +## end gnulib module setenv-tests + ## begin gnulib module signbit-tests TESTS += test-signbit check_PROGRAMS += test-signbit -EXTRA_DIST += test-signbit.c +EXTRA_DIST += test-signbit.c macros.h ## end gnulib module signbit-tests @@ -377,7 +414,6 @@ EXTRA_DIST += test-signbit.c TESTS += test-stdbool check_PROGRAMS += test-stdbool - EXTRA_DIST += test-stdbool.c ## end gnulib module stdbool-tests @@ -386,7 +422,6 @@ EXTRA_DIST += test-stdbool.c TESTS += test-stddef check_PROGRAMS += test-stddef - EXTRA_DIST += test-stddef.c ## end gnulib module stddef-tests @@ -395,7 +430,6 @@ EXTRA_DIST += test-stddef.c TESTS += test-stdint check_PROGRAMS += test-stdint - EXTRA_DIST += test-stdint.c ## end gnulib module stdint-tests @@ -404,7 +438,6 @@ EXTRA_DIST += test-stdint.c TESTS += test-stdlib check_PROGRAMS += test-stdlib - EXTRA_DIST += test-stdlib.c ## end gnulib module stdlib-tests @@ -422,7 +455,7 @@ EXTRA_libtests_a_SOURCES += strerror.c TESTS += test-strerror check_PROGRAMS += test-strerror -EXTRA_DIST += test-strerror.c +EXTRA_DIST += test-strerror.c signature.h macros.h ## end gnulib module strerror-tests @@ -432,7 +465,7 @@ TESTS += test-striconveh check_PROGRAMS += test-striconveh test_striconveh_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += test-striconveh.c +EXTRA_DIST += test-striconveh.c macros.h ## end gnulib module striconveh-tests @@ -442,7 +475,7 @@ TESTS += test-striconveha check_PROGRAMS += test-striconveha test_striconveha_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += test-striconveha.c +EXTRA_DIST += test-striconveha.c macros.h ## end gnulib module striconveha-tests @@ -450,18 +483,31 @@ EXTRA_DIST += test-striconveha.c TESTS += test-string check_PROGRAMS += test-string - EXTRA_DIST += test-string.c ## end gnulib module string-tests +## begin gnulib module strncat-tests + +TESTS += test-strncat +check_PROGRAMS += test-strncat +EXTRA_DIST += test-strncat.c unistr/test-strncat.h zerosize-ptr.h signature.h macros.h + +## end gnulib module strncat-tests + +## begin gnulib module thread + +libtests_a_SOURCES += glthread/thread.h glthread/thread.c + +## end gnulib module thread + ## begin gnulib module unicase/cased-tests TESTS += test-cased check_PROGRAMS += test-cased test_cased_SOURCES = unicase/test-cased.c -EXTRA_DIST += unicase/test-cased.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h +EXTRA_DIST += unicase/test-cased.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h macros.h ## end gnulib module unicase/cased-tests @@ -471,18 +517,18 @@ TESTS += test-ignorable check_PROGRAMS += test-ignorable test_ignorable_SOURCES = unicase/test-ignorable.c -EXTRA_DIST += unicase/test-ignorable.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h +EXTRA_DIST += unicase/test-ignorable.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h macros.h ## end gnulib module unicase/ignorable-tests ## begin gnulib module unicase/locale-language-tests TESTS += unicase/test-locale-language.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-locale-language test_locale_language_SOURCES = unicase/test-locale-language.c test_locale_language_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ -EXTRA_DIST += unicase/test-locale-language.sh unicase/test-locale-language.c +EXTRA_DIST += unicase/test-locale-language.sh unicase/test-locale-language.c macros.h ## end gnulib module unicase/locale-language-tests @@ -492,7 +538,7 @@ TESTS += test-uc_tolower check_PROGRAMS += test-uc_tolower test_uc_tolower_SOURCES = unicase/test-uc_tolower.c -EXTRA_DIST += unicase/test-uc_tolower.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h +EXTRA_DIST += unicase/test-uc_tolower.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h macros.h ## end gnulib module unicase/tolower-tests @@ -502,7 +548,7 @@ TESTS += test-uc_totitle check_PROGRAMS += test-uc_totitle test_uc_totitle_SOURCES = unicase/test-uc_totitle.c -EXTRA_DIST += unicase/test-uc_totitle.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h +EXTRA_DIST += unicase/test-uc_totitle.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h macros.h ## end gnulib module unicase/totitle-tests @@ -512,7 +558,7 @@ TESTS += test-uc_toupper check_PROGRAMS += test-uc_toupper test_uc_toupper_SOURCES = unicase/test-uc_toupper.c -EXTRA_DIST += unicase/test-uc_toupper.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h +EXTRA_DIST += unicase/test-uc_toupper.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h macros.h ## end gnulib module unicase/toupper-tests @@ -522,7 +568,7 @@ TESTS += test-u16-casecmp check_PROGRAMS += test-u16-casecmp test_u16_casecmp_SOURCES = unicase/test-u16-casecmp.c -EXTRA_DIST += unicase/test-u16-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u16-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u16-casecmp-tests @@ -533,7 +579,7 @@ check_PROGRAMS += test-u16-casecoll test_u16_casecoll_SOURCES = unicase/test-u16-casecoll.c test_u16_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-u16-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u16-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u16-casecoll-tests @@ -543,7 +589,7 @@ TESTS += test-u16-casefold check_PROGRAMS += test-u16-casefold test_u16_casefold_SOURCES = unicase/test-u16-casefold.c -EXTRA_DIST += unicase/test-u16-casefold.c +EXTRA_DIST += unicase/test-u16-casefold.c macros.h ## end gnulib module unicase/u16-casefold-tests @@ -553,7 +599,7 @@ TESTS += test-u16-is-cased check_PROGRAMS += test-u16-is-cased test_u16_is_cased_SOURCES = unicase/test-u16-is-cased.c -EXTRA_DIST += unicase/test-u16-is-cased.c unicase/test-is-cased.h +EXTRA_DIST += unicase/test-u16-is-cased.c unicase/test-is-cased.h macros.h ## end gnulib module unicase/u16-is-cased-tests @@ -563,7 +609,7 @@ TESTS += test-u16-is-casefolded check_PROGRAMS += test-u16-is-casefolded test_u16_is_casefolded_SOURCES = unicase/test-u16-is-casefolded.c -EXTRA_DIST += unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h +EXTRA_DIST += unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h macros.h ## end gnulib module unicase/u16-is-casefolded-tests @@ -573,7 +619,7 @@ TESTS += test-u16-is-lowercase check_PROGRAMS += test-u16-is-lowercase test_u16_is_lowercase_SOURCES = unicase/test-u16-is-lowercase.c -EXTRA_DIST += unicase/test-u16-is-lowercase.c unicase/test-is-lowercase.h +EXTRA_DIST += unicase/test-u16-is-lowercase.c unicase/test-is-lowercase.h macros.h ## end gnulib module unicase/u16-is-lowercase-tests @@ -583,7 +629,7 @@ TESTS += test-u16-is-titlecase check_PROGRAMS += test-u16-is-titlecase test_u16_is_titlecase_SOURCES = unicase/test-u16-is-titlecase.c -EXTRA_DIST += unicase/test-u16-is-titlecase.c unicase/test-is-titlecase.h +EXTRA_DIST += unicase/test-u16-is-titlecase.c unicase/test-is-titlecase.h macros.h ## end gnulib module unicase/u16-is-titlecase-tests @@ -593,7 +639,7 @@ TESTS += test-u16-is-uppercase check_PROGRAMS += test-u16-is-uppercase test_u16_is_uppercase_SOURCES = unicase/test-u16-is-uppercase.c -EXTRA_DIST += unicase/test-u16-is-uppercase.c unicase/test-is-uppercase.h +EXTRA_DIST += unicase/test-u16-is-uppercase.c unicase/test-is-uppercase.h macros.h ## end gnulib module unicase/u16-is-uppercase-tests @@ -603,7 +649,7 @@ TESTS += test-u16-tolower check_PROGRAMS += test-u16-tolower test_u16_tolower_SOURCES = unicase/test-u16-tolower.c -EXTRA_DIST += unicase/test-u16-tolower.c +EXTRA_DIST += unicase/test-u16-tolower.c macros.h ## end gnulib module unicase/u16-tolower-tests @@ -613,7 +659,7 @@ TESTS += test-u16-totitle check_PROGRAMS += test-u16-totitle test_u16_totitle_SOURCES = unicase/test-u16-totitle.c -EXTRA_DIST += unicase/test-u16-totitle.c +EXTRA_DIST += unicase/test-u16-totitle.c macros.h ## end gnulib module unicase/u16-totitle-tests @@ -623,7 +669,7 @@ TESTS += test-u16-toupper check_PROGRAMS += test-u16-toupper test_u16_toupper_SOURCES = unicase/test-u16-toupper.c -EXTRA_DIST += unicase/test-u16-toupper.c +EXTRA_DIST += unicase/test-u16-toupper.c macros.h ## end gnulib module unicase/u16-toupper-tests @@ -633,7 +679,7 @@ TESTS += test-u32-casecmp check_PROGRAMS += test-u32-casecmp test_u32_casecmp_SOURCES = unicase/test-u32-casecmp.c -EXTRA_DIST += unicase/test-u32-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u32-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u32-casecmp-tests @@ -644,7 +690,7 @@ check_PROGRAMS += test-u32-casecoll test_u32_casecoll_SOURCES = unicase/test-u32-casecoll.c test_u32_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-u32-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u32-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u32-casecoll-tests @@ -654,7 +700,7 @@ TESTS += test-u32-casefold check_PROGRAMS += test-u32-casefold test_u32_casefold_SOURCES = unicase/test-u32-casefold.c -EXTRA_DIST += unicase/test-u32-casefold.c +EXTRA_DIST += unicase/test-u32-casefold.c macros.h ## end gnulib module unicase/u32-casefold-tests @@ -664,7 +710,7 @@ TESTS += test-u32-is-cased check_PROGRAMS += test-u32-is-cased test_u32_is_cased_SOURCES = unicase/test-u32-is-cased.c -EXTRA_DIST += unicase/test-u32-is-cased.c unicase/test-is-cased.h +EXTRA_DIST += unicase/test-u32-is-cased.c unicase/test-is-cased.h macros.h ## end gnulib module unicase/u32-is-cased-tests @@ -674,7 +720,7 @@ TESTS += test-u32-is-casefolded check_PROGRAMS += test-u32-is-casefolded test_u32_is_casefolded_SOURCES = unicase/test-u32-is-casefolded.c -EXTRA_DIST += unicase/test-u32-is-casefolded.c unicase/test-is-casefolded.h +EXTRA_DIST += unicase/test-u32-is-casefolded.c unicase/test-is-casefolded.h macros.h ## end gnulib module unicase/u32-is-casefolded-tests @@ -684,7 +730,7 @@ TESTS += test-u32-is-lowercase check_PROGRAMS += test-u32-is-lowercase test_u32_is_lowercase_SOURCES = unicase/test-u32-is-lowercase.c -EXTRA_DIST += unicase/test-u32-is-lowercase.c unicase/test-is-lowercase.h +EXTRA_DIST += unicase/test-u32-is-lowercase.c unicase/test-is-lowercase.h macros.h ## end gnulib module unicase/u32-is-lowercase-tests @@ -694,7 +740,7 @@ TESTS += test-u32-is-titlecase check_PROGRAMS += test-u32-is-titlecase test_u32_is_titlecase_SOURCES = unicase/test-u32-is-titlecase.c -EXTRA_DIST += unicase/test-u32-is-titlecase.c unicase/test-is-titlecase.h +EXTRA_DIST += unicase/test-u32-is-titlecase.c unicase/test-is-titlecase.h macros.h ## end gnulib module unicase/u32-is-titlecase-tests @@ -704,7 +750,7 @@ TESTS += test-u32-is-uppercase check_PROGRAMS += test-u32-is-uppercase test_u32_is_uppercase_SOURCES = unicase/test-u32-is-uppercase.c -EXTRA_DIST += unicase/test-u32-is-uppercase.c unicase/test-is-uppercase.h +EXTRA_DIST += unicase/test-u32-is-uppercase.c unicase/test-is-uppercase.h macros.h ## end gnulib module unicase/u32-is-uppercase-tests @@ -714,7 +760,7 @@ TESTS += test-u32-tolower check_PROGRAMS += test-u32-tolower test_u32_tolower_SOURCES = unicase/test-u32-tolower.c -EXTRA_DIST += unicase/test-u32-tolower.c +EXTRA_DIST += unicase/test-u32-tolower.c macros.h ## end gnulib module unicase/u32-tolower-tests @@ -724,7 +770,7 @@ TESTS += test-u32-totitle check_PROGRAMS += test-u32-totitle test_u32_totitle_SOURCES = unicase/test-u32-totitle.c -EXTRA_DIST += unicase/test-u32-totitle.c +EXTRA_DIST += unicase/test-u32-totitle.c macros.h ## end gnulib module unicase/u32-totitle-tests @@ -734,7 +780,7 @@ TESTS += test-u32-toupper check_PROGRAMS += test-u32-toupper test_u32_toupper_SOURCES = unicase/test-u32-toupper.c -EXTRA_DIST += unicase/test-u32-toupper.c +EXTRA_DIST += unicase/test-u32-toupper.c macros.h ## end gnulib module unicase/u32-toupper-tests @@ -744,7 +790,7 @@ TESTS += test-u8-casecmp check_PROGRAMS += test-u8-casecmp test_u8_casecmp_SOURCES = unicase/test-u8-casecmp.c -EXTRA_DIST += unicase/test-u8-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u8-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u8-casecmp-tests @@ -755,7 +801,7 @@ check_PROGRAMS += test-u8-casecoll test_u8_casecoll_SOURCES = unicase/test-u8-casecoll.c test_u8_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-u8-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u8-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u8-casecoll-tests @@ -765,7 +811,7 @@ TESTS += test-u8-casefold check_PROGRAMS += test-u8-casefold test_u8_casefold_SOURCES = unicase/test-u8-casefold.c -EXTRA_DIST += unicase/test-u8-casefold.c +EXTRA_DIST += unicase/test-u8-casefold.c macros.h ## end gnulib module unicase/u8-casefold-tests @@ -775,7 +821,7 @@ TESTS += test-u8-is-cased check_PROGRAMS += test-u8-is-cased test_u8_is_cased_SOURCES = unicase/test-u8-is-cased.c -EXTRA_DIST += unicase/test-u8-is-cased.c unicase/test-is-cased.h +EXTRA_DIST += unicase/test-u8-is-cased.c unicase/test-is-cased.h macros.h ## end gnulib module unicase/u8-is-cased-tests @@ -785,7 +831,7 @@ TESTS += test-u8-is-casefolded check_PROGRAMS += test-u8-is-casefolded test_u8_is_casefolded_SOURCES = unicase/test-u8-is-casefolded.c -EXTRA_DIST += unicase/test-u8-is-casefolded.c unicase/test-is-casefolded.h +EXTRA_DIST += unicase/test-u8-is-casefolded.c unicase/test-is-casefolded.h macros.h ## end gnulib module unicase/u8-is-casefolded-tests @@ -795,7 +841,7 @@ TESTS += test-u8-is-lowercase check_PROGRAMS += test-u8-is-lowercase test_u8_is_lowercase_SOURCES = unicase/test-u8-is-lowercase.c -EXTRA_DIST += unicase/test-u8-is-lowercase.c unicase/test-is-lowercase.h +EXTRA_DIST += unicase/test-u8-is-lowercase.c unicase/test-is-lowercase.h macros.h ## end gnulib module unicase/u8-is-lowercase-tests @@ -805,7 +851,7 @@ TESTS += test-u8-is-titlecase check_PROGRAMS += test-u8-is-titlecase test_u8_is_titlecase_SOURCES = unicase/test-u8-is-titlecase.c -EXTRA_DIST += unicase/test-u8-is-titlecase.c unicase/test-is-titlecase.h +EXTRA_DIST += unicase/test-u8-is-titlecase.c unicase/test-is-titlecase.h macros.h ## end gnulib module unicase/u8-is-titlecase-tests @@ -815,7 +861,7 @@ TESTS += test-u8-is-uppercase check_PROGRAMS += test-u8-is-uppercase test_u8_is_uppercase_SOURCES = unicase/test-u8-is-uppercase.c -EXTRA_DIST += unicase/test-u8-is-uppercase.c unicase/test-is-uppercase.h +EXTRA_DIST += unicase/test-u8-is-uppercase.c unicase/test-is-uppercase.h macros.h ## end gnulib module unicase/u8-is-uppercase-tests @@ -825,7 +871,7 @@ TESTS += test-u8-tolower check_PROGRAMS += test-u8-tolower test_u8_tolower_SOURCES = unicase/test-u8-tolower.c -EXTRA_DIST += unicase/test-u8-tolower.c +EXTRA_DIST += unicase/test-u8-tolower.c macros.h ## end gnulib module unicase/u8-tolower-tests @@ -835,7 +881,7 @@ TESTS += test-u8-totitle check_PROGRAMS += test-u8-totitle test_u8_totitle_SOURCES = unicase/test-u8-totitle.c -EXTRA_DIST += unicase/test-u8-totitle.c +EXTRA_DIST += unicase/test-u8-totitle.c macros.h ## end gnulib module unicase/u8-totitle-tests @@ -845,7 +891,7 @@ TESTS += test-u8-toupper check_PROGRAMS += test-u8-toupper test_u8_toupper_SOURCES = unicase/test-u8-toupper.c -EXTRA_DIST += unicase/test-u8-toupper.c +EXTRA_DIST += unicase/test-u8-toupper.c macros.h ## end gnulib module unicase/u8-toupper-tests @@ -853,14 +899,13 @@ EXTRA_DIST += unicase/test-u8-toupper.c TESTS += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh TESTS_ENVIRONMENT += \ - EXEEXT='@EXEEXT@' \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-ulc-casecmp test_ulc_casecmp_SOURCES = unicase/test-ulc-casecmp.c test_ulc_casecmp_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh unicase/test-ulc-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh unicase/test-ulc-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/ulc-casecmp-tests @@ -868,14 +913,13 @@ EXTRA_DIST += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh unicase/ TESTS += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh TESTS_ENVIRONMENT += \ - EXEEXT='@EXEEXT@' \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-ulc-casecoll test_ulc_casecoll_SOURCES = unicase/test-ulc-casecoll.c test_ulc_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh unicase/test-ulc-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh unicase/test-ulc-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/ulc-casecoll-tests @@ -886,7 +930,7 @@ check_PROGRAMS += test-u16-conv-from-enc test_u16_conv_from_enc_SOURCES = uniconv/test-u16-conv-from-enc.c test_u16_conv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-conv-from-enc.c +EXTRA_DIST += uniconv/test-u16-conv-from-enc.c macros.h ## end gnulib module uniconv/u16-conv-from-enc-tests @@ -897,7 +941,7 @@ check_PROGRAMS += test-u16-conv-to-enc test_u16_conv_to_enc_SOURCES = uniconv/test-u16-conv-to-enc.c test_u16_conv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-conv-to-enc.c +EXTRA_DIST += uniconv/test-u16-conv-to-enc.c macros.h ## end gnulib module uniconv/u16-conv-to-enc-tests @@ -908,7 +952,7 @@ check_PROGRAMS += test-u16-strconv-from-enc test_u16_strconv_from_enc_SOURCES = uniconv/test-u16-strconv-from-enc.c test_u16_strconv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-strconv-from-enc.c +EXTRA_DIST += uniconv/test-u16-strconv-from-enc.c macros.h ## end gnulib module uniconv/u16-strconv-from-enc-tests @@ -919,7 +963,7 @@ check_PROGRAMS += test-u16-strconv-to-enc test_u16_strconv_to_enc_SOURCES = uniconv/test-u16-strconv-to-enc.c test_u16_strconv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-strconv-to-enc.c +EXTRA_DIST += uniconv/test-u16-strconv-to-enc.c macros.h ## end gnulib module uniconv/u16-strconv-to-enc-tests @@ -930,7 +974,7 @@ check_PROGRAMS += test-u32-conv-from-enc test_u32_conv_from_enc_SOURCES = uniconv/test-u32-conv-from-enc.c test_u32_conv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-conv-from-enc.c +EXTRA_DIST += uniconv/test-u32-conv-from-enc.c macros.h ## end gnulib module uniconv/u32-conv-from-enc-tests @@ -941,7 +985,7 @@ check_PROGRAMS += test-u32-conv-to-enc test_u32_conv_to_enc_SOURCES = uniconv/test-u32-conv-to-enc.c test_u32_conv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-conv-to-enc.c +EXTRA_DIST += uniconv/test-u32-conv-to-enc.c macros.h ## end gnulib module uniconv/u32-conv-to-enc-tests @@ -952,7 +996,7 @@ check_PROGRAMS += test-u32-strconv-from-enc test_u32_strconv_from_enc_SOURCES = uniconv/test-u32-strconv-from-enc.c test_u32_strconv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-strconv-from-enc.c +EXTRA_DIST += uniconv/test-u32-strconv-from-enc.c macros.h ## end gnulib module uniconv/u32-strconv-from-enc-tests @@ -963,7 +1007,7 @@ check_PROGRAMS += test-u32-strconv-to-enc test_u32_strconv_to_enc_SOURCES = uniconv/test-u32-strconv-to-enc.c test_u32_strconv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-strconv-to-enc.c +EXTRA_DIST += uniconv/test-u32-strconv-to-enc.c macros.h ## end gnulib module uniconv/u32-strconv-to-enc-tests @@ -974,7 +1018,7 @@ check_PROGRAMS += test-u8-conv-from-enc test_u8_conv_from_enc_SOURCES = uniconv/test-u8-conv-from-enc.c test_u8_conv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-conv-from-enc.c +EXTRA_DIST += uniconv/test-u8-conv-from-enc.c macros.h ## end gnulib module uniconv/u8-conv-from-enc-tests @@ -985,7 +1029,7 @@ check_PROGRAMS += test-u8-conv-to-enc test_u8_conv_to_enc_SOURCES = uniconv/test-u8-conv-to-enc.c test_u8_conv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-conv-to-enc.c +EXTRA_DIST += uniconv/test-u8-conv-to-enc.c macros.h ## end gnulib module uniconv/u8-conv-to-enc-tests @@ -996,7 +1040,7 @@ check_PROGRAMS += test-u8-strconv-from-enc test_u8_strconv_from_enc_SOURCES = uniconv/test-u8-strconv-from-enc.c test_u8_strconv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-strconv-from-enc.c +EXTRA_DIST += uniconv/test-u8-strconv-from-enc.c macros.h ## end gnulib module uniconv/u8-strconv-from-enc-tests @@ -1007,7 +1051,7 @@ check_PROGRAMS += test-u8-strconv-to-enc test_u8_strconv_to_enc_SOURCES = uniconv/test-u8-strconv-to-enc.c test_u8_strconv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-strconv-to-enc.c +EXTRA_DIST += uniconv/test-u8-strconv-to-enc.c macros.h ## end gnulib module uniconv/u8-strconv-to-enc-tests @@ -1017,7 +1061,7 @@ TESTS += test-bidi_byname check_PROGRAMS += test-bidi_byname test_bidi_byname_SOURCES = unictype/test-bidi_byname.c -EXTRA_DIST += unictype/test-bidi_byname.c +EXTRA_DIST += unictype/test-bidi_byname.c macros.h ## end gnulib module unictype/bidicategory-byname-tests @@ -1027,7 +1071,7 @@ TESTS += test-bidi_name check_PROGRAMS += test-bidi_name test_bidi_name_SOURCES = unictype/test-bidi_name.c -EXTRA_DIST += unictype/test-bidi_name.c +EXTRA_DIST += unictype/test-bidi_name.c macros.h ## end gnulib module unictype/bidicategory-name-tests @@ -1037,7 +1081,7 @@ TESTS += test-bidi_of check_PROGRAMS += test-bidi_of test_bidi_of_SOURCES = unictype/test-bidi_of.c -EXTRA_DIST += unictype/test-bidi_of.c +EXTRA_DIST += unictype/test-bidi_of.c macros.h ## end gnulib module unictype/bidicategory-of-tests @@ -1047,7 +1091,7 @@ TESTS += test-bidi_test check_PROGRAMS += test-bidi_test test_bidi_test_SOURCES = unictype/test-bidi_test.c -EXTRA_DIST += unictype/test-bidi_test.c +EXTRA_DIST += unictype/test-bidi_test.c macros.h ## end gnulib module unictype/bidicategory-test-tests @@ -1057,7 +1101,7 @@ TESTS += test-block_list check_PROGRAMS += test-block_list test_block_list_SOURCES = unictype/test-block_list.c -EXTRA_DIST += unictype/test-block_list.c +EXTRA_DIST += unictype/test-block_list.c macros.h ## end gnulib module unictype/block-list-tests @@ -1067,7 +1111,7 @@ TESTS += test-block_of check_PROGRAMS += test-block_of test_block_of_SOURCES = unictype/test-block_of.c -EXTRA_DIST += unictype/test-block_of.c +EXTRA_DIST += unictype/test-block_of.c macros.h ## end gnulib module unictype/block-of-tests @@ -1077,7 +1121,7 @@ TESTS += test-block_test check_PROGRAMS += test-block_test test_block_test_SOURCES = unictype/test-block_test.c -EXTRA_DIST += unictype/test-block_test.c +EXTRA_DIST += unictype/test-block_test.c macros.h ## end gnulib module unictype/block-test-tests @@ -1087,7 +1131,7 @@ TESTS += test-categ_C check_PROGRAMS += test-categ_C test_categ_C_SOURCES = unictype/test-categ_C.c -EXTRA_DIST += unictype/test-categ_C.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_C.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-C-tests @@ -1097,7 +1141,7 @@ TESTS += test-categ_Cc check_PROGRAMS += test-categ_Cc test_categ_Cc_SOURCES = unictype/test-categ_Cc.c -EXTRA_DIST += unictype/test-categ_Cc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cc-tests @@ -1107,7 +1151,7 @@ TESTS += test-categ_Cf check_PROGRAMS += test-categ_Cf test_categ_Cf_SOURCES = unictype/test-categ_Cf.c -EXTRA_DIST += unictype/test-categ_Cf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cf-tests @@ -1117,7 +1161,7 @@ TESTS += test-categ_Cn check_PROGRAMS += test-categ_Cn test_categ_Cn_SOURCES = unictype/test-categ_Cn.c -EXTRA_DIST += unictype/test-categ_Cn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cn-tests @@ -1127,7 +1171,7 @@ TESTS += test-categ_Co check_PROGRAMS += test-categ_Co test_categ_Co_SOURCES = unictype/test-categ_Co.c -EXTRA_DIST += unictype/test-categ_Co.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Co.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Co-tests @@ -1137,7 +1181,7 @@ TESTS += test-categ_Cs check_PROGRAMS += test-categ_Cs test_categ_Cs_SOURCES = unictype/test-categ_Cs.c -EXTRA_DIST += unictype/test-categ_Cs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cs-tests @@ -1147,7 +1191,7 @@ TESTS += test-categ_L check_PROGRAMS += test-categ_L test_categ_L_SOURCES = unictype/test-categ_L.c -EXTRA_DIST += unictype/test-categ_L.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_L.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-L-tests @@ -1157,7 +1201,7 @@ TESTS += test-categ_Ll check_PROGRAMS += test-categ_Ll test_categ_Ll_SOURCES = unictype/test-categ_Ll.c -EXTRA_DIST += unictype/test-categ_Ll.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Ll.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Ll-tests @@ -1167,7 +1211,7 @@ TESTS += test-categ_Lm check_PROGRAMS += test-categ_Lm test_categ_Lm_SOURCES = unictype/test-categ_Lm.c -EXTRA_DIST += unictype/test-categ_Lm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lm-tests @@ -1177,7 +1221,7 @@ TESTS += test-categ_Lo check_PROGRAMS += test-categ_Lo test_categ_Lo_SOURCES = unictype/test-categ_Lo.c -EXTRA_DIST += unictype/test-categ_Lo.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lo.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lo-tests @@ -1187,7 +1231,7 @@ TESTS += test-categ_Lt check_PROGRAMS += test-categ_Lt test_categ_Lt_SOURCES = unictype/test-categ_Lt.c -EXTRA_DIST += unictype/test-categ_Lt.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lt.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lt-tests @@ -1197,7 +1241,7 @@ TESTS += test-categ_Lu check_PROGRAMS += test-categ_Lu test_categ_Lu_SOURCES = unictype/test-categ_Lu.c -EXTRA_DIST += unictype/test-categ_Lu.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lu.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lu-tests @@ -1207,7 +1251,7 @@ TESTS += test-categ_M check_PROGRAMS += test-categ_M test_categ_M_SOURCES = unictype/test-categ_M.c -EXTRA_DIST += unictype/test-categ_M.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_M.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-M-tests @@ -1217,7 +1261,7 @@ TESTS += test-categ_Mc check_PROGRAMS += test-categ_Mc test_categ_Mc_SOURCES = unictype/test-categ_Mc.c -EXTRA_DIST += unictype/test-categ_Mc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Mc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Mc-tests @@ -1227,7 +1271,7 @@ TESTS += test-categ_Me check_PROGRAMS += test-categ_Me test_categ_Me_SOURCES = unictype/test-categ_Me.c -EXTRA_DIST += unictype/test-categ_Me.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Me.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Me-tests @@ -1237,7 +1281,7 @@ TESTS += test-categ_Mn check_PROGRAMS += test-categ_Mn test_categ_Mn_SOURCES = unictype/test-categ_Mn.c -EXTRA_DIST += unictype/test-categ_Mn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Mn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Mn-tests @@ -1247,7 +1291,7 @@ TESTS += test-categ_N check_PROGRAMS += test-categ_N test_categ_N_SOURCES = unictype/test-categ_N.c -EXTRA_DIST += unictype/test-categ_N.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_N.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-N-tests @@ -1257,7 +1301,7 @@ TESTS += test-categ_Nd check_PROGRAMS += test-categ_Nd test_categ_Nd_SOURCES = unictype/test-categ_Nd.c -EXTRA_DIST += unictype/test-categ_Nd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Nd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Nd-tests @@ -1267,7 +1311,7 @@ TESTS += test-categ_Nl check_PROGRAMS += test-categ_Nl test_categ_Nl_SOURCES = unictype/test-categ_Nl.c -EXTRA_DIST += unictype/test-categ_Nl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Nl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Nl-tests @@ -1277,7 +1321,7 @@ TESTS += test-categ_No check_PROGRAMS += test-categ_No test_categ_No_SOURCES = unictype/test-categ_No.c -EXTRA_DIST += unictype/test-categ_No.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_No.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-No-tests @@ -1287,7 +1331,7 @@ TESTS += test-categ_P check_PROGRAMS += test-categ_P test_categ_P_SOURCES = unictype/test-categ_P.c -EXTRA_DIST += unictype/test-categ_P.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_P.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-P-tests @@ -1297,7 +1341,7 @@ TESTS += test-categ_Pc check_PROGRAMS += test-categ_Pc test_categ_Pc_SOURCES = unictype/test-categ_Pc.c -EXTRA_DIST += unictype/test-categ_Pc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pc-tests @@ -1307,7 +1351,7 @@ TESTS += test-categ_Pd check_PROGRAMS += test-categ_Pd test_categ_Pd_SOURCES = unictype/test-categ_Pd.c -EXTRA_DIST += unictype/test-categ_Pd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pd-tests @@ -1317,7 +1361,7 @@ TESTS += test-categ_Pe check_PROGRAMS += test-categ_Pe test_categ_Pe_SOURCES = unictype/test-categ_Pe.c -EXTRA_DIST += unictype/test-categ_Pe.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pe.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pe-tests @@ -1327,7 +1371,7 @@ TESTS += test-categ_Pf check_PROGRAMS += test-categ_Pf test_categ_Pf_SOURCES = unictype/test-categ_Pf.c -EXTRA_DIST += unictype/test-categ_Pf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pf-tests @@ -1337,7 +1381,7 @@ TESTS += test-categ_Pi check_PROGRAMS += test-categ_Pi test_categ_Pi_SOURCES = unictype/test-categ_Pi.c -EXTRA_DIST += unictype/test-categ_Pi.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pi.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pi-tests @@ -1347,7 +1391,7 @@ TESTS += test-categ_Po check_PROGRAMS += test-categ_Po test_categ_Po_SOURCES = unictype/test-categ_Po.c -EXTRA_DIST += unictype/test-categ_Po.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Po.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Po-tests @@ -1357,7 +1401,7 @@ TESTS += test-categ_Ps check_PROGRAMS += test-categ_Ps test_categ_Ps_SOURCES = unictype/test-categ_Ps.c -EXTRA_DIST += unictype/test-categ_Ps.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Ps.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Ps-tests @@ -1367,7 +1411,7 @@ TESTS += test-categ_S check_PROGRAMS += test-categ_S test_categ_S_SOURCES = unictype/test-categ_S.c -EXTRA_DIST += unictype/test-categ_S.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_S.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-S-tests @@ -1377,7 +1421,7 @@ TESTS += test-categ_Sc check_PROGRAMS += test-categ_Sc test_categ_Sc_SOURCES = unictype/test-categ_Sc.c -EXTRA_DIST += unictype/test-categ_Sc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Sc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Sc-tests @@ -1387,7 +1431,7 @@ TESTS += test-categ_Sk check_PROGRAMS += test-categ_Sk test_categ_Sk_SOURCES = unictype/test-categ_Sk.c -EXTRA_DIST += unictype/test-categ_Sk.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Sk.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Sk-tests @@ -1397,7 +1441,7 @@ TESTS += test-categ_Sm check_PROGRAMS += test-categ_Sm test_categ_Sm_SOURCES = unictype/test-categ_Sm.c -EXTRA_DIST += unictype/test-categ_Sm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Sm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Sm-tests @@ -1407,7 +1451,7 @@ TESTS += test-categ_So check_PROGRAMS += test-categ_So test_categ_So_SOURCES = unictype/test-categ_So.c -EXTRA_DIST += unictype/test-categ_So.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_So.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-So-tests @@ -1417,7 +1461,7 @@ TESTS += test-categ_Z check_PROGRAMS += test-categ_Z test_categ_Z_SOURCES = unictype/test-categ_Z.c -EXTRA_DIST += unictype/test-categ_Z.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Z.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Z-tests @@ -1427,7 +1471,7 @@ TESTS += test-categ_Zl check_PROGRAMS += test-categ_Zl test_categ_Zl_SOURCES = unictype/test-categ_Zl.c -EXTRA_DIST += unictype/test-categ_Zl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Zl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Zl-tests @@ -1437,7 +1481,7 @@ TESTS += test-categ_Zp check_PROGRAMS += test-categ_Zp test_categ_Zp_SOURCES = unictype/test-categ_Zp.c -EXTRA_DIST += unictype/test-categ_Zp.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Zp.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Zp-tests @@ -1447,7 +1491,7 @@ TESTS += test-categ_Zs check_PROGRAMS += test-categ_Zs test_categ_Zs_SOURCES = unictype/test-categ_Zs.c -EXTRA_DIST += unictype/test-categ_Zs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Zs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Zs-tests @@ -1457,7 +1501,7 @@ TESTS += test-categ_and_not check_PROGRAMS += test-categ_and_not test_categ_and_not_SOURCES = unictype/test-categ_and_not.c -EXTRA_DIST += unictype/test-categ_and_not.c +EXTRA_DIST += unictype/test-categ_and_not.c macros.h ## end gnulib module unictype/category-and-not-tests @@ -1467,7 +1511,7 @@ TESTS += test-categ_and check_PROGRAMS += test-categ_and test_categ_and_SOURCES = unictype/test-categ_and.c -EXTRA_DIST += unictype/test-categ_and.c +EXTRA_DIST += unictype/test-categ_and.c macros.h ## end gnulib module unictype/category-and-tests @@ -1477,7 +1521,7 @@ TESTS += test-categ_byname check_PROGRAMS += test-categ_byname test_categ_byname_SOURCES = unictype/test-categ_byname.c -EXTRA_DIST += unictype/test-categ_byname.c +EXTRA_DIST += unictype/test-categ_byname.c macros.h ## end gnulib module unictype/category-byname-tests @@ -1487,7 +1531,7 @@ TESTS += test-categ_name check_PROGRAMS += test-categ_name test_categ_name_SOURCES = unictype/test-categ_name.c -EXTRA_DIST += unictype/test-categ_name.c +EXTRA_DIST += unictype/test-categ_name.c macros.h ## end gnulib module unictype/category-name-tests @@ -1499,7 +1543,7 @@ check_PROGRAMS += test-categ_none test_categ_none_SOURCES = unictype/test-categ_none.c endif -EXTRA_DIST += unictype/test-categ_none.c +EXTRA_DIST += unictype/test-categ_none.c macros.h ## end gnulib module unictype/category-none-tests @@ -1509,7 +1553,7 @@ TESTS += test-categ_of check_PROGRAMS += test-categ_of test_categ_of_SOURCES = unictype/test-categ_of.c -EXTRA_DIST += unictype/test-categ_of.c +EXTRA_DIST += unictype/test-categ_of.c macros.h ## end gnulib module unictype/category-of-tests @@ -1519,7 +1563,7 @@ TESTS += test-categ_or check_PROGRAMS += test-categ_or test_categ_or_SOURCES = unictype/test-categ_or.c -EXTRA_DIST += unictype/test-categ_or.c +EXTRA_DIST += unictype/test-categ_or.c macros.h ## end gnulib module unictype/category-or-tests @@ -1529,7 +1573,7 @@ TESTS += test-categ_test_withtable check_PROGRAMS += test-categ_test_withtable test_categ_test_withtable_SOURCES = unictype/test-categ_test_withtable.c -EXTRA_DIST += unictype/test-categ_test_withtable.c +EXTRA_DIST += unictype/test-categ_test_withtable.c macros.h ## end gnulib module unictype/category-test-withtable-tests @@ -1539,7 +1583,7 @@ TESTS += test-combining check_PROGRAMS += test-combining test_combining_SOURCES = unictype/test-combining.c -EXTRA_DIST += unictype/test-combining.c +EXTRA_DIST += unictype/test-combining.c macros.h ## end gnulib module unictype/combining-class-tests @@ -1549,7 +1593,7 @@ TESTS += test-ctype_alnum check_PROGRAMS += test-ctype_alnum test_ctype_alnum_SOURCES = unictype/test-ctype_alnum.c -EXTRA_DIST += unictype/test-ctype_alnum.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_alnum.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-alnum-tests @@ -1559,7 +1603,7 @@ TESTS += test-ctype_alpha check_PROGRAMS += test-ctype_alpha test_ctype_alpha_SOURCES = unictype/test-ctype_alpha.c -EXTRA_DIST += unictype/test-ctype_alpha.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_alpha.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-alpha-tests @@ -1569,7 +1613,7 @@ TESTS += test-ctype_blank check_PROGRAMS += test-ctype_blank test_ctype_blank_SOURCES = unictype/test-ctype_blank.c -EXTRA_DIST += unictype/test-ctype_blank.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_blank.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-blank-tests @@ -1579,7 +1623,7 @@ TESTS += test-ctype_cntrl check_PROGRAMS += test-ctype_cntrl test_ctype_cntrl_SOURCES = unictype/test-ctype_cntrl.c -EXTRA_DIST += unictype/test-ctype_cntrl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_cntrl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-cntrl-tests @@ -1589,7 +1633,7 @@ TESTS += test-ctype_digit check_PROGRAMS += test-ctype_digit test_ctype_digit_SOURCES = unictype/test-ctype_digit.c -EXTRA_DIST += unictype/test-ctype_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-digit-tests @@ -1599,7 +1643,7 @@ TESTS += test-ctype_graph check_PROGRAMS += test-ctype_graph test_ctype_graph_SOURCES = unictype/test-ctype_graph.c -EXTRA_DIST += unictype/test-ctype_graph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_graph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-graph-tests @@ -1609,7 +1653,7 @@ TESTS += test-ctype_lower check_PROGRAMS += test-ctype_lower test_ctype_lower_SOURCES = unictype/test-ctype_lower.c -EXTRA_DIST += unictype/test-ctype_lower.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_lower.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-lower-tests @@ -1619,7 +1663,7 @@ TESTS += test-ctype_print check_PROGRAMS += test-ctype_print test_ctype_print_SOURCES = unictype/test-ctype_print.c -EXTRA_DIST += unictype/test-ctype_print.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_print.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-print-tests @@ -1629,7 +1673,7 @@ TESTS += test-ctype_punct check_PROGRAMS += test-ctype_punct test_ctype_punct_SOURCES = unictype/test-ctype_punct.c -EXTRA_DIST += unictype/test-ctype_punct.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_punct.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-punct-tests @@ -1639,7 +1683,7 @@ TESTS += test-ctype_space check_PROGRAMS += test-ctype_space test_ctype_space_SOURCES = unictype/test-ctype_space.c -EXTRA_DIST += unictype/test-ctype_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-space-tests @@ -1649,7 +1693,7 @@ TESTS += test-ctype_upper check_PROGRAMS += test-ctype_upper test_ctype_upper_SOURCES = unictype/test-ctype_upper.c -EXTRA_DIST += unictype/test-ctype_upper.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_upper.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-upper-tests @@ -1659,7 +1703,7 @@ TESTS += test-ctype_xdigit check_PROGRAMS += test-ctype_xdigit test_ctype_xdigit_SOURCES = unictype/test-ctype_xdigit.c -EXTRA_DIST += unictype/test-ctype_xdigit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_xdigit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-xdigit-tests @@ -1669,7 +1713,7 @@ TESTS += test-decdigit check_PROGRAMS += test-decdigit test_decdigit_SOURCES = unictype/test-decdigit.c -EXTRA_DIST += unictype/test-decdigit.c unictype/test-decdigit.h +EXTRA_DIST += unictype/test-decdigit.c unictype/test-decdigit.h macros.h ## end gnulib module unictype/decimal-digit-tests @@ -1679,7 +1723,7 @@ TESTS += test-digit check_PROGRAMS += test-digit test_digit_SOURCES = unictype/test-digit.c -EXTRA_DIST += unictype/test-digit.c unictype/test-digit.h +EXTRA_DIST += unictype/test-digit.c unictype/test-digit.h macros.h ## end gnulib module unictype/digit-tests @@ -1689,7 +1733,7 @@ TESTS += test-mirror check_PROGRAMS += test-mirror test_mirror_SOURCES = unictype/test-mirror.c -EXTRA_DIST += unictype/test-mirror.c +EXTRA_DIST += unictype/test-mirror.c macros.h ## end gnulib module unictype/mirror-tests @@ -1699,7 +1743,7 @@ TESTS += test-numeric check_PROGRAMS += test-numeric test_numeric_SOURCES = unictype/test-numeric.c -EXTRA_DIST += unictype/test-numeric.c unictype/test-numeric.h +EXTRA_DIST += unictype/test-numeric.c unictype/test-numeric.h macros.h ## end gnulib module unictype/numeric-tests @@ -1709,7 +1753,7 @@ TESTS += test-pr_alphabetic check_PROGRAMS += test-pr_alphabetic test_pr_alphabetic_SOURCES = unictype/test-pr_alphabetic.c -EXTRA_DIST += unictype/test-pr_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-alphabetic-tests @@ -1719,7 +1763,7 @@ TESTS += test-pr_ascii_hex_digit check_PROGRAMS += test-pr_ascii_hex_digit test_pr_ascii_hex_digit_SOURCES = unictype/test-pr_ascii_hex_digit.c -EXTRA_DIST += unictype/test-pr_ascii_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ascii_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ascii-hex-digit-tests @@ -1729,7 +1773,7 @@ TESTS += test-pr_bidi_arabic_digit check_PROGRAMS += test-pr_bidi_arabic_digit test_pr_bidi_arabic_digit_SOURCES = unictype/test-pr_bidi_arabic_digit.c -EXTRA_DIST += unictype/test-pr_bidi_arabic_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_arabic_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-arabic-digit-tests @@ -1739,7 +1783,7 @@ TESTS += test-pr_bidi_arabic_right_to_left check_PROGRAMS += test-pr_bidi_arabic_right_to_left test_pr_bidi_arabic_right_to_left_SOURCES = unictype/test-pr_bidi_arabic_right_to_left.c -EXTRA_DIST += unictype/test-pr_bidi_arabic_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_arabic_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-arabic-right-to-left-tests @@ -1749,7 +1793,7 @@ TESTS += test-pr_bidi_block_separator check_PROGRAMS += test-pr_bidi_block_separator test_pr_bidi_block_separator_SOURCES = unictype/test-pr_bidi_block_separator.c -EXTRA_DIST += unictype/test-pr_bidi_block_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_block_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-block-separator-tests @@ -1759,7 +1803,7 @@ TESTS += test-pr_bidi_boundary_neutral check_PROGRAMS += test-pr_bidi_boundary_neutral test_pr_bidi_boundary_neutral_SOURCES = unictype/test-pr_bidi_boundary_neutral.c -EXTRA_DIST += unictype/test-pr_bidi_boundary_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_boundary_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-boundary-neutral-tests @@ -1769,7 +1813,7 @@ TESTS += test-pr_bidi_common_separator check_PROGRAMS += test-pr_bidi_common_separator test_pr_bidi_common_separator_SOURCES = unictype/test-pr_bidi_common_separator.c -EXTRA_DIST += unictype/test-pr_bidi_common_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_common_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-common-separator-tests @@ -1779,7 +1823,7 @@ TESTS += test-pr_bidi_control check_PROGRAMS += test-pr_bidi_control test_pr_bidi_control_SOURCES = unictype/test-pr_bidi_control.c -EXTRA_DIST += unictype/test-pr_bidi_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-control-tests @@ -1789,7 +1833,7 @@ TESTS += test-pr_bidi_embedding_or_override check_PROGRAMS += test-pr_bidi_embedding_or_override test_pr_bidi_embedding_or_override_SOURCES = unictype/test-pr_bidi_embedding_or_override.c -EXTRA_DIST += unictype/test-pr_bidi_embedding_or_override.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_embedding_or_override.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-embedding-or-override-tests @@ -1799,7 +1843,7 @@ TESTS += test-pr_bidi_eur_num_separator check_PROGRAMS += test-pr_bidi_eur_num_separator test_pr_bidi_eur_num_separator_SOURCES = unictype/test-pr_bidi_eur_num_separator.c -EXTRA_DIST += unictype/test-pr_bidi_eur_num_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_eur_num_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-eur-num-separator-tests @@ -1809,7 +1853,7 @@ TESTS += test-pr_bidi_eur_num_terminator check_PROGRAMS += test-pr_bidi_eur_num_terminator test_pr_bidi_eur_num_terminator_SOURCES = unictype/test-pr_bidi_eur_num_terminator.c -EXTRA_DIST += unictype/test-pr_bidi_eur_num_terminator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_eur_num_terminator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-eur-num-terminator-tests @@ -1819,7 +1863,7 @@ TESTS += test-pr_bidi_european_digit check_PROGRAMS += test-pr_bidi_european_digit test_pr_bidi_european_digit_SOURCES = unictype/test-pr_bidi_european_digit.c -EXTRA_DIST += unictype/test-pr_bidi_european_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_european_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-european-digit-tests @@ -1829,7 +1873,7 @@ TESTS += test-pr_bidi_hebrew_right_to_left check_PROGRAMS += test-pr_bidi_hebrew_right_to_left test_pr_bidi_hebrew_right_to_left_SOURCES = unictype/test-pr_bidi_hebrew_right_to_left.c -EXTRA_DIST += unictype/test-pr_bidi_hebrew_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_hebrew_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-hebrew-right-to-left-tests @@ -1839,7 +1883,7 @@ TESTS += test-pr_bidi_left_to_right check_PROGRAMS += test-pr_bidi_left_to_right test_pr_bidi_left_to_right_SOURCES = unictype/test-pr_bidi_left_to_right.c -EXTRA_DIST += unictype/test-pr_bidi_left_to_right.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_left_to_right.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-left-to-right-tests @@ -1849,7 +1893,7 @@ TESTS += test-pr_bidi_non_spacing_mark check_PROGRAMS += test-pr_bidi_non_spacing_mark test_pr_bidi_non_spacing_mark_SOURCES = unictype/test-pr_bidi_non_spacing_mark.c -EXTRA_DIST += unictype/test-pr_bidi_non_spacing_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_non_spacing_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-non-spacing-mark-tests @@ -1859,7 +1903,7 @@ TESTS += test-pr_bidi_other_neutral check_PROGRAMS += test-pr_bidi_other_neutral test_pr_bidi_other_neutral_SOURCES = unictype/test-pr_bidi_other_neutral.c -EXTRA_DIST += unictype/test-pr_bidi_other_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_other_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-other-neutral-tests @@ -1869,7 +1913,7 @@ TESTS += test-pr_bidi_pdf check_PROGRAMS += test-pr_bidi_pdf test_pr_bidi_pdf_SOURCES = unictype/test-pr_bidi_pdf.c -EXTRA_DIST += unictype/test-pr_bidi_pdf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_pdf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-pdf-tests @@ -1879,7 +1923,7 @@ TESTS += test-pr_bidi_segment_separator check_PROGRAMS += test-pr_bidi_segment_separator test_pr_bidi_segment_separator_SOURCES = unictype/test-pr_bidi_segment_separator.c -EXTRA_DIST += unictype/test-pr_bidi_segment_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_segment_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-segment-separator-tests @@ -1889,7 +1933,7 @@ TESTS += test-pr_bidi_whitespace check_PROGRAMS += test-pr_bidi_whitespace test_pr_bidi_whitespace_SOURCES = unictype/test-pr_bidi_whitespace.c -EXTRA_DIST += unictype/test-pr_bidi_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-whitespace-tests @@ -1899,7 +1943,7 @@ TESTS += test-pr_byname check_PROGRAMS += test-pr_byname test_pr_byname_SOURCES = unictype/test-pr_byname.c -EXTRA_DIST += unictype/test-pr_byname.c +EXTRA_DIST += unictype/test-pr_byname.c macros.h ## end gnulib module unictype/property-byname-tests @@ -1909,7 +1953,7 @@ TESTS += test-pr_combining check_PROGRAMS += test-pr_combining test_pr_combining_SOURCES = unictype/test-pr_combining.c -EXTRA_DIST += unictype/test-pr_combining.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_combining.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-combining-tests @@ -1919,7 +1963,7 @@ TESTS += test-pr_composite check_PROGRAMS += test-pr_composite test_pr_composite_SOURCES = unictype/test-pr_composite.c -EXTRA_DIST += unictype/test-pr_composite.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_composite.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-composite-tests @@ -1929,7 +1973,7 @@ TESTS += test-pr_currency_symbol check_PROGRAMS += test-pr_currency_symbol test_pr_currency_symbol_SOURCES = unictype/test-pr_currency_symbol.c -EXTRA_DIST += unictype/test-pr_currency_symbol.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_currency_symbol.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-currency-symbol-tests @@ -1939,7 +1983,7 @@ TESTS += test-pr_dash check_PROGRAMS += test-pr_dash test_pr_dash_SOURCES = unictype/test-pr_dash.c -EXTRA_DIST += unictype/test-pr_dash.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_dash.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-dash-tests @@ -1949,7 +1993,7 @@ TESTS += test-pr_decimal_digit check_PROGRAMS += test-pr_decimal_digit test_pr_decimal_digit_SOURCES = unictype/test-pr_decimal_digit.c -EXTRA_DIST += unictype/test-pr_decimal_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_decimal_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-decimal-digit-tests @@ -1959,7 +2003,7 @@ TESTS += test-pr_default_ignorable_code_point check_PROGRAMS += test-pr_default_ignorable_code_point test_pr_default_ignorable_code_point_SOURCES = unictype/test-pr_default_ignorable_code_point.c -EXTRA_DIST += unictype/test-pr_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-default-ignorable-code-point-tests @@ -1969,7 +2013,7 @@ TESTS += test-pr_deprecated check_PROGRAMS += test-pr_deprecated test_pr_deprecated_SOURCES = unictype/test-pr_deprecated.c -EXTRA_DIST += unictype/test-pr_deprecated.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_deprecated.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-deprecated-tests @@ -1979,7 +2023,7 @@ TESTS += test-pr_diacritic check_PROGRAMS += test-pr_diacritic test_pr_diacritic_SOURCES = unictype/test-pr_diacritic.c -EXTRA_DIST += unictype/test-pr_diacritic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_diacritic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-diacritic-tests @@ -1989,7 +2033,7 @@ TESTS += test-pr_extender check_PROGRAMS += test-pr_extender test_pr_extender_SOURCES = unictype/test-pr_extender.c -EXTRA_DIST += unictype/test-pr_extender.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_extender.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-extender-tests @@ -1999,7 +2043,7 @@ TESTS += test-pr_format_control check_PROGRAMS += test-pr_format_control test_pr_format_control_SOURCES = unictype/test-pr_format_control.c -EXTRA_DIST += unictype/test-pr_format_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_format_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-format-control-tests @@ -2009,7 +2053,7 @@ TESTS += test-pr_grapheme_base check_PROGRAMS += test-pr_grapheme_base test_pr_grapheme_base_SOURCES = unictype/test-pr_grapheme_base.c -EXTRA_DIST += unictype/test-pr_grapheme_base.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_grapheme_base.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-grapheme-base-tests @@ -2019,7 +2063,7 @@ TESTS += test-pr_grapheme_extend check_PROGRAMS += test-pr_grapheme_extend test_pr_grapheme_extend_SOURCES = unictype/test-pr_grapheme_extend.c -EXTRA_DIST += unictype/test-pr_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-grapheme-extend-tests @@ -2029,7 +2073,7 @@ TESTS += test-pr_grapheme_link check_PROGRAMS += test-pr_grapheme_link test_pr_grapheme_link_SOURCES = unictype/test-pr_grapheme_link.c -EXTRA_DIST += unictype/test-pr_grapheme_link.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_grapheme_link.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-grapheme-link-tests @@ -2039,7 +2083,7 @@ TESTS += test-pr_hex_digit check_PROGRAMS += test-pr_hex_digit test_pr_hex_digit_SOURCES = unictype/test-pr_hex_digit.c -EXTRA_DIST += unictype/test-pr_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-hex-digit-tests @@ -2049,7 +2093,7 @@ TESTS += test-pr_hyphen check_PROGRAMS += test-pr_hyphen test_pr_hyphen_SOURCES = unictype/test-pr_hyphen.c -EXTRA_DIST += unictype/test-pr_hyphen.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_hyphen.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-hyphen-tests @@ -2059,7 +2103,7 @@ TESTS += test-pr_id_continue check_PROGRAMS += test-pr_id_continue test_pr_id_continue_SOURCES = unictype/test-pr_id_continue.c -EXTRA_DIST += unictype/test-pr_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-id-continue-tests @@ -2069,7 +2113,7 @@ TESTS += test-pr_id_start check_PROGRAMS += test-pr_id_start test_pr_id_start_SOURCES = unictype/test-pr_id_start.c -EXTRA_DIST += unictype/test-pr_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-id-start-tests @@ -2079,7 +2123,7 @@ TESTS += test-pr_ideographic check_PROGRAMS += test-pr_ideographic test_pr_ideographic_SOURCES = unictype/test-pr_ideographic.c -EXTRA_DIST += unictype/test-pr_ideographic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ideographic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ideographic-tests @@ -2089,7 +2133,7 @@ TESTS += test-pr_ids_binary_operator check_PROGRAMS += test-pr_ids_binary_operator test_pr_ids_binary_operator_SOURCES = unictype/test-pr_ids_binary_operator.c -EXTRA_DIST += unictype/test-pr_ids_binary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ids_binary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ids-binary-operator-tests @@ -2099,7 +2143,7 @@ TESTS += test-pr_ids_trinary_operator check_PROGRAMS += test-pr_ids_trinary_operator test_pr_ids_trinary_operator_SOURCES = unictype/test-pr_ids_trinary_operator.c -EXTRA_DIST += unictype/test-pr_ids_trinary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ids_trinary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ids-trinary-operator-tests @@ -2109,7 +2153,7 @@ TESTS += test-pr_ignorable_control check_PROGRAMS += test-pr_ignorable_control test_pr_ignorable_control_SOURCES = unictype/test-pr_ignorable_control.c -EXTRA_DIST += unictype/test-pr_ignorable_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ignorable_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ignorable-control-tests @@ -2119,7 +2163,7 @@ TESTS += test-pr_iso_control check_PROGRAMS += test-pr_iso_control test_pr_iso_control_SOURCES = unictype/test-pr_iso_control.c -EXTRA_DIST += unictype/test-pr_iso_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_iso_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-iso-control-tests @@ -2129,7 +2173,7 @@ TESTS += test-pr_join_control check_PROGRAMS += test-pr_join_control test_pr_join_control_SOURCES = unictype/test-pr_join_control.c -EXTRA_DIST += unictype/test-pr_join_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_join_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-join-control-tests @@ -2139,7 +2183,7 @@ TESTS += test-pr_left_of_pair check_PROGRAMS += test-pr_left_of_pair test_pr_left_of_pair_SOURCES = unictype/test-pr_left_of_pair.c -EXTRA_DIST += unictype/test-pr_left_of_pair.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_left_of_pair.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-left-of-pair-tests @@ -2149,7 +2193,7 @@ TESTS += test-pr_line_separator check_PROGRAMS += test-pr_line_separator test_pr_line_separator_SOURCES = unictype/test-pr_line_separator.c -EXTRA_DIST += unictype/test-pr_line_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_line_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-line-separator-tests @@ -2159,7 +2203,7 @@ TESTS += test-pr_logical_order_exception check_PROGRAMS += test-pr_logical_order_exception test_pr_logical_order_exception_SOURCES = unictype/test-pr_logical_order_exception.c -EXTRA_DIST += unictype/test-pr_logical_order_exception.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_logical_order_exception.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-logical-order-exception-tests @@ -2169,7 +2213,7 @@ TESTS += test-pr_lowercase check_PROGRAMS += test-pr_lowercase test_pr_lowercase_SOURCES = unictype/test-pr_lowercase.c -EXTRA_DIST += unictype/test-pr_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-lowercase-tests @@ -2179,7 +2223,7 @@ TESTS += test-pr_math check_PROGRAMS += test-pr_math test_pr_math_SOURCES = unictype/test-pr_math.c -EXTRA_DIST += unictype/test-pr_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-math-tests @@ -2189,7 +2233,7 @@ TESTS += test-pr_non_break check_PROGRAMS += test-pr_non_break test_pr_non_break_SOURCES = unictype/test-pr_non_break.c -EXTRA_DIST += unictype/test-pr_non_break.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_non_break.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-non-break-tests @@ -2199,7 +2243,7 @@ TESTS += test-pr_not_a_character check_PROGRAMS += test-pr_not_a_character test_pr_not_a_character_SOURCES = unictype/test-pr_not_a_character.c -EXTRA_DIST += unictype/test-pr_not_a_character.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_not_a_character.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-not-a-character-tests @@ -2209,7 +2253,7 @@ TESTS += test-pr_numeric check_PROGRAMS += test-pr_numeric test_pr_numeric_SOURCES = unictype/test-pr_numeric.c -EXTRA_DIST += unictype/test-pr_numeric.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_numeric.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-numeric-tests @@ -2219,7 +2263,7 @@ TESTS += test-pr_other_alphabetic check_PROGRAMS += test-pr_other_alphabetic test_pr_other_alphabetic_SOURCES = unictype/test-pr_other_alphabetic.c -EXTRA_DIST += unictype/test-pr_other_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-alphabetic-tests @@ -2229,7 +2273,7 @@ TESTS += test-pr_other_default_ignorable_code_point check_PROGRAMS += test-pr_other_default_ignorable_code_point test_pr_other_default_ignorable_code_point_SOURCES = unictype/test-pr_other_default_ignorable_code_point.c -EXTRA_DIST += unictype/test-pr_other_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-default-ignorable-code-point-tests @@ -2239,7 +2283,7 @@ TESTS += test-pr_other_grapheme_extend check_PROGRAMS += test-pr_other_grapheme_extend test_pr_other_grapheme_extend_SOURCES = unictype/test-pr_other_grapheme_extend.c -EXTRA_DIST += unictype/test-pr_other_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-grapheme-extend-tests @@ -2249,7 +2293,7 @@ TESTS += test-pr_other_id_continue check_PROGRAMS += test-pr_other_id_continue test_pr_other_id_continue_SOURCES = unictype/test-pr_other_id_continue.c -EXTRA_DIST += unictype/test-pr_other_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-id-continue-tests @@ -2259,7 +2303,7 @@ TESTS += test-pr_other_id_start check_PROGRAMS += test-pr_other_id_start test_pr_other_id_start_SOURCES = unictype/test-pr_other_id_start.c -EXTRA_DIST += unictype/test-pr_other_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-id-start-tests @@ -2269,7 +2313,7 @@ TESTS += test-pr_other_lowercase check_PROGRAMS += test-pr_other_lowercase test_pr_other_lowercase_SOURCES = unictype/test-pr_other_lowercase.c -EXTRA_DIST += unictype/test-pr_other_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-lowercase-tests @@ -2279,7 +2323,7 @@ TESTS += test-pr_other_math check_PROGRAMS += test-pr_other_math test_pr_other_math_SOURCES = unictype/test-pr_other_math.c -EXTRA_DIST += unictype/test-pr_other_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-math-tests @@ -2289,7 +2333,7 @@ TESTS += test-pr_other_uppercase check_PROGRAMS += test-pr_other_uppercase test_pr_other_uppercase_SOURCES = unictype/test-pr_other_uppercase.c -EXTRA_DIST += unictype/test-pr_other_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-uppercase-tests @@ -2299,7 +2343,7 @@ TESTS += test-pr_paired_punctuation check_PROGRAMS += test-pr_paired_punctuation test_pr_paired_punctuation_SOURCES = unictype/test-pr_paired_punctuation.c -EXTRA_DIST += unictype/test-pr_paired_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_paired_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-paired-punctuation-tests @@ -2309,7 +2353,7 @@ TESTS += test-pr_paragraph_separator check_PROGRAMS += test-pr_paragraph_separator test_pr_paragraph_separator_SOURCES = unictype/test-pr_paragraph_separator.c -EXTRA_DIST += unictype/test-pr_paragraph_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_paragraph_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-paragraph-separator-tests @@ -2319,7 +2363,7 @@ TESTS += test-pr_pattern_syntax check_PROGRAMS += test-pr_pattern_syntax test_pr_pattern_syntax_SOURCES = unictype/test-pr_pattern_syntax.c -EXTRA_DIST += unictype/test-pr_pattern_syntax.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_pattern_syntax.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-pattern-syntax-tests @@ -2329,7 +2373,7 @@ TESTS += test-pr_pattern_white_space check_PROGRAMS += test-pr_pattern_white_space test_pr_pattern_white_space_SOURCES = unictype/test-pr_pattern_white_space.c -EXTRA_DIST += unictype/test-pr_pattern_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_pattern_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-pattern-white-space-tests @@ -2339,7 +2383,7 @@ TESTS += test-pr_private_use check_PROGRAMS += test-pr_private_use test_pr_private_use_SOURCES = unictype/test-pr_private_use.c -EXTRA_DIST += unictype/test-pr_private_use.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_private_use.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-private-use-tests @@ -2349,7 +2393,7 @@ TESTS += test-pr_punctuation check_PROGRAMS += test-pr_punctuation test_pr_punctuation_SOURCES = unictype/test-pr_punctuation.c -EXTRA_DIST += unictype/test-pr_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-punctuation-tests @@ -2359,7 +2403,7 @@ TESTS += test-pr_quotation_mark check_PROGRAMS += test-pr_quotation_mark test_pr_quotation_mark_SOURCES = unictype/test-pr_quotation_mark.c -EXTRA_DIST += unictype/test-pr_quotation_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_quotation_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-quotation-mark-tests @@ -2369,7 +2413,7 @@ TESTS += test-pr_radical check_PROGRAMS += test-pr_radical test_pr_radical_SOURCES = unictype/test-pr_radical.c -EXTRA_DIST += unictype/test-pr_radical.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_radical.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-radical-tests @@ -2379,7 +2423,7 @@ TESTS += test-pr_sentence_terminal check_PROGRAMS += test-pr_sentence_terminal test_pr_sentence_terminal_SOURCES = unictype/test-pr_sentence_terminal.c -EXTRA_DIST += unictype/test-pr_sentence_terminal.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_sentence_terminal.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-sentence-terminal-tests @@ -2389,7 +2433,7 @@ TESTS += test-pr_soft_dotted check_PROGRAMS += test-pr_soft_dotted test_pr_soft_dotted_SOURCES = unictype/test-pr_soft_dotted.c -EXTRA_DIST += unictype/test-pr_soft_dotted.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_soft_dotted.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-soft-dotted-tests @@ -2399,7 +2443,7 @@ TESTS += test-pr_space check_PROGRAMS += test-pr_space test_pr_space_SOURCES = unictype/test-pr_space.c -EXTRA_DIST += unictype/test-pr_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-space-tests @@ -2409,7 +2453,7 @@ TESTS += test-pr_terminal_punctuation check_PROGRAMS += test-pr_terminal_punctuation test_pr_terminal_punctuation_SOURCES = unictype/test-pr_terminal_punctuation.c -EXTRA_DIST += unictype/test-pr_terminal_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_terminal_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-terminal-punctuation-tests @@ -2419,7 +2463,7 @@ TESTS += test-pr_test check_PROGRAMS += test-pr_test test_pr_test_SOURCES = unictype/test-pr_test.c -EXTRA_DIST += unictype/test-pr_test.c +EXTRA_DIST += unictype/test-pr_test.c macros.h ## end gnulib module unictype/property-test-tests @@ -2429,7 +2473,7 @@ TESTS += test-pr_titlecase check_PROGRAMS += test-pr_titlecase test_pr_titlecase_SOURCES = unictype/test-pr_titlecase.c -EXTRA_DIST += unictype/test-pr_titlecase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_titlecase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-titlecase-tests @@ -2439,7 +2483,7 @@ TESTS += test-pr_unassigned_code_value check_PROGRAMS += test-pr_unassigned_code_value test_pr_unassigned_code_value_SOURCES = unictype/test-pr_unassigned_code_value.c -EXTRA_DIST += unictype/test-pr_unassigned_code_value.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_unassigned_code_value.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-unassigned-code-value-tests @@ -2449,7 +2493,7 @@ TESTS += test-pr_unified_ideograph check_PROGRAMS += test-pr_unified_ideograph test_pr_unified_ideograph_SOURCES = unictype/test-pr_unified_ideograph.c -EXTRA_DIST += unictype/test-pr_unified_ideograph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_unified_ideograph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-unified-ideograph-tests @@ -2459,7 +2503,7 @@ TESTS += test-pr_uppercase check_PROGRAMS += test-pr_uppercase test_pr_uppercase_SOURCES = unictype/test-pr_uppercase.c -EXTRA_DIST += unictype/test-pr_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-uppercase-tests @@ -2469,7 +2513,7 @@ TESTS += test-pr_variation_selector check_PROGRAMS += test-pr_variation_selector test_pr_variation_selector_SOURCES = unictype/test-pr_variation_selector.c -EXTRA_DIST += unictype/test-pr_variation_selector.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_variation_selector.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-variation-selector-tests @@ -2479,7 +2523,7 @@ TESTS += test-pr_white_space check_PROGRAMS += test-pr_white_space test_pr_white_space_SOURCES = unictype/test-pr_white_space.c -EXTRA_DIST += unictype/test-pr_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-white-space-tests @@ -2489,7 +2533,7 @@ TESTS += test-pr_xid_continue check_PROGRAMS += test-pr_xid_continue test_pr_xid_continue_SOURCES = unictype/test-pr_xid_continue.c -EXTRA_DIST += unictype/test-pr_xid_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_xid_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-xid-continue-tests @@ -2499,7 +2543,7 @@ TESTS += test-pr_xid_start check_PROGRAMS += test-pr_xid_start test_pr_xid_start_SOURCES = unictype/test-pr_xid_start.c -EXTRA_DIST += unictype/test-pr_xid_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_xid_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-xid-start-tests @@ -2509,7 +2553,7 @@ TESTS += test-pr_zero_width check_PROGRAMS += test-pr_zero_width test_pr_zero_width_SOURCES = unictype/test-pr_zero_width.c -EXTRA_DIST += unictype/test-pr_zero_width.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_zero_width.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-zero-width-tests @@ -2519,7 +2563,7 @@ TESTS += test-scripts check_PROGRAMS += test-scripts test_scripts_SOURCES = unictype/test-scripts.c -EXTRA_DIST += unictype/test-scripts.c +EXTRA_DIST += unictype/test-scripts.c macros.h ## end gnulib module unictype/scripts-tests @@ -2529,7 +2573,7 @@ TESTS += test-sy_c_ident check_PROGRAMS += test-sy_c_ident test_sy_c_ident_SOURCES = unictype/test-sy_c_ident.c -EXTRA_DIST += unictype/test-sy_c_ident.c +EXTRA_DIST += unictype/test-sy_c_ident.c macros.h ## end gnulib module unictype/syntax-c-ident-tests @@ -2539,7 +2583,7 @@ TESTS += test-sy_c_whitespace check_PROGRAMS += test-sy_c_whitespace test_sy_c_whitespace_SOURCES = unictype/test-sy_c_whitespace.c -EXTRA_DIST += unictype/test-sy_c_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-sy_c_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/syntax-c-whitespace-tests @@ -2549,7 +2593,7 @@ TESTS += test-sy_java_ident check_PROGRAMS += test-sy_java_ident test_sy_java_ident_SOURCES = unictype/test-sy_java_ident.c -EXTRA_DIST += unictype/test-sy_java_ident.c +EXTRA_DIST += unictype/test-sy_java_ident.c macros.h ## end gnulib module unictype/syntax-java-ident-tests @@ -2559,7 +2603,7 @@ TESTS += test-sy_java_whitespace check_PROGRAMS += test-sy_java_whitespace test_sy_java_whitespace_SOURCES = unictype/test-sy_java_whitespace.c -EXTRA_DIST += unictype/test-sy_java_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-sy_java_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/syntax-java-whitespace-tests @@ -2569,7 +2613,7 @@ TESTS += test-u16-possible-linebreaks check_PROGRAMS += test-u16-possible-linebreaks test_u16_possible_linebreaks_SOURCES = unilbrk/test-u16-possible-linebreaks.c -EXTRA_DIST += unilbrk/test-u16-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-u16-possible-linebreaks.c macros.h ## end gnulib module unilbrk/u16-possible-linebreaks-tests @@ -2579,7 +2623,7 @@ TESTS += test-u16-width-linebreaks check_PROGRAMS += test-u16-width-linebreaks test_u16_width_linebreaks_SOURCES = unilbrk/test-u16-width-linebreaks.c -EXTRA_DIST += unilbrk/test-u16-width-linebreaks.c +EXTRA_DIST += unilbrk/test-u16-width-linebreaks.c macros.h ## end gnulib module unilbrk/u16-width-linebreaks-tests @@ -2589,7 +2633,7 @@ TESTS += test-u32-possible-linebreaks check_PROGRAMS += test-u32-possible-linebreaks test_u32_possible_linebreaks_SOURCES = unilbrk/test-u32-possible-linebreaks.c -EXTRA_DIST += unilbrk/test-u32-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-u32-possible-linebreaks.c macros.h ## end gnulib module unilbrk/u32-possible-linebreaks-tests @@ -2599,7 +2643,7 @@ TESTS += test-u32-width-linebreaks check_PROGRAMS += test-u32-width-linebreaks test_u32_width_linebreaks_SOURCES = unilbrk/test-u32-width-linebreaks.c -EXTRA_DIST += unilbrk/test-u32-width-linebreaks.c +EXTRA_DIST += unilbrk/test-u32-width-linebreaks.c macros.h ## end gnulib module unilbrk/u32-width-linebreaks-tests @@ -2609,7 +2653,7 @@ TESTS += test-u8-possible-linebreaks check_PROGRAMS += test-u8-possible-linebreaks test_u8_possible_linebreaks_SOURCES = unilbrk/test-u8-possible-linebreaks.c -EXTRA_DIST += unilbrk/test-u8-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-u8-possible-linebreaks.c macros.h ## end gnulib module unilbrk/u8-possible-linebreaks-tests @@ -2619,7 +2663,7 @@ TESTS += test-u8-width-linebreaks check_PROGRAMS += test-u8-width-linebreaks test_u8_width_linebreaks_SOURCES = unilbrk/test-u8-width-linebreaks.c -EXTRA_DIST += unilbrk/test-u8-width-linebreaks.c +EXTRA_DIST += unilbrk/test-u8-width-linebreaks.c macros.h ## end gnulib module unilbrk/u8-width-linebreaks-tests @@ -2630,7 +2674,7 @@ check_PROGRAMS += test-ulc-possible-linebreaks test_ulc_possible_linebreaks_SOURCES = unilbrk/test-ulc-possible-linebreaks.c test_ulc_possible_linebreaks_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unilbrk/test-ulc-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-ulc-possible-linebreaks.c macros.h ## end gnulib module unilbrk/ulc-possible-linebreaks-tests @@ -2641,14 +2685,13 @@ check_PROGRAMS += test-ulc-width-linebreaks test_ulc_width_linebreaks_SOURCES = unilbrk/test-ulc-width-linebreaks.c test_ulc_width_linebreaks_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unilbrk/test-ulc-width-linebreaks.c +EXTRA_DIST += unilbrk/test-ulc-width-linebreaks.c macros.h ## end gnulib module unilbrk/ulc-width-linebreaks-tests ## begin gnulib module uniname/uniname-tests TESTS += uniname/test-uninames.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' check_PROGRAMS += test-uninames test_uninames_SOURCES = uniname/test-uninames.c test_uninames_LDADD = $(LDADD) @LIBINTL@ @@ -2663,7 +2706,7 @@ TESTS += test-canonical-decomposition check_PROGRAMS += test-canonical-decomposition test_canonical_decomposition_SOURCES = uninorm/test-canonical-decomposition.c -EXTRA_DIST += uninorm/test-canonical-decomposition.c +EXTRA_DIST += uninorm/test-canonical-decomposition.c macros.h ## end gnulib module uninorm/canonical-decomposition-tests @@ -2673,7 +2716,7 @@ TESTS += test-compat-decomposition check_PROGRAMS += test-compat-decomposition test_compat_decomposition_SOURCES = uninorm/test-compat-decomposition.c -EXTRA_DIST += uninorm/test-compat-decomposition.c +EXTRA_DIST += uninorm/test-compat-decomposition.c macros.h ## end gnulib module uninorm/compat-decomposition-tests @@ -2683,7 +2726,7 @@ TESTS += test-composition check_PROGRAMS += test-composition test_composition_SOURCES = uninorm/test-composition.c -EXTRA_DIST += uninorm/test-composition.c +EXTRA_DIST += uninorm/test-composition.c macros.h ## end gnulib module uninorm/composition-tests @@ -2693,7 +2736,7 @@ TESTS += test-decomposing-form check_PROGRAMS += test-decomposing-form test_decomposing_form_SOURCES = uninorm/test-decomposing-form.c -EXTRA_DIST += uninorm/test-decomposing-form.c +EXTRA_DIST += uninorm/test-decomposing-form.c macros.h ## end gnulib module uninorm/decomposing-form-tests @@ -2703,7 +2746,7 @@ TESTS += test-decomposition check_PROGRAMS += test-decomposition test_decomposition_SOURCES = uninorm/test-decomposition.c -EXTRA_DIST += uninorm/test-decomposition.c +EXTRA_DIST += uninorm/test-decomposition.c macros.h ## end gnulib module uninorm/decomposition-tests @@ -2713,7 +2756,7 @@ TESTS += test-uninorm-filter-nfc check_PROGRAMS += test-uninorm-filter-nfc test_uninorm_filter_nfc_SOURCES = uninorm/test-uninorm-filter-nfc.c -EXTRA_DIST += uninorm/test-uninorm-filter-nfc.c +EXTRA_DIST += uninorm/test-uninorm-filter-nfc.c macros.h ## end gnulib module uninorm/filter-tests @@ -2730,7 +2773,7 @@ test_u32_nfc_big_SOURCES = \ uninorm/test-u32-nfc-big.c \ uninorm/test-u32-normalize-big.c test_u32_nfc_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfc.c uninorm/test-u8-nfc.c uninorm/test-u16-nfc.c uninorm/test-u32-nfc.c uninorm/test-u32-nfc-big.sh uninorm/test-u32-nfc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfc.c uninorm/test-u8-nfc.c uninorm/test-u16-nfc.c uninorm/test-u32-nfc.c uninorm/test-u32-nfc-big.sh uninorm/test-u32-nfc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfc-tests @@ -2748,7 +2791,7 @@ test_u32_nfd_big_SOURCES = \ uninorm/test-u32-normalize-big.c test_u32_nfd_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfd.c uninorm/test-u8-nfd.c uninorm/test-u16-nfd.c uninorm/test-u32-nfd.c uninorm/test-u32-nfd-big.sh uninorm/test-u32-nfd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfd.c uninorm/test-u8-nfd.c uninorm/test-u16-nfd.c uninorm/test-u32-nfd.c uninorm/test-u32-nfd-big.sh uninorm/test-u32-nfd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfd-tests @@ -2766,7 +2809,7 @@ test_u32_nfkc_big_SOURCES = \ uninorm/test-u32-normalize-big.c test_u32_nfkc_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfkc.c uninorm/test-u8-nfkc.c uninorm/test-u16-nfkc.c uninorm/test-u32-nfkc.c uninorm/test-u32-nfkc-big.sh uninorm/test-u32-nfkc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfkc.c uninorm/test-u8-nfkc.c uninorm/test-u16-nfkc.c uninorm/test-u32-nfkc.c uninorm/test-u32-nfkc-big.sh uninorm/test-u32-nfkc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfkc-tests @@ -2784,7 +2827,7 @@ test_u32_nfkd_big_SOURCES = \ uninorm/test-u32-normalize-big.c test_u32_nfkd_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfkd.c uninorm/test-u8-nfkd.c uninorm/test-u16-nfkd.c uninorm/test-u32-nfkd.c uninorm/test-u32-nfkd-big.sh uninorm/test-u32-nfkd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfkd.c uninorm/test-u8-nfkd.c uninorm/test-u16-nfkd.c uninorm/test-u32-nfkd.c uninorm/test-u32-nfkd-big.sh uninorm/test-u32-nfkd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfkd-tests @@ -2794,7 +2837,7 @@ TESTS += test-u16-normcmp check_PROGRAMS += test-u16-normcmp test_u16_normcmp_SOURCES = uninorm/test-u16-normcmp.c -EXTRA_DIST += uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h +EXTRA_DIST += uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h macros.h ## end gnulib module uninorm/u16-normcmp-tests @@ -2805,7 +2848,7 @@ check_PROGRAMS += test-u16-normcoll test_u16_normcoll_SOURCES = uninorm/test-u16-normcoll.c test_u16_normcoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uninorm/test-u16-normcoll.c uninorm/test-u16-normcmp.h +EXTRA_DIST += uninorm/test-u16-normcoll.c uninorm/test-u16-normcmp.h macros.h ## end gnulib module uninorm/u16-normcoll-tests @@ -2815,7 +2858,7 @@ TESTS += test-u32-normcmp check_PROGRAMS += test-u32-normcmp test_u32_normcmp_SOURCES = uninorm/test-u32-normcmp.c -EXTRA_DIST += uninorm/test-u32-normcmp.c uninorm/test-u32-normcmp.h +EXTRA_DIST += uninorm/test-u32-normcmp.c uninorm/test-u32-normcmp.h macros.h ## end gnulib module uninorm/u32-normcmp-tests @@ -2826,7 +2869,7 @@ check_PROGRAMS += test-u32-normcoll test_u32_normcoll_SOURCES = uninorm/test-u32-normcoll.c test_u32_normcoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uninorm/test-u32-normcoll.c uninorm/test-u32-normcmp.h +EXTRA_DIST += uninorm/test-u32-normcoll.c uninorm/test-u32-normcmp.h macros.h ## end gnulib module uninorm/u32-normcoll-tests @@ -2836,7 +2879,7 @@ TESTS += test-u8-normcmp check_PROGRAMS += test-u8-normcmp test_u8_normcmp_SOURCES = uninorm/test-u8-normcmp.c -EXTRA_DIST += uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h +EXTRA_DIST += uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h macros.h ## end gnulib module uninorm/u8-normcmp-tests @@ -2847,7 +2890,7 @@ check_PROGRAMS += test-u8-normcoll test_u8_normcoll_SOURCES = uninorm/test-u8-normcoll.c test_u8_normcoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h +EXTRA_DIST += uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h macros.h ## end gnulib module uninorm/u8-normcoll-tests @@ -2855,7 +2898,6 @@ EXTRA_DIST += uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h TESTS += test-unistd check_PROGRAMS += test-unistd - EXTRA_DIST += test-unistd.c ## end gnulib module unistd-tests @@ -2866,14 +2908,14 @@ TESTS += test-u16-asnprintf1 check_PROGRAMS += test-u16-asnprintf1 test_u16_asnprintf1_SOURCES = unistdio/test-u16-asnprintf1.c test_u16_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-asnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-asnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-asnprintf-tests ## begin gnulib module unistdio/u16-vasnprintf-tests TESTS += test-u16-vasnprintf1 unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-u16-vasnprintf1 test-u16-vasnprintf2 test-u16-vasnprintf3 test_u16_vasnprintf1_SOURCES = unistdio/test-u16-vasnprintf1.c test_u16_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -2881,7 +2923,7 @@ test_u16_vasnprintf2_SOURCES = unistdio/test-u16-vasnprintf2.c test_u16_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_u16_vasnprintf3_SOURCES = unistdio/test-u16-vasnprintf3.c test_u16_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vasnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf2.c unistdio/test-u16-vasnprintf3.sh unistdio/test-u16-vasnprintf3.c +EXTRA_DIST += unistdio/test-u16-vasnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf2.c unistdio/test-u16-vasnprintf3.sh unistdio/test-u16-vasnprintf3.c macros.h ## end gnulib module unistdio/u16-vasnprintf-tests @@ -2891,7 +2933,7 @@ TESTS += test-u16-vasprintf1 check_PROGRAMS += test-u16-vasprintf1 test_u16_vasprintf1_SOURCES = unistdio/test-u16-vasprintf1.c test_u16_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vasprintf1.c unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-vasprintf1.c unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-vasprintf-tests @@ -2901,7 +2943,7 @@ TESTS += test-u16-vsnprintf1 check_PROGRAMS += test-u16-vsnprintf1 test_u16_vsnprintf1_SOURCES = unistdio/test-u16-vsnprintf1.c test_u16_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vsnprintf1.c unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-vsnprintf1.c unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-vsnprintf-tests @@ -2911,7 +2953,7 @@ TESTS += test-u16-vsprintf1 check_PROGRAMS += test-u16-vsprintf1 test_u16_vsprintf1_SOURCES = unistdio/test-u16-vsprintf1.c test_u16_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vsprintf1.c unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-vsprintf1.c unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-vsprintf-tests @@ -2921,14 +2963,14 @@ TESTS += test-u32-asnprintf1 check_PROGRAMS += test-u32-asnprintf1 test_u32_asnprintf1_SOURCES = unistdio/test-u32-asnprintf1.c test_u32_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-asnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-asnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-asnprintf-tests ## begin gnulib module unistdio/u32-vasnprintf-tests TESTS += test-u32-vasnprintf1 unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-u32-vasnprintf1 test-u32-vasnprintf2 test-u32-vasnprintf3 test_u32_vasnprintf1_SOURCES = unistdio/test-u32-vasnprintf1.c test_u32_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -2936,7 +2978,7 @@ test_u32_vasnprintf2_SOURCES = unistdio/test-u32-vasnprintf2.c test_u32_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_u32_vasnprintf3_SOURCES = unistdio/test-u32-vasnprintf3.c test_u32_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vasnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf2.c unistdio/test-u32-vasnprintf3.sh unistdio/test-u32-vasnprintf3.c +EXTRA_DIST += unistdio/test-u32-vasnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf2.c unistdio/test-u32-vasnprintf3.sh unistdio/test-u32-vasnprintf3.c macros.h ## end gnulib module unistdio/u32-vasnprintf-tests @@ -2946,7 +2988,7 @@ TESTS += test-u32-vasprintf1 check_PROGRAMS += test-u32-vasprintf1 test_u32_vasprintf1_SOURCES = unistdio/test-u32-vasprintf1.c test_u32_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vasprintf1.c unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-vasprintf1.c unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-vasprintf-tests @@ -2956,7 +2998,7 @@ TESTS += test-u32-vsnprintf1 check_PROGRAMS += test-u32-vsnprintf1 test_u32_vsnprintf1_SOURCES = unistdio/test-u32-vsnprintf1.c test_u32_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vsnprintf1.c unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-vsnprintf1.c unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-vsnprintf-tests @@ -2966,7 +3008,7 @@ TESTS += test-u32-vsprintf1 check_PROGRAMS += test-u32-vsprintf1 test_u32_vsprintf1_SOURCES = unistdio/test-u32-vsprintf1.c test_u32_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vsprintf1.c unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-vsprintf1.c unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-vsprintf-tests @@ -2976,14 +3018,14 @@ TESTS += test-u8-asnprintf1 check_PROGRAMS += test-u8-asnprintf1 test_u8_asnprintf1_SOURCES = unistdio/test-u8-asnprintf1.c test_u8_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-asnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-asnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-asnprintf-tests ## begin gnulib module unistdio/u8-vasnprintf-tests TESTS += test-u8-vasnprintf1 unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-u8-vasnprintf1 test-u8-vasnprintf2 test-u8-vasnprintf3 test_u8_vasnprintf1_SOURCES = unistdio/test-u8-vasnprintf1.c test_u8_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -2991,7 +3033,7 @@ test_u8_vasnprintf2_SOURCES = unistdio/test-u8-vasnprintf2.c test_u8_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_u8_vasnprintf3_SOURCES = unistdio/test-u8-vasnprintf3.c test_u8_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vasnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf2.c unistdio/test-u8-vasnprintf3.sh unistdio/test-u8-vasnprintf3.c +EXTRA_DIST += unistdio/test-u8-vasnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf2.c unistdio/test-u8-vasnprintf3.sh unistdio/test-u8-vasnprintf3.c macros.h ## end gnulib module unistdio/u8-vasnprintf-tests @@ -3001,7 +3043,7 @@ TESTS += test-u8-vasprintf1 check_PROGRAMS += test-u8-vasprintf1 test_u8_vasprintf1_SOURCES = unistdio/test-u8-vasprintf1.c test_u8_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vasprintf1.c unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-vasprintf1.c unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-vasprintf-tests @@ -3011,7 +3053,7 @@ TESTS += test-u8-vsnprintf1 check_PROGRAMS += test-u8-vsnprintf1 test_u8_vsnprintf1_SOURCES = unistdio/test-u8-vsnprintf1.c test_u8_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vsnprintf1.c unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-vsnprintf1.c unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-vsnprintf-tests @@ -3021,7 +3063,7 @@ TESTS += test-u8-vsprintf1 check_PROGRAMS += test-u8-vsprintf1 test_u8_vsprintf1_SOURCES = unistdio/test-u8-vsprintf1.c test_u8_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vsprintf1.c unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-vsprintf1.c unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-vsprintf-tests @@ -3031,14 +3073,14 @@ TESTS += test-ulc-asnprintf1 check_PROGRAMS += test-ulc-asnprintf1 test_ulc_asnprintf1_SOURCES = unistdio/test-ulc-asnprintf1.c test_ulc_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-asnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-asnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-asnprintf-tests ## begin gnulib module unistdio/ulc-vasnprintf-tests TESTS += test-ulc-vasnprintf1 unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-ulc-vasnprintf1 test-ulc-vasnprintf2 test-ulc-vasnprintf3 test_ulc_vasnprintf1_SOURCES = unistdio/test-ulc-vasnprintf1.c test_ulc_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -3046,7 +3088,7 @@ test_ulc_vasnprintf2_SOURCES = unistdio/test-ulc-vasnprintf2.c test_ulc_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_ulc_vasnprintf3_SOURCES = unistdio/test-ulc-vasnprintf3.c test_ulc_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vasnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf2.c unistdio/test-ulc-vasnprintf3.sh unistdio/test-ulc-vasnprintf3.c +EXTRA_DIST += unistdio/test-ulc-vasnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf2.c unistdio/test-ulc-vasnprintf3.sh unistdio/test-ulc-vasnprintf3.c macros.h ## end gnulib module unistdio/ulc-vasnprintf-tests @@ -3056,7 +3098,7 @@ TESTS += test-ulc-vasprintf1 check_PROGRAMS += test-ulc-vasprintf1 test_ulc_vasprintf1_SOURCES = unistdio/test-ulc-vasprintf1.c test_ulc_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vasprintf1.c unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-vasprintf1.c unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-vasprintf-tests @@ -3066,7 +3108,7 @@ TESTS += test-ulc-vsnprintf1 check_PROGRAMS += test-ulc-vsnprintf1 test_ulc_vsnprintf1_SOURCES = unistdio/test-ulc-vsnprintf1.c test_ulc_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vsnprintf1.c unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-vsnprintf1.c unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-vsnprintf-tests @@ -3076,17 +3118,884 @@ TESTS += test-ulc-vsprintf1 check_PROGRAMS += test-ulc-vsprintf1 test_ulc_vsprintf1_SOURCES = unistdio/test-ulc-vsprintf1.c test_ulc_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vsprintf1.c unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-vsprintf1.c unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-vsprintf-tests +## begin gnulib module unistr/u16-check-tests + +TESTS += test-u16-check +check_PROGRAMS += test-u16-check +test_u16_check_SOURCES = unistr/test-u16-check.c +EXTRA_DIST += unistr/test-u16-check.c macros.h + +## end gnulib module unistr/u16-check-tests + +## begin gnulib module unistr/u16-chr-tests + +TESTS += test-u16-chr +check_PROGRAMS += test-u16-chr +test_u16_chr_SOURCES = unistr/test-u16-chr.c +EXTRA_DIST += unistr/test-u16-chr.c unistr/test-chr.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-chr-tests + +## begin gnulib module unistr/u16-cmp-tests + +TESTS += test-u16-cmp +check_PROGRAMS += test-u16-cmp +test_u16_cmp_SOURCES = unistr/test-u16-cmp.c +EXTRA_DIST += unistr/test-u16-cmp.c unistr/test-cmp.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-cmp-tests + +## begin gnulib module unistr/u16-cmp2-tests + +TESTS += test-u16-cmp2 +check_PROGRAMS += test-u16-cmp2 +test_u16_cmp2_SOURCES = unistr/test-u16-cmp2.c +EXTRA_DIST += unistr/test-u16-cmp2.c unistr/test-cmp2.h macros.h + +## end gnulib module unistr/u16-cmp2-tests + +## begin gnulib module unistr/u16-cpy-alloc-tests + +TESTS += test-u16-cpy-alloc +check_PROGRAMS += test-u16-cpy-alloc +test_u16_cpy_alloc_SOURCES = unistr/test-u16-cpy-alloc.c +EXTRA_DIST += unistr/test-u16-cpy-alloc.c unistr/test-cpy-alloc.h macros.h + +## end gnulib module unistr/u16-cpy-alloc-tests + +## begin gnulib module unistr/u16-cpy-tests + +TESTS += test-u16-cpy +check_PROGRAMS += test-u16-cpy +test_u16_cpy_SOURCES = unistr/test-u16-cpy.c +EXTRA_DIST += unistr/test-u16-cpy.c unistr/test-cpy.h macros.h + +## end gnulib module unistr/u16-cpy-tests + +## begin gnulib module unistr/u16-mblen-tests + +TESTS += test-u16-mblen +check_PROGRAMS += test-u16-mblen +test_u16_mblen_SOURCES = unistr/test-u16-mblen.c +EXTRA_DIST += unistr/test-u16-mblen.c macros.h + +## end gnulib module unistr/u16-mblen-tests + +## begin gnulib module unistr/u16-mbsnlen-tests + +TESTS += test-u16-mbsnlen +check_PROGRAMS += test-u16-mbsnlen +test_u16_mbsnlen_SOURCES = unistr/test-u16-mbsnlen.c +EXTRA_DIST += unistr/test-u16-mbsnlen.c macros.h + +## end gnulib module unistr/u16-mbsnlen-tests + +## begin gnulib module unistr/u16-mbtouc-tests + +TESTS += test-u16-mbtouc +check_PROGRAMS += test-u16-mbtouc +test_u16_mbtouc_SOURCES = unistr/test-u16-mbtouc.c +EXTRA_DIST += unistr/test-u16-mbtouc.c unistr/test-u16-mbtouc.h macros.h + +## end gnulib module unistr/u16-mbtouc-tests + +## begin gnulib module unistr/u16-mbtouc-unsafe-tests + +TESTS += test-u16-mbtouc-unsafe +check_PROGRAMS += test-u16-mbtouc-unsafe +test_u16_mbtouc_unsafe_SOURCES = unistr/test-u16-mbtouc-unsafe.c +EXTRA_DIST += unistr/test-u16-mbtouc-unsafe.c unistr/test-u16-mbtouc.h macros.h + +## end gnulib module unistr/u16-mbtouc-unsafe-tests + +## begin gnulib module unistr/u16-mbtoucr-tests + +TESTS += test-u16-mbtoucr +check_PROGRAMS += test-u16-mbtoucr +test_u16_mbtoucr_SOURCES = unistr/test-u16-mbtoucr.c +EXTRA_DIST += unistr/test-u16-mbtoucr.c macros.h + +## end gnulib module unistr/u16-mbtoucr-tests + +## begin gnulib module unistr/u16-move-tests + +TESTS += test-u16-move +check_PROGRAMS += test-u16-move +test_u16_move_SOURCES = unistr/test-u16-move.c +EXTRA_DIST += unistr/test-u16-move.c unistr/test-move.h macros.h + +## end gnulib module unistr/u16-move-tests + +## begin gnulib module unistr/u16-next-tests + +TESTS += test-u16-next +check_PROGRAMS += test-u16-next +test_u16_next_SOURCES = unistr/test-u16-next.c +EXTRA_DIST += unistr/test-u16-next.c macros.h + +## end gnulib module unistr/u16-next-tests + +## begin gnulib module unistr/u16-prev-tests + +TESTS += test-u16-prev +check_PROGRAMS += test-u16-prev +test_u16_prev_SOURCES = unistr/test-u16-prev.c +EXTRA_DIST += unistr/test-u16-prev.c macros.h + +## end gnulib module unistr/u16-prev-tests + +## begin gnulib module unistr/u16-set-tests + +TESTS += test-u16-set +check_PROGRAMS += test-u16-set +test_u16_set_SOURCES = unistr/test-u16-set.c +EXTRA_DIST += unistr/test-u16-set.c unistr/test-set.h macros.h + +## end gnulib module unistr/u16-set-tests + +## begin gnulib module unistr/u16-stpcpy-tests + +TESTS += test-u16-stpcpy +check_PROGRAMS += test-u16-stpcpy +test_u16_stpcpy_SOURCES = unistr/test-u16-stpcpy.c +EXTRA_DIST += unistr/test-u16-stpcpy.c unistr/test-stpcpy.h macros.h + +## end gnulib module unistr/u16-stpcpy-tests + +## begin gnulib module unistr/u16-stpncpy-tests + +TESTS += test-u16-stpncpy +check_PROGRAMS += test-u16-stpncpy +test_u16_stpncpy_SOURCES = unistr/test-u16-stpncpy.c +EXTRA_DIST += unistr/test-u16-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-stpncpy-tests + +## begin gnulib module unistr/u16-strcat-tests + +TESTS += test-u16-strcat +check_PROGRAMS += test-u16-strcat +test_u16_strcat_SOURCES = unistr/test-u16-strcat.c +EXTRA_DIST += unistr/test-u16-strcat.c unistr/test-strcat.h macros.h + +## end gnulib module unistr/u16-strcat-tests + +## begin gnulib module unistr/u16-strcmp-tests + +TESTS += test-u16-strcmp +check_PROGRAMS += test-u16-strcmp +test_u16_strcmp_SOURCES = unistr/test-u16-strcmp.c +EXTRA_DIST += unistr/test-u16-strcmp.c unistr/test-u16-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u16-strcmp-tests + +## begin gnulib module unistr/u16-strcoll-tests + +TESTS += test-u16-strcoll +check_PROGRAMS += test-u16-strcoll +test_u16_strcoll_SOURCES = unistr/test-u16-strcoll.c +test_u16_strcoll_LDADD = $(LDADD) @LIBICONV@ +EXTRA_DIST += unistr/test-u16-strcoll.c unistr/test-u16-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u16-strcoll-tests + +## begin gnulib module unistr/u16-strcpy-tests + +TESTS += test-u16-strcpy +check_PROGRAMS += test-u16-strcpy +test_u16_strcpy_SOURCES = unistr/test-u16-strcpy.c +EXTRA_DIST += unistr/test-u16-strcpy.c unistr/test-strcpy.h macros.h + +## end gnulib module unistr/u16-strcpy-tests + +## begin gnulib module unistr/u16-strdup-tests + +TESTS += test-u16-strdup +check_PROGRAMS += test-u16-strdup +test_u16_strdup_SOURCES = unistr/test-u16-strdup.c +EXTRA_DIST += unistr/test-u16-strdup.c unistr/test-strdup.h macros.h + +## end gnulib module unistr/u16-strdup-tests + +## begin gnulib module unistr/u16-strlen-tests + +TESTS += test-u16-strlen +check_PROGRAMS += test-u16-strlen +test_u16_strlen_SOURCES = unistr/test-u16-strlen.c +EXTRA_DIST += unistr/test-u16-strlen.c macros.h + +## end gnulib module unistr/u16-strlen-tests + +## begin gnulib module unistr/u16-strmblen-tests + +TESTS += test-u16-strmblen +check_PROGRAMS += test-u16-strmblen +test_u16_strmblen_SOURCES = unistr/test-u16-strmblen.c +EXTRA_DIST += unistr/test-u16-strmblen.c macros.h + +## end gnulib module unistr/u16-strmblen-tests + +## begin gnulib module unistr/u16-strmbtouc-tests + +TESTS += test-u16-strmbtouc +check_PROGRAMS += test-u16-strmbtouc +test_u16_strmbtouc_SOURCES = unistr/test-u16-strmbtouc.c +EXTRA_DIST += unistr/test-u16-strmbtouc.c macros.h + +## end gnulib module unistr/u16-strmbtouc-tests + +## begin gnulib module unistr/u16-strncat-tests + +TESTS += test-u16-strncat +check_PROGRAMS += test-u16-strncat +test_u16_strncat_SOURCES = unistr/test-u16-strncat.c +EXTRA_DIST += unistr/test-u16-strncat.c unistr/test-strncat.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-strncat-tests + +## begin gnulib module unistr/u16-strncmp-tests + +TESTS += test-u16-strncmp +check_PROGRAMS += test-u16-strncmp +test_u16_strncmp_SOURCES = unistr/test-u16-strncmp.c +EXTRA_DIST += unistr/test-u16-strncmp.c unistr/test-strncmp.h macros.h + +## end gnulib module unistr/u16-strncmp-tests + +## begin gnulib module unistr/u16-strncpy-tests + +TESTS += test-u16-strncpy +check_PROGRAMS += test-u16-strncpy +test_u16_strncpy_SOURCES = unistr/test-u16-strncpy.c +EXTRA_DIST += unistr/test-u16-strncpy.c unistr/test-strncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-strncpy-tests + +## begin gnulib module unistr/u16-strnlen-tests + +TESTS += test-u16-strnlen +check_PROGRAMS += test-u16-strnlen +test_u16_strnlen_SOURCES = unistr/test-u16-strnlen.c +EXTRA_DIST += unistr/test-u16-strnlen.c unistr/test-strnlen.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-strnlen-tests + +## begin gnulib module unistr/u16-to-u32-tests + +TESTS += test-u16-to-u32 +check_PROGRAMS += test-u16-to-u32 +test_u16_to_u32_SOURCES = unistr/test-u16-to-u32.c +EXTRA_DIST += unistr/test-u16-to-u32.c macros.h + +## end gnulib module unistr/u16-to-u32-tests + +## begin gnulib module unistr/u16-to-u8-tests + +TESTS += test-u16-to-u8 +check_PROGRAMS += test-u16-to-u8 +test_u16_to_u8_SOURCES = unistr/test-u16-to-u8.c +EXTRA_DIST += unistr/test-u16-to-u8.c macros.h + +## end gnulib module unistr/u16-to-u8-tests + +## begin gnulib module unistr/u16-uctomb-tests + +TESTS += test-u16-uctomb +check_PROGRAMS += test-u16-uctomb +test_u16_uctomb_SOURCES = unistr/test-u16-uctomb.c +EXTRA_DIST += unistr/test-u16-uctomb.c macros.h + +## end gnulib module unistr/u16-uctomb-tests + +## begin gnulib module unistr/u32-check-tests + +TESTS += test-u32-check +check_PROGRAMS += test-u32-check +test_u32_check_SOURCES = unistr/test-u32-check.c +EXTRA_DIST += unistr/test-u32-check.c macros.h + +## end gnulib module unistr/u32-check-tests + +## begin gnulib module unistr/u32-chr-tests + +TESTS += test-u32-chr +check_PROGRAMS += test-u32-chr +test_u32_chr_SOURCES = unistr/test-u32-chr.c +EXTRA_DIST += unistr/test-u32-chr.c unistr/test-chr.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-chr-tests + +## begin gnulib module unistr/u32-cmp-tests + +TESTS += test-u32-cmp +check_PROGRAMS += test-u32-cmp +test_u32_cmp_SOURCES = unistr/test-u32-cmp.c +EXTRA_DIST += unistr/test-u32-cmp.c unistr/test-cmp.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-cmp-tests + +## begin gnulib module unistr/u32-cmp2-tests + +TESTS += test-u32-cmp2 +check_PROGRAMS += test-u32-cmp2 +test_u32_cmp2_SOURCES = unistr/test-u32-cmp2.c +EXTRA_DIST += unistr/test-u32-cmp2.c unistr/test-cmp2.h macros.h + +## end gnulib module unistr/u32-cmp2-tests + +## begin gnulib module unistr/u32-cpy-alloc-tests + +TESTS += test-u32-cpy-alloc +check_PROGRAMS += test-u32-cpy-alloc +test_u32_cpy_alloc_SOURCES = unistr/test-u32-cpy-alloc.c +EXTRA_DIST += unistr/test-u32-cpy-alloc.c unistr/test-cpy-alloc.h macros.h + +## end gnulib module unistr/u32-cpy-alloc-tests + +## begin gnulib module unistr/u32-cpy-tests + +TESTS += test-u32-cpy +check_PROGRAMS += test-u32-cpy +test_u32_cpy_SOURCES = unistr/test-u32-cpy.c +EXTRA_DIST += unistr/test-u32-cpy.c unistr/test-cpy.h macros.h + +## end gnulib module unistr/u32-cpy-tests + +## begin gnulib module unistr/u32-mblen-tests + +TESTS += test-u32-mblen +check_PROGRAMS += test-u32-mblen +test_u32_mblen_SOURCES = unistr/test-u32-mblen.c +EXTRA_DIST += unistr/test-u32-mblen.c macros.h + +## end gnulib module unistr/u32-mblen-tests + +## begin gnulib module unistr/u32-mbsnlen-tests + +TESTS += test-u32-mbsnlen +check_PROGRAMS += test-u32-mbsnlen +test_u32_mbsnlen_SOURCES = unistr/test-u32-mbsnlen.c +EXTRA_DIST += unistr/test-u32-mbsnlen.c macros.h + +## end gnulib module unistr/u32-mbsnlen-tests + +## begin gnulib module unistr/u32-mbtouc-tests + +TESTS += test-u32-mbtouc +check_PROGRAMS += test-u32-mbtouc +test_u32_mbtouc_SOURCES = unistr/test-u32-mbtouc.c +EXTRA_DIST += unistr/test-u32-mbtouc.c unistr/test-u32-mbtouc.h macros.h + +## end gnulib module unistr/u32-mbtouc-tests + +## begin gnulib module unistr/u32-mbtouc-unsafe-tests + +TESTS += test-u32-mbtouc-unsafe +check_PROGRAMS += test-u32-mbtouc-unsafe +test_u32_mbtouc_unsafe_SOURCES = unistr/test-u32-mbtouc-unsafe.c +EXTRA_DIST += unistr/test-u32-mbtouc-unsafe.c unistr/test-u32-mbtouc.h macros.h + +## end gnulib module unistr/u32-mbtouc-unsafe-tests + +## begin gnulib module unistr/u32-mbtoucr-tests + +TESTS += test-u32-mbtoucr +check_PROGRAMS += test-u32-mbtoucr +test_u32_mbtoucr_SOURCES = unistr/test-u32-mbtoucr.c +EXTRA_DIST += unistr/test-u32-mbtoucr.c macros.h + +## end gnulib module unistr/u32-mbtoucr-tests + +## begin gnulib module unistr/u32-move-tests + +TESTS += test-u32-move +check_PROGRAMS += test-u32-move +test_u32_move_SOURCES = unistr/test-u32-move.c +EXTRA_DIST += unistr/test-u32-move.c unistr/test-move.h macros.h + +## end gnulib module unistr/u32-move-tests + +## begin gnulib module unistr/u32-next-tests + +TESTS += test-u32-next +check_PROGRAMS += test-u32-next +test_u32_next_SOURCES = unistr/test-u32-next.c +EXTRA_DIST += unistr/test-u32-next.c macros.h + +## end gnulib module unistr/u32-next-tests + +## begin gnulib module unistr/u32-prev-tests + +TESTS += test-u32-prev +check_PROGRAMS += test-u32-prev +test_u32_prev_SOURCES = unistr/test-u32-prev.c +EXTRA_DIST += unistr/test-u32-prev.c macros.h + +## end gnulib module unistr/u32-prev-tests + +## begin gnulib module unistr/u32-set-tests + +TESTS += test-u32-set +check_PROGRAMS += test-u32-set +test_u32_set_SOURCES = unistr/test-u32-set.c +EXTRA_DIST += unistr/test-u32-set.c unistr/test-set.h macros.h + +## end gnulib module unistr/u32-set-tests + +## begin gnulib module unistr/u32-stpcpy-tests + +TESTS += test-u32-stpcpy +check_PROGRAMS += test-u32-stpcpy +test_u32_stpcpy_SOURCES = unistr/test-u32-stpcpy.c +EXTRA_DIST += unistr/test-u32-stpcpy.c unistr/test-stpcpy.h macros.h + +## end gnulib module unistr/u32-stpcpy-tests + +## begin gnulib module unistr/u32-stpncpy-tests + +TESTS += test-u32-stpncpy +check_PROGRAMS += test-u32-stpncpy +test_u32_stpncpy_SOURCES = unistr/test-u32-stpncpy.c +EXTRA_DIST += unistr/test-u32-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-stpncpy-tests + +## begin gnulib module unistr/u32-strcat-tests + +TESTS += test-u32-strcat +check_PROGRAMS += test-u32-strcat +test_u32_strcat_SOURCES = unistr/test-u32-strcat.c +EXTRA_DIST += unistr/test-u32-strcat.c unistr/test-strcat.h macros.h + +## end gnulib module unistr/u32-strcat-tests + +## begin gnulib module unistr/u32-strcmp-tests + +TESTS += test-u32-strcmp +check_PROGRAMS += test-u32-strcmp +test_u32_strcmp_SOURCES = unistr/test-u32-strcmp.c +EXTRA_DIST += unistr/test-u32-strcmp.c unistr/test-u32-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u32-strcmp-tests + +## begin gnulib module unistr/u32-strcoll-tests + +TESTS += test-u32-strcoll +check_PROGRAMS += test-u32-strcoll +test_u32_strcoll_SOURCES = unistr/test-u32-strcoll.c +test_u32_strcoll_LDADD = $(LDADD) @LIBICONV@ +EXTRA_DIST += unistr/test-u32-strcoll.c unistr/test-u32-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u32-strcoll-tests + +## begin gnulib module unistr/u32-strcpy-tests + +TESTS += test-u32-strcpy +check_PROGRAMS += test-u32-strcpy +test_u32_strcpy_SOURCES = unistr/test-u32-strcpy.c +EXTRA_DIST += unistr/test-u32-strcpy.c unistr/test-strcpy.h macros.h + +## end gnulib module unistr/u32-strcpy-tests + +## begin gnulib module unistr/u32-strdup-tests + +TESTS += test-u32-strdup +check_PROGRAMS += test-u32-strdup +test_u32_strdup_SOURCES = unistr/test-u32-strdup.c +EXTRA_DIST += unistr/test-u32-strdup.c unistr/test-strdup.h macros.h + +## end gnulib module unistr/u32-strdup-tests + +## begin gnulib module unistr/u32-strlen-tests + +TESTS += test-u32-strlen +check_PROGRAMS += test-u32-strlen +test_u32_strlen_SOURCES = unistr/test-u32-strlen.c +EXTRA_DIST += unistr/test-u32-strlen.c macros.h + +## end gnulib module unistr/u32-strlen-tests + +## begin gnulib module unistr/u32-strmblen-tests + +TESTS += test-u32-strmblen +check_PROGRAMS += test-u32-strmblen +test_u32_strmblen_SOURCES = unistr/test-u32-strmblen.c +EXTRA_DIST += unistr/test-u32-strmblen.c macros.h + +## end gnulib module unistr/u32-strmblen-tests + +## begin gnulib module unistr/u32-strmbtouc-tests + +TESTS += test-u32-strmbtouc +check_PROGRAMS += test-u32-strmbtouc +test_u32_strmbtouc_SOURCES = unistr/test-u32-strmbtouc.c +EXTRA_DIST += unistr/test-u32-strmbtouc.c macros.h + +## end gnulib module unistr/u32-strmbtouc-tests + +## begin gnulib module unistr/u32-strncat-tests + +TESTS += test-u32-strncat +check_PROGRAMS += test-u32-strncat +test_u32_strncat_SOURCES = unistr/test-u32-strncat.c +EXTRA_DIST += unistr/test-u32-strncat.c unistr/test-strncat.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-strncat-tests + +## begin gnulib module unistr/u32-strncmp-tests + +TESTS += test-u32-strncmp +check_PROGRAMS += test-u32-strncmp +test_u32_strncmp_SOURCES = unistr/test-u32-strncmp.c +EXTRA_DIST += unistr/test-u32-strncmp.c unistr/test-strncmp.h macros.h + +## end gnulib module unistr/u32-strncmp-tests + +## begin gnulib module unistr/u32-strncpy-tests + +TESTS += test-u32-strncpy +check_PROGRAMS += test-u32-strncpy +test_u32_strncpy_SOURCES = unistr/test-u32-strncpy.c +EXTRA_DIST += unistr/test-u32-strncpy.c unistr/test-strncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-strncpy-tests + +## begin gnulib module unistr/u32-strnlen-tests + +TESTS += test-u32-strnlen +check_PROGRAMS += test-u32-strnlen +test_u32_strnlen_SOURCES = unistr/test-u32-strnlen.c +EXTRA_DIST += unistr/test-u32-strnlen.c unistr/test-strnlen.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-strnlen-tests + +## begin gnulib module unistr/u32-to-u16-tests + +TESTS += test-u32-to-u16 +check_PROGRAMS += test-u32-to-u16 +test_u32_to_u16_SOURCES = unistr/test-u32-to-u16.c +EXTRA_DIST += unistr/test-u32-to-u16.c macros.h + +## end gnulib module unistr/u32-to-u16-tests + +## begin gnulib module unistr/u32-to-u8-tests + +TESTS += test-u32-to-u8 +check_PROGRAMS += test-u32-to-u8 +test_u32_to_u8_SOURCES = unistr/test-u32-to-u8.c +EXTRA_DIST += unistr/test-u32-to-u8.c macros.h + +## end gnulib module unistr/u32-to-u8-tests + +## begin gnulib module unistr/u32-uctomb-tests + +TESTS += test-u32-uctomb +check_PROGRAMS += test-u32-uctomb +test_u32_uctomb_SOURCES = unistr/test-u32-uctomb.c +EXTRA_DIST += unistr/test-u32-uctomb.c macros.h + +## end gnulib module unistr/u32-uctomb-tests + +## begin gnulib module unistr/u8-check-tests + +TESTS += test-u8-check +check_PROGRAMS += test-u8-check +test_u8_check_SOURCES = unistr/test-u8-check.c +EXTRA_DIST += unistr/test-u8-check.c macros.h + +## end gnulib module unistr/u8-check-tests + +## begin gnulib module unistr/u8-chr-tests + +TESTS += test-u8-chr +check_PROGRAMS += test-u8-chr +test_u8_chr_SOURCES = unistr/test-u8-chr.c +EXTRA_DIST += unistr/test-u8-chr.c unistr/test-chr.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-chr-tests + +## begin gnulib module unistr/u8-cmp-tests + +TESTS += test-u8-cmp +check_PROGRAMS += test-u8-cmp +test_u8_cmp_SOURCES = unistr/test-u8-cmp.c +EXTRA_DIST += unistr/test-u8-cmp.c unistr/test-cmp.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-cmp-tests + +## begin gnulib module unistr/u8-cmp2-tests + +TESTS += test-u8-cmp2 +check_PROGRAMS += test-u8-cmp2 +test_u8_cmp2_SOURCES = unistr/test-u8-cmp2.c +EXTRA_DIST += unistr/test-u8-cmp2.c unistr/test-cmp2.h macros.h + +## end gnulib module unistr/u8-cmp2-tests + +## begin gnulib module unistr/u8-cpy-alloc-tests + +TESTS += test-u8-cpy-alloc +check_PROGRAMS += test-u8-cpy-alloc +test_u8_cpy_alloc_SOURCES = unistr/test-u8-cpy-alloc.c +EXTRA_DIST += unistr/test-u8-cpy-alloc.c unistr/test-cpy-alloc.h macros.h + +## end gnulib module unistr/u8-cpy-alloc-tests + +## begin gnulib module unistr/u8-cpy-tests + +TESTS += test-u8-cpy +check_PROGRAMS += test-u8-cpy +test_u8_cpy_SOURCES = unistr/test-u8-cpy.c +EXTRA_DIST += unistr/test-u8-cpy.c unistr/test-cpy.h macros.h + +## end gnulib module unistr/u8-cpy-tests + +## begin gnulib module unistr/u8-mblen-tests + +TESTS += test-u8-mblen +check_PROGRAMS += test-u8-mblen +test_u8_mblen_SOURCES = unistr/test-u8-mblen.c +EXTRA_DIST += unistr/test-u8-mblen.c macros.h + +## end gnulib module unistr/u8-mblen-tests + +## begin gnulib module unistr/u8-mbsnlen-tests + +TESTS += test-u8-mbsnlen +check_PROGRAMS += test-u8-mbsnlen +test_u8_mbsnlen_SOURCES = unistr/test-u8-mbsnlen.c +EXTRA_DIST += unistr/test-u8-mbsnlen.c macros.h + +## end gnulib module unistr/u8-mbsnlen-tests + +## begin gnulib module unistr/u8-mbtouc-tests + +TESTS += test-u8-mbtouc +check_PROGRAMS += test-u8-mbtouc +test_u8_mbtouc_SOURCES = unistr/test-u8-mbtouc.c +EXTRA_DIST += unistr/test-u8-mbtouc.c unistr/test-u8-mbtouc.h macros.h + +## end gnulib module unistr/u8-mbtouc-tests + +## begin gnulib module unistr/u8-mbtouc-unsafe-tests + +TESTS += test-u8-mbtouc-unsafe +check_PROGRAMS += test-u8-mbtouc-unsafe +test_u8_mbtouc_unsafe_SOURCES = unistr/test-u8-mbtouc-unsafe.c +EXTRA_DIST += unistr/test-u8-mbtouc-unsafe.c unistr/test-u8-mbtouc.h macros.h + +## end gnulib module unistr/u8-mbtouc-unsafe-tests + +## begin gnulib module unistr/u8-mbtoucr-tests + +TESTS += test-u8-mbtoucr +check_PROGRAMS += test-u8-mbtoucr +test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c +EXTRA_DIST += unistr/test-u8-mbtoucr.c macros.h + +## end gnulib module unistr/u8-mbtoucr-tests + +## begin gnulib module unistr/u8-move-tests + +TESTS += test-u8-move +check_PROGRAMS += test-u8-move +test_u8_move_SOURCES = unistr/test-u8-move.c +EXTRA_DIST += unistr/test-u8-move.c unistr/test-move.h macros.h + +## end gnulib module unistr/u8-move-tests + +## begin gnulib module unistr/u8-next-tests + +TESTS += test-u8-next +check_PROGRAMS += test-u8-next +test_u8_next_SOURCES = unistr/test-u8-next.c +EXTRA_DIST += unistr/test-u8-next.c macros.h + +## end gnulib module unistr/u8-next-tests + +## begin gnulib module unistr/u8-prev-tests + +TESTS += test-u8-prev +check_PROGRAMS += test-u8-prev +test_u8_prev_SOURCES = unistr/test-u8-prev.c +EXTRA_DIST += unistr/test-u8-prev.c macros.h + +## end gnulib module unistr/u8-prev-tests + +## begin gnulib module unistr/u8-set-tests + +TESTS += test-u8-set +check_PROGRAMS += test-u8-set +test_u8_set_SOURCES = unistr/test-u8-set.c +EXTRA_DIST += unistr/test-u8-set.c unistr/test-set.h macros.h + +## end gnulib module unistr/u8-set-tests + +## begin gnulib module unistr/u8-stpcpy-tests + +TESTS += test-u8-stpcpy +check_PROGRAMS += test-u8-stpcpy +test_u8_stpcpy_SOURCES = unistr/test-u8-stpcpy.c +EXTRA_DIST += unistr/test-u8-stpcpy.c unistr/test-stpcpy.h macros.h + +## end gnulib module unistr/u8-stpcpy-tests + +## begin gnulib module unistr/u8-stpncpy-tests + +TESTS += test-u8-stpncpy +check_PROGRAMS += test-u8-stpncpy +test_u8_stpncpy_SOURCES = unistr/test-u8-stpncpy.c +EXTRA_DIST += unistr/test-u8-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-stpncpy-tests + +## begin gnulib module unistr/u8-strcat-tests + +TESTS += test-u8-strcat +check_PROGRAMS += test-u8-strcat +test_u8_strcat_SOURCES = unistr/test-u8-strcat.c +EXTRA_DIST += unistr/test-u8-strcat.c unistr/test-strcat.h macros.h + +## end gnulib module unistr/u8-strcat-tests + +## begin gnulib module unistr/u8-strcmp-tests + +TESTS += test-u8-strcmp +check_PROGRAMS += test-u8-strcmp +test_u8_strcmp_SOURCES = unistr/test-u8-strcmp.c +EXTRA_DIST += unistr/test-u8-strcmp.c unistr/test-u8-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u8-strcmp-tests + +## begin gnulib module unistr/u8-strcoll-tests + +TESTS += test-u8-strcoll +check_PROGRAMS += test-u8-strcoll +test_u8_strcoll_SOURCES = unistr/test-u8-strcoll.c +test_u8_strcoll_LDADD = $(LDADD) @LIBICONV@ +EXTRA_DIST += unistr/test-u8-strcoll.c unistr/test-u8-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u8-strcoll-tests + +## begin gnulib module unistr/u8-strcpy-tests + +TESTS += test-u8-strcpy +check_PROGRAMS += test-u8-strcpy +test_u8_strcpy_SOURCES = unistr/test-u8-strcpy.c +EXTRA_DIST += unistr/test-u8-strcpy.c unistr/test-strcpy.h macros.h + +## end gnulib module unistr/u8-strcpy-tests + +## begin gnulib module unistr/u8-strdup-tests + +TESTS += test-u8-strdup +check_PROGRAMS += test-u8-strdup +test_u8_strdup_SOURCES = unistr/test-u8-strdup.c +EXTRA_DIST += unistr/test-u8-strdup.c unistr/test-strdup.h macros.h + +## end gnulib module unistr/u8-strdup-tests + +## begin gnulib module unistr/u8-strlen-tests + +TESTS += test-u8-strlen +check_PROGRAMS += test-u8-strlen +test_u8_strlen_SOURCES = unistr/test-u8-strlen.c +EXTRA_DIST += unistr/test-u8-strlen.c macros.h + +## end gnulib module unistr/u8-strlen-tests + +## begin gnulib module unistr/u8-strmblen-tests + +TESTS += test-u8-strmblen +check_PROGRAMS += test-u8-strmblen +test_u8_strmblen_SOURCES = unistr/test-u8-strmblen.c +EXTRA_DIST += unistr/test-u8-strmblen.c macros.h + +## end gnulib module unistr/u8-strmblen-tests + +## begin gnulib module unistr/u8-strmbtouc-tests + +TESTS += test-u8-strmbtouc +check_PROGRAMS += test-u8-strmbtouc +test_u8_strmbtouc_SOURCES = unistr/test-u8-strmbtouc.c +EXTRA_DIST += unistr/test-u8-strmbtouc.c macros.h + +## end gnulib module unistr/u8-strmbtouc-tests + +## begin gnulib module unistr/u8-strncat-tests + +TESTS += test-u8-strncat +check_PROGRAMS += test-u8-strncat +test_u8_strncat_SOURCES = unistr/test-u8-strncat.c +EXTRA_DIST += unistr/test-u8-strncat.c unistr/test-strncat.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-strncat-tests + +## begin gnulib module unistr/u8-strncmp-tests + +TESTS += test-u8-strncmp +check_PROGRAMS += test-u8-strncmp +test_u8_strncmp_SOURCES = unistr/test-u8-strncmp.c +EXTRA_DIST += unistr/test-u8-strncmp.c unistr/test-strncmp.h macros.h + +## end gnulib module unistr/u8-strncmp-tests + +## begin gnulib module unistr/u8-strncpy-tests + +TESTS += test-u8-strncpy +check_PROGRAMS += test-u8-strncpy +test_u8_strncpy_SOURCES = unistr/test-u8-strncpy.c +EXTRA_DIST += unistr/test-u8-strncpy.c unistr/test-strncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-strncpy-tests + +## begin gnulib module unistr/u8-strnlen-tests + +TESTS += test-u8-strnlen +check_PROGRAMS += test-u8-strnlen +test_u8_strnlen_SOURCES = unistr/test-u8-strnlen.c +EXTRA_DIST += unistr/test-u8-strnlen.c unistr/test-strnlen.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-strnlen-tests + +## begin gnulib module unistr/u8-to-u16-tests + +TESTS += test-u8-to-u16 +check_PROGRAMS += test-u8-to-u16 +test_u8_to_u16_SOURCES = unistr/test-u8-to-u16.c +EXTRA_DIST += unistr/test-u8-to-u16.c macros.h + +## end gnulib module unistr/u8-to-u16-tests + +## begin gnulib module unistr/u8-to-u32-tests + +TESTS += test-u8-to-u32 +check_PROGRAMS += test-u8-to-u32 +test_u8_to_u32_SOURCES = unistr/test-u8-to-u32.c +EXTRA_DIST += unistr/test-u8-to-u32.c macros.h + +## end gnulib module unistr/u8-to-u32-tests + +## begin gnulib module unistr/u8-uctomb-tests + +TESTS += test-u8-uctomb +check_PROGRAMS += test-u8-uctomb +test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c +EXTRA_DIST += unistr/test-u8-uctomb.c macros.h + +## end gnulib module unistr/u8-uctomb-tests + ## begin gnulib module uniwbrk/u16-wordbreaks-tests TESTS += test-u16-wordbreaks check_PROGRAMS += test-u16-wordbreaks test_u16_wordbreaks_SOURCES = uniwbrk/test-u16-wordbreaks.c -EXTRA_DIST += uniwbrk/test-u16-wordbreaks.c +EXTRA_DIST += uniwbrk/test-u16-wordbreaks.c macros.h ## end gnulib module uniwbrk/u16-wordbreaks-tests @@ -3096,7 +4005,7 @@ TESTS += test-u32-wordbreaks check_PROGRAMS += test-u32-wordbreaks test_u32_wordbreaks_SOURCES = uniwbrk/test-u32-wordbreaks.c -EXTRA_DIST += uniwbrk/test-u32-wordbreaks.c +EXTRA_DIST += uniwbrk/test-u32-wordbreaks.c macros.h ## end gnulib module uniwbrk/u32-wordbreaks-tests @@ -3106,19 +4015,19 @@ TESTS += test-u8-wordbreaks check_PROGRAMS += test-u8-wordbreaks test_u8_wordbreaks_SOURCES = uniwbrk/test-u8-wordbreaks.c -EXTRA_DIST += uniwbrk/test-u8-wordbreaks.c +EXTRA_DIST += uniwbrk/test-u8-wordbreaks.c macros.h ## end gnulib module uniwbrk/u8-wordbreaks-tests ## begin gnulib module uniwbrk/ulc-wordbreaks-tests TESTS += uniwbrk/test-ulc-wordbreaks.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' check_PROGRAMS += test-ulc-wordbreaks test_ulc_wordbreaks_SOURCES = uniwbrk/test-ulc-wordbreaks.c test_ulc_wordbreaks_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniwbrk/test-ulc-wordbreaks.sh uniwbrk/test-ulc-wordbreaks.c +EXTRA_DIST += uniwbrk/test-ulc-wordbreaks.sh uniwbrk/test-ulc-wordbreaks.c macros.h ## end gnulib module uniwbrk/ulc-wordbreaks-tests @@ -3128,7 +4037,7 @@ TESTS += test-u16-strwidth check_PROGRAMS += test-u16-strwidth test_u16_strwidth_SOURCES = uniwidth/test-u16-strwidth.c -EXTRA_DIST += uniwidth/test-u16-strwidth.c +EXTRA_DIST += uniwidth/test-u16-strwidth.c macros.h ## end gnulib module uniwidth/u16-strwidth-tests @@ -3138,7 +4047,7 @@ TESTS += test-u16-width check_PROGRAMS += test-u16-width test_u16_width_SOURCES = uniwidth/test-u16-width.c -EXTRA_DIST += uniwidth/test-u16-width.c +EXTRA_DIST += uniwidth/test-u16-width.c macros.h ## end gnulib module uniwidth/u16-width-tests @@ -3148,7 +4057,7 @@ TESTS += test-u32-strwidth check_PROGRAMS += test-u32-strwidth test_u32_strwidth_SOURCES = uniwidth/test-u32-strwidth.c -EXTRA_DIST += uniwidth/test-u32-strwidth.c +EXTRA_DIST += uniwidth/test-u32-strwidth.c macros.h ## end gnulib module uniwidth/u32-strwidth-tests @@ -3158,7 +4067,7 @@ TESTS += test-u32-width check_PROGRAMS += test-u32-width test_u32_width_SOURCES = uniwidth/test-u32-width.c -EXTRA_DIST += uniwidth/test-u32-width.c +EXTRA_DIST += uniwidth/test-u32-width.c macros.h ## end gnulib module uniwidth/u32-width-tests @@ -3168,7 +4077,7 @@ TESTS += test-u8-strwidth check_PROGRAMS += test-u8-strwidth test_u8_strwidth_SOURCES = uniwidth/test-u8-strwidth.c -EXTRA_DIST += uniwidth/test-u8-strwidth.c +EXTRA_DIST += uniwidth/test-u8-strwidth.c macros.h ## end gnulib module uniwidth/u8-strwidth-tests @@ -3178,19 +4087,18 @@ TESTS += test-u8-width check_PROGRAMS += test-u8-width test_u8_width_SOURCES = uniwidth/test-u8-width.c -EXTRA_DIST += uniwidth/test-u8-width.c +EXTRA_DIST += uniwidth/test-u8-width.c macros.h ## end gnulib module uniwidth/u8-width-tests ## begin gnulib module uniwidth/width-tests TESTS += test-uc_width uniwidth/test-uc_width2.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' check_PROGRAMS += test-uc_width test-uc_width2 test_uc_width_SOURCES = uniwidth/test-uc_width.c test_uc_width2_SOURCES = uniwidth/test-uc_width2.c -EXTRA_DIST += uniwidth/test-uc_width.c uniwidth/test-uc_width2.c uniwidth/test-uc_width2.sh +EXTRA_DIST += uniwidth/test-uc_width.c uniwidth/test-uc_width2.c uniwidth/test-uc_width2.sh macros.h ## end gnulib module uniwidth/width-tests @@ -3203,11 +4111,62 @@ EXTRA_libtests_a_SOURCES += unsetenv.c ## end gnulib module unsetenv +## begin gnulib module unsetenv-tests + +TESTS += test-unsetenv +check_PROGRAMS += test-unsetenv +EXTRA_DIST += test-unsetenv.c signature.h macros.h + +## end gnulib module unsetenv-tests + +## begin gnulib module unused-parameter + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += unused-parameter.h +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t + +UNUSED_PARAMETER_H=unused-parameter.h + +EXTRA_DIST += $(top_srcdir)/build-aux/unused-parameter.h + +## end gnulib module unused-parameter + +## begin gnulib module warn-on-use + +BUILT_SOURCES += warn-on-use.h +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t + +WARN_ON_USE_H=warn-on-use.h + +EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h + +## end gnulib module warn-on-use + ## begin gnulib module wchar-tests TESTS += test-wchar check_PROGRAMS += test-wchar - EXTRA_DIST += test-wchar.c ## end gnulib module wchar-tests @@ -3225,8 +4184,7 @@ EXTRA_libtests_a_SOURCES += wctob.c TESTS += test-wctype check_PROGRAMS += test-wctype - -EXTRA_DIST += test-wctype.c +EXTRA_DIST += test-wctype.c macros.h ## end gnulib module wctype-tests @@ -3235,7 +4193,7 @@ EXTRA_DIST += test-wctype.c TESTS += test-wcwidth check_PROGRAMS += test-wcwidth -EXTRA_DIST += test-wcwidth.c +EXTRA_DIST += test-wcwidth.c signature.h macros.h ## end gnulib module wcwidth-tests @@ -3254,6 +4212,21 @@ libtests_a_SOURCES += xalloc-die.c ## end gnulib module xalloc-die +## begin gnulib module xalloc-die-tests + +TESTS += test-xalloc-die.sh +check_PROGRAMS += test-xalloc-die +test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-xalloc-die.c test-xalloc-die.sh init.sh + +## end gnulib module xalloc-die-tests + +## begin gnulib module yield + +libtests_a_SOURCES += glthread/yield.h + +## end gnulib module yield + # Clean up after Solaris cc. clean-local: rm -rf SunWS_cache diff --git a/tests/Makefile.in b/tests/Makefile.in index b1d9e4a..0983281 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,7 +15,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -49,43 +49,44 @@ host_triplet = @host@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.gnulib $(srcdir)/Makefile.in TESTS = test-alloca-opt$(EXEEXT) test-array-mergesort$(EXEEXT) \ - test-c-ctype$(EXEEXT) test-c-strcase.sh test-dup2$(EXEEXT) \ - test-environ$(EXEEXT) test-errno$(EXEEXT) test-fcntl$(EXEEXT) \ - test-frexpl-nolibm$(EXEEXT) test-fseterr$(EXEEXT) \ + test-c-ctype$(EXEEXT) test-c-strcase.sh test-environ$(EXEEXT) \ + test-errno$(EXEEXT) test-frexpl-nolibm$(EXEEXT) \ + test-fseterr$(EXEEXT) test-iconv-h$(EXEEXT) \ test-iconv$(EXEEXT) test-isnand-nolibm$(EXEEXT) \ test-isnanf-nolibm$(EXEEXT) test-isnanl-nolibm$(EXEEXT) \ test-locale$(EXEEXT) test-localename$(EXEEXT) \ - test-malloca$(EXEEXT) test-math$(EXEEXT) test-mbrtowc1.sh \ - test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh \ - test-mbsinit.sh test-memchr$(EXEEXT) test-open$(EXEEXT) \ + test-lock$(EXEEXT) test-malloca$(EXEEXT) test-math$(EXEEXT) \ + test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh \ + test-mbrtowc4.sh test-mbsinit.sh test-memchr$(EXEEXT) \ test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ - test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ - test-stddef$(EXEEXT) test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ + test-setenv$(EXEEXT) test-signbit$(EXEEXT) \ + test-stdbool$(EXEEXT) test-stddef$(EXEEXT) \ + test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ test-strerror$(EXEEXT) test-striconveh$(EXEEXT) \ test-striconveha$(EXEEXT) test-string$(EXEEXT) \ - test-cased$(EXEEXT) test-ignorable$(EXEEXT) \ - unicase/test-locale-language.sh test-uc_tolower$(EXEEXT) \ - test-uc_totitle$(EXEEXT) test-uc_toupper$(EXEEXT) \ - test-u16-casecmp$(EXEEXT) test-u16-casecoll$(EXEEXT) \ - test-u16-casefold$(EXEEXT) test-u16-is-cased$(EXEEXT) \ - test-u16-is-casefolded$(EXEEXT) test-u16-is-lowercase$(EXEEXT) \ - test-u16-is-titlecase$(EXEEXT) test-u16-is-uppercase$(EXEEXT) \ - test-u16-tolower$(EXEEXT) test-u16-totitle$(EXEEXT) \ - test-u16-toupper$(EXEEXT) test-u32-casecmp$(EXEEXT) \ - test-u32-casecoll$(EXEEXT) test-u32-casefold$(EXEEXT) \ - test-u32-is-cased$(EXEEXT) test-u32-is-casefolded$(EXEEXT) \ - test-u32-is-lowercase$(EXEEXT) test-u32-is-titlecase$(EXEEXT) \ - test-u32-is-uppercase$(EXEEXT) test-u32-tolower$(EXEEXT) \ - test-u32-totitle$(EXEEXT) test-u32-toupper$(EXEEXT) \ - test-u8-casecmp$(EXEEXT) test-u8-casecoll$(EXEEXT) \ - test-u8-casefold$(EXEEXT) test-u8-is-cased$(EXEEXT) \ - test-u8-is-casefolded$(EXEEXT) test-u8-is-lowercase$(EXEEXT) \ - test-u8-is-titlecase$(EXEEXT) test-u8-is-uppercase$(EXEEXT) \ - test-u8-tolower$(EXEEXT) test-u8-totitle$(EXEEXT) \ - test-u8-toupper$(EXEEXT) unicase/test-ulc-casecmp1.sh \ - unicase/test-ulc-casecmp2.sh unicase/test-ulc-casecoll1.sh \ - unicase/test-ulc-casecoll2.sh test-u16-conv-from-enc$(EXEEXT) \ - test-u16-conv-to-enc$(EXEEXT) \ + test-strncat$(EXEEXT) test-cased$(EXEEXT) \ + test-ignorable$(EXEEXT) unicase/test-locale-language.sh \ + test-uc_tolower$(EXEEXT) test-uc_totitle$(EXEEXT) \ + test-uc_toupper$(EXEEXT) test-u16-casecmp$(EXEEXT) \ + test-u16-casecoll$(EXEEXT) test-u16-casefold$(EXEEXT) \ + test-u16-is-cased$(EXEEXT) test-u16-is-casefolded$(EXEEXT) \ + test-u16-is-lowercase$(EXEEXT) test-u16-is-titlecase$(EXEEXT) \ + test-u16-is-uppercase$(EXEEXT) test-u16-tolower$(EXEEXT) \ + test-u16-totitle$(EXEEXT) test-u16-toupper$(EXEEXT) \ + test-u32-casecmp$(EXEEXT) test-u32-casecoll$(EXEEXT) \ + test-u32-casefold$(EXEEXT) test-u32-is-cased$(EXEEXT) \ + test-u32-is-casefolded$(EXEEXT) test-u32-is-lowercase$(EXEEXT) \ + test-u32-is-titlecase$(EXEEXT) test-u32-is-uppercase$(EXEEXT) \ + test-u32-tolower$(EXEEXT) test-u32-totitle$(EXEEXT) \ + test-u32-toupper$(EXEEXT) test-u8-casecmp$(EXEEXT) \ + test-u8-casecoll$(EXEEXT) test-u8-casefold$(EXEEXT) \ + test-u8-is-cased$(EXEEXT) test-u8-is-casefolded$(EXEEXT) \ + test-u8-is-lowercase$(EXEEXT) test-u8-is-titlecase$(EXEEXT) \ + test-u8-is-uppercase$(EXEEXT) test-u8-tolower$(EXEEXT) \ + test-u8-totitle$(EXEEXT) test-u8-toupper$(EXEEXT) \ + unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh \ + unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh \ + test-u16-conv-from-enc$(EXEEXT) test-u16-conv-to-enc$(EXEEXT) \ test-u16-strconv-from-enc$(EXEEXT) \ test-u16-strconv-to-enc$(EXEEXT) \ test-u32-conv-from-enc$(EXEEXT) test-u32-conv-to-enc$(EXEEXT) \ @@ -224,52 +225,103 @@ TESTS = test-alloca-opt$(EXEEXT) test-array-mergesort$(EXEEXT) \ unistdio/test-ulc-vasnprintf2.sh \ unistdio/test-ulc-vasnprintf3.sh test-ulc-vasprintf1$(EXEEXT) \ test-ulc-vsnprintf1$(EXEEXT) test-ulc-vsprintf1$(EXEEXT) \ + test-u16-check$(EXEEXT) test-u16-chr$(EXEEXT) \ + test-u16-cmp$(EXEEXT) test-u16-cmp2$(EXEEXT) \ + test-u16-cpy-alloc$(EXEEXT) test-u16-cpy$(EXEEXT) \ + test-u16-mblen$(EXEEXT) test-u16-mbsnlen$(EXEEXT) \ + test-u16-mbtouc$(EXEEXT) test-u16-mbtouc-unsafe$(EXEEXT) \ + test-u16-mbtoucr$(EXEEXT) test-u16-move$(EXEEXT) \ + test-u16-next$(EXEEXT) test-u16-prev$(EXEEXT) \ + test-u16-set$(EXEEXT) test-u16-stpcpy$(EXEEXT) \ + test-u16-stpncpy$(EXEEXT) test-u16-strcat$(EXEEXT) \ + test-u16-strcmp$(EXEEXT) test-u16-strcoll$(EXEEXT) \ + test-u16-strcpy$(EXEEXT) test-u16-strdup$(EXEEXT) \ + test-u16-strlen$(EXEEXT) test-u16-strmblen$(EXEEXT) \ + test-u16-strmbtouc$(EXEEXT) test-u16-strncat$(EXEEXT) \ + test-u16-strncmp$(EXEEXT) test-u16-strncpy$(EXEEXT) \ + test-u16-strnlen$(EXEEXT) test-u16-to-u32$(EXEEXT) \ + test-u16-to-u8$(EXEEXT) test-u16-uctomb$(EXEEXT) \ + test-u32-check$(EXEEXT) test-u32-chr$(EXEEXT) \ + test-u32-cmp$(EXEEXT) test-u32-cmp2$(EXEEXT) \ + test-u32-cpy-alloc$(EXEEXT) test-u32-cpy$(EXEEXT) \ + test-u32-mblen$(EXEEXT) test-u32-mbsnlen$(EXEEXT) \ + test-u32-mbtouc$(EXEEXT) test-u32-mbtouc-unsafe$(EXEEXT) \ + test-u32-mbtoucr$(EXEEXT) test-u32-move$(EXEEXT) \ + test-u32-next$(EXEEXT) test-u32-prev$(EXEEXT) \ + test-u32-set$(EXEEXT) test-u32-stpcpy$(EXEEXT) \ + test-u32-stpncpy$(EXEEXT) test-u32-strcat$(EXEEXT) \ + test-u32-strcmp$(EXEEXT) test-u32-strcoll$(EXEEXT) \ + test-u32-strcpy$(EXEEXT) test-u32-strdup$(EXEEXT) \ + test-u32-strlen$(EXEEXT) test-u32-strmblen$(EXEEXT) \ + test-u32-strmbtouc$(EXEEXT) test-u32-strncat$(EXEEXT) \ + test-u32-strncmp$(EXEEXT) test-u32-strncpy$(EXEEXT) \ + test-u32-strnlen$(EXEEXT) test-u32-to-u16$(EXEEXT) \ + test-u32-to-u8$(EXEEXT) test-u32-uctomb$(EXEEXT) \ + test-u8-check$(EXEEXT) test-u8-chr$(EXEEXT) \ + test-u8-cmp$(EXEEXT) test-u8-cmp2$(EXEEXT) \ + test-u8-cpy-alloc$(EXEEXT) test-u8-cpy$(EXEEXT) \ + test-u8-mblen$(EXEEXT) test-u8-mbsnlen$(EXEEXT) \ + test-u8-mbtouc$(EXEEXT) test-u8-mbtouc-unsafe$(EXEEXT) \ + test-u8-mbtoucr$(EXEEXT) test-u8-move$(EXEEXT) \ + test-u8-next$(EXEEXT) test-u8-prev$(EXEEXT) \ + test-u8-set$(EXEEXT) test-u8-stpcpy$(EXEEXT) \ + test-u8-stpncpy$(EXEEXT) test-u8-strcat$(EXEEXT) \ + test-u8-strcmp$(EXEEXT) test-u8-strcoll$(EXEEXT) \ + test-u8-strcpy$(EXEEXT) test-u8-strdup$(EXEEXT) \ + test-u8-strlen$(EXEEXT) test-u8-strmblen$(EXEEXT) \ + test-u8-strmbtouc$(EXEEXT) test-u8-strncat$(EXEEXT) \ + test-u8-strncmp$(EXEEXT) test-u8-strncpy$(EXEEXT) \ + test-u8-strnlen$(EXEEXT) test-u8-to-u16$(EXEEXT) \ + test-u8-to-u32$(EXEEXT) test-u8-uctomb$(EXEEXT) \ test-u16-wordbreaks$(EXEEXT) test-u32-wordbreaks$(EXEEXT) \ test-u8-wordbreaks$(EXEEXT) uniwbrk/test-ulc-wordbreaks.sh \ test-u16-strwidth$(EXEEXT) test-u16-width$(EXEEXT) \ test-u32-strwidth$(EXEEXT) test-u32-width$(EXEEXT) \ test-u8-strwidth$(EXEEXT) test-u8-width$(EXEEXT) \ test-uc_width$(EXEEXT) uniwidth/test-uc_width2.sh \ - test-wchar$(EXEEXT) test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) + test-unsetenv$(EXEEXT) test-wchar$(EXEEXT) \ + test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) test-xalloc-die.sh +XFAIL_TESTS = noinst_PROGRAMS = check_PROGRAMS = test-alloca-opt$(EXEEXT) \ test-array-mergesort$(EXEEXT) test-c-ctype$(EXEEXT) \ test-c-strcasecmp$(EXEEXT) test-c-strncasecmp$(EXEEXT) \ - test-dup2$(EXEEXT) test-environ$(EXEEXT) test-errno$(EXEEXT) \ - test-fcntl$(EXEEXT) test-frexpl-nolibm$(EXEEXT) \ - test-fseterr$(EXEEXT) test-iconv$(EXEEXT) \ + test-environ$(EXEEXT) test-errno$(EXEEXT) \ + test-frexpl-nolibm$(EXEEXT) test-fseterr$(EXEEXT) \ + test-iconv-h$(EXEEXT) test-iconv$(EXEEXT) \ test-isnand-nolibm$(EXEEXT) test-isnanf-nolibm$(EXEEXT) \ test-isnanl-nolibm$(EXEEXT) test-locale$(EXEEXT) \ - test-localename$(EXEEXT) test-malloca$(EXEEXT) \ - test-math$(EXEEXT) test-mbrtowc$(EXEEXT) test-mbsinit$(EXEEXT) \ - test-memchr$(EXEEXT) test-open$(EXEEXT) \ + test-localename$(EXEEXT) test-lock$(EXEEXT) \ + test-malloca$(EXEEXT) test-math$(EXEEXT) test-mbrtowc$(EXEEXT) \ + test-mbsinit$(EXEEXT) test-memchr$(EXEEXT) \ test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ - test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ - test-stddef$(EXEEXT) test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ + test-setenv$(EXEEXT) test-signbit$(EXEEXT) \ + test-stdbool$(EXEEXT) test-stddef$(EXEEXT) \ + test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ test-strerror$(EXEEXT) test-striconveh$(EXEEXT) \ test-striconveha$(EXEEXT) test-string$(EXEEXT) \ - test-cased$(EXEEXT) test-ignorable$(EXEEXT) \ - test-locale-language$(EXEEXT) test-uc_tolower$(EXEEXT) \ - test-uc_totitle$(EXEEXT) test-uc_toupper$(EXEEXT) \ - test-u16-casecmp$(EXEEXT) test-u16-casecoll$(EXEEXT) \ - test-u16-casefold$(EXEEXT) test-u16-is-cased$(EXEEXT) \ - test-u16-is-casefolded$(EXEEXT) test-u16-is-lowercase$(EXEEXT) \ - test-u16-is-titlecase$(EXEEXT) test-u16-is-uppercase$(EXEEXT) \ - test-u16-tolower$(EXEEXT) test-u16-totitle$(EXEEXT) \ - test-u16-toupper$(EXEEXT) test-u32-casecmp$(EXEEXT) \ - test-u32-casecoll$(EXEEXT) test-u32-casefold$(EXEEXT) \ - test-u32-is-cased$(EXEEXT) test-u32-is-casefolded$(EXEEXT) \ - test-u32-is-lowercase$(EXEEXT) test-u32-is-titlecase$(EXEEXT) \ - test-u32-is-uppercase$(EXEEXT) test-u32-tolower$(EXEEXT) \ - test-u32-totitle$(EXEEXT) test-u32-toupper$(EXEEXT) \ - test-u8-casecmp$(EXEEXT) test-u8-casecoll$(EXEEXT) \ - test-u8-casefold$(EXEEXT) test-u8-is-cased$(EXEEXT) \ - test-u8-is-casefolded$(EXEEXT) test-u8-is-lowercase$(EXEEXT) \ - test-u8-is-titlecase$(EXEEXT) test-u8-is-uppercase$(EXEEXT) \ - test-u8-tolower$(EXEEXT) test-u8-totitle$(EXEEXT) \ - test-u8-toupper$(EXEEXT) test-ulc-casecmp$(EXEEXT) \ - test-ulc-casecoll$(EXEEXT) test-u16-conv-from-enc$(EXEEXT) \ - test-u16-conv-to-enc$(EXEEXT) \ + test-strncat$(EXEEXT) test-cased$(EXEEXT) \ + test-ignorable$(EXEEXT) test-locale-language$(EXEEXT) \ + test-uc_tolower$(EXEEXT) test-uc_totitle$(EXEEXT) \ + test-uc_toupper$(EXEEXT) test-u16-casecmp$(EXEEXT) \ + test-u16-casecoll$(EXEEXT) test-u16-casefold$(EXEEXT) \ + test-u16-is-cased$(EXEEXT) test-u16-is-casefolded$(EXEEXT) \ + test-u16-is-lowercase$(EXEEXT) test-u16-is-titlecase$(EXEEXT) \ + test-u16-is-uppercase$(EXEEXT) test-u16-tolower$(EXEEXT) \ + test-u16-totitle$(EXEEXT) test-u16-toupper$(EXEEXT) \ + test-u32-casecmp$(EXEEXT) test-u32-casecoll$(EXEEXT) \ + test-u32-casefold$(EXEEXT) test-u32-is-cased$(EXEEXT) \ + test-u32-is-casefolded$(EXEEXT) test-u32-is-lowercase$(EXEEXT) \ + test-u32-is-titlecase$(EXEEXT) test-u32-is-uppercase$(EXEEXT) \ + test-u32-tolower$(EXEEXT) test-u32-totitle$(EXEEXT) \ + test-u32-toupper$(EXEEXT) test-u8-casecmp$(EXEEXT) \ + test-u8-casecoll$(EXEEXT) test-u8-casefold$(EXEEXT) \ + test-u8-is-cased$(EXEEXT) test-u8-is-casefolded$(EXEEXT) \ + test-u8-is-lowercase$(EXEEXT) test-u8-is-titlecase$(EXEEXT) \ + test-u8-is-uppercase$(EXEEXT) test-u8-tolower$(EXEEXT) \ + test-u8-totitle$(EXEEXT) test-u8-toupper$(EXEEXT) \ + test-ulc-casecmp$(EXEEXT) test-ulc-casecoll$(EXEEXT) \ + test-u16-conv-from-enc$(EXEEXT) test-u16-conv-to-enc$(EXEEXT) \ test-u16-strconv-from-enc$(EXEEXT) \ test-u16-strconv-to-enc$(EXEEXT) \ test-u32-conv-from-enc$(EXEEXT) test-u32-conv-to-enc$(EXEEXT) \ @@ -406,13 +458,63 @@ check_PROGRAMS = test-alloca-opt$(EXEEXT) \ test-ulc-vasnprintf1$(EXEEXT) test-ulc-vasnprintf2$(EXEEXT) \ test-ulc-vasnprintf3$(EXEEXT) test-ulc-vasprintf1$(EXEEXT) \ test-ulc-vsnprintf1$(EXEEXT) test-ulc-vsprintf1$(EXEEXT) \ + test-u16-check$(EXEEXT) test-u16-chr$(EXEEXT) \ + test-u16-cmp$(EXEEXT) test-u16-cmp2$(EXEEXT) \ + test-u16-cpy-alloc$(EXEEXT) test-u16-cpy$(EXEEXT) \ + test-u16-mblen$(EXEEXT) test-u16-mbsnlen$(EXEEXT) \ + test-u16-mbtouc$(EXEEXT) test-u16-mbtouc-unsafe$(EXEEXT) \ + test-u16-mbtoucr$(EXEEXT) test-u16-move$(EXEEXT) \ + test-u16-next$(EXEEXT) test-u16-prev$(EXEEXT) \ + test-u16-set$(EXEEXT) test-u16-stpcpy$(EXEEXT) \ + test-u16-stpncpy$(EXEEXT) test-u16-strcat$(EXEEXT) \ + test-u16-strcmp$(EXEEXT) test-u16-strcoll$(EXEEXT) \ + test-u16-strcpy$(EXEEXT) test-u16-strdup$(EXEEXT) \ + test-u16-strlen$(EXEEXT) test-u16-strmblen$(EXEEXT) \ + test-u16-strmbtouc$(EXEEXT) test-u16-strncat$(EXEEXT) \ + test-u16-strncmp$(EXEEXT) test-u16-strncpy$(EXEEXT) \ + test-u16-strnlen$(EXEEXT) test-u16-to-u32$(EXEEXT) \ + test-u16-to-u8$(EXEEXT) test-u16-uctomb$(EXEEXT) \ + test-u32-check$(EXEEXT) test-u32-chr$(EXEEXT) \ + test-u32-cmp$(EXEEXT) test-u32-cmp2$(EXEEXT) \ + test-u32-cpy-alloc$(EXEEXT) test-u32-cpy$(EXEEXT) \ + test-u32-mblen$(EXEEXT) test-u32-mbsnlen$(EXEEXT) \ + test-u32-mbtouc$(EXEEXT) test-u32-mbtouc-unsafe$(EXEEXT) \ + test-u32-mbtoucr$(EXEEXT) test-u32-move$(EXEEXT) \ + test-u32-next$(EXEEXT) test-u32-prev$(EXEEXT) \ + test-u32-set$(EXEEXT) test-u32-stpcpy$(EXEEXT) \ + test-u32-stpncpy$(EXEEXT) test-u32-strcat$(EXEEXT) \ + test-u32-strcmp$(EXEEXT) test-u32-strcoll$(EXEEXT) \ + test-u32-strcpy$(EXEEXT) test-u32-strdup$(EXEEXT) \ + test-u32-strlen$(EXEEXT) test-u32-strmblen$(EXEEXT) \ + test-u32-strmbtouc$(EXEEXT) test-u32-strncat$(EXEEXT) \ + test-u32-strncmp$(EXEEXT) test-u32-strncpy$(EXEEXT) \ + test-u32-strnlen$(EXEEXT) test-u32-to-u16$(EXEEXT) \ + test-u32-to-u8$(EXEEXT) test-u32-uctomb$(EXEEXT) \ + test-u8-check$(EXEEXT) test-u8-chr$(EXEEXT) \ + test-u8-cmp$(EXEEXT) test-u8-cmp2$(EXEEXT) \ + test-u8-cpy-alloc$(EXEEXT) test-u8-cpy$(EXEEXT) \ + test-u8-mblen$(EXEEXT) test-u8-mbsnlen$(EXEEXT) \ + test-u8-mbtouc$(EXEEXT) test-u8-mbtouc-unsafe$(EXEEXT) \ + test-u8-mbtoucr$(EXEEXT) test-u8-move$(EXEEXT) \ + test-u8-next$(EXEEXT) test-u8-prev$(EXEEXT) \ + test-u8-set$(EXEEXT) test-u8-stpcpy$(EXEEXT) \ + test-u8-stpncpy$(EXEEXT) test-u8-strcat$(EXEEXT) \ + test-u8-strcmp$(EXEEXT) test-u8-strcoll$(EXEEXT) \ + test-u8-strcpy$(EXEEXT) test-u8-strdup$(EXEEXT) \ + test-u8-strlen$(EXEEXT) test-u8-strmblen$(EXEEXT) \ + test-u8-strmbtouc$(EXEEXT) test-u8-strncat$(EXEEXT) \ + test-u8-strncmp$(EXEEXT) test-u8-strncpy$(EXEEXT) \ + test-u8-strnlen$(EXEEXT) test-u8-to-u16$(EXEEXT) \ + test-u8-to-u32$(EXEEXT) test-u8-uctomb$(EXEEXT) \ test-u16-wordbreaks$(EXEEXT) test-u32-wordbreaks$(EXEEXT) \ test-u8-wordbreaks$(EXEEXT) test-ulc-wordbreaks$(EXEEXT) \ test-u16-strwidth$(EXEEXT) test-u16-width$(EXEEXT) \ test-u32-strwidth$(EXEEXT) test-u32-width$(EXEEXT) \ test-u8-strwidth$(EXEEXT) test-u8-width$(EXEEXT) \ test-uc_width$(EXEEXT) test-uc_width2$(EXEEXT) \ - test-wchar$(EXEEXT) test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) + test-unsetenv$(EXEEXT) test-wchar$(EXEEXT) \ + test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) \ + test-xalloc-die$(EXEEXT) @WOE32DLL_FALSE@am__append_1 = test-categ_none @WOE32DLL_FALSE@am__append_2 = test-categ_none subdir = tests @@ -420,17 +522,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/alloca.m4 \ $(top_srcdir)/gnulib-m4/codeset.m4 \ - $(top_srcdir)/gnulib-m4/dup2.m4 \ $(top_srcdir)/gnulib-m4/eealloc.m4 \ $(top_srcdir)/gnulib-m4/environ.m4 \ $(top_srcdir)/gnulib-m4/errno_h.m4 \ $(top_srcdir)/gnulib-m4/error.m4 \ - $(top_srcdir)/gnulib-m4/exitfail.m4 \ $(top_srcdir)/gnulib-m4/exponentd.m4 \ $(top_srcdir)/gnulib-m4/exponentf.m4 \ $(top_srcdir)/gnulib-m4/exponentl.m4 \ $(top_srcdir)/gnulib-m4/extensions.m4 \ - $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ $(top_srcdir)/gnulib-m4/float_h.m4 \ $(top_srcdir)/gnulib-m4/fpieee.m4 \ $(top_srcdir)/gnulib-m4/frexp.m4 \ @@ -462,6 +562,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/locale-zh.m4 \ $(top_srcdir)/gnulib-m4/locale_h.m4 \ $(top_srcdir)/gnulib-m4/localename.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ $(top_srcdir)/gnulib-m4/longlong.m4 \ $(top_srcdir)/gnulib-m4/malloc.m4 \ $(top_srcdir)/gnulib-m4/malloca.m4 \ @@ -474,13 +575,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/memchr.m4 \ $(top_srcdir)/gnulib-m4/minmax.m4 \ $(top_srcdir)/gnulib-m4/mmap-anon.m4 \ - $(top_srcdir)/gnulib-m4/mode_t.m4 \ $(top_srcdir)/gnulib-m4/multiarch.m4 \ $(top_srcdir)/gnulib-m4/nocrash.m4 \ - $(top_srcdir)/gnulib-m4/open.m4 \ $(top_srcdir)/gnulib-m4/printf-frexp.m4 \ $(top_srcdir)/gnulib-m4/printf-frexpl.m4 \ $(top_srcdir)/gnulib-m4/printf.m4 \ + $(top_srcdir)/gnulib-m4/putenv.m4 \ $(top_srcdir)/gnulib-m4/relocatable-lib.m4 \ $(top_srcdir)/gnulib-m4/setenv.m4 \ $(top_srcdir)/gnulib-m4/signbit.m4 \ @@ -492,16 +592,21 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/stdlib_h.m4 \ $(top_srcdir)/gnulib-m4/strerror.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/thread.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ $(top_srcdir)/gnulib-m4/unistd_h.m4 \ $(top_srcdir)/gnulib-m4/vasnprintf.m4 \ - $(top_srcdir)/gnulib-m4/wchar.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_h.m4 \ $(top_srcdir)/gnulib-m4/wchar_t.m4 \ $(top_srcdir)/gnulib-m4/wctob.m4 \ - $(top_srcdir)/gnulib-m4/wctype.m4 \ + $(top_srcdir)/gnulib-m4/wctype_h.m4 \ $(top_srcdir)/gnulib-m4/wcwidth.m4 \ $(top_srcdir)/gnulib-m4/wint_t.m4 \ $(top_srcdir)/gnulib-m4/xalloc.m4 \ - $(top_srcdir)/gnulib-m4/xsize.m4 $(top_srcdir)/m4/exported.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/yield.m4 $(top_srcdir)/m4/exported.m4 \ $(top_srcdir)/m4/init-package-version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ @@ -523,7 +628,9 @@ am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ libtests_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = -am_libtests_a_OBJECTS = progname.$(OBJEXT) xalloc-die.$(OBJEXT) +am__dirstamp = $(am__leading_dot)dirstamp +am_libtests_a_OBJECTS = exitfail.$(OBJEXT) progname.$(OBJEXT) \ + glthread/thread.$(OBJEXT) xalloc-die.$(OBJEXT) libtests_a_OBJECTS = $(am_libtests_a_OBJECTS) @WOE32DLL_FALSE@am__EXEEXT_1 = test-categ_none$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) @@ -540,7 +647,6 @@ test_array_mergesort_OBJECTS = test-array-mergesort.$(OBJEXT) test_array_mergesort_LDADD = $(LDADD) test_array_mergesort_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) -am__dirstamp = $(am__leading_dot)dirstamp am_test_bidi_byname_OBJECTS = unictype/test-bidi_byname.$(OBJEXT) test_bidi_byname_OBJECTS = $(am_test_bidi_byname_OBJECTS) test_bidi_byname_LDADD = $(LDADD) @@ -930,11 +1036,6 @@ test_digit_OBJECTS = $(am_test_digit_OBJECTS) test_digit_LDADD = $(LDADD) test_digit_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) -test_dup2_SOURCES = test-dup2.c -test_dup2_OBJECTS = test-dup2.$(OBJEXT) -test_dup2_LDADD = $(LDADD) -test_dup2_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ - $(am__DEPENDENCIES_1) test_environ_SOURCES = test-environ.c test_environ_OBJECTS = test-environ.$(OBJEXT) test_environ_LDADD = $(LDADD) @@ -945,11 +1046,6 @@ test_errno_OBJECTS = test-errno.$(OBJEXT) test_errno_LDADD = $(LDADD) test_errno_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) -test_fcntl_SOURCES = test-fcntl.c -test_fcntl_OBJECTS = test-fcntl.$(OBJEXT) -test_fcntl_LDADD = $(LDADD) -test_fcntl_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ - $(am__DEPENDENCIES_1) am_test_frexpl_nolibm_OBJECTS = test-frexpl.$(OBJEXT) test_frexpl_nolibm_OBJECTS = $(am_test_frexpl_nolibm_OBJECTS) test_frexpl_nolibm_LDADD = $(LDADD) @@ -965,6 +1061,11 @@ test_iconv_OBJECTS = test-iconv.$(OBJEXT) am__DEPENDENCIES_2 = libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) test_iconv_DEPENDENCIES = $(am__DEPENDENCIES_2) +test_iconv_h_SOURCES = test-iconv-h.c +test_iconv_h_OBJECTS = test-iconv-h.$(OBJEXT) +test_iconv_h_LDADD = $(LDADD) +test_iconv_h_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_ignorable_OBJECTS = unicase/test-ignorable.$(OBJEXT) test_ignorable_OBJECTS = $(am_test_ignorable_OBJECTS) test_ignorable_LDADD = $(LDADD) @@ -997,6 +1098,9 @@ test_locale_language_DEPENDENCIES = $(am__DEPENDENCIES_2) test_localename_SOURCES = test-localename.c test_localename_OBJECTS = test-localename.$(OBJEXT) test_localename_DEPENDENCIES = $(am__DEPENDENCIES_2) +test_lock_SOURCES = test-lock.c +test_lock_OBJECTS = test-lock.$(OBJEXT) +test_lock_DEPENDENCIES = $(am__DEPENDENCIES_2) test_malloca_SOURCES = test-malloca.c test_malloca_OBJECTS = test-malloca.$(OBJEXT) test_malloca_LDADD = $(LDADD) @@ -1060,11 +1164,6 @@ test_numeric_OBJECTS = $(am_test_numeric_OBJECTS) test_numeric_LDADD = $(LDADD) test_numeric_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) -test_open_SOURCES = test-open.c -test_open_OBJECTS = test-open.$(OBJEXT) -test_open_LDADD = $(LDADD) -test_open_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ - $(am__DEPENDENCIES_1) am_test_pr_alphabetic_OBJECTS = unictype/test-pr_alphabetic.$(OBJEXT) test_pr_alphabetic_OBJECTS = $(am_test_pr_alphabetic_OBJECTS) test_pr_alphabetic_LDADD = $(LDADD) @@ -1580,6 +1679,11 @@ test_scripts_OBJECTS = $(am_test_scripts_OBJECTS) test_scripts_LDADD = $(LDADD) test_scripts_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_setenv_SOURCES = test-setenv.c +test_setenv_OBJECTS = test-setenv.$(OBJEXT) +test_setenv_LDADD = $(LDADD) +test_setenv_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) test_signbit_SOURCES = test-signbit.c test_signbit_OBJECTS = test-signbit.$(OBJEXT) test_signbit_LDADD = $(LDADD) @@ -1621,6 +1725,11 @@ test_string_OBJECTS = test-string.$(OBJEXT) test_string_LDADD = $(LDADD) test_string_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_strncat_SOURCES = test-strncat.c +test_strncat_OBJECTS = test-strncat.$(OBJEXT) +test_strncat_LDADD = $(LDADD) +test_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_sy_c_ident_OBJECTS = unictype/test-sy_c_ident.$(OBJEXT) test_sy_c_ident_OBJECTS = $(am_test_sy_c_ident_OBJECTS) test_sy_c_ident_LDADD = $(LDADD) @@ -1661,6 +1770,26 @@ test_u16_casefold_OBJECTS = $(am_test_u16_casefold_OBJECTS) test_u16_casefold_LDADD = $(LDADD) test_u16_casefold_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_check_OBJECTS = unistr/test-u16-check.$(OBJEXT) +test_u16_check_OBJECTS = $(am_test_u16_check_OBJECTS) +test_u16_check_LDADD = $(LDADD) +test_u16_check_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_chr_OBJECTS = unistr/test-u16-chr.$(OBJEXT) +test_u16_chr_OBJECTS = $(am_test_u16_chr_OBJECTS) +test_u16_chr_LDADD = $(LDADD) +test_u16_chr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_cmp_OBJECTS = unistr/test-u16-cmp.$(OBJEXT) +test_u16_cmp_OBJECTS = $(am_test_u16_cmp_OBJECTS) +test_u16_cmp_LDADD = $(LDADD) +test_u16_cmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_cmp2_OBJECTS = unistr/test-u16-cmp2.$(OBJEXT) +test_u16_cmp2_OBJECTS = $(am_test_u16_cmp2_OBJECTS) +test_u16_cmp2_LDADD = $(LDADD) +test_u16_cmp2_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_conv_from_enc_OBJECTS = \ uniconv/test-u16-conv-from-enc.$(OBJEXT) test_u16_conv_from_enc_OBJECTS = $(am_test_u16_conv_from_enc_OBJECTS) @@ -1669,6 +1798,16 @@ am_test_u16_conv_to_enc_OBJECTS = \ uniconv/test-u16-conv-to-enc.$(OBJEXT) test_u16_conv_to_enc_OBJECTS = $(am_test_u16_conv_to_enc_OBJECTS) test_u16_conv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u16_cpy_OBJECTS = unistr/test-u16-cpy.$(OBJEXT) +test_u16_cpy_OBJECTS = $(am_test_u16_cpy_OBJECTS) +test_u16_cpy_LDADD = $(LDADD) +test_u16_cpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_cpy_alloc_OBJECTS = unistr/test-u16-cpy-alloc.$(OBJEXT) +test_u16_cpy_alloc_OBJECTS = $(am_test_u16_cpy_alloc_OBJECTS) +test_u16_cpy_alloc_LDADD = $(LDADD) +test_u16_cpy_alloc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_is_cased_OBJECTS = unicase/test-u16-is-cased.$(OBJEXT) test_u16_is_cased_OBJECTS = $(am_test_u16_is_cased_OBJECTS) test_u16_is_cased_LDADD = $(LDADD) @@ -1698,6 +1837,42 @@ test_u16_is_uppercase_OBJECTS = $(am_test_u16_is_uppercase_OBJECTS) test_u16_is_uppercase_LDADD = $(LDADD) test_u16_is_uppercase_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mblen_OBJECTS = unistr/test-u16-mblen.$(OBJEXT) +test_u16_mblen_OBJECTS = $(am_test_u16_mblen_OBJECTS) +test_u16_mblen_LDADD = $(LDADD) +test_u16_mblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbsnlen_OBJECTS = unistr/test-u16-mbsnlen.$(OBJEXT) +test_u16_mbsnlen_OBJECTS = $(am_test_u16_mbsnlen_OBJECTS) +test_u16_mbsnlen_LDADD = $(LDADD) +test_u16_mbsnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbtouc_OBJECTS = unistr/test-u16-mbtouc.$(OBJEXT) +test_u16_mbtouc_OBJECTS = $(am_test_u16_mbtouc_OBJECTS) +test_u16_mbtouc_LDADD = $(LDADD) +test_u16_mbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbtouc_unsafe_OBJECTS = \ + unistr/test-u16-mbtouc-unsafe.$(OBJEXT) +test_u16_mbtouc_unsafe_OBJECTS = $(am_test_u16_mbtouc_unsafe_OBJECTS) +test_u16_mbtouc_unsafe_LDADD = $(LDADD) +test_u16_mbtouc_unsafe_DEPENDENCIES = libtests.a \ + ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbtoucr_OBJECTS = unistr/test-u16-mbtoucr.$(OBJEXT) +test_u16_mbtoucr_OBJECTS = $(am_test_u16_mbtoucr_OBJECTS) +test_u16_mbtoucr_LDADD = $(LDADD) +test_u16_mbtoucr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_move_OBJECTS = unistr/test-u16-move.$(OBJEXT) +test_u16_move_OBJECTS = $(am_test_u16_move_OBJECTS) +test_u16_move_LDADD = $(LDADD) +test_u16_move_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_next_OBJECTS = unistr/test-u16-next.$(OBJEXT) +test_u16_next_OBJECTS = $(am_test_u16_next_OBJECTS) +test_u16_next_LDADD = $(LDADD) +test_u16_next_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_normcmp_OBJECTS = uninorm/test-u16-normcmp.$(OBJEXT) test_u16_normcmp_OBJECTS = $(am_test_u16_normcmp_OBJECTS) test_u16_normcmp_LDADD = $(LDADD) @@ -1713,6 +1888,39 @@ test_u16_possible_linebreaks_OBJECTS = \ test_u16_possible_linebreaks_LDADD = $(LDADD) test_u16_possible_linebreaks_DEPENDENCIES = libtests.a \ ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u16_prev_OBJECTS = unistr/test-u16-prev.$(OBJEXT) +test_u16_prev_OBJECTS = $(am_test_u16_prev_OBJECTS) +test_u16_prev_LDADD = $(LDADD) +test_u16_prev_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_set_OBJECTS = unistr/test-u16-set.$(OBJEXT) +test_u16_set_OBJECTS = $(am_test_u16_set_OBJECTS) +test_u16_set_LDADD = $(LDADD) +test_u16_set_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_stpcpy_OBJECTS = unistr/test-u16-stpcpy.$(OBJEXT) +test_u16_stpcpy_OBJECTS = $(am_test_u16_stpcpy_OBJECTS) +test_u16_stpcpy_LDADD = $(LDADD) +test_u16_stpcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_stpncpy_OBJECTS = unistr/test-u16-stpncpy.$(OBJEXT) +test_u16_stpncpy_OBJECTS = $(am_test_u16_stpncpy_OBJECTS) +test_u16_stpncpy_LDADD = $(LDADD) +test_u16_stpncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strcat_OBJECTS = unistr/test-u16-strcat.$(OBJEXT) +test_u16_strcat_OBJECTS = $(am_test_u16_strcat_OBJECTS) +test_u16_strcat_LDADD = $(LDADD) +test_u16_strcat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strcmp_OBJECTS = unistr/test-u16-strcmp.$(OBJEXT) +test_u16_strcmp_OBJECTS = $(am_test_u16_strcmp_OBJECTS) +test_u16_strcmp_LDADD = $(LDADD) +test_u16_strcmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strcoll_OBJECTS = unistr/test-u16-strcoll.$(OBJEXT) +test_u16_strcoll_OBJECTS = $(am_test_u16_strcoll_OBJECTS) +test_u16_strcoll_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u16_strconv_from_enc_OBJECTS = \ uniconv/test-u16-strconv-from-enc.$(OBJEXT) test_u16_strconv_from_enc_OBJECTS = \ @@ -1723,11 +1931,66 @@ am_test_u16_strconv_to_enc_OBJECTS = \ test_u16_strconv_to_enc_OBJECTS = \ $(am_test_u16_strconv_to_enc_OBJECTS) test_u16_strconv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u16_strcpy_OBJECTS = unistr/test-u16-strcpy.$(OBJEXT) +test_u16_strcpy_OBJECTS = $(am_test_u16_strcpy_OBJECTS) +test_u16_strcpy_LDADD = $(LDADD) +test_u16_strcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strdup_OBJECTS = unistr/test-u16-strdup.$(OBJEXT) +test_u16_strdup_OBJECTS = $(am_test_u16_strdup_OBJECTS) +test_u16_strdup_LDADD = $(LDADD) +test_u16_strdup_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strlen_OBJECTS = unistr/test-u16-strlen.$(OBJEXT) +test_u16_strlen_OBJECTS = $(am_test_u16_strlen_OBJECTS) +test_u16_strlen_LDADD = $(LDADD) +test_u16_strlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strmblen_OBJECTS = unistr/test-u16-strmblen.$(OBJEXT) +test_u16_strmblen_OBJECTS = $(am_test_u16_strmblen_OBJECTS) +test_u16_strmblen_LDADD = $(LDADD) +test_u16_strmblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strmbtouc_OBJECTS = unistr/test-u16-strmbtouc.$(OBJEXT) +test_u16_strmbtouc_OBJECTS = $(am_test_u16_strmbtouc_OBJECTS) +test_u16_strmbtouc_LDADD = $(LDADD) +test_u16_strmbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strncat_OBJECTS = unistr/test-u16-strncat.$(OBJEXT) +test_u16_strncat_OBJECTS = $(am_test_u16_strncat_OBJECTS) +test_u16_strncat_LDADD = $(LDADD) +test_u16_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strncmp_OBJECTS = unistr/test-u16-strncmp.$(OBJEXT) +test_u16_strncmp_OBJECTS = $(am_test_u16_strncmp_OBJECTS) +test_u16_strncmp_LDADD = $(LDADD) +test_u16_strncmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strncpy_OBJECTS = unistr/test-u16-strncpy.$(OBJEXT) +test_u16_strncpy_OBJECTS = $(am_test_u16_strncpy_OBJECTS) +test_u16_strncpy_LDADD = $(LDADD) +test_u16_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strnlen_OBJECTS = unistr/test-u16-strnlen.$(OBJEXT) +test_u16_strnlen_OBJECTS = $(am_test_u16_strnlen_OBJECTS) +test_u16_strnlen_LDADD = $(LDADD) +test_u16_strnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_strwidth_OBJECTS = uniwidth/test-u16-strwidth.$(OBJEXT) test_u16_strwidth_OBJECTS = $(am_test_u16_strwidth_OBJECTS) test_u16_strwidth_LDADD = $(LDADD) test_u16_strwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_to_u32_OBJECTS = unistr/test-u16-to-u32.$(OBJEXT) +test_u16_to_u32_OBJECTS = $(am_test_u16_to_u32_OBJECTS) +test_u16_to_u32_LDADD = $(LDADD) +test_u16_to_u32_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_to_u8_OBJECTS = unistr/test-u16-to-u8.$(OBJEXT) +test_u16_to_u8_OBJECTS = $(am_test_u16_to_u8_OBJECTS) +test_u16_to_u8_LDADD = $(LDADD) +test_u16_to_u8_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_tolower_OBJECTS = unicase/test-u16-tolower.$(OBJEXT) test_u16_tolower_OBJECTS = $(am_test_u16_tolower_OBJECTS) test_u16_tolower_LDADD = $(LDADD) @@ -1743,6 +2006,11 @@ test_u16_toupper_OBJECTS = $(am_test_u16_toupper_OBJECTS) test_u16_toupper_LDADD = $(LDADD) test_u16_toupper_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_uctomb_OBJECTS = unistr/test-u16-uctomb.$(OBJEXT) +test_u16_uctomb_OBJECTS = $(am_test_u16_uctomb_OBJECTS) +test_u16_uctomb_LDADD = $(LDADD) +test_u16_uctomb_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_vasnprintf1_OBJECTS = \ unistdio/test-u16-vasnprintf1.$(OBJEXT) test_u16_vasnprintf1_OBJECTS = $(am_test_u16_vasnprintf1_OBJECTS) @@ -1801,6 +2069,26 @@ test_u32_casefold_OBJECTS = $(am_test_u32_casefold_OBJECTS) test_u32_casefold_LDADD = $(LDADD) test_u32_casefold_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_check_OBJECTS = unistr/test-u32-check.$(OBJEXT) +test_u32_check_OBJECTS = $(am_test_u32_check_OBJECTS) +test_u32_check_LDADD = $(LDADD) +test_u32_check_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_chr_OBJECTS = unistr/test-u32-chr.$(OBJEXT) +test_u32_chr_OBJECTS = $(am_test_u32_chr_OBJECTS) +test_u32_chr_LDADD = $(LDADD) +test_u32_chr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_cmp_OBJECTS = unistr/test-u32-cmp.$(OBJEXT) +test_u32_cmp_OBJECTS = $(am_test_u32_cmp_OBJECTS) +test_u32_cmp_LDADD = $(LDADD) +test_u32_cmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_cmp2_OBJECTS = unistr/test-u32-cmp2.$(OBJEXT) +test_u32_cmp2_OBJECTS = $(am_test_u32_cmp2_OBJECTS) +test_u32_cmp2_LDADD = $(LDADD) +test_u32_cmp2_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_conv_from_enc_OBJECTS = \ uniconv/test-u32-conv-from-enc.$(OBJEXT) test_u32_conv_from_enc_OBJECTS = $(am_test_u32_conv_from_enc_OBJECTS) @@ -1809,6 +2097,16 @@ am_test_u32_conv_to_enc_OBJECTS = \ uniconv/test-u32-conv-to-enc.$(OBJEXT) test_u32_conv_to_enc_OBJECTS = $(am_test_u32_conv_to_enc_OBJECTS) test_u32_conv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u32_cpy_OBJECTS = unistr/test-u32-cpy.$(OBJEXT) +test_u32_cpy_OBJECTS = $(am_test_u32_cpy_OBJECTS) +test_u32_cpy_LDADD = $(LDADD) +test_u32_cpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_cpy_alloc_OBJECTS = unistr/test-u32-cpy-alloc.$(OBJEXT) +test_u32_cpy_alloc_OBJECTS = $(am_test_u32_cpy_alloc_OBJECTS) +test_u32_cpy_alloc_LDADD = $(LDADD) +test_u32_cpy_alloc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_is_cased_OBJECTS = unicase/test-u32-is-cased.$(OBJEXT) test_u32_is_cased_OBJECTS = $(am_test_u32_is_cased_OBJECTS) test_u32_is_cased_LDADD = $(LDADD) @@ -1838,6 +2136,42 @@ test_u32_is_uppercase_OBJECTS = $(am_test_u32_is_uppercase_OBJECTS) test_u32_is_uppercase_LDADD = $(LDADD) test_u32_is_uppercase_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mblen_OBJECTS = unistr/test-u32-mblen.$(OBJEXT) +test_u32_mblen_OBJECTS = $(am_test_u32_mblen_OBJECTS) +test_u32_mblen_LDADD = $(LDADD) +test_u32_mblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbsnlen_OBJECTS = unistr/test-u32-mbsnlen.$(OBJEXT) +test_u32_mbsnlen_OBJECTS = $(am_test_u32_mbsnlen_OBJECTS) +test_u32_mbsnlen_LDADD = $(LDADD) +test_u32_mbsnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbtouc_OBJECTS = unistr/test-u32-mbtouc.$(OBJEXT) +test_u32_mbtouc_OBJECTS = $(am_test_u32_mbtouc_OBJECTS) +test_u32_mbtouc_LDADD = $(LDADD) +test_u32_mbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbtouc_unsafe_OBJECTS = \ + unistr/test-u32-mbtouc-unsafe.$(OBJEXT) +test_u32_mbtouc_unsafe_OBJECTS = $(am_test_u32_mbtouc_unsafe_OBJECTS) +test_u32_mbtouc_unsafe_LDADD = $(LDADD) +test_u32_mbtouc_unsafe_DEPENDENCIES = libtests.a \ + ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbtoucr_OBJECTS = unistr/test-u32-mbtoucr.$(OBJEXT) +test_u32_mbtoucr_OBJECTS = $(am_test_u32_mbtoucr_OBJECTS) +test_u32_mbtoucr_LDADD = $(LDADD) +test_u32_mbtoucr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_move_OBJECTS = unistr/test-u32-move.$(OBJEXT) +test_u32_move_OBJECTS = $(am_test_u32_move_OBJECTS) +test_u32_move_LDADD = $(LDADD) +test_u32_move_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_next_OBJECTS = unistr/test-u32-next.$(OBJEXT) +test_u32_next_OBJECTS = $(am_test_u32_next_OBJECTS) +test_u32_next_LDADD = $(LDADD) +test_u32_next_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_nfc_big_OBJECTS = uninorm/test-u32-nfc-big.$(OBJEXT) \ uninorm/test-u32-normalize-big.$(OBJEXT) test_u32_nfc_big_OBJECTS = $(am_test_u32_nfc_big_OBJECTS) @@ -1869,6 +2203,39 @@ test_u32_possible_linebreaks_OBJECTS = \ test_u32_possible_linebreaks_LDADD = $(LDADD) test_u32_possible_linebreaks_DEPENDENCIES = libtests.a \ ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u32_prev_OBJECTS = unistr/test-u32-prev.$(OBJEXT) +test_u32_prev_OBJECTS = $(am_test_u32_prev_OBJECTS) +test_u32_prev_LDADD = $(LDADD) +test_u32_prev_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_set_OBJECTS = unistr/test-u32-set.$(OBJEXT) +test_u32_set_OBJECTS = $(am_test_u32_set_OBJECTS) +test_u32_set_LDADD = $(LDADD) +test_u32_set_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_stpcpy_OBJECTS = unistr/test-u32-stpcpy.$(OBJEXT) +test_u32_stpcpy_OBJECTS = $(am_test_u32_stpcpy_OBJECTS) +test_u32_stpcpy_LDADD = $(LDADD) +test_u32_stpcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_stpncpy_OBJECTS = unistr/test-u32-stpncpy.$(OBJEXT) +test_u32_stpncpy_OBJECTS = $(am_test_u32_stpncpy_OBJECTS) +test_u32_stpncpy_LDADD = $(LDADD) +test_u32_stpncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strcat_OBJECTS = unistr/test-u32-strcat.$(OBJEXT) +test_u32_strcat_OBJECTS = $(am_test_u32_strcat_OBJECTS) +test_u32_strcat_LDADD = $(LDADD) +test_u32_strcat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strcmp_OBJECTS = unistr/test-u32-strcmp.$(OBJEXT) +test_u32_strcmp_OBJECTS = $(am_test_u32_strcmp_OBJECTS) +test_u32_strcmp_LDADD = $(LDADD) +test_u32_strcmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strcoll_OBJECTS = unistr/test-u32-strcoll.$(OBJEXT) +test_u32_strcoll_OBJECTS = $(am_test_u32_strcoll_OBJECTS) +test_u32_strcoll_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u32_strconv_from_enc_OBJECTS = \ uniconv/test-u32-strconv-from-enc.$(OBJEXT) test_u32_strconv_from_enc_OBJECTS = \ @@ -1879,11 +2246,66 @@ am_test_u32_strconv_to_enc_OBJECTS = \ test_u32_strconv_to_enc_OBJECTS = \ $(am_test_u32_strconv_to_enc_OBJECTS) test_u32_strconv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u32_strcpy_OBJECTS = unistr/test-u32-strcpy.$(OBJEXT) +test_u32_strcpy_OBJECTS = $(am_test_u32_strcpy_OBJECTS) +test_u32_strcpy_LDADD = $(LDADD) +test_u32_strcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strdup_OBJECTS = unistr/test-u32-strdup.$(OBJEXT) +test_u32_strdup_OBJECTS = $(am_test_u32_strdup_OBJECTS) +test_u32_strdup_LDADD = $(LDADD) +test_u32_strdup_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strlen_OBJECTS = unistr/test-u32-strlen.$(OBJEXT) +test_u32_strlen_OBJECTS = $(am_test_u32_strlen_OBJECTS) +test_u32_strlen_LDADD = $(LDADD) +test_u32_strlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strmblen_OBJECTS = unistr/test-u32-strmblen.$(OBJEXT) +test_u32_strmblen_OBJECTS = $(am_test_u32_strmblen_OBJECTS) +test_u32_strmblen_LDADD = $(LDADD) +test_u32_strmblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strmbtouc_OBJECTS = unistr/test-u32-strmbtouc.$(OBJEXT) +test_u32_strmbtouc_OBJECTS = $(am_test_u32_strmbtouc_OBJECTS) +test_u32_strmbtouc_LDADD = $(LDADD) +test_u32_strmbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strncat_OBJECTS = unistr/test-u32-strncat.$(OBJEXT) +test_u32_strncat_OBJECTS = $(am_test_u32_strncat_OBJECTS) +test_u32_strncat_LDADD = $(LDADD) +test_u32_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strncmp_OBJECTS = unistr/test-u32-strncmp.$(OBJEXT) +test_u32_strncmp_OBJECTS = $(am_test_u32_strncmp_OBJECTS) +test_u32_strncmp_LDADD = $(LDADD) +test_u32_strncmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strncpy_OBJECTS = unistr/test-u32-strncpy.$(OBJEXT) +test_u32_strncpy_OBJECTS = $(am_test_u32_strncpy_OBJECTS) +test_u32_strncpy_LDADD = $(LDADD) +test_u32_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strnlen_OBJECTS = unistr/test-u32-strnlen.$(OBJEXT) +test_u32_strnlen_OBJECTS = $(am_test_u32_strnlen_OBJECTS) +test_u32_strnlen_LDADD = $(LDADD) +test_u32_strnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_strwidth_OBJECTS = uniwidth/test-u32-strwidth.$(OBJEXT) test_u32_strwidth_OBJECTS = $(am_test_u32_strwidth_OBJECTS) test_u32_strwidth_LDADD = $(LDADD) test_u32_strwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_to_u16_OBJECTS = unistr/test-u32-to-u16.$(OBJEXT) +test_u32_to_u16_OBJECTS = $(am_test_u32_to_u16_OBJECTS) +test_u32_to_u16_LDADD = $(LDADD) +test_u32_to_u16_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_to_u8_OBJECTS = unistr/test-u32-to-u8.$(OBJEXT) +test_u32_to_u8_OBJECTS = $(am_test_u32_to_u8_OBJECTS) +test_u32_to_u8_LDADD = $(LDADD) +test_u32_to_u8_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_tolower_OBJECTS = unicase/test-u32-tolower.$(OBJEXT) test_u32_tolower_OBJECTS = $(am_test_u32_tolower_OBJECTS) test_u32_tolower_LDADD = $(LDADD) @@ -1899,6 +2321,11 @@ test_u32_toupper_OBJECTS = $(am_test_u32_toupper_OBJECTS) test_u32_toupper_LDADD = $(LDADD) test_u32_toupper_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_uctomb_OBJECTS = unistr/test-u32-uctomb.$(OBJEXT) +test_u32_uctomb_OBJECTS = $(am_test_u32_uctomb_OBJECTS) +test_u32_uctomb_LDADD = $(LDADD) +test_u32_uctomb_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_vasnprintf1_OBJECTS = \ unistdio/test-u32-vasnprintf1.$(OBJEXT) test_u32_vasnprintf1_OBJECTS = $(am_test_u32_vasnprintf1_OBJECTS) @@ -1956,6 +2383,26 @@ test_u8_casefold_OBJECTS = $(am_test_u8_casefold_OBJECTS) test_u8_casefold_LDADD = $(LDADD) test_u8_casefold_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_check_OBJECTS = unistr/test-u8-check.$(OBJEXT) +test_u8_check_OBJECTS = $(am_test_u8_check_OBJECTS) +test_u8_check_LDADD = $(LDADD) +test_u8_check_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_chr_OBJECTS = unistr/test-u8-chr.$(OBJEXT) +test_u8_chr_OBJECTS = $(am_test_u8_chr_OBJECTS) +test_u8_chr_LDADD = $(LDADD) +test_u8_chr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_cmp_OBJECTS = unistr/test-u8-cmp.$(OBJEXT) +test_u8_cmp_OBJECTS = $(am_test_u8_cmp_OBJECTS) +test_u8_cmp_LDADD = $(LDADD) +test_u8_cmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_cmp2_OBJECTS = unistr/test-u8-cmp2.$(OBJEXT) +test_u8_cmp2_OBJECTS = $(am_test_u8_cmp2_OBJECTS) +test_u8_cmp2_LDADD = $(LDADD) +test_u8_cmp2_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_conv_from_enc_OBJECTS = \ uniconv/test-u8-conv-from-enc.$(OBJEXT) test_u8_conv_from_enc_OBJECTS = $(am_test_u8_conv_from_enc_OBJECTS) @@ -1964,6 +2411,16 @@ am_test_u8_conv_to_enc_OBJECTS = \ uniconv/test-u8-conv-to-enc.$(OBJEXT) test_u8_conv_to_enc_OBJECTS = $(am_test_u8_conv_to_enc_OBJECTS) test_u8_conv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u8_cpy_OBJECTS = unistr/test-u8-cpy.$(OBJEXT) +test_u8_cpy_OBJECTS = $(am_test_u8_cpy_OBJECTS) +test_u8_cpy_LDADD = $(LDADD) +test_u8_cpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_cpy_alloc_OBJECTS = unistr/test-u8-cpy-alloc.$(OBJEXT) +test_u8_cpy_alloc_OBJECTS = $(am_test_u8_cpy_alloc_OBJECTS) +test_u8_cpy_alloc_LDADD = $(LDADD) +test_u8_cpy_alloc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_is_cased_OBJECTS = unicase/test-u8-is-cased.$(OBJEXT) test_u8_is_cased_OBJECTS = $(am_test_u8_is_cased_OBJECTS) test_u8_is_cased_LDADD = $(LDADD) @@ -1993,6 +2450,42 @@ test_u8_is_uppercase_OBJECTS = $(am_test_u8_is_uppercase_OBJECTS) test_u8_is_uppercase_LDADD = $(LDADD) test_u8_is_uppercase_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mblen_OBJECTS = unistr/test-u8-mblen.$(OBJEXT) +test_u8_mblen_OBJECTS = $(am_test_u8_mblen_OBJECTS) +test_u8_mblen_LDADD = $(LDADD) +test_u8_mblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbsnlen_OBJECTS = unistr/test-u8-mbsnlen.$(OBJEXT) +test_u8_mbsnlen_OBJECTS = $(am_test_u8_mbsnlen_OBJECTS) +test_u8_mbsnlen_LDADD = $(LDADD) +test_u8_mbsnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbtouc_OBJECTS = unistr/test-u8-mbtouc.$(OBJEXT) +test_u8_mbtouc_OBJECTS = $(am_test_u8_mbtouc_OBJECTS) +test_u8_mbtouc_LDADD = $(LDADD) +test_u8_mbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbtouc_unsafe_OBJECTS = \ + unistr/test-u8-mbtouc-unsafe.$(OBJEXT) +test_u8_mbtouc_unsafe_OBJECTS = $(am_test_u8_mbtouc_unsafe_OBJECTS) +test_u8_mbtouc_unsafe_LDADD = $(LDADD) +test_u8_mbtouc_unsafe_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbtoucr_OBJECTS = unistr/test-u8-mbtoucr.$(OBJEXT) +test_u8_mbtoucr_OBJECTS = $(am_test_u8_mbtoucr_OBJECTS) +test_u8_mbtoucr_LDADD = $(LDADD) +test_u8_mbtoucr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_move_OBJECTS = unistr/test-u8-move.$(OBJEXT) +test_u8_move_OBJECTS = $(am_test_u8_move_OBJECTS) +test_u8_move_LDADD = $(LDADD) +test_u8_move_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_next_OBJECTS = unistr/test-u8-next.$(OBJEXT) +test_u8_next_OBJECTS = $(am_test_u8_next_OBJECTS) +test_u8_next_LDADD = $(LDADD) +test_u8_next_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_normcmp_OBJECTS = uninorm/test-u8-normcmp.$(OBJEXT) test_u8_normcmp_OBJECTS = $(am_test_u8_normcmp_OBJECTS) test_u8_normcmp_LDADD = $(LDADD) @@ -2008,6 +2501,39 @@ test_u8_possible_linebreaks_OBJECTS = \ test_u8_possible_linebreaks_LDADD = $(LDADD) test_u8_possible_linebreaks_DEPENDENCIES = libtests.a \ ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u8_prev_OBJECTS = unistr/test-u8-prev.$(OBJEXT) +test_u8_prev_OBJECTS = $(am_test_u8_prev_OBJECTS) +test_u8_prev_LDADD = $(LDADD) +test_u8_prev_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_set_OBJECTS = unistr/test-u8-set.$(OBJEXT) +test_u8_set_OBJECTS = $(am_test_u8_set_OBJECTS) +test_u8_set_LDADD = $(LDADD) +test_u8_set_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_stpcpy_OBJECTS = unistr/test-u8-stpcpy.$(OBJEXT) +test_u8_stpcpy_OBJECTS = $(am_test_u8_stpcpy_OBJECTS) +test_u8_stpcpy_LDADD = $(LDADD) +test_u8_stpcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_stpncpy_OBJECTS = unistr/test-u8-stpncpy.$(OBJEXT) +test_u8_stpncpy_OBJECTS = $(am_test_u8_stpncpy_OBJECTS) +test_u8_stpncpy_LDADD = $(LDADD) +test_u8_stpncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strcat_OBJECTS = unistr/test-u8-strcat.$(OBJEXT) +test_u8_strcat_OBJECTS = $(am_test_u8_strcat_OBJECTS) +test_u8_strcat_LDADD = $(LDADD) +test_u8_strcat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strcmp_OBJECTS = unistr/test-u8-strcmp.$(OBJEXT) +test_u8_strcmp_OBJECTS = $(am_test_u8_strcmp_OBJECTS) +test_u8_strcmp_LDADD = $(LDADD) +test_u8_strcmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strcoll_OBJECTS = unistr/test-u8-strcoll.$(OBJEXT) +test_u8_strcoll_OBJECTS = $(am_test_u8_strcoll_OBJECTS) +test_u8_strcoll_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u8_strconv_from_enc_OBJECTS = \ uniconv/test-u8-strconv-from-enc.$(OBJEXT) test_u8_strconv_from_enc_OBJECTS = \ @@ -2017,11 +2543,66 @@ am_test_u8_strconv_to_enc_OBJECTS = \ uniconv/test-u8-strconv-to-enc.$(OBJEXT) test_u8_strconv_to_enc_OBJECTS = $(am_test_u8_strconv_to_enc_OBJECTS) test_u8_strconv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u8_strcpy_OBJECTS = unistr/test-u8-strcpy.$(OBJEXT) +test_u8_strcpy_OBJECTS = $(am_test_u8_strcpy_OBJECTS) +test_u8_strcpy_LDADD = $(LDADD) +test_u8_strcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strdup_OBJECTS = unistr/test-u8-strdup.$(OBJEXT) +test_u8_strdup_OBJECTS = $(am_test_u8_strdup_OBJECTS) +test_u8_strdup_LDADD = $(LDADD) +test_u8_strdup_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strlen_OBJECTS = unistr/test-u8-strlen.$(OBJEXT) +test_u8_strlen_OBJECTS = $(am_test_u8_strlen_OBJECTS) +test_u8_strlen_LDADD = $(LDADD) +test_u8_strlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strmblen_OBJECTS = unistr/test-u8-strmblen.$(OBJEXT) +test_u8_strmblen_OBJECTS = $(am_test_u8_strmblen_OBJECTS) +test_u8_strmblen_LDADD = $(LDADD) +test_u8_strmblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strmbtouc_OBJECTS = unistr/test-u8-strmbtouc.$(OBJEXT) +test_u8_strmbtouc_OBJECTS = $(am_test_u8_strmbtouc_OBJECTS) +test_u8_strmbtouc_LDADD = $(LDADD) +test_u8_strmbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strncat_OBJECTS = unistr/test-u8-strncat.$(OBJEXT) +test_u8_strncat_OBJECTS = $(am_test_u8_strncat_OBJECTS) +test_u8_strncat_LDADD = $(LDADD) +test_u8_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strncmp_OBJECTS = unistr/test-u8-strncmp.$(OBJEXT) +test_u8_strncmp_OBJECTS = $(am_test_u8_strncmp_OBJECTS) +test_u8_strncmp_LDADD = $(LDADD) +test_u8_strncmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strncpy_OBJECTS = unistr/test-u8-strncpy.$(OBJEXT) +test_u8_strncpy_OBJECTS = $(am_test_u8_strncpy_OBJECTS) +test_u8_strncpy_LDADD = $(LDADD) +test_u8_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strnlen_OBJECTS = unistr/test-u8-strnlen.$(OBJEXT) +test_u8_strnlen_OBJECTS = $(am_test_u8_strnlen_OBJECTS) +test_u8_strnlen_LDADD = $(LDADD) +test_u8_strnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_strwidth_OBJECTS = uniwidth/test-u8-strwidth.$(OBJEXT) test_u8_strwidth_OBJECTS = $(am_test_u8_strwidth_OBJECTS) test_u8_strwidth_LDADD = $(LDADD) test_u8_strwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_to_u16_OBJECTS = unistr/test-u8-to-u16.$(OBJEXT) +test_u8_to_u16_OBJECTS = $(am_test_u8_to_u16_OBJECTS) +test_u8_to_u16_LDADD = $(LDADD) +test_u8_to_u16_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_to_u32_OBJECTS = unistr/test-u8-to-u32.$(OBJEXT) +test_u8_to_u32_OBJECTS = $(am_test_u8_to_u32_OBJECTS) +test_u8_to_u32_LDADD = $(LDADD) +test_u8_to_u32_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_tolower_OBJECTS = unicase/test-u8-tolower.$(OBJEXT) test_u8_tolower_OBJECTS = $(am_test_u8_tolower_OBJECTS) test_u8_tolower_LDADD = $(LDADD) @@ -2037,6 +2618,11 @@ test_u8_toupper_OBJECTS = $(am_test_u8_toupper_OBJECTS) test_u8_toupper_LDADD = $(LDADD) test_u8_toupper_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_uctomb_OBJECTS = unistr/test-u8-uctomb.$(OBJEXT) +test_u8_uctomb_OBJECTS = $(am_test_u8_uctomb_OBJECTS) +test_u8_uctomb_LDADD = $(LDADD) +test_u8_uctomb_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_vasnprintf1_OBJECTS = \ unistdio/test-u8-vasnprintf1.$(OBJEXT) test_u8_vasnprintf1_OBJECTS = $(am_test_u8_vasnprintf1_OBJECTS) @@ -2162,6 +2748,11 @@ test_unistd_OBJECTS = test-unistd.$(OBJEXT) test_unistd_LDADD = $(LDADD) test_unistd_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_unsetenv_SOURCES = test-unsetenv.c +test_unsetenv_OBJECTS = test-unsetenv.$(OBJEXT) +test_unsetenv_LDADD = $(LDADD) +test_unsetenv_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) test_wchar_SOURCES = test-wchar.c test_wchar_OBJECTS = test-wchar.$(OBJEXT) test_wchar_LDADD = $(LDADD) @@ -2177,6 +2768,9 @@ test_wcwidth_OBJECTS = test-wcwidth.$(OBJEXT) test_wcwidth_LDADD = $(LDADD) test_wcwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_xalloc_die_SOURCES = test-xalloc-die.c +test_xalloc_die_OBJECTS = test-xalloc-die.$(OBJEXT) +test_xalloc_die_DEPENDENCIES = $(am__DEPENDENCIES_2) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f @@ -2238,16 +2832,15 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ctype_space_SOURCES) $(test_ctype_upper_SOURCES) \ $(test_ctype_xdigit_SOURCES) $(test_decdigit_SOURCES) \ $(test_decomposing_form_SOURCES) $(test_decomposition_SOURCES) \ - $(test_digit_SOURCES) test-dup2.c test-environ.c test-errno.c \ - test-fcntl.c $(test_frexpl_nolibm_SOURCES) test-fseterr.c \ - test-iconv.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ + $(test_digit_SOURCES) test-environ.c test-errno.c \ + $(test_frexpl_nolibm_SOURCES) test-fseterr.c test-iconv.c \ + test-iconv-h.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ test-isnanf-nolibm.c test-isnanl-nolibm.c test-locale.c \ - $(test_locale_language_SOURCES) test-localename.c \ + $(test_locale_language_SOURCES) test-localename.c test-lock.c \ test-malloca.c test-math.c test-mbrtowc.c test-mbsinit.c \ test-memchr.c $(test_mirror_SOURCES) $(test_nfc_SOURCES) \ $(test_nfd_SOURCES) $(test_nfkc_SOURCES) $(test_nfkd_SOURCES) \ - $(test_numeric_SOURCES) test-open.c \ - $(test_pr_alphabetic_SOURCES) \ + $(test_numeric_SOURCES) $(test_pr_alphabetic_SOURCES) \ $(test_pr_ascii_hex_digit_SOURCES) \ $(test_pr_bidi_arabic_digit_SOURCES) \ $(test_pr_bidi_arabic_right_to_left_SOURCES) \ @@ -2312,66 +2905,111 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_pr_white_space_SOURCES) $(test_pr_xid_continue_SOURCES) \ $(test_pr_xid_start_SOURCES) $(test_pr_zero_width_SOURCES) \ test-printf-frexp.c test-printf-frexpl.c \ - $(test_scripts_SOURCES) test-signbit.c test-stdbool.c \ - test-stddef.c test-stdint.c test-stdlib.c test-strerror.c \ - test-striconveh.c test-striconveha.c test-string.c \ - $(test_sy_c_ident_SOURCES) $(test_sy_c_whitespace_SOURCES) \ - $(test_sy_java_ident_SOURCES) \ + $(test_scripts_SOURCES) test-setenv.c test-signbit.c \ + test-stdbool.c test-stddef.c test-stdint.c test-stdlib.c \ + test-strerror.c test-striconveh.c test-striconveha.c \ + test-string.c test-strncat.c $(test_sy_c_ident_SOURCES) \ + $(test_sy_c_whitespace_SOURCES) $(test_sy_java_ident_SOURCES) \ $(test_sy_java_whitespace_SOURCES) \ $(test_u16_asnprintf1_SOURCES) $(test_u16_casecmp_SOURCES) \ $(test_u16_casecoll_SOURCES) $(test_u16_casefold_SOURCES) \ + $(test_u16_check_SOURCES) $(test_u16_chr_SOURCES) \ + $(test_u16_cmp_SOURCES) $(test_u16_cmp2_SOURCES) \ $(test_u16_conv_from_enc_SOURCES) \ - $(test_u16_conv_to_enc_SOURCES) $(test_u16_is_cased_SOURCES) \ + $(test_u16_conv_to_enc_SOURCES) $(test_u16_cpy_SOURCES) \ + $(test_u16_cpy_alloc_SOURCES) $(test_u16_is_cased_SOURCES) \ $(test_u16_is_casefolded_SOURCES) \ $(test_u16_is_lowercase_SOURCES) \ $(test_u16_is_titlecase_SOURCES) \ - $(test_u16_is_uppercase_SOURCES) $(test_u16_normcmp_SOURCES) \ - $(test_u16_normcoll_SOURCES) \ + $(test_u16_is_uppercase_SOURCES) $(test_u16_mblen_SOURCES) \ + $(test_u16_mbsnlen_SOURCES) $(test_u16_mbtouc_SOURCES) \ + $(test_u16_mbtouc_unsafe_SOURCES) $(test_u16_mbtoucr_SOURCES) \ + $(test_u16_move_SOURCES) $(test_u16_next_SOURCES) \ + $(test_u16_normcmp_SOURCES) $(test_u16_normcoll_SOURCES) \ $(test_u16_possible_linebreaks_SOURCES) \ + $(test_u16_prev_SOURCES) $(test_u16_set_SOURCES) \ + $(test_u16_stpcpy_SOURCES) $(test_u16_stpncpy_SOURCES) \ + $(test_u16_strcat_SOURCES) $(test_u16_strcmp_SOURCES) \ + $(test_u16_strcoll_SOURCES) \ $(test_u16_strconv_from_enc_SOURCES) \ - $(test_u16_strconv_to_enc_SOURCES) \ - $(test_u16_strwidth_SOURCES) $(test_u16_tolower_SOURCES) \ + $(test_u16_strconv_to_enc_SOURCES) $(test_u16_strcpy_SOURCES) \ + $(test_u16_strdup_SOURCES) $(test_u16_strlen_SOURCES) \ + $(test_u16_strmblen_SOURCES) $(test_u16_strmbtouc_SOURCES) \ + $(test_u16_strncat_SOURCES) $(test_u16_strncmp_SOURCES) \ + $(test_u16_strncpy_SOURCES) $(test_u16_strnlen_SOURCES) \ + $(test_u16_strwidth_SOURCES) $(test_u16_to_u32_SOURCES) \ + $(test_u16_to_u8_SOURCES) $(test_u16_tolower_SOURCES) \ $(test_u16_totitle_SOURCES) $(test_u16_toupper_SOURCES) \ - $(test_u16_vasnprintf1_SOURCES) \ + $(test_u16_uctomb_SOURCES) $(test_u16_vasnprintf1_SOURCES) \ $(test_u16_vasnprintf2_SOURCES) \ $(test_u16_vasnprintf3_SOURCES) $(test_u16_vasprintf1_SOURCES) \ $(test_u16_vsnprintf1_SOURCES) $(test_u16_vsprintf1_SOURCES) \ $(test_u16_width_SOURCES) $(test_u16_width_linebreaks_SOURCES) \ $(test_u16_wordbreaks_SOURCES) $(test_u32_asnprintf1_SOURCES) \ $(test_u32_casecmp_SOURCES) $(test_u32_casecoll_SOURCES) \ - $(test_u32_casefold_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ - $(test_u32_conv_to_enc_SOURCES) $(test_u32_is_cased_SOURCES) \ + $(test_u32_casefold_SOURCES) $(test_u32_check_SOURCES) \ + $(test_u32_chr_SOURCES) $(test_u32_cmp_SOURCES) \ + $(test_u32_cmp2_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ + $(test_u32_conv_to_enc_SOURCES) $(test_u32_cpy_SOURCES) \ + $(test_u32_cpy_alloc_SOURCES) $(test_u32_is_cased_SOURCES) \ $(test_u32_is_casefolded_SOURCES) \ $(test_u32_is_lowercase_SOURCES) \ $(test_u32_is_titlecase_SOURCES) \ - $(test_u32_is_uppercase_SOURCES) $(test_u32_nfc_big_SOURCES) \ - $(test_u32_nfd_big_SOURCES) $(test_u32_nfkc_big_SOURCES) \ - $(test_u32_nfkd_big_SOURCES) $(test_u32_normcmp_SOURCES) \ - $(test_u32_normcoll_SOURCES) \ + $(test_u32_is_uppercase_SOURCES) $(test_u32_mblen_SOURCES) \ + $(test_u32_mbsnlen_SOURCES) $(test_u32_mbtouc_SOURCES) \ + $(test_u32_mbtouc_unsafe_SOURCES) $(test_u32_mbtoucr_SOURCES) \ + $(test_u32_move_SOURCES) $(test_u32_next_SOURCES) \ + $(test_u32_nfc_big_SOURCES) $(test_u32_nfd_big_SOURCES) \ + $(test_u32_nfkc_big_SOURCES) $(test_u32_nfkd_big_SOURCES) \ + $(test_u32_normcmp_SOURCES) $(test_u32_normcoll_SOURCES) \ $(test_u32_possible_linebreaks_SOURCES) \ + $(test_u32_prev_SOURCES) $(test_u32_set_SOURCES) \ + $(test_u32_stpcpy_SOURCES) $(test_u32_stpncpy_SOURCES) \ + $(test_u32_strcat_SOURCES) $(test_u32_strcmp_SOURCES) \ + $(test_u32_strcoll_SOURCES) \ $(test_u32_strconv_from_enc_SOURCES) \ - $(test_u32_strconv_to_enc_SOURCES) \ - $(test_u32_strwidth_SOURCES) $(test_u32_tolower_SOURCES) \ + $(test_u32_strconv_to_enc_SOURCES) $(test_u32_strcpy_SOURCES) \ + $(test_u32_strdup_SOURCES) $(test_u32_strlen_SOURCES) \ + $(test_u32_strmblen_SOURCES) $(test_u32_strmbtouc_SOURCES) \ + $(test_u32_strncat_SOURCES) $(test_u32_strncmp_SOURCES) \ + $(test_u32_strncpy_SOURCES) $(test_u32_strnlen_SOURCES) \ + $(test_u32_strwidth_SOURCES) $(test_u32_to_u16_SOURCES) \ + $(test_u32_to_u8_SOURCES) $(test_u32_tolower_SOURCES) \ $(test_u32_totitle_SOURCES) $(test_u32_toupper_SOURCES) \ - $(test_u32_vasnprintf1_SOURCES) \ + $(test_u32_uctomb_SOURCES) $(test_u32_vasnprintf1_SOURCES) \ $(test_u32_vasnprintf2_SOURCES) \ $(test_u32_vasnprintf3_SOURCES) $(test_u32_vasprintf1_SOURCES) \ $(test_u32_vsnprintf1_SOURCES) $(test_u32_vsprintf1_SOURCES) \ $(test_u32_width_SOURCES) $(test_u32_width_linebreaks_SOURCES) \ $(test_u32_wordbreaks_SOURCES) $(test_u8_asnprintf1_SOURCES) \ $(test_u8_casecmp_SOURCES) $(test_u8_casecoll_SOURCES) \ - $(test_u8_casefold_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ - $(test_u8_conv_to_enc_SOURCES) $(test_u8_is_cased_SOURCES) \ + $(test_u8_casefold_SOURCES) $(test_u8_check_SOURCES) \ + $(test_u8_chr_SOURCES) $(test_u8_cmp_SOURCES) \ + $(test_u8_cmp2_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ + $(test_u8_conv_to_enc_SOURCES) $(test_u8_cpy_SOURCES) \ + $(test_u8_cpy_alloc_SOURCES) $(test_u8_is_cased_SOURCES) \ $(test_u8_is_casefolded_SOURCES) \ $(test_u8_is_lowercase_SOURCES) \ $(test_u8_is_titlecase_SOURCES) \ - $(test_u8_is_uppercase_SOURCES) $(test_u8_normcmp_SOURCES) \ - $(test_u8_normcoll_SOURCES) \ - $(test_u8_possible_linebreaks_SOURCES) \ + $(test_u8_is_uppercase_SOURCES) $(test_u8_mblen_SOURCES) \ + $(test_u8_mbsnlen_SOURCES) $(test_u8_mbtouc_SOURCES) \ + $(test_u8_mbtouc_unsafe_SOURCES) $(test_u8_mbtoucr_SOURCES) \ + $(test_u8_move_SOURCES) $(test_u8_next_SOURCES) \ + $(test_u8_normcmp_SOURCES) $(test_u8_normcoll_SOURCES) \ + $(test_u8_possible_linebreaks_SOURCES) $(test_u8_prev_SOURCES) \ + $(test_u8_set_SOURCES) $(test_u8_stpcpy_SOURCES) \ + $(test_u8_stpncpy_SOURCES) $(test_u8_strcat_SOURCES) \ + $(test_u8_strcmp_SOURCES) $(test_u8_strcoll_SOURCES) \ $(test_u8_strconv_from_enc_SOURCES) \ - $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strwidth_SOURCES) \ - $(test_u8_tolower_SOURCES) $(test_u8_totitle_SOURCES) \ - $(test_u8_toupper_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ + $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strcpy_SOURCES) \ + $(test_u8_strdup_SOURCES) $(test_u8_strlen_SOURCES) \ + $(test_u8_strmblen_SOURCES) $(test_u8_strmbtouc_SOURCES) \ + $(test_u8_strncat_SOURCES) $(test_u8_strncmp_SOURCES) \ + $(test_u8_strncpy_SOURCES) $(test_u8_strnlen_SOURCES) \ + $(test_u8_strwidth_SOURCES) $(test_u8_to_u16_SOURCES) \ + $(test_u8_to_u32_SOURCES) $(test_u8_tolower_SOURCES) \ + $(test_u8_totitle_SOURCES) $(test_u8_toupper_SOURCES) \ + $(test_u8_uctomb_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ $(test_u8_vasnprintf2_SOURCES) $(test_u8_vasnprintf3_SOURCES) \ $(test_u8_vasprintf1_SOURCES) $(test_u8_vsnprintf1_SOURCES) \ $(test_u8_vsprintf1_SOURCES) $(test_u8_width_SOURCES) \ @@ -2388,8 +3026,9 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ulc_vsnprintf1_SOURCES) $(test_ulc_vsprintf1_SOURCES) \ $(test_ulc_width_linebreaks_SOURCES) \ $(test_ulc_wordbreaks_SOURCES) $(test_uninames_SOURCES) \ - $(test_uninorm_filter_nfc_SOURCES) test-unistd.c test-wchar.c \ - test-wctype.c test-wcwidth.c + $(test_uninorm_filter_nfc_SOURCES) test-unistd.c \ + test-unsetenv.c test-wchar.c test-wctype.c test-wcwidth.c \ + test-xalloc-die.c DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ test-alloca-opt.c test-array-mergesort.c \ $(test_bidi_byname_SOURCES) $(test_bidi_name_SOURCES) \ @@ -2429,16 +3068,15 @@ DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ctype_space_SOURCES) $(test_ctype_upper_SOURCES) \ $(test_ctype_xdigit_SOURCES) $(test_decdigit_SOURCES) \ $(test_decomposing_form_SOURCES) $(test_decomposition_SOURCES) \ - $(test_digit_SOURCES) test-dup2.c test-environ.c test-errno.c \ - test-fcntl.c $(test_frexpl_nolibm_SOURCES) test-fseterr.c \ - test-iconv.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ + $(test_digit_SOURCES) test-environ.c test-errno.c \ + $(test_frexpl_nolibm_SOURCES) test-fseterr.c test-iconv.c \ + test-iconv-h.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ test-isnanf-nolibm.c test-isnanl-nolibm.c test-locale.c \ - $(test_locale_language_SOURCES) test-localename.c \ + $(test_locale_language_SOURCES) test-localename.c test-lock.c \ test-malloca.c test-math.c test-mbrtowc.c test-mbsinit.c \ test-memchr.c $(test_mirror_SOURCES) $(test_nfc_SOURCES) \ $(test_nfd_SOURCES) $(test_nfkc_SOURCES) $(test_nfkd_SOURCES) \ - $(test_numeric_SOURCES) test-open.c \ - $(test_pr_alphabetic_SOURCES) \ + $(test_numeric_SOURCES) $(test_pr_alphabetic_SOURCES) \ $(test_pr_ascii_hex_digit_SOURCES) \ $(test_pr_bidi_arabic_digit_SOURCES) \ $(test_pr_bidi_arabic_right_to_left_SOURCES) \ @@ -2503,66 +3141,111 @@ DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_pr_white_space_SOURCES) $(test_pr_xid_continue_SOURCES) \ $(test_pr_xid_start_SOURCES) $(test_pr_zero_width_SOURCES) \ test-printf-frexp.c test-printf-frexpl.c \ - $(test_scripts_SOURCES) test-signbit.c test-stdbool.c \ - test-stddef.c test-stdint.c test-stdlib.c test-strerror.c \ - test-striconveh.c test-striconveha.c test-string.c \ - $(test_sy_c_ident_SOURCES) $(test_sy_c_whitespace_SOURCES) \ - $(test_sy_java_ident_SOURCES) \ + $(test_scripts_SOURCES) test-setenv.c test-signbit.c \ + test-stdbool.c test-stddef.c test-stdint.c test-stdlib.c \ + test-strerror.c test-striconveh.c test-striconveha.c \ + test-string.c test-strncat.c $(test_sy_c_ident_SOURCES) \ + $(test_sy_c_whitespace_SOURCES) $(test_sy_java_ident_SOURCES) \ $(test_sy_java_whitespace_SOURCES) \ $(test_u16_asnprintf1_SOURCES) $(test_u16_casecmp_SOURCES) \ $(test_u16_casecoll_SOURCES) $(test_u16_casefold_SOURCES) \ + $(test_u16_check_SOURCES) $(test_u16_chr_SOURCES) \ + $(test_u16_cmp_SOURCES) $(test_u16_cmp2_SOURCES) \ $(test_u16_conv_from_enc_SOURCES) \ - $(test_u16_conv_to_enc_SOURCES) $(test_u16_is_cased_SOURCES) \ + $(test_u16_conv_to_enc_SOURCES) $(test_u16_cpy_SOURCES) \ + $(test_u16_cpy_alloc_SOURCES) $(test_u16_is_cased_SOURCES) \ $(test_u16_is_casefolded_SOURCES) \ $(test_u16_is_lowercase_SOURCES) \ $(test_u16_is_titlecase_SOURCES) \ - $(test_u16_is_uppercase_SOURCES) $(test_u16_normcmp_SOURCES) \ - $(test_u16_normcoll_SOURCES) \ + $(test_u16_is_uppercase_SOURCES) $(test_u16_mblen_SOURCES) \ + $(test_u16_mbsnlen_SOURCES) $(test_u16_mbtouc_SOURCES) \ + $(test_u16_mbtouc_unsafe_SOURCES) $(test_u16_mbtoucr_SOURCES) \ + $(test_u16_move_SOURCES) $(test_u16_next_SOURCES) \ + $(test_u16_normcmp_SOURCES) $(test_u16_normcoll_SOURCES) \ $(test_u16_possible_linebreaks_SOURCES) \ + $(test_u16_prev_SOURCES) $(test_u16_set_SOURCES) \ + $(test_u16_stpcpy_SOURCES) $(test_u16_stpncpy_SOURCES) \ + $(test_u16_strcat_SOURCES) $(test_u16_strcmp_SOURCES) \ + $(test_u16_strcoll_SOURCES) \ $(test_u16_strconv_from_enc_SOURCES) \ - $(test_u16_strconv_to_enc_SOURCES) \ - $(test_u16_strwidth_SOURCES) $(test_u16_tolower_SOURCES) \ + $(test_u16_strconv_to_enc_SOURCES) $(test_u16_strcpy_SOURCES) \ + $(test_u16_strdup_SOURCES) $(test_u16_strlen_SOURCES) \ + $(test_u16_strmblen_SOURCES) $(test_u16_strmbtouc_SOURCES) \ + $(test_u16_strncat_SOURCES) $(test_u16_strncmp_SOURCES) \ + $(test_u16_strncpy_SOURCES) $(test_u16_strnlen_SOURCES) \ + $(test_u16_strwidth_SOURCES) $(test_u16_to_u32_SOURCES) \ + $(test_u16_to_u8_SOURCES) $(test_u16_tolower_SOURCES) \ $(test_u16_totitle_SOURCES) $(test_u16_toupper_SOURCES) \ - $(test_u16_vasnprintf1_SOURCES) \ + $(test_u16_uctomb_SOURCES) $(test_u16_vasnprintf1_SOURCES) \ $(test_u16_vasnprintf2_SOURCES) \ $(test_u16_vasnprintf3_SOURCES) $(test_u16_vasprintf1_SOURCES) \ $(test_u16_vsnprintf1_SOURCES) $(test_u16_vsprintf1_SOURCES) \ $(test_u16_width_SOURCES) $(test_u16_width_linebreaks_SOURCES) \ $(test_u16_wordbreaks_SOURCES) $(test_u32_asnprintf1_SOURCES) \ $(test_u32_casecmp_SOURCES) $(test_u32_casecoll_SOURCES) \ - $(test_u32_casefold_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ - $(test_u32_conv_to_enc_SOURCES) $(test_u32_is_cased_SOURCES) \ + $(test_u32_casefold_SOURCES) $(test_u32_check_SOURCES) \ + $(test_u32_chr_SOURCES) $(test_u32_cmp_SOURCES) \ + $(test_u32_cmp2_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ + $(test_u32_conv_to_enc_SOURCES) $(test_u32_cpy_SOURCES) \ + $(test_u32_cpy_alloc_SOURCES) $(test_u32_is_cased_SOURCES) \ $(test_u32_is_casefolded_SOURCES) \ $(test_u32_is_lowercase_SOURCES) \ $(test_u32_is_titlecase_SOURCES) \ - $(test_u32_is_uppercase_SOURCES) $(test_u32_nfc_big_SOURCES) \ - $(test_u32_nfd_big_SOURCES) $(test_u32_nfkc_big_SOURCES) \ - $(test_u32_nfkd_big_SOURCES) $(test_u32_normcmp_SOURCES) \ - $(test_u32_normcoll_SOURCES) \ + $(test_u32_is_uppercase_SOURCES) $(test_u32_mblen_SOURCES) \ + $(test_u32_mbsnlen_SOURCES) $(test_u32_mbtouc_SOURCES) \ + $(test_u32_mbtouc_unsafe_SOURCES) $(test_u32_mbtoucr_SOURCES) \ + $(test_u32_move_SOURCES) $(test_u32_next_SOURCES) \ + $(test_u32_nfc_big_SOURCES) $(test_u32_nfd_big_SOURCES) \ + $(test_u32_nfkc_big_SOURCES) $(test_u32_nfkd_big_SOURCES) \ + $(test_u32_normcmp_SOURCES) $(test_u32_normcoll_SOURCES) \ $(test_u32_possible_linebreaks_SOURCES) \ + $(test_u32_prev_SOURCES) $(test_u32_set_SOURCES) \ + $(test_u32_stpcpy_SOURCES) $(test_u32_stpncpy_SOURCES) \ + $(test_u32_strcat_SOURCES) $(test_u32_strcmp_SOURCES) \ + $(test_u32_strcoll_SOURCES) \ $(test_u32_strconv_from_enc_SOURCES) \ - $(test_u32_strconv_to_enc_SOURCES) \ - $(test_u32_strwidth_SOURCES) $(test_u32_tolower_SOURCES) \ + $(test_u32_strconv_to_enc_SOURCES) $(test_u32_strcpy_SOURCES) \ + $(test_u32_strdup_SOURCES) $(test_u32_strlen_SOURCES) \ + $(test_u32_strmblen_SOURCES) $(test_u32_strmbtouc_SOURCES) \ + $(test_u32_strncat_SOURCES) $(test_u32_strncmp_SOURCES) \ + $(test_u32_strncpy_SOURCES) $(test_u32_strnlen_SOURCES) \ + $(test_u32_strwidth_SOURCES) $(test_u32_to_u16_SOURCES) \ + $(test_u32_to_u8_SOURCES) $(test_u32_tolower_SOURCES) \ $(test_u32_totitle_SOURCES) $(test_u32_toupper_SOURCES) \ - $(test_u32_vasnprintf1_SOURCES) \ + $(test_u32_uctomb_SOURCES) $(test_u32_vasnprintf1_SOURCES) \ $(test_u32_vasnprintf2_SOURCES) \ $(test_u32_vasnprintf3_SOURCES) $(test_u32_vasprintf1_SOURCES) \ $(test_u32_vsnprintf1_SOURCES) $(test_u32_vsprintf1_SOURCES) \ $(test_u32_width_SOURCES) $(test_u32_width_linebreaks_SOURCES) \ $(test_u32_wordbreaks_SOURCES) $(test_u8_asnprintf1_SOURCES) \ $(test_u8_casecmp_SOURCES) $(test_u8_casecoll_SOURCES) \ - $(test_u8_casefold_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ - $(test_u8_conv_to_enc_SOURCES) $(test_u8_is_cased_SOURCES) \ + $(test_u8_casefold_SOURCES) $(test_u8_check_SOURCES) \ + $(test_u8_chr_SOURCES) $(test_u8_cmp_SOURCES) \ + $(test_u8_cmp2_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ + $(test_u8_conv_to_enc_SOURCES) $(test_u8_cpy_SOURCES) \ + $(test_u8_cpy_alloc_SOURCES) $(test_u8_is_cased_SOURCES) \ $(test_u8_is_casefolded_SOURCES) \ $(test_u8_is_lowercase_SOURCES) \ $(test_u8_is_titlecase_SOURCES) \ - $(test_u8_is_uppercase_SOURCES) $(test_u8_normcmp_SOURCES) \ - $(test_u8_normcoll_SOURCES) \ - $(test_u8_possible_linebreaks_SOURCES) \ + $(test_u8_is_uppercase_SOURCES) $(test_u8_mblen_SOURCES) \ + $(test_u8_mbsnlen_SOURCES) $(test_u8_mbtouc_SOURCES) \ + $(test_u8_mbtouc_unsafe_SOURCES) $(test_u8_mbtoucr_SOURCES) \ + $(test_u8_move_SOURCES) $(test_u8_next_SOURCES) \ + $(test_u8_normcmp_SOURCES) $(test_u8_normcoll_SOURCES) \ + $(test_u8_possible_linebreaks_SOURCES) $(test_u8_prev_SOURCES) \ + $(test_u8_set_SOURCES) $(test_u8_stpcpy_SOURCES) \ + $(test_u8_stpncpy_SOURCES) $(test_u8_strcat_SOURCES) \ + $(test_u8_strcmp_SOURCES) $(test_u8_strcoll_SOURCES) \ $(test_u8_strconv_from_enc_SOURCES) \ - $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strwidth_SOURCES) \ - $(test_u8_tolower_SOURCES) $(test_u8_totitle_SOURCES) \ - $(test_u8_toupper_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ + $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strcpy_SOURCES) \ + $(test_u8_strdup_SOURCES) $(test_u8_strlen_SOURCES) \ + $(test_u8_strmblen_SOURCES) $(test_u8_strmbtouc_SOURCES) \ + $(test_u8_strncat_SOURCES) $(test_u8_strncmp_SOURCES) \ + $(test_u8_strncpy_SOURCES) $(test_u8_strnlen_SOURCES) \ + $(test_u8_strwidth_SOURCES) $(test_u8_to_u16_SOURCES) \ + $(test_u8_to_u32_SOURCES) $(test_u8_tolower_SOURCES) \ + $(test_u8_totitle_SOURCES) $(test_u8_toupper_SOURCES) \ + $(test_u8_uctomb_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ $(test_u8_vasnprintf2_SOURCES) $(test_u8_vasnprintf3_SOURCES) \ $(test_u8_vasprintf1_SOURCES) $(test_u8_vsnprintf1_SOURCES) \ $(test_u8_vsprintf1_SOURCES) $(test_u8_width_SOURCES) \ @@ -2579,8 +3262,9 @@ DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ulc_vsnprintf1_SOURCES) $(test_ulc_vsprintf1_SOURCES) \ $(test_ulc_width_linebreaks_SOURCES) \ $(test_ulc_wordbreaks_SOURCES) $(test_uninames_SOURCES) \ - $(test_uninorm_filter_nfc_SOURCES) test-unistd.c test-wchar.c \ - test-wctype.c test-wcwidth.c + $(test_uninorm_filter_nfc_SOURCES) test-unistd.c \ + test-unsetenv.c test-wchar.c test-wctype.c test-wcwidth.c \ + test-xalloc-die.c RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -2680,22 +3364,31 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GLIBC21 = @GLIBC21@ GLOBAL_SYMBOL_PIPE = @GLOBAL_SYMBOL_PIPE@ +GNULIB_ACOSL = @GNULIB_ACOSL@ +GNULIB_ASINL = @GNULIB_ASINL@ +GNULIB_ATANL = @GNULIB_ATANL@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_BTOWC = @GNULIB_BTOWC@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ GNULIB_CEILF = @GNULIB_CEILF@ GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_COSL = @GNULIB_COSL@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_DUP3 = @GNULIB_DUP3@ +GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FLOORF = @GNULIB_FLOORF@ GNULIB_FLOORL = @GNULIB_FLOORL@ GNULIB_FREXP = @GNULIB_FREXP@ @@ -2705,12 +3398,15 @@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_ISINF = @GNULIB_ISINF@ GNULIB_ISNAN = @GNULIB_ISNAN@ @@ -2720,9 +3416,11 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ +GNULIB_LINKAT = @GNULIB_LINKAT@ +GNULIB_LOGB = @GNULIB_LOGB@ +GNULIB_LOGL = @GNULIB_LOGL@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MBRLEN = @GNULIB_MBRLEN@ GNULIB_MBRTOWC = @GNULIB_MBRTOWC@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ @@ -2747,26 +3445,37 @@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ +GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ +GNULIB_PIPE2 = @GNULIB_PIPE2@ +GNULIB_PREAD = @GNULIB_PREAD@ +GNULIB_PTSNAME = @GNULIB_PTSNAME@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_REALPATH = @GNULIB_REALPATH@ +GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_ROUND = @GNULIB_ROUND@ GNULIB_ROUNDF = @GNULIB_ROUNDF@ GNULIB_ROUNDL = @GNULIB_ROUNDL@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SINL = @GNULIB_SINL@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SQRTL = @GNULIB_SQRTL@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ @@ -2778,12 +3487,20 @@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_SYMLINK = @GNULIB_SYMLINK@ +GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ +GNULIB_TANL = @GNULIB_TANL@ GNULIB_TRUNC = @GNULIB_TRUNC@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNLINK = @GNULIB_UNLINK@ +GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ +GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ @@ -2791,26 +3508,41 @@ GNULIB_WCTOB = @GNULIB_WCTOB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ +HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ASINL = @HAVE_ASINL@ +HAVE_ATANL = @HAVE_ATANL@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COSL = @HAVE_COSL@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILF = @HAVE_DECL_CEILF@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORF = @HAVE_DECL_FLOORF@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGB = @HAVE_DECL_LOGB@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_ROUND = @HAVE_DECL_ROUND@ +HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ +HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -2818,52 +3550,77 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPL = @HAVE_EXPL@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ HAVE_GLOBAL_SYMBOL_PIPE = @HAVE_GLOBAL_SYMBOL_PIPE@ +HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ HAVE_ISNANL = @HAVE_ISNANL@ +HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LOGL = @HAVE_LOGL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ +HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ +HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ +HAVE_MKSTEMP = @HAVE_MKSTEMP@ +HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SINL = @HAVE_SINL@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ @@ -2871,14 +3628,21 @@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TANL = @HAVE_TANL@ +HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ @@ -2886,6 +3650,7 @@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HEXVERSION = @HEXVERSION@ ICONV_H = @ICONV_H@ @@ -2901,27 +3666,32 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ LIBS = @LIBS@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LIBTHREAD = @LIBTHREAD@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ -LOCALE_H = @LOCALE_H@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NAMESPACING = @NAMESPACING@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -2934,7 +3704,6 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -2967,17 +3736,21 @@ RANLIB = @RANLIB@ RC = @RC@ RELOCATABLE = @RELOCATABLE@ REPLACE_BTOWC = @REPLACE_BTOWC@ +REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CEILF = @REPLACE_CEILF@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FLOORF = @REPLACE_FLOORF@ REPLACE_FLOORL = @REPLACE_FLOORL@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_ICONV = @REPLACE_ICONV@ @@ -2989,6 +3762,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ @@ -3001,20 +3776,36 @@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_NAN = @REPLACE_NAN@ REPLACE_NULL = @REPLACE_NULL@ -REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_REALPATH = @REPLACE_REALPATH@ +REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ +REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_UNSETENV = @REPLACE_UNSETENV@ +REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ @@ -3031,14 +3822,13 @@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ TEXI2DVI = @TEXI2DVI@ +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ -VOID_UNSETENV = @VOID_UNSETENV@ -WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +YIELD_LIB = @YIELD_LIB@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -3066,6 +3856,7 @@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -3097,528 +3888,692 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Rules generated and collected by gnulib-tool. -AUTOMAKE_OPTIONS = 1.5 foreign 1.11 subdir-objects color-tests -SUBDIRS = +AUTOMAKE_OPTIONS = 1.5 foreign subdir-objects 1.11 subdir-objects \ + color-tests +SUBDIRS = . # The test suite uses the 'localcharset' module. # This must be the last thing that gets added to TESTS_ENVIRONMENT. -TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' EXEEXT='@EXEEXT@' \ +TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' srcdir='$(srcdir)' \ + LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' \ LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' \ - EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' \ - LOCALE_ZH_CN='@LOCALE_ZH_CN@' EXEEXT='@EXEEXT@' \ - LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' EXEEXT='@EXEEXT@' \ - srcdir='$(srcdir)' EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' EXEEXT='@EXEEXT@' \ - LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' EXEEXT='@EXEEXT@' \ - LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' EXEEXT='@EXEEXT@' \ + LOCALE_ZH_CN='@LOCALE_ZH_CN@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ @LOCALCHARSET_TESTS_ENVIRONMENT@ $(SHELL) \ $(top_srcdir)/build-aux/run-test '$(CHECKER)' noinst_HEADERS = noinst_LIBRARIES = check_LIBRARIES = libtests.a -EXTRA_DIST = test-alloca-opt.c test-array-mergesort.c test-c-ctype.c \ +EXTRA_DIST = test-alloca-opt.c $(top_srcdir)/build-aux/arg-nonnull.h \ + test-array-mergesort.c macros.h \ + $(top_srcdir)/build-aux/c++defs.h test-c-ctype.c macros.h \ test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c \ - test-dup2.c test-environ.c test-errno.c error.c error.h \ - exitfail.c exitfail.h fcntl.in.h test-fcntl.c test-frexpl.c \ - test-fseterr.c test-iconv.c intprops.h test-isnand-nolibm.c \ - test-isnand.h nan.h test-isnanf-nolibm.c test-isnanf.h nan.h \ - test-isnanl-nolibm.c test-isnanl.h nan.h locale.in.h \ - test-locale.c test-localename.c test-malloca.c test-math.c \ - test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh \ - test-mbrtowc4.sh test-mbrtowc.c test-mbsinit.sh test-mbsinit.c \ - test-memchr.c zerosize-ptr.h open.c test-open.c \ - test-printf-frexp.c test-printf-frexpl.c setenv.c \ - test-signbit.c test-stdbool.c test-stddef.c test-stdint.c \ - test-stdlib.c strerror.c test-strerror.c test-striconveh.c \ - test-striconveha.c test-string.c unicase/test-cased.c \ - unicase/test-predicate-part1.h unicase/test-predicate-part2.h \ + macros.h test-environ.c test-errno.c error.c error.h \ + exitfail.h test-frexpl.c signature.h macros.h test-fseterr.c \ + getpagesize.c test-iconv-h.c test-iconv.c signature.h macros.h \ + intprops.h test-isnand-nolibm.c test-isnand.h nan.h macros.h \ + test-isnanf-nolibm.c test-isnanf.h nan.h macros.h \ + test-isnanl-nolibm.c test-isnanl.h nan.h macros.h locale.in.h \ + test-locale.c test-localename.c macros.h test-lock.c \ + test-malloca.c test-math.c test-mbrtowc1.sh test-mbrtowc2.sh \ + test-mbrtowc3.sh test-mbrtowc4.sh test-mbrtowc.c signature.h \ + macros.h test-mbsinit.sh test-mbsinit.c signature.h macros.h \ + test-memchr.c zerosize-ptr.h signature.h macros.h \ + test-printf-frexp.c macros.h test-printf-frexpl.c macros.h \ + putenv.c setenv.c test-setenv.c signature.h macros.h \ + test-signbit.c macros.h test-stdbool.c test-stddef.c \ + test-stdint.c test-stdlib.c strerror.c test-strerror.c \ + signature.h macros.h test-striconveh.c macros.h \ + test-striconveha.c macros.h test-string.c test-strncat.c \ + unistr/test-strncat.h zerosize-ptr.h signature.h macros.h \ + unicase/test-cased.c unicase/test-predicate-part1.h \ + unicase/test-predicate-part2.h macros.h \ unicase/test-ignorable.c unicase/test-predicate-part1.h \ - unicase/test-predicate-part2.h unicase/test-locale-language.sh \ - unicase/test-locale-language.c unicase/test-uc_tolower.c \ + unicase/test-predicate-part2.h macros.h \ + unicase/test-locale-language.sh unicase/test-locale-language.c \ + macros.h unicase/test-uc_tolower.c \ unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - unicase/test-uc_totitle.c unicase/test-mapping-part1.h \ - unicase/test-mapping-part2.h unicase/test-uc_toupper.c \ + macros.h unicase/test-uc_totitle.c \ unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - unicase/test-u16-casecmp.c unicase/test-casecmp.h \ - unicase/test-u16-casecoll.c unicase/test-casecmp.h \ - unicase/test-u16-casefold.c unicase/test-u16-is-cased.c \ - unicase/test-is-cased.h unicase/test-u16-is-casefolded.c \ - unicase/test-is-casefolded.h unicase/test-u16-is-lowercase.c \ - unicase/test-is-lowercase.h unicase/test-u16-is-titlecase.c \ - unicase/test-is-titlecase.h unicase/test-u16-is-uppercase.c \ - unicase/test-is-uppercase.h unicase/test-u16-tolower.c \ - unicase/test-u16-totitle.c unicase/test-u16-toupper.c \ - unicase/test-u32-casecmp.c unicase/test-casecmp.h \ - unicase/test-u32-casecoll.c unicase/test-casecmp.h \ - unicase/test-u32-casefold.c unicase/test-u32-is-cased.c \ - unicase/test-is-cased.h unicase/test-u32-is-casefolded.c \ - unicase/test-is-casefolded.h unicase/test-u32-is-lowercase.c \ - unicase/test-is-lowercase.h unicase/test-u32-is-titlecase.c \ - unicase/test-is-titlecase.h unicase/test-u32-is-uppercase.c \ - unicase/test-is-uppercase.h unicase/test-u32-tolower.c \ - unicase/test-u32-totitle.c unicase/test-u32-toupper.c \ - unicase/test-u8-casecmp.c unicase/test-casecmp.h \ - unicase/test-u8-casecoll.c unicase/test-casecmp.h \ - unicase/test-u8-casefold.c unicase/test-u8-is-cased.c \ - unicase/test-is-cased.h unicase/test-u8-is-casefolded.c \ - unicase/test-is-casefolded.h unicase/test-u8-is-lowercase.c \ - unicase/test-is-lowercase.h unicase/test-u8-is-titlecase.c \ - unicase/test-is-titlecase.h unicase/test-u8-is-uppercase.c \ - unicase/test-is-uppercase.h unicase/test-u8-tolower.c \ - unicase/test-u8-totitle.c unicase/test-u8-toupper.c \ + macros.h unicase/test-uc_toupper.c \ + unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ + macros.h unicase/test-u16-casecmp.c unicase/test-casecmp.h \ + macros.h unicase/test-u16-casecoll.c unicase/test-casecmp.h \ + macros.h unicase/test-u16-casefold.c macros.h \ + unicase/test-u16-is-cased.c unicase/test-is-cased.h macros.h \ + unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h \ + macros.h unicase/test-u16-is-lowercase.c \ + unicase/test-is-lowercase.h macros.h \ + unicase/test-u16-is-titlecase.c unicase/test-is-titlecase.h \ + macros.h unicase/test-u16-is-uppercase.c \ + unicase/test-is-uppercase.h macros.h \ + unicase/test-u16-tolower.c macros.h unicase/test-u16-totitle.c \ + macros.h unicase/test-u16-toupper.c macros.h \ + unicase/test-u32-casecmp.c unicase/test-casecmp.h macros.h \ + unicase/test-u32-casecoll.c unicase/test-casecmp.h macros.h \ + unicase/test-u32-casefold.c macros.h \ + unicase/test-u32-is-cased.c unicase/test-is-cased.h macros.h \ + unicase/test-u32-is-casefolded.c unicase/test-is-casefolded.h \ + macros.h unicase/test-u32-is-lowercase.c \ + unicase/test-is-lowercase.h macros.h \ + unicase/test-u32-is-titlecase.c unicase/test-is-titlecase.h \ + macros.h unicase/test-u32-is-uppercase.c \ + unicase/test-is-uppercase.h macros.h \ + unicase/test-u32-tolower.c macros.h unicase/test-u32-totitle.c \ + macros.h unicase/test-u32-toupper.c macros.h \ + unicase/test-u8-casecmp.c unicase/test-casecmp.h macros.h \ + unicase/test-u8-casecoll.c unicase/test-casecmp.h macros.h \ + unicase/test-u8-casefold.c macros.h unicase/test-u8-is-cased.c \ + unicase/test-is-cased.h macros.h \ + unicase/test-u8-is-casefolded.c unicase/test-is-casefolded.h \ + macros.h unicase/test-u8-is-lowercase.c \ + unicase/test-is-lowercase.h macros.h \ + unicase/test-u8-is-titlecase.c unicase/test-is-titlecase.h \ + macros.h unicase/test-u8-is-uppercase.c \ + unicase/test-is-uppercase.h macros.h unicase/test-u8-tolower.c \ + macros.h unicase/test-u8-totitle.c macros.h \ + unicase/test-u8-toupper.c macros.h \ unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh \ - unicase/test-ulc-casecmp.c unicase/test-casecmp.h \ + unicase/test-ulc-casecmp.c unicase/test-casecmp.h macros.h \ unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh \ - unicase/test-ulc-casecoll.c unicase/test-casecmp.h \ - uniconv/test-u16-conv-from-enc.c \ - uniconv/test-u16-conv-to-enc.c \ - uniconv/test-u16-strconv-from-enc.c \ - uniconv/test-u16-strconv-to-enc.c \ - uniconv/test-u32-conv-from-enc.c \ - uniconv/test-u32-conv-to-enc.c \ - uniconv/test-u32-strconv-from-enc.c \ - uniconv/test-u32-strconv-to-enc.c \ - uniconv/test-u8-conv-from-enc.c uniconv/test-u8-conv-to-enc.c \ - uniconv/test-u8-strconv-from-enc.c \ - uniconv/test-u8-strconv-to-enc.c unictype/test-bidi_byname.c \ - unictype/test-bidi_name.c unictype/test-bidi_of.c \ - unictype/test-bidi_test.c unictype/test-block_list.c \ - unictype/test-block_of.c unictype/test-block_test.c \ - unictype/test-categ_C.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cf.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cn.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Co.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cs.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_L.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Ll.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lm.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lo.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lt.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lu.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_M.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Mc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Me.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Mn.c \ + unicase/test-ulc-casecoll.c unicase/test-casecmp.h macros.h \ + uniconv/test-u16-conv-from-enc.c macros.h \ + uniconv/test-u16-conv-to-enc.c macros.h \ + uniconv/test-u16-strconv-from-enc.c macros.h \ + uniconv/test-u16-strconv-to-enc.c macros.h \ + uniconv/test-u32-conv-from-enc.c macros.h \ + uniconv/test-u32-conv-to-enc.c macros.h \ + uniconv/test-u32-strconv-from-enc.c macros.h \ + uniconv/test-u32-strconv-to-enc.c macros.h \ + uniconv/test-u8-conv-from-enc.c macros.h \ + uniconv/test-u8-conv-to-enc.c macros.h \ + uniconv/test-u8-strconv-from-enc.c macros.h \ + uniconv/test-u8-strconv-to-enc.c macros.h \ + unictype/test-bidi_byname.c macros.h unictype/test-bidi_name.c \ + macros.h unictype/test-bidi_of.c macros.h \ + unictype/test-bidi_test.c macros.h unictype/test-block_list.c \ + macros.h unictype/test-block_of.c macros.h \ + unictype/test-block_test.c macros.h unictype/test-categ_C.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_N.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cf.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cn.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Co.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cs.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_L.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Ll.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lm.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lo.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lt.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lu.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_M.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Mc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Me.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Mn.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_N.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Nd.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Nl.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_No.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_P.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pd.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pe.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pf.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pi.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Po.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Ps.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_S.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Sc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Sk.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Sm.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_So.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Z.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Zl.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Zp.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Zs.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_and_not.c macros.h \ + unictype/test-categ_and.c macros.h \ + unictype/test-categ_byname.c macros.h \ + unictype/test-categ_name.c macros.h unictype/test-categ_none.c \ + macros.h unictype/test-categ_of.c macros.h \ + unictype/test-categ_or.c macros.h \ + unictype/test-categ_test_withtable.c macros.h \ + unictype/test-combining.c macros.h unictype/test-ctype_alnum.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Nd.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_alpha.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_blank.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_cntrl.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_digit.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_graph.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_lower.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_print.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_punct.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_space.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_upper.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_xdigit.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-decdigit.c unictype/test-decdigit.h macros.h \ + unictype/test-digit.c unictype/test-digit.h macros.h \ + unictype/test-mirror.c macros.h unictype/test-numeric.c \ + unictype/test-numeric.h macros.h unictype/test-pr_alphabetic.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Nl.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_No.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_P.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pd.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pe.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pf.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pi.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Po.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Ps.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_S.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Sc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Sk.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Sm.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_So.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Z.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Zl.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Zp.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Zs.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_and_not.c \ - unictype/test-categ_and.c unictype/test-categ_byname.c \ - unictype/test-categ_name.c unictype/test-categ_none.c \ - unictype/test-categ_of.c unictype/test-categ_or.c \ - unictype/test-categ_test_withtable.c unictype/test-combining.c \ - unictype/test-ctype_alnum.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_alpha.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_blank.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_cntrl.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_digit.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_graph.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_lower.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_print.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_punct.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_space.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_upper.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_xdigit.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-decdigit.c \ - unictype/test-decdigit.h unictype/test-digit.c \ - unictype/test-digit.h unictype/test-mirror.c \ - unictype/test-numeric.c unictype/test-numeric.h \ - unictype/test-pr_alphabetic.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ascii_hex_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_arabic_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_arabic_right_to_left.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_block_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_boundary_neutral.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_common_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_embedding_or_override.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_eur_num_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_eur_num_terminator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_european_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_hebrew_right_to_left.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_left_to_right.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_non_spacing_mark.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_other_neutral.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_bidi_pdf.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_bidi_pdf.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_segment_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_whitespace.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_byname.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_byname.c macros.h \ unictype/test-pr_combining.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_composite.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_composite.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_currency_symbol.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_dash.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_dash.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_decimal_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_default_ignorable_code_point.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_deprecated.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_diacritic.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_extender.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_deprecated.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_diacritic.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_extender.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_format_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_grapheme_base.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_grapheme_extend.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_grapheme_link.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_hex_digit.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_hyphen.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_id_continue.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_id_start.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_ideographic.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_hex_digit.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_hyphen.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_id_continue.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_id_start.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_ideographic.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ids_binary_operator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ids_trinary_operator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ignorable_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_iso_control.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_iso_control.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_join_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_left_of_pair.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_line_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_logical_order_exception.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_lowercase.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_math.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_non_break.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_lowercase.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_math.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_non_break.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_not_a_character.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_numeric.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_numeric.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_alphabetic.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_default_ignorable_code_point.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_grapheme_extend.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_id_continue.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_id_start.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_lowercase.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_other_math.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_other_math.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_uppercase.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_paired_punctuation.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_paragraph_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_pattern_syntax.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_pattern_white_space.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_private_use.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_punctuation.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_private_use.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_punctuation.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_quotation_mark.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_radical.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_radical.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_sentence_terminal.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_soft_dotted.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_space.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_soft_dotted.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_space.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_terminal_punctuation.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_test.c \ - unictype/test-pr_titlecase.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_test.c macros.h unictype/test-pr_titlecase.c \ + unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_unassigned_code_value.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_unified_ideograph.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_uppercase.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_uppercase.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_variation_selector.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_white_space.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_white_space.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_xid_continue.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_xid_start.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_zero_width.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-scripts.c \ - unictype/test-sy_c_ident.c unictype/test-sy_c_whitespace.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_xid_start.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_zero_width.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-scripts.c macros.h unictype/test-sy_c_ident.c \ + macros.h unictype/test-sy_c_whitespace.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-sy_java_ident.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-sy_java_ident.c macros.h \ unictype/test-sy_java_whitespace.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ - unilbrk/test-u16-possible-linebreaks.c \ - unilbrk/test-u16-width-linebreaks.c \ - unilbrk/test-u32-possible-linebreaks.c \ - unilbrk/test-u32-width-linebreaks.c \ - unilbrk/test-u8-possible-linebreaks.c \ - unilbrk/test-u8-width-linebreaks.c \ - unilbrk/test-ulc-possible-linebreaks.c \ - unilbrk/test-ulc-width-linebreaks.c uniname/test-uninames.sh \ - uniname/test-uninames.c uniname/UnicodeDataNames.txt \ - uninorm/test-canonical-decomposition.c \ - uninorm/test-compat-decomposition.c uninorm/test-composition.c \ - uninorm/test-decomposing-form.c uninorm/test-decomposition.c \ - uninorm/test-uninorm-filter-nfc.c uninorm/test-nfc.c \ + unictype/test-predicate-part2.h macros.h \ + unilbrk/test-u16-possible-linebreaks.c macros.h \ + unilbrk/test-u16-width-linebreaks.c macros.h \ + unilbrk/test-u32-possible-linebreaks.c macros.h \ + unilbrk/test-u32-width-linebreaks.c macros.h \ + unilbrk/test-u8-possible-linebreaks.c macros.h \ + unilbrk/test-u8-width-linebreaks.c macros.h \ + unilbrk/test-ulc-possible-linebreaks.c macros.h \ + unilbrk/test-ulc-width-linebreaks.c macros.h \ + uniname/test-uninames.sh uniname/test-uninames.c \ + uniname/UnicodeDataNames.txt \ + uninorm/test-canonical-decomposition.c macros.h \ + uninorm/test-compat-decomposition.c macros.h \ + uninorm/test-composition.c macros.h \ + uninorm/test-decomposing-form.c macros.h \ + uninorm/test-decomposition.c macros.h \ + uninorm/test-uninorm-filter-nfc.c macros.h uninorm/test-nfc.c \ uninorm/test-u8-nfc.c uninorm/test-u16-nfc.c \ uninorm/test-u32-nfc.c uninorm/test-u32-nfc-big.sh \ uninorm/test-u32-nfc-big.c uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-nfd.c uninorm/test-u8-nfd.c \ + macros.h uninorm/test-nfd.c uninorm/test-u8-nfd.c \ uninorm/test-u16-nfd.c uninorm/test-u32-nfd.c \ uninorm/test-u32-nfd-big.sh uninorm/test-u32-nfd-big.c \ uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-nfkc.c uninorm/test-u8-nfkc.c \ + macros.h uninorm/test-nfkc.c uninorm/test-u8-nfkc.c \ uninorm/test-u16-nfkc.c uninorm/test-u32-nfkc.c \ uninorm/test-u32-nfkc-big.sh uninorm/test-u32-nfkc-big.c \ uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-nfkd.c uninorm/test-u8-nfkd.c \ + macros.h uninorm/test-nfkd.c uninorm/test-u8-nfkd.c \ uninorm/test-u16-nfkd.c uninorm/test-u32-nfkd.c \ uninorm/test-u32-nfkd-big.sh uninorm/test-u32-nfkd-big.c \ uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h \ - uninorm/test-u16-normcoll.c uninorm/test-u16-normcmp.h \ - uninorm/test-u32-normcmp.c uninorm/test-u32-normcmp.h \ + macros.h uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h \ + macros.h uninorm/test-u16-normcoll.c \ + uninorm/test-u16-normcmp.h macros.h uninorm/test-u32-normcmp.c \ + uninorm/test-u32-normcmp.h macros.h \ uninorm/test-u32-normcoll.c uninorm/test-u32-normcmp.h \ - uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h \ - uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h \ - test-unistd.c unistdio/test-u16-asnprintf1.c \ + macros.h uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h \ + macros.h uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h \ + macros.h test-unistd.c unistdio/test-u16-asnprintf1.c \ unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h \ - unistdio/test-u16-vasnprintf1.c unistdio/test-u16-asnprintf1.h \ - unistdio/test-u16-printf1.h unistdio/test-u16-vasnprintf2.sh \ + macros.h unistdio/test-u16-vasnprintf1.c \ + unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h \ + unistdio/test-u16-vasnprintf2.sh \ unistdio/test-u16-vasnprintf2.c \ unistdio/test-u16-vasnprintf3.sh \ - unistdio/test-u16-vasnprintf3.c unistdio/test-u16-vasprintf1.c \ - unistdio/test-u16-printf1.h unistdio/test-u16-vsnprintf1.c \ - unistdio/test-u16-printf1.h unistdio/test-u16-vsprintf1.c \ - unistdio/test-u16-printf1.h unistdio/test-u32-asnprintf1.c \ + unistdio/test-u16-vasnprintf3.c macros.h \ + unistdio/test-u16-vasprintf1.c unistdio/test-u16-printf1.h \ + macros.h unistdio/test-u16-vsnprintf1.c \ + unistdio/test-u16-printf1.h macros.h \ + unistdio/test-u16-vsprintf1.c unistdio/test-u16-printf1.h \ + macros.h unistdio/test-u32-asnprintf1.c \ unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h \ - unistdio/test-u32-vasnprintf1.c unistdio/test-u32-asnprintf1.h \ - unistdio/test-u32-printf1.h unistdio/test-u32-vasnprintf2.sh \ + macros.h unistdio/test-u32-vasnprintf1.c \ + unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h \ + unistdio/test-u32-vasnprintf2.sh \ unistdio/test-u32-vasnprintf2.c \ unistdio/test-u32-vasnprintf3.sh \ - unistdio/test-u32-vasnprintf3.c unistdio/test-u32-vasprintf1.c \ - unistdio/test-u32-printf1.h unistdio/test-u32-vsnprintf1.c \ - unistdio/test-u32-printf1.h unistdio/test-u32-vsprintf1.c \ - unistdio/test-u32-printf1.h unistdio/test-u8-asnprintf1.c \ + unistdio/test-u32-vasnprintf3.c macros.h \ + unistdio/test-u32-vasprintf1.c unistdio/test-u32-printf1.h \ + macros.h unistdio/test-u32-vsnprintf1.c \ + unistdio/test-u32-printf1.h macros.h \ + unistdio/test-u32-vsprintf1.c unistdio/test-u32-printf1.h \ + macros.h unistdio/test-u8-asnprintf1.c \ unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h \ - unistdio/test-u8-vasnprintf1.c unistdio/test-u8-asnprintf1.h \ - unistdio/test-u8-printf1.h unistdio/test-u8-vasnprintf2.sh \ - unistdio/test-u8-vasnprintf2.c unistdio/test-u8-vasnprintf3.sh \ - unistdio/test-u8-vasnprintf3.c unistdio/test-u8-vasprintf1.c \ - unistdio/test-u8-printf1.h unistdio/test-u8-vsnprintf1.c \ - unistdio/test-u8-printf1.h unistdio/test-u8-vsprintf1.c \ - unistdio/test-u8-printf1.h unistdio/test-ulc-asnprintf1.c \ - unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h \ + macros.h unistdio/test-u8-vasnprintf1.c \ + unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h \ + unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf2.c \ + unistdio/test-u8-vasnprintf3.sh unistdio/test-u8-vasnprintf3.c \ + macros.h unistdio/test-u8-vasprintf1.c \ + unistdio/test-u8-printf1.h macros.h \ + unistdio/test-u8-vsnprintf1.c unistdio/test-u8-printf1.h \ + macros.h unistdio/test-u8-vsprintf1.c \ + unistdio/test-u8-printf1.h macros.h \ + unistdio/test-ulc-asnprintf1.c unistdio/test-ulc-asnprintf1.h \ + unistdio/test-ulc-printf1.h macros.h \ unistdio/test-ulc-vasnprintf1.c unistdio/test-ulc-asnprintf1.h \ unistdio/test-ulc-printf1.h unistdio/test-ulc-vasnprintf2.sh \ unistdio/test-ulc-vasnprintf2.c \ unistdio/test-ulc-vasnprintf3.sh \ - unistdio/test-ulc-vasnprintf3.c unistdio/test-ulc-vasprintf1.c \ - unistdio/test-ulc-printf1.h unistdio/test-ulc-vsnprintf1.c \ - unistdio/test-ulc-printf1.h unistdio/test-ulc-vsprintf1.c \ - unistdio/test-ulc-printf1.h uniwbrk/test-u16-wordbreaks.c \ - uniwbrk/test-u32-wordbreaks.c uniwbrk/test-u8-wordbreaks.c \ + unistdio/test-ulc-vasnprintf3.c macros.h \ + unistdio/test-ulc-vasprintf1.c unistdio/test-ulc-printf1.h \ + macros.h unistdio/test-ulc-vsnprintf1.c \ + unistdio/test-ulc-printf1.h macros.h \ + unistdio/test-ulc-vsprintf1.c unistdio/test-ulc-printf1.h \ + macros.h unistr/test-u16-check.c macros.h \ + unistr/test-u16-chr.c unistr/test-chr.h zerosize-ptr.h \ + macros.h unistr/test-u16-cmp.c unistr/test-cmp.h \ + zerosize-ptr.h macros.h unistr/test-u16-cmp2.c \ + unistr/test-cmp2.h macros.h unistr/test-u16-cpy-alloc.c \ + unistr/test-cpy-alloc.h macros.h unistr/test-u16-cpy.c \ + unistr/test-cpy.h macros.h unistr/test-u16-mblen.c macros.h \ + unistr/test-u16-mbsnlen.c macros.h unistr/test-u16-mbtouc.c \ + unistr/test-u16-mbtouc.h macros.h \ + unistr/test-u16-mbtouc-unsafe.c unistr/test-u16-mbtouc.h \ + macros.h unistr/test-u16-mbtoucr.c macros.h \ + unistr/test-u16-move.c unistr/test-move.h macros.h \ + unistr/test-u16-next.c macros.h unistr/test-u16-prev.c \ + macros.h unistr/test-u16-set.c unistr/test-set.h macros.h \ + unistr/test-u16-stpcpy.c unistr/test-stpcpy.h macros.h \ + unistr/test-u16-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h \ + macros.h unistr/test-u16-strcat.c unistr/test-strcat.h \ + macros.h unistr/test-u16-strcmp.c unistr/test-u16-strcmp.h \ + unistr/test-strcmp.h macros.h unistr/test-u16-strcoll.c \ + unistr/test-u16-strcmp.h unistr/test-strcmp.h macros.h \ + unistr/test-u16-strcpy.c unistr/test-strcpy.h macros.h \ + unistr/test-u16-strdup.c unistr/test-strdup.h macros.h \ + unistr/test-u16-strlen.c macros.h unistr/test-u16-strmblen.c \ + macros.h unistr/test-u16-strmbtouc.c macros.h \ + unistr/test-u16-strncat.c unistr/test-strncat.h zerosize-ptr.h \ + macros.h unistr/test-u16-strncmp.c unistr/test-strncmp.h \ + macros.h unistr/test-u16-strncpy.c unistr/test-strncpy.h \ + zerosize-ptr.h macros.h unistr/test-u16-strnlen.c \ + unistr/test-strnlen.h zerosize-ptr.h macros.h \ + unistr/test-u16-to-u32.c macros.h unistr/test-u16-to-u8.c \ + macros.h unistr/test-u16-uctomb.c macros.h \ + unistr/test-u32-check.c macros.h unistr/test-u32-chr.c \ + unistr/test-chr.h zerosize-ptr.h macros.h \ + unistr/test-u32-cmp.c unistr/test-cmp.h zerosize-ptr.h \ + macros.h unistr/test-u32-cmp2.c unistr/test-cmp2.h macros.h \ + unistr/test-u32-cpy-alloc.c unistr/test-cpy-alloc.h macros.h \ + unistr/test-u32-cpy.c unistr/test-cpy.h macros.h \ + unistr/test-u32-mblen.c macros.h unistr/test-u32-mbsnlen.c \ + macros.h unistr/test-u32-mbtouc.c unistr/test-u32-mbtouc.h \ + macros.h unistr/test-u32-mbtouc-unsafe.c \ + unistr/test-u32-mbtouc.h macros.h unistr/test-u32-mbtoucr.c \ + macros.h unistr/test-u32-move.c unistr/test-move.h macros.h \ + unistr/test-u32-next.c macros.h unistr/test-u32-prev.c \ + macros.h unistr/test-u32-set.c unistr/test-set.h macros.h \ + unistr/test-u32-stpcpy.c unistr/test-stpcpy.h macros.h \ + unistr/test-u32-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h \ + macros.h unistr/test-u32-strcat.c unistr/test-strcat.h \ + macros.h unistr/test-u32-strcmp.c unistr/test-u32-strcmp.h \ + unistr/test-strcmp.h macros.h unistr/test-u32-strcoll.c \ + unistr/test-u32-strcmp.h unistr/test-strcmp.h macros.h \ + unistr/test-u32-strcpy.c unistr/test-strcpy.h macros.h \ + unistr/test-u32-strdup.c unistr/test-strdup.h macros.h \ + unistr/test-u32-strlen.c macros.h unistr/test-u32-strmblen.c \ + macros.h unistr/test-u32-strmbtouc.c macros.h \ + unistr/test-u32-strncat.c unistr/test-strncat.h zerosize-ptr.h \ + macros.h unistr/test-u32-strncmp.c unistr/test-strncmp.h \ + macros.h unistr/test-u32-strncpy.c unistr/test-strncpy.h \ + zerosize-ptr.h macros.h unistr/test-u32-strnlen.c \ + unistr/test-strnlen.h zerosize-ptr.h macros.h \ + unistr/test-u32-to-u16.c macros.h unistr/test-u32-to-u8.c \ + macros.h unistr/test-u32-uctomb.c macros.h \ + unistr/test-u8-check.c macros.h unistr/test-u8-chr.c \ + unistr/test-chr.h zerosize-ptr.h macros.h unistr/test-u8-cmp.c \ + unistr/test-cmp.h zerosize-ptr.h macros.h \ + unistr/test-u8-cmp2.c unistr/test-cmp2.h macros.h \ + unistr/test-u8-cpy-alloc.c unistr/test-cpy-alloc.h macros.h \ + unistr/test-u8-cpy.c unistr/test-cpy.h macros.h \ + unistr/test-u8-mblen.c macros.h unistr/test-u8-mbsnlen.c \ + macros.h unistr/test-u8-mbtouc.c unistr/test-u8-mbtouc.h \ + macros.h unistr/test-u8-mbtouc-unsafe.c \ + unistr/test-u8-mbtouc.h macros.h unistr/test-u8-mbtoucr.c \ + macros.h unistr/test-u8-move.c unistr/test-move.h macros.h \ + unistr/test-u8-next.c macros.h unistr/test-u8-prev.c macros.h \ + unistr/test-u8-set.c unistr/test-set.h macros.h \ + unistr/test-u8-stpcpy.c unistr/test-stpcpy.h macros.h \ + unistr/test-u8-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h \ + macros.h unistr/test-u8-strcat.c unistr/test-strcat.h macros.h \ + unistr/test-u8-strcmp.c unistr/test-u8-strcmp.h \ + unistr/test-strcmp.h macros.h unistr/test-u8-strcoll.c \ + unistr/test-u8-strcmp.h unistr/test-strcmp.h macros.h \ + unistr/test-u8-strcpy.c unistr/test-strcpy.h macros.h \ + unistr/test-u8-strdup.c unistr/test-strdup.h macros.h \ + unistr/test-u8-strlen.c macros.h unistr/test-u8-strmblen.c \ + macros.h unistr/test-u8-strmbtouc.c macros.h \ + unistr/test-u8-strncat.c unistr/test-strncat.h zerosize-ptr.h \ + macros.h unistr/test-u8-strncmp.c unistr/test-strncmp.h \ + macros.h unistr/test-u8-strncpy.c unistr/test-strncpy.h \ + zerosize-ptr.h macros.h unistr/test-u8-strnlen.c \ + unistr/test-strnlen.h zerosize-ptr.h macros.h \ + unistr/test-u8-to-u16.c macros.h unistr/test-u8-to-u32.c \ + macros.h unistr/test-u8-uctomb.c macros.h \ + uniwbrk/test-u16-wordbreaks.c macros.h \ + uniwbrk/test-u32-wordbreaks.c macros.h \ + uniwbrk/test-u8-wordbreaks.c macros.h \ uniwbrk/test-ulc-wordbreaks.sh uniwbrk/test-ulc-wordbreaks.c \ - uniwidth/test-u16-strwidth.c uniwidth/test-u16-width.c \ - uniwidth/test-u32-strwidth.c uniwidth/test-u32-width.c \ - uniwidth/test-u8-strwidth.c uniwidth/test-u8-width.c \ + macros.h uniwidth/test-u16-strwidth.c macros.h \ + uniwidth/test-u16-width.c macros.h \ + uniwidth/test-u32-strwidth.c macros.h \ + uniwidth/test-u32-width.c macros.h uniwidth/test-u8-strwidth.c \ + macros.h uniwidth/test-u8-width.c macros.h \ uniwidth/test-uc_width.c uniwidth/test-uc_width2.c \ - uniwidth/test-uc_width2.sh unsetenv.c test-wchar.c wctob.c \ - test-wctype.c test-wcwidth.c xalloc.h xmalloc.c -BUILT_SOURCES = $(FCNTL_H) $(LOCALE_H) + uniwidth/test-uc_width2.sh macros.h unsetenv.c test-unsetenv.c \ + signature.h macros.h \ + $(top_srcdir)/build-aux/unused-parameter.h \ + $(top_srcdir)/build-aux/warn-on-use.h test-wchar.c wctob.c \ + test-wctype.c macros.h test-wcwidth.c signature.h macros.h \ + xalloc.h xmalloc.c test-xalloc-die.c test-xalloc-die.sh \ + init.sh + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. +BUILT_SOURCES = arg-nonnull.h c++defs.h locale.h unused-parameter.h \ + warn-on-use.h SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump fcntl.h fcntl.h-t locale.h \ - locale.h-t +MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ + c++defs.h c++defs.h-t locale.h locale.h-t unused-parameter.h \ + unused-parameter.h-t warn-on-use.h warn-on-use.h-t MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = \ + -D@gltests_WITNESS@=1 \ -I. -I$(srcdir) \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib LDADD = libtests.a ../lib/libunistring.la libtests.a $(LIBTESTS_LIBDEPS) -libtests_a_SOURCES = gettext.h progname.h progname.c xalloc-die.c +libtests_a_SOURCES = exitfail.c gettext.h progname.h progname.c \ + glthread/thread.h glthread/thread.c xalloc-die.c \ + glthread/yield.h libtests_a_LIBADD = $(gltests_LIBOBJS) libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) -EXTRA_libtests_a_SOURCES = error.c exitfail.c open.c setenv.c \ +EXTRA_libtests_a_SOURCES = error.c getpagesize.c putenv.c setenv.c \ strerror.c unsetenv.c wctob.c xmalloc.c AM_LIBTOOLFLAGS = --preserve-dup-deps +ARG_NONNULL_H = arg-nonnull.h +CXXDEFS_H = c++defs.h test_frexpl_nolibm_SOURCES = test-frexpl.c test_iconv_LDADD = $(LDADD) @LIBICONV@ test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ +test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@ test_striconveh_LDADD = $(LDADD) @LIBICONV@ test_striconveha_LDADD = $(LDADD) @LIBICONV@ test_cased_SOURCES = unicase/test-cased.c @@ -3974,6 +4929,105 @@ test_ulc_vsnprintf1_SOURCES = unistdio/test-ulc-vsnprintf1.c test_ulc_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ test_ulc_vsprintf1_SOURCES = unistdio/test-ulc-vsprintf1.c test_ulc_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ +test_u16_check_SOURCES = unistr/test-u16-check.c +test_u16_chr_SOURCES = unistr/test-u16-chr.c +test_u16_cmp_SOURCES = unistr/test-u16-cmp.c +test_u16_cmp2_SOURCES = unistr/test-u16-cmp2.c +test_u16_cpy_alloc_SOURCES = unistr/test-u16-cpy-alloc.c +test_u16_cpy_SOURCES = unistr/test-u16-cpy.c +test_u16_mblen_SOURCES = unistr/test-u16-mblen.c +test_u16_mbsnlen_SOURCES = unistr/test-u16-mbsnlen.c +test_u16_mbtouc_SOURCES = unistr/test-u16-mbtouc.c +test_u16_mbtouc_unsafe_SOURCES = unistr/test-u16-mbtouc-unsafe.c +test_u16_mbtoucr_SOURCES = unistr/test-u16-mbtoucr.c +test_u16_move_SOURCES = unistr/test-u16-move.c +test_u16_next_SOURCES = unistr/test-u16-next.c +test_u16_prev_SOURCES = unistr/test-u16-prev.c +test_u16_set_SOURCES = unistr/test-u16-set.c +test_u16_stpcpy_SOURCES = unistr/test-u16-stpcpy.c +test_u16_stpncpy_SOURCES = unistr/test-u16-stpncpy.c +test_u16_strcat_SOURCES = unistr/test-u16-strcat.c +test_u16_strcmp_SOURCES = unistr/test-u16-strcmp.c +test_u16_strcoll_SOURCES = unistr/test-u16-strcoll.c +test_u16_strcoll_LDADD = $(LDADD) @LIBICONV@ +test_u16_strcpy_SOURCES = unistr/test-u16-strcpy.c +test_u16_strdup_SOURCES = unistr/test-u16-strdup.c +test_u16_strlen_SOURCES = unistr/test-u16-strlen.c +test_u16_strmblen_SOURCES = unistr/test-u16-strmblen.c +test_u16_strmbtouc_SOURCES = unistr/test-u16-strmbtouc.c +test_u16_strncat_SOURCES = unistr/test-u16-strncat.c +test_u16_strncmp_SOURCES = unistr/test-u16-strncmp.c +test_u16_strncpy_SOURCES = unistr/test-u16-strncpy.c +test_u16_strnlen_SOURCES = unistr/test-u16-strnlen.c +test_u16_to_u32_SOURCES = unistr/test-u16-to-u32.c +test_u16_to_u8_SOURCES = unistr/test-u16-to-u8.c +test_u16_uctomb_SOURCES = unistr/test-u16-uctomb.c +test_u32_check_SOURCES = unistr/test-u32-check.c +test_u32_chr_SOURCES = unistr/test-u32-chr.c +test_u32_cmp_SOURCES = unistr/test-u32-cmp.c +test_u32_cmp2_SOURCES = unistr/test-u32-cmp2.c +test_u32_cpy_alloc_SOURCES = unistr/test-u32-cpy-alloc.c +test_u32_cpy_SOURCES = unistr/test-u32-cpy.c +test_u32_mblen_SOURCES = unistr/test-u32-mblen.c +test_u32_mbsnlen_SOURCES = unistr/test-u32-mbsnlen.c +test_u32_mbtouc_SOURCES = unistr/test-u32-mbtouc.c +test_u32_mbtouc_unsafe_SOURCES = unistr/test-u32-mbtouc-unsafe.c +test_u32_mbtoucr_SOURCES = unistr/test-u32-mbtoucr.c +test_u32_move_SOURCES = unistr/test-u32-move.c +test_u32_next_SOURCES = unistr/test-u32-next.c +test_u32_prev_SOURCES = unistr/test-u32-prev.c +test_u32_set_SOURCES = unistr/test-u32-set.c +test_u32_stpcpy_SOURCES = unistr/test-u32-stpcpy.c +test_u32_stpncpy_SOURCES = unistr/test-u32-stpncpy.c +test_u32_strcat_SOURCES = unistr/test-u32-strcat.c +test_u32_strcmp_SOURCES = unistr/test-u32-strcmp.c +test_u32_strcoll_SOURCES = unistr/test-u32-strcoll.c +test_u32_strcoll_LDADD = $(LDADD) @LIBICONV@ +test_u32_strcpy_SOURCES = unistr/test-u32-strcpy.c +test_u32_strdup_SOURCES = unistr/test-u32-strdup.c +test_u32_strlen_SOURCES = unistr/test-u32-strlen.c +test_u32_strmblen_SOURCES = unistr/test-u32-strmblen.c +test_u32_strmbtouc_SOURCES = unistr/test-u32-strmbtouc.c +test_u32_strncat_SOURCES = unistr/test-u32-strncat.c +test_u32_strncmp_SOURCES = unistr/test-u32-strncmp.c +test_u32_strncpy_SOURCES = unistr/test-u32-strncpy.c +test_u32_strnlen_SOURCES = unistr/test-u32-strnlen.c +test_u32_to_u16_SOURCES = unistr/test-u32-to-u16.c +test_u32_to_u8_SOURCES = unistr/test-u32-to-u8.c +test_u32_uctomb_SOURCES = unistr/test-u32-uctomb.c +test_u8_check_SOURCES = unistr/test-u8-check.c +test_u8_chr_SOURCES = unistr/test-u8-chr.c +test_u8_cmp_SOURCES = unistr/test-u8-cmp.c +test_u8_cmp2_SOURCES = unistr/test-u8-cmp2.c +test_u8_cpy_alloc_SOURCES = unistr/test-u8-cpy-alloc.c +test_u8_cpy_SOURCES = unistr/test-u8-cpy.c +test_u8_mblen_SOURCES = unistr/test-u8-mblen.c +test_u8_mbsnlen_SOURCES = unistr/test-u8-mbsnlen.c +test_u8_mbtouc_SOURCES = unistr/test-u8-mbtouc.c +test_u8_mbtouc_unsafe_SOURCES = unistr/test-u8-mbtouc-unsafe.c +test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c +test_u8_move_SOURCES = unistr/test-u8-move.c +test_u8_next_SOURCES = unistr/test-u8-next.c +test_u8_prev_SOURCES = unistr/test-u8-prev.c +test_u8_set_SOURCES = unistr/test-u8-set.c +test_u8_stpcpy_SOURCES = unistr/test-u8-stpcpy.c +test_u8_stpncpy_SOURCES = unistr/test-u8-stpncpy.c +test_u8_strcat_SOURCES = unistr/test-u8-strcat.c +test_u8_strcmp_SOURCES = unistr/test-u8-strcmp.c +test_u8_strcoll_SOURCES = unistr/test-u8-strcoll.c +test_u8_strcoll_LDADD = $(LDADD) @LIBICONV@ +test_u8_strcpy_SOURCES = unistr/test-u8-strcpy.c +test_u8_strdup_SOURCES = unistr/test-u8-strdup.c +test_u8_strlen_SOURCES = unistr/test-u8-strlen.c +test_u8_strmblen_SOURCES = unistr/test-u8-strmblen.c +test_u8_strmbtouc_SOURCES = unistr/test-u8-strmbtouc.c +test_u8_strncat_SOURCES = unistr/test-u8-strncat.c +test_u8_strncmp_SOURCES = unistr/test-u8-strncmp.c +test_u8_strncpy_SOURCES = unistr/test-u8-strncpy.c +test_u8_strnlen_SOURCES = unistr/test-u8-strnlen.c +test_u8_to_u16_SOURCES = unistr/test-u8-to-u16.c +test_u8_to_u32_SOURCES = unistr/test-u8-to-u32.c +test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c test_u16_wordbreaks_SOURCES = uniwbrk/test-u16-wordbreaks.c test_u32_wordbreaks_SOURCES = uniwbrk/test-u32-wordbreaks.c test_u8_wordbreaks_SOURCES = uniwbrk/test-u8-wordbreaks.c @@ -3987,6 +5041,9 @@ test_u8_strwidth_SOURCES = uniwidth/test-u8-strwidth.c test_u8_width_SOURCES = uniwidth/test-u8-width.c test_uc_width_SOURCES = uniwidth/test-uc_width.c test_uc_width2_SOURCES = uniwidth/test-uc_width2.c +UNUSED_PARAMETER_H = unused-parameter.h +WARN_ON_USE_H = warn-on-use.h +test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ # Ensure that ../lib/config.h is seen before ../config.h. DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/lib -I$(top_builddir) @@ -4038,6 +5095,14 @@ clean-checkLIBRARIES: clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +glthread/$(am__dirstamp): + @$(MKDIR_P) glthread + @: > glthread/$(am__dirstamp) +glthread/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) glthread/$(DEPDIR) + @: > glthread/$(DEPDIR)/$(am__dirstamp) +glthread/thread.$(OBJEXT): glthread/$(am__dirstamp) \ + glthread/$(DEPDIR)/$(am__dirstamp) libtests.a: $(libtests_a_OBJECTS) $(libtests_a_DEPENDENCIES) $(AM_V_at)-rm -f libtests.a $(AM_V_AR)$(libtests_a_AR) libtests.a $(libtests_a_OBJECTS) $(libtests_a_LIBADD) @@ -4458,18 +5523,12 @@ unictype/test-digit.$(OBJEXT): unictype/$(am__dirstamp) \ test-digit$(EXEEXT): $(test_digit_OBJECTS) $(test_digit_DEPENDENCIES) @rm -f test-digit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_digit_OBJECTS) $(test_digit_LDADD) $(LIBS) -test-dup2$(EXEEXT): $(test_dup2_OBJECTS) $(test_dup2_DEPENDENCIES) - @rm -f test-dup2$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_dup2_OBJECTS) $(test_dup2_LDADD) $(LIBS) test-environ$(EXEEXT): $(test_environ_OBJECTS) $(test_environ_DEPENDENCIES) @rm -f test-environ$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_environ_OBJECTS) $(test_environ_LDADD) $(LIBS) test-errno$(EXEEXT): $(test_errno_OBJECTS) $(test_errno_DEPENDENCIES) @rm -f test-errno$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_errno_OBJECTS) $(test_errno_LDADD) $(LIBS) -test-fcntl$(EXEEXT): $(test_fcntl_OBJECTS) $(test_fcntl_DEPENDENCIES) - @rm -f test-fcntl$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_fcntl_OBJECTS) $(test_fcntl_LDADD) $(LIBS) test-frexpl-nolibm$(EXEEXT): $(test_frexpl_nolibm_OBJECTS) $(test_frexpl_nolibm_DEPENDENCIES) @rm -f test-frexpl-nolibm$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_frexpl_nolibm_OBJECTS) $(test_frexpl_nolibm_LDADD) $(LIBS) @@ -4479,6 +5538,9 @@ test-fseterr$(EXEEXT): $(test_fseterr_OBJECTS) $(test_fseterr_DEPENDENCIES) test-iconv$(EXEEXT): $(test_iconv_OBJECTS) $(test_iconv_DEPENDENCIES) @rm -f test-iconv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iconv_OBJECTS) $(test_iconv_LDADD) $(LIBS) +test-iconv-h$(EXEEXT): $(test_iconv_h_OBJECTS) $(test_iconv_h_DEPENDENCIES) + @rm -f test-iconv-h$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_iconv_h_OBJECTS) $(test_iconv_h_LDADD) $(LIBS) unicase/test-ignorable.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-ignorable$(EXEEXT): $(test_ignorable_OBJECTS) $(test_ignorable_DEPENDENCIES) @@ -4504,6 +5566,9 @@ test-locale-language$(EXEEXT): $(test_locale_language_OBJECTS) $(test_locale_lan test-localename$(EXEEXT): $(test_localename_OBJECTS) $(test_localename_DEPENDENCIES) @rm -f test-localename$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_localename_OBJECTS) $(test_localename_LDADD) $(LIBS) +test-lock$(EXEEXT): $(test_lock_OBJECTS) $(test_lock_DEPENDENCIES) + @rm -f test-lock$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_lock_OBJECTS) $(test_lock_LDADD) $(LIBS) test-malloca$(EXEEXT): $(test_malloca_OBJECTS) $(test_malloca_DEPENDENCIES) @rm -f test-malloca$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_malloca_OBJECTS) $(test_malloca_LDADD) $(LIBS) @@ -4573,9 +5638,6 @@ unictype/test-numeric.$(OBJEXT): unictype/$(am__dirstamp) \ test-numeric$(EXEEXT): $(test_numeric_OBJECTS) $(test_numeric_DEPENDENCIES) @rm -f test-numeric$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_numeric_OBJECTS) $(test_numeric_LDADD) $(LIBS) -test-open$(EXEEXT): $(test_open_OBJECTS) $(test_open_DEPENDENCIES) - @rm -f test-open$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_open_OBJECTS) $(test_open_LDADD) $(LIBS) unictype/test-pr_alphabetic.$(OBJEXT): unictype/$(am__dirstamp) \ unictype/$(DEPDIR)/$(am__dirstamp) test-pr_alphabetic$(EXEEXT): $(test_pr_alphabetic_OBJECTS) $(test_pr_alphabetic_DEPENDENCIES) @@ -4992,6 +6054,9 @@ unictype/test-scripts.$(OBJEXT): unictype/$(am__dirstamp) \ test-scripts$(EXEEXT): $(test_scripts_OBJECTS) $(test_scripts_DEPENDENCIES) @rm -f test-scripts$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_scripts_OBJECTS) $(test_scripts_LDADD) $(LIBS) +test-setenv$(EXEEXT): $(test_setenv_OBJECTS) $(test_setenv_DEPENDENCIES) + @rm -f test-setenv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_setenv_OBJECTS) $(test_setenv_LDADD) $(LIBS) test-signbit$(EXEEXT): $(test_signbit_OBJECTS) $(test_signbit_DEPENDENCIES) @rm -f test-signbit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_signbit_OBJECTS) $(test_signbit_LDADD) $(LIBS) @@ -5019,6 +6084,9 @@ test-striconveha$(EXEEXT): $(test_striconveha_OBJECTS) $(test_striconveha_DEPEND test-string$(EXEEXT): $(test_string_OBJECTS) $(test_string_DEPENDENCIES) @rm -f test-string$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_string_OBJECTS) $(test_string_LDADD) $(LIBS) +test-strncat$(EXEEXT): $(test_strncat_OBJECTS) $(test_strncat_DEPENDENCIES) + @rm -f test-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_strncat_OBJECTS) $(test_strncat_LDADD) $(LIBS) unictype/test-sy_c_ident.$(OBJEXT): unictype/$(am__dirstamp) \ unictype/$(DEPDIR)/$(am__dirstamp) test-sy_c_ident$(EXEEXT): $(test_sy_c_ident_OBJECTS) $(test_sy_c_ident_DEPENDENCIES) @@ -5065,6 +6133,32 @@ unicase/test-u16-casefold.$(OBJEXT): unicase/$(am__dirstamp) \ test-u16-casefold$(EXEEXT): $(test_u16_casefold_OBJECTS) $(test_u16_casefold_DEPENDENCIES) @rm -f test-u16-casefold$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_casefold_OBJECTS) $(test_u16_casefold_LDADD) $(LIBS) +unistr/$(am__dirstamp): + @$(MKDIR_P) unistr + @: > unistr/$(am__dirstamp) +unistr/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) unistr/$(DEPDIR) + @: > unistr/$(DEPDIR)/$(am__dirstamp) +unistr/test-u16-check.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-check$(EXEEXT): $(test_u16_check_OBJECTS) $(test_u16_check_DEPENDENCIES) + @rm -f test-u16-check$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_check_OBJECTS) $(test_u16_check_LDADD) $(LIBS) +unistr/test-u16-chr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-chr$(EXEEXT): $(test_u16_chr_OBJECTS) $(test_u16_chr_DEPENDENCIES) + @rm -f test-u16-chr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_chr_OBJECTS) $(test_u16_chr_LDADD) $(LIBS) +unistr/test-u16-cmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cmp$(EXEEXT): $(test_u16_cmp_OBJECTS) $(test_u16_cmp_DEPENDENCIES) + @rm -f test-u16-cmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cmp_OBJECTS) $(test_u16_cmp_LDADD) $(LIBS) +unistr/test-u16-cmp2.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cmp2$(EXEEXT): $(test_u16_cmp2_OBJECTS) $(test_u16_cmp2_DEPENDENCIES) + @rm -f test-u16-cmp2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cmp2_OBJECTS) $(test_u16_cmp2_LDADD) $(LIBS) uniconv/$(am__dirstamp): @$(MKDIR_P) uniconv @: > uniconv/$(am__dirstamp) @@ -5081,6 +6175,16 @@ uniconv/test-u16-conv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u16-conv-to-enc$(EXEEXT): $(test_u16_conv_to_enc_OBJECTS) $(test_u16_conv_to_enc_DEPENDENCIES) @rm -f test-u16-conv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_conv_to_enc_OBJECTS) $(test_u16_conv_to_enc_LDADD) $(LIBS) +unistr/test-u16-cpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cpy$(EXEEXT): $(test_u16_cpy_OBJECTS) $(test_u16_cpy_DEPENDENCIES) + @rm -f test-u16-cpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cpy_OBJECTS) $(test_u16_cpy_LDADD) $(LIBS) +unistr/test-u16-cpy-alloc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cpy-alloc$(EXEEXT): $(test_u16_cpy_alloc_OBJECTS) $(test_u16_cpy_alloc_DEPENDENCIES) + @rm -f test-u16-cpy-alloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cpy_alloc_OBJECTS) $(test_u16_cpy_alloc_LDADD) $(LIBS) unicase/test-u16-is-cased.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u16-is-cased$(EXEEXT): $(test_u16_is_cased_OBJECTS) $(test_u16_is_cased_DEPENDENCIES) @@ -5106,6 +6210,41 @@ unicase/test-u16-is-uppercase.$(OBJEXT): unicase/$(am__dirstamp) \ test-u16-is-uppercase$(EXEEXT): $(test_u16_is_uppercase_OBJECTS) $(test_u16_is_uppercase_DEPENDENCIES) @rm -f test-u16-is-uppercase$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_is_uppercase_OBJECTS) $(test_u16_is_uppercase_LDADD) $(LIBS) +unistr/test-u16-mblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mblen$(EXEEXT): $(test_u16_mblen_OBJECTS) $(test_u16_mblen_DEPENDENCIES) + @rm -f test-u16-mblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mblen_OBJECTS) $(test_u16_mblen_LDADD) $(LIBS) +unistr/test-u16-mbsnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbsnlen$(EXEEXT): $(test_u16_mbsnlen_OBJECTS) $(test_u16_mbsnlen_DEPENDENCIES) + @rm -f test-u16-mbsnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbsnlen_OBJECTS) $(test_u16_mbsnlen_LDADD) $(LIBS) +unistr/test-u16-mbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbtouc$(EXEEXT): $(test_u16_mbtouc_OBJECTS) $(test_u16_mbtouc_DEPENDENCIES) + @rm -f test-u16-mbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbtouc_OBJECTS) $(test_u16_mbtouc_LDADD) $(LIBS) +unistr/test-u16-mbtouc-unsafe.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbtouc-unsafe$(EXEEXT): $(test_u16_mbtouc_unsafe_OBJECTS) $(test_u16_mbtouc_unsafe_DEPENDENCIES) + @rm -f test-u16-mbtouc-unsafe$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbtouc_unsafe_OBJECTS) $(test_u16_mbtouc_unsafe_LDADD) $(LIBS) +unistr/test-u16-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbtoucr$(EXEEXT): $(test_u16_mbtoucr_OBJECTS) $(test_u16_mbtoucr_DEPENDENCIES) + @rm -f test-u16-mbtoucr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbtoucr_OBJECTS) $(test_u16_mbtoucr_LDADD) $(LIBS) +unistr/test-u16-move.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-move$(EXEEXT): $(test_u16_move_OBJECTS) $(test_u16_move_DEPENDENCIES) + @rm -f test-u16-move$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_move_OBJECTS) $(test_u16_move_LDADD) $(LIBS) +unistr/test-u16-next.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-next$(EXEEXT): $(test_u16_next_OBJECTS) $(test_u16_next_DEPENDENCIES) + @rm -f test-u16-next$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_next_OBJECTS) $(test_u16_next_LDADD) $(LIBS) uninorm/test-u16-normcmp.$(OBJEXT): uninorm/$(am__dirstamp) \ uninorm/$(DEPDIR)/$(am__dirstamp) test-u16-normcmp$(EXEEXT): $(test_u16_normcmp_OBJECTS) $(test_u16_normcmp_DEPENDENCIES) @@ -5127,6 +6266,41 @@ unilbrk/test-u16-possible-linebreaks.$(OBJEXT): \ test-u16-possible-linebreaks$(EXEEXT): $(test_u16_possible_linebreaks_OBJECTS) $(test_u16_possible_linebreaks_DEPENDENCIES) @rm -f test-u16-possible-linebreaks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_possible_linebreaks_OBJECTS) $(test_u16_possible_linebreaks_LDADD) $(LIBS) +unistr/test-u16-prev.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-prev$(EXEEXT): $(test_u16_prev_OBJECTS) $(test_u16_prev_DEPENDENCIES) + @rm -f test-u16-prev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_prev_OBJECTS) $(test_u16_prev_LDADD) $(LIBS) +unistr/test-u16-set.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-set$(EXEEXT): $(test_u16_set_OBJECTS) $(test_u16_set_DEPENDENCIES) + @rm -f test-u16-set$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_set_OBJECTS) $(test_u16_set_LDADD) $(LIBS) +unistr/test-u16-stpcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-stpcpy$(EXEEXT): $(test_u16_stpcpy_OBJECTS) $(test_u16_stpcpy_DEPENDENCIES) + @rm -f test-u16-stpcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_stpcpy_OBJECTS) $(test_u16_stpcpy_LDADD) $(LIBS) +unistr/test-u16-stpncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-stpncpy$(EXEEXT): $(test_u16_stpncpy_OBJECTS) $(test_u16_stpncpy_DEPENDENCIES) + @rm -f test-u16-stpncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_stpncpy_OBJECTS) $(test_u16_stpncpy_LDADD) $(LIBS) +unistr/test-u16-strcat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcat$(EXEEXT): $(test_u16_strcat_OBJECTS) $(test_u16_strcat_DEPENDENCIES) + @rm -f test-u16-strcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcat_OBJECTS) $(test_u16_strcat_LDADD) $(LIBS) +unistr/test-u16-strcmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcmp$(EXEEXT): $(test_u16_strcmp_OBJECTS) $(test_u16_strcmp_DEPENDENCIES) + @rm -f test-u16-strcmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcmp_OBJECTS) $(test_u16_strcmp_LDADD) $(LIBS) +unistr/test-u16-strcoll.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcoll$(EXEEXT): $(test_u16_strcoll_OBJECTS) $(test_u16_strcoll_DEPENDENCIES) + @rm -f test-u16-strcoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcoll_OBJECTS) $(test_u16_strcoll_LDADD) $(LIBS) uniconv/test-u16-strconv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u16-strconv-from-enc$(EXEEXT): $(test_u16_strconv_from_enc_OBJECTS) $(test_u16_strconv_from_enc_DEPENDENCIES) @@ -5137,6 +6311,51 @@ uniconv/test-u16-strconv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u16-strconv-to-enc$(EXEEXT): $(test_u16_strconv_to_enc_OBJECTS) $(test_u16_strconv_to_enc_DEPENDENCIES) @rm -f test-u16-strconv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_strconv_to_enc_OBJECTS) $(test_u16_strconv_to_enc_LDADD) $(LIBS) +unistr/test-u16-strcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcpy$(EXEEXT): $(test_u16_strcpy_OBJECTS) $(test_u16_strcpy_DEPENDENCIES) + @rm -f test-u16-strcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcpy_OBJECTS) $(test_u16_strcpy_LDADD) $(LIBS) +unistr/test-u16-strdup.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strdup$(EXEEXT): $(test_u16_strdup_OBJECTS) $(test_u16_strdup_DEPENDENCIES) + @rm -f test-u16-strdup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strdup_OBJECTS) $(test_u16_strdup_LDADD) $(LIBS) +unistr/test-u16-strlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strlen$(EXEEXT): $(test_u16_strlen_OBJECTS) $(test_u16_strlen_DEPENDENCIES) + @rm -f test-u16-strlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strlen_OBJECTS) $(test_u16_strlen_LDADD) $(LIBS) +unistr/test-u16-strmblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strmblen$(EXEEXT): $(test_u16_strmblen_OBJECTS) $(test_u16_strmblen_DEPENDENCIES) + @rm -f test-u16-strmblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strmblen_OBJECTS) $(test_u16_strmblen_LDADD) $(LIBS) +unistr/test-u16-strmbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strmbtouc$(EXEEXT): $(test_u16_strmbtouc_OBJECTS) $(test_u16_strmbtouc_DEPENDENCIES) + @rm -f test-u16-strmbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strmbtouc_OBJECTS) $(test_u16_strmbtouc_LDADD) $(LIBS) +unistr/test-u16-strncat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strncat$(EXEEXT): $(test_u16_strncat_OBJECTS) $(test_u16_strncat_DEPENDENCIES) + @rm -f test-u16-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strncat_OBJECTS) $(test_u16_strncat_LDADD) $(LIBS) +unistr/test-u16-strncmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strncmp$(EXEEXT): $(test_u16_strncmp_OBJECTS) $(test_u16_strncmp_DEPENDENCIES) + @rm -f test-u16-strncmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strncmp_OBJECTS) $(test_u16_strncmp_LDADD) $(LIBS) +unistr/test-u16-strncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strncpy$(EXEEXT): $(test_u16_strncpy_OBJECTS) $(test_u16_strncpy_DEPENDENCIES) + @rm -f test-u16-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strncpy_OBJECTS) $(test_u16_strncpy_LDADD) $(LIBS) +unistr/test-u16-strnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strnlen$(EXEEXT): $(test_u16_strnlen_OBJECTS) $(test_u16_strnlen_DEPENDENCIES) + @rm -f test-u16-strnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strnlen_OBJECTS) $(test_u16_strnlen_LDADD) $(LIBS) uniwidth/$(am__dirstamp): @$(MKDIR_P) uniwidth @: > uniwidth/$(am__dirstamp) @@ -5148,6 +6367,16 @@ uniwidth/test-u16-strwidth.$(OBJEXT): uniwidth/$(am__dirstamp) \ test-u16-strwidth$(EXEEXT): $(test_u16_strwidth_OBJECTS) $(test_u16_strwidth_DEPENDENCIES) @rm -f test-u16-strwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_strwidth_OBJECTS) $(test_u16_strwidth_LDADD) $(LIBS) +unistr/test-u16-to-u32.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-to-u32$(EXEEXT): $(test_u16_to_u32_OBJECTS) $(test_u16_to_u32_DEPENDENCIES) + @rm -f test-u16-to-u32$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_to_u32_OBJECTS) $(test_u16_to_u32_LDADD) $(LIBS) +unistr/test-u16-to-u8.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-to-u8$(EXEEXT): $(test_u16_to_u8_OBJECTS) $(test_u16_to_u8_DEPENDENCIES) + @rm -f test-u16-to-u8$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_to_u8_OBJECTS) $(test_u16_to_u8_LDADD) $(LIBS) unicase/test-u16-tolower.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u16-tolower$(EXEEXT): $(test_u16_tolower_OBJECTS) $(test_u16_tolower_DEPENDENCIES) @@ -5163,6 +6392,11 @@ unicase/test-u16-toupper.$(OBJEXT): unicase/$(am__dirstamp) \ test-u16-toupper$(EXEEXT): $(test_u16_toupper_OBJECTS) $(test_u16_toupper_DEPENDENCIES) @rm -f test-u16-toupper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_toupper_OBJECTS) $(test_u16_toupper_LDADD) $(LIBS) +unistr/test-u16-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-uctomb$(EXEEXT): $(test_u16_uctomb_OBJECTS) $(test_u16_uctomb_DEPENDENCIES) + @rm -f test-u16-uctomb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_uctomb_OBJECTS) $(test_u16_uctomb_LDADD) $(LIBS) unistdio/test-u16-vasnprintf1.$(OBJEXT): unistdio/$(am__dirstamp) \ unistdio/$(DEPDIR)/$(am__dirstamp) test-u16-vasnprintf1$(EXEEXT): $(test_u16_vasnprintf1_OBJECTS) $(test_u16_vasnprintf1_DEPENDENCIES) @@ -5234,6 +6468,26 @@ unicase/test-u32-casefold.$(OBJEXT): unicase/$(am__dirstamp) \ test-u32-casefold$(EXEEXT): $(test_u32_casefold_OBJECTS) $(test_u32_casefold_DEPENDENCIES) @rm -f test-u32-casefold$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_casefold_OBJECTS) $(test_u32_casefold_LDADD) $(LIBS) +unistr/test-u32-check.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-check$(EXEEXT): $(test_u32_check_OBJECTS) $(test_u32_check_DEPENDENCIES) + @rm -f test-u32-check$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_check_OBJECTS) $(test_u32_check_LDADD) $(LIBS) +unistr/test-u32-chr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-chr$(EXEEXT): $(test_u32_chr_OBJECTS) $(test_u32_chr_DEPENDENCIES) + @rm -f test-u32-chr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_chr_OBJECTS) $(test_u32_chr_LDADD) $(LIBS) +unistr/test-u32-cmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cmp$(EXEEXT): $(test_u32_cmp_OBJECTS) $(test_u32_cmp_DEPENDENCIES) + @rm -f test-u32-cmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cmp_OBJECTS) $(test_u32_cmp_LDADD) $(LIBS) +unistr/test-u32-cmp2.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cmp2$(EXEEXT): $(test_u32_cmp2_OBJECTS) $(test_u32_cmp2_DEPENDENCIES) + @rm -f test-u32-cmp2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cmp2_OBJECTS) $(test_u32_cmp2_LDADD) $(LIBS) uniconv/test-u32-conv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u32-conv-from-enc$(EXEEXT): $(test_u32_conv_from_enc_OBJECTS) $(test_u32_conv_from_enc_DEPENDENCIES) @@ -5244,6 +6498,16 @@ uniconv/test-u32-conv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u32-conv-to-enc$(EXEEXT): $(test_u32_conv_to_enc_OBJECTS) $(test_u32_conv_to_enc_DEPENDENCIES) @rm -f test-u32-conv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_conv_to_enc_OBJECTS) $(test_u32_conv_to_enc_LDADD) $(LIBS) +unistr/test-u32-cpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cpy$(EXEEXT): $(test_u32_cpy_OBJECTS) $(test_u32_cpy_DEPENDENCIES) + @rm -f test-u32-cpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cpy_OBJECTS) $(test_u32_cpy_LDADD) $(LIBS) +unistr/test-u32-cpy-alloc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cpy-alloc$(EXEEXT): $(test_u32_cpy_alloc_OBJECTS) $(test_u32_cpy_alloc_DEPENDENCIES) + @rm -f test-u32-cpy-alloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cpy_alloc_OBJECTS) $(test_u32_cpy_alloc_LDADD) $(LIBS) unicase/test-u32-is-cased.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u32-is-cased$(EXEEXT): $(test_u32_is_cased_OBJECTS) $(test_u32_is_cased_DEPENDENCIES) @@ -5269,6 +6533,41 @@ unicase/test-u32-is-uppercase.$(OBJEXT): unicase/$(am__dirstamp) \ test-u32-is-uppercase$(EXEEXT): $(test_u32_is_uppercase_OBJECTS) $(test_u32_is_uppercase_DEPENDENCIES) @rm -f test-u32-is-uppercase$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_is_uppercase_OBJECTS) $(test_u32_is_uppercase_LDADD) $(LIBS) +unistr/test-u32-mblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mblen$(EXEEXT): $(test_u32_mblen_OBJECTS) $(test_u32_mblen_DEPENDENCIES) + @rm -f test-u32-mblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mblen_OBJECTS) $(test_u32_mblen_LDADD) $(LIBS) +unistr/test-u32-mbsnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbsnlen$(EXEEXT): $(test_u32_mbsnlen_OBJECTS) $(test_u32_mbsnlen_DEPENDENCIES) + @rm -f test-u32-mbsnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbsnlen_OBJECTS) $(test_u32_mbsnlen_LDADD) $(LIBS) +unistr/test-u32-mbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbtouc$(EXEEXT): $(test_u32_mbtouc_OBJECTS) $(test_u32_mbtouc_DEPENDENCIES) + @rm -f test-u32-mbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbtouc_OBJECTS) $(test_u32_mbtouc_LDADD) $(LIBS) +unistr/test-u32-mbtouc-unsafe.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbtouc-unsafe$(EXEEXT): $(test_u32_mbtouc_unsafe_OBJECTS) $(test_u32_mbtouc_unsafe_DEPENDENCIES) + @rm -f test-u32-mbtouc-unsafe$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbtouc_unsafe_OBJECTS) $(test_u32_mbtouc_unsafe_LDADD) $(LIBS) +unistr/test-u32-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbtoucr$(EXEEXT): $(test_u32_mbtoucr_OBJECTS) $(test_u32_mbtoucr_DEPENDENCIES) + @rm -f test-u32-mbtoucr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbtoucr_OBJECTS) $(test_u32_mbtoucr_LDADD) $(LIBS) +unistr/test-u32-move.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-move$(EXEEXT): $(test_u32_move_OBJECTS) $(test_u32_move_DEPENDENCIES) + @rm -f test-u32-move$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_move_OBJECTS) $(test_u32_move_LDADD) $(LIBS) +unistr/test-u32-next.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-next$(EXEEXT): $(test_u32_next_OBJECTS) $(test_u32_next_DEPENDENCIES) + @rm -f test-u32-next$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_next_OBJECTS) $(test_u32_next_LDADD) $(LIBS) uninorm/test-u32-nfc-big.$(OBJEXT): uninorm/$(am__dirstamp) \ uninorm/$(DEPDIR)/$(am__dirstamp) uninorm/test-u32-normalize-big.$(OBJEXT): uninorm/$(am__dirstamp) \ @@ -5306,6 +6605,41 @@ unilbrk/test-u32-possible-linebreaks.$(OBJEXT): \ test-u32-possible-linebreaks$(EXEEXT): $(test_u32_possible_linebreaks_OBJECTS) $(test_u32_possible_linebreaks_DEPENDENCIES) @rm -f test-u32-possible-linebreaks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_possible_linebreaks_OBJECTS) $(test_u32_possible_linebreaks_LDADD) $(LIBS) +unistr/test-u32-prev.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-prev$(EXEEXT): $(test_u32_prev_OBJECTS) $(test_u32_prev_DEPENDENCIES) + @rm -f test-u32-prev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_prev_OBJECTS) $(test_u32_prev_LDADD) $(LIBS) +unistr/test-u32-set.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-set$(EXEEXT): $(test_u32_set_OBJECTS) $(test_u32_set_DEPENDENCIES) + @rm -f test-u32-set$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_set_OBJECTS) $(test_u32_set_LDADD) $(LIBS) +unistr/test-u32-stpcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-stpcpy$(EXEEXT): $(test_u32_stpcpy_OBJECTS) $(test_u32_stpcpy_DEPENDENCIES) + @rm -f test-u32-stpcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_stpcpy_OBJECTS) $(test_u32_stpcpy_LDADD) $(LIBS) +unistr/test-u32-stpncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-stpncpy$(EXEEXT): $(test_u32_stpncpy_OBJECTS) $(test_u32_stpncpy_DEPENDENCIES) + @rm -f test-u32-stpncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_stpncpy_OBJECTS) $(test_u32_stpncpy_LDADD) $(LIBS) +unistr/test-u32-strcat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcat$(EXEEXT): $(test_u32_strcat_OBJECTS) $(test_u32_strcat_DEPENDENCIES) + @rm -f test-u32-strcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcat_OBJECTS) $(test_u32_strcat_LDADD) $(LIBS) +unistr/test-u32-strcmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcmp$(EXEEXT): $(test_u32_strcmp_OBJECTS) $(test_u32_strcmp_DEPENDENCIES) + @rm -f test-u32-strcmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcmp_OBJECTS) $(test_u32_strcmp_LDADD) $(LIBS) +unistr/test-u32-strcoll.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcoll$(EXEEXT): $(test_u32_strcoll_OBJECTS) $(test_u32_strcoll_DEPENDENCIES) + @rm -f test-u32-strcoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcoll_OBJECTS) $(test_u32_strcoll_LDADD) $(LIBS) uniconv/test-u32-strconv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u32-strconv-from-enc$(EXEEXT): $(test_u32_strconv_from_enc_OBJECTS) $(test_u32_strconv_from_enc_DEPENDENCIES) @@ -5316,11 +6650,66 @@ uniconv/test-u32-strconv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u32-strconv-to-enc$(EXEEXT): $(test_u32_strconv_to_enc_OBJECTS) $(test_u32_strconv_to_enc_DEPENDENCIES) @rm -f test-u32-strconv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_strconv_to_enc_OBJECTS) $(test_u32_strconv_to_enc_LDADD) $(LIBS) +unistr/test-u32-strcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcpy$(EXEEXT): $(test_u32_strcpy_OBJECTS) $(test_u32_strcpy_DEPENDENCIES) + @rm -f test-u32-strcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcpy_OBJECTS) $(test_u32_strcpy_LDADD) $(LIBS) +unistr/test-u32-strdup.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strdup$(EXEEXT): $(test_u32_strdup_OBJECTS) $(test_u32_strdup_DEPENDENCIES) + @rm -f test-u32-strdup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strdup_OBJECTS) $(test_u32_strdup_LDADD) $(LIBS) +unistr/test-u32-strlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strlen$(EXEEXT): $(test_u32_strlen_OBJECTS) $(test_u32_strlen_DEPENDENCIES) + @rm -f test-u32-strlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strlen_OBJECTS) $(test_u32_strlen_LDADD) $(LIBS) +unistr/test-u32-strmblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strmblen$(EXEEXT): $(test_u32_strmblen_OBJECTS) $(test_u32_strmblen_DEPENDENCIES) + @rm -f test-u32-strmblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strmblen_OBJECTS) $(test_u32_strmblen_LDADD) $(LIBS) +unistr/test-u32-strmbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strmbtouc$(EXEEXT): $(test_u32_strmbtouc_OBJECTS) $(test_u32_strmbtouc_DEPENDENCIES) + @rm -f test-u32-strmbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strmbtouc_OBJECTS) $(test_u32_strmbtouc_LDADD) $(LIBS) +unistr/test-u32-strncat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strncat$(EXEEXT): $(test_u32_strncat_OBJECTS) $(test_u32_strncat_DEPENDENCIES) + @rm -f test-u32-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strncat_OBJECTS) $(test_u32_strncat_LDADD) $(LIBS) +unistr/test-u32-strncmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strncmp$(EXEEXT): $(test_u32_strncmp_OBJECTS) $(test_u32_strncmp_DEPENDENCIES) + @rm -f test-u32-strncmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strncmp_OBJECTS) $(test_u32_strncmp_LDADD) $(LIBS) +unistr/test-u32-strncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strncpy$(EXEEXT): $(test_u32_strncpy_OBJECTS) $(test_u32_strncpy_DEPENDENCIES) + @rm -f test-u32-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strncpy_OBJECTS) $(test_u32_strncpy_LDADD) $(LIBS) +unistr/test-u32-strnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strnlen$(EXEEXT): $(test_u32_strnlen_OBJECTS) $(test_u32_strnlen_DEPENDENCIES) + @rm -f test-u32-strnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strnlen_OBJECTS) $(test_u32_strnlen_LDADD) $(LIBS) uniwidth/test-u32-strwidth.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) test-u32-strwidth$(EXEEXT): $(test_u32_strwidth_OBJECTS) $(test_u32_strwidth_DEPENDENCIES) @rm -f test-u32-strwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_strwidth_OBJECTS) $(test_u32_strwidth_LDADD) $(LIBS) +unistr/test-u32-to-u16.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-to-u16$(EXEEXT): $(test_u32_to_u16_OBJECTS) $(test_u32_to_u16_DEPENDENCIES) + @rm -f test-u32-to-u16$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_to_u16_OBJECTS) $(test_u32_to_u16_LDADD) $(LIBS) +unistr/test-u32-to-u8.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-to-u8$(EXEEXT): $(test_u32_to_u8_OBJECTS) $(test_u32_to_u8_DEPENDENCIES) + @rm -f test-u32-to-u8$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_to_u8_OBJECTS) $(test_u32_to_u8_LDADD) $(LIBS) unicase/test-u32-tolower.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u32-tolower$(EXEEXT): $(test_u32_tolower_OBJECTS) $(test_u32_tolower_DEPENDENCIES) @@ -5336,6 +6725,11 @@ unicase/test-u32-toupper.$(OBJEXT): unicase/$(am__dirstamp) \ test-u32-toupper$(EXEEXT): $(test_u32_toupper_OBJECTS) $(test_u32_toupper_DEPENDENCIES) @rm -f test-u32-toupper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_toupper_OBJECTS) $(test_u32_toupper_LDADD) $(LIBS) +unistr/test-u32-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-uctomb$(EXEEXT): $(test_u32_uctomb_OBJECTS) $(test_u32_uctomb_DEPENDENCIES) + @rm -f test-u32-uctomb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_uctomb_OBJECTS) $(test_u32_uctomb_LDADD) $(LIBS) unistdio/test-u32-vasnprintf1.$(OBJEXT): unistdio/$(am__dirstamp) \ unistdio/$(DEPDIR)/$(am__dirstamp) test-u32-vasnprintf1$(EXEEXT): $(test_u32_vasnprintf1_OBJECTS) $(test_u32_vasnprintf1_DEPENDENCIES) @@ -5401,6 +6795,26 @@ unicase/test-u8-casefold.$(OBJEXT): unicase/$(am__dirstamp) \ test-u8-casefold$(EXEEXT): $(test_u8_casefold_OBJECTS) $(test_u8_casefold_DEPENDENCIES) @rm -f test-u8-casefold$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_casefold_OBJECTS) $(test_u8_casefold_LDADD) $(LIBS) +unistr/test-u8-check.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-check$(EXEEXT): $(test_u8_check_OBJECTS) $(test_u8_check_DEPENDENCIES) + @rm -f test-u8-check$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_check_OBJECTS) $(test_u8_check_LDADD) $(LIBS) +unistr/test-u8-chr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-chr$(EXEEXT): $(test_u8_chr_OBJECTS) $(test_u8_chr_DEPENDENCIES) + @rm -f test-u8-chr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_chr_OBJECTS) $(test_u8_chr_LDADD) $(LIBS) +unistr/test-u8-cmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cmp$(EXEEXT): $(test_u8_cmp_OBJECTS) $(test_u8_cmp_DEPENDENCIES) + @rm -f test-u8-cmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cmp_OBJECTS) $(test_u8_cmp_LDADD) $(LIBS) +unistr/test-u8-cmp2.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cmp2$(EXEEXT): $(test_u8_cmp2_OBJECTS) $(test_u8_cmp2_DEPENDENCIES) + @rm -f test-u8-cmp2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cmp2_OBJECTS) $(test_u8_cmp2_LDADD) $(LIBS) uniconv/test-u8-conv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u8-conv-from-enc$(EXEEXT): $(test_u8_conv_from_enc_OBJECTS) $(test_u8_conv_from_enc_DEPENDENCIES) @@ -5411,6 +6825,16 @@ uniconv/test-u8-conv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u8-conv-to-enc$(EXEEXT): $(test_u8_conv_to_enc_OBJECTS) $(test_u8_conv_to_enc_DEPENDENCIES) @rm -f test-u8-conv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_conv_to_enc_OBJECTS) $(test_u8_conv_to_enc_LDADD) $(LIBS) +unistr/test-u8-cpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cpy$(EXEEXT): $(test_u8_cpy_OBJECTS) $(test_u8_cpy_DEPENDENCIES) + @rm -f test-u8-cpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cpy_OBJECTS) $(test_u8_cpy_LDADD) $(LIBS) +unistr/test-u8-cpy-alloc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cpy-alloc$(EXEEXT): $(test_u8_cpy_alloc_OBJECTS) $(test_u8_cpy_alloc_DEPENDENCIES) + @rm -f test-u8-cpy-alloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cpy_alloc_OBJECTS) $(test_u8_cpy_alloc_LDADD) $(LIBS) unicase/test-u8-is-cased.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u8-is-cased$(EXEEXT): $(test_u8_is_cased_OBJECTS) $(test_u8_is_cased_DEPENDENCIES) @@ -5436,6 +6860,41 @@ unicase/test-u8-is-uppercase.$(OBJEXT): unicase/$(am__dirstamp) \ test-u8-is-uppercase$(EXEEXT): $(test_u8_is_uppercase_OBJECTS) $(test_u8_is_uppercase_DEPENDENCIES) @rm -f test-u8-is-uppercase$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_is_uppercase_OBJECTS) $(test_u8_is_uppercase_LDADD) $(LIBS) +unistr/test-u8-mblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mblen$(EXEEXT): $(test_u8_mblen_OBJECTS) $(test_u8_mblen_DEPENDENCIES) + @rm -f test-u8-mblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mblen_OBJECTS) $(test_u8_mblen_LDADD) $(LIBS) +unistr/test-u8-mbsnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbsnlen$(EXEEXT): $(test_u8_mbsnlen_OBJECTS) $(test_u8_mbsnlen_DEPENDENCIES) + @rm -f test-u8-mbsnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbsnlen_OBJECTS) $(test_u8_mbsnlen_LDADD) $(LIBS) +unistr/test-u8-mbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbtouc$(EXEEXT): $(test_u8_mbtouc_OBJECTS) $(test_u8_mbtouc_DEPENDENCIES) + @rm -f test-u8-mbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbtouc_OBJECTS) $(test_u8_mbtouc_LDADD) $(LIBS) +unistr/test-u8-mbtouc-unsafe.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbtouc-unsafe$(EXEEXT): $(test_u8_mbtouc_unsafe_OBJECTS) $(test_u8_mbtouc_unsafe_DEPENDENCIES) + @rm -f test-u8-mbtouc-unsafe$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbtouc_unsafe_OBJECTS) $(test_u8_mbtouc_unsafe_LDADD) $(LIBS) +unistr/test-u8-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbtoucr$(EXEEXT): $(test_u8_mbtoucr_OBJECTS) $(test_u8_mbtoucr_DEPENDENCIES) + @rm -f test-u8-mbtoucr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbtoucr_OBJECTS) $(test_u8_mbtoucr_LDADD) $(LIBS) +unistr/test-u8-move.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-move$(EXEEXT): $(test_u8_move_OBJECTS) $(test_u8_move_DEPENDENCIES) + @rm -f test-u8-move$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_move_OBJECTS) $(test_u8_move_LDADD) $(LIBS) +unistr/test-u8-next.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-next$(EXEEXT): $(test_u8_next_OBJECTS) $(test_u8_next_DEPENDENCIES) + @rm -f test-u8-next$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_next_OBJECTS) $(test_u8_next_LDADD) $(LIBS) uninorm/test-u8-normcmp.$(OBJEXT): uninorm/$(am__dirstamp) \ uninorm/$(DEPDIR)/$(am__dirstamp) test-u8-normcmp$(EXEEXT): $(test_u8_normcmp_OBJECTS) $(test_u8_normcmp_DEPENDENCIES) @@ -5451,6 +6910,41 @@ unilbrk/test-u8-possible-linebreaks.$(OBJEXT): \ test-u8-possible-linebreaks$(EXEEXT): $(test_u8_possible_linebreaks_OBJECTS) $(test_u8_possible_linebreaks_DEPENDENCIES) @rm -f test-u8-possible-linebreaks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_possible_linebreaks_OBJECTS) $(test_u8_possible_linebreaks_LDADD) $(LIBS) +unistr/test-u8-prev.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-prev$(EXEEXT): $(test_u8_prev_OBJECTS) $(test_u8_prev_DEPENDENCIES) + @rm -f test-u8-prev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_prev_OBJECTS) $(test_u8_prev_LDADD) $(LIBS) +unistr/test-u8-set.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-set$(EXEEXT): $(test_u8_set_OBJECTS) $(test_u8_set_DEPENDENCIES) + @rm -f test-u8-set$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_set_OBJECTS) $(test_u8_set_LDADD) $(LIBS) +unistr/test-u8-stpcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-stpcpy$(EXEEXT): $(test_u8_stpcpy_OBJECTS) $(test_u8_stpcpy_DEPENDENCIES) + @rm -f test-u8-stpcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_stpcpy_OBJECTS) $(test_u8_stpcpy_LDADD) $(LIBS) +unistr/test-u8-stpncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-stpncpy$(EXEEXT): $(test_u8_stpncpy_OBJECTS) $(test_u8_stpncpy_DEPENDENCIES) + @rm -f test-u8-stpncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_stpncpy_OBJECTS) $(test_u8_stpncpy_LDADD) $(LIBS) +unistr/test-u8-strcat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcat$(EXEEXT): $(test_u8_strcat_OBJECTS) $(test_u8_strcat_DEPENDENCIES) + @rm -f test-u8-strcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcat_OBJECTS) $(test_u8_strcat_LDADD) $(LIBS) +unistr/test-u8-strcmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcmp$(EXEEXT): $(test_u8_strcmp_OBJECTS) $(test_u8_strcmp_DEPENDENCIES) + @rm -f test-u8-strcmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcmp_OBJECTS) $(test_u8_strcmp_LDADD) $(LIBS) +unistr/test-u8-strcoll.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcoll$(EXEEXT): $(test_u8_strcoll_OBJECTS) $(test_u8_strcoll_DEPENDENCIES) + @rm -f test-u8-strcoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcoll_OBJECTS) $(test_u8_strcoll_LDADD) $(LIBS) uniconv/test-u8-strconv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u8-strconv-from-enc$(EXEEXT): $(test_u8_strconv_from_enc_OBJECTS) $(test_u8_strconv_from_enc_DEPENDENCIES) @@ -5461,11 +6955,66 @@ uniconv/test-u8-strconv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u8-strconv-to-enc$(EXEEXT): $(test_u8_strconv_to_enc_OBJECTS) $(test_u8_strconv_to_enc_DEPENDENCIES) @rm -f test-u8-strconv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_strconv_to_enc_OBJECTS) $(test_u8_strconv_to_enc_LDADD) $(LIBS) +unistr/test-u8-strcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcpy$(EXEEXT): $(test_u8_strcpy_OBJECTS) $(test_u8_strcpy_DEPENDENCIES) + @rm -f test-u8-strcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcpy_OBJECTS) $(test_u8_strcpy_LDADD) $(LIBS) +unistr/test-u8-strdup.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strdup$(EXEEXT): $(test_u8_strdup_OBJECTS) $(test_u8_strdup_DEPENDENCIES) + @rm -f test-u8-strdup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strdup_OBJECTS) $(test_u8_strdup_LDADD) $(LIBS) +unistr/test-u8-strlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strlen$(EXEEXT): $(test_u8_strlen_OBJECTS) $(test_u8_strlen_DEPENDENCIES) + @rm -f test-u8-strlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strlen_OBJECTS) $(test_u8_strlen_LDADD) $(LIBS) +unistr/test-u8-strmblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strmblen$(EXEEXT): $(test_u8_strmblen_OBJECTS) $(test_u8_strmblen_DEPENDENCIES) + @rm -f test-u8-strmblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strmblen_OBJECTS) $(test_u8_strmblen_LDADD) $(LIBS) +unistr/test-u8-strmbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strmbtouc$(EXEEXT): $(test_u8_strmbtouc_OBJECTS) $(test_u8_strmbtouc_DEPENDENCIES) + @rm -f test-u8-strmbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strmbtouc_OBJECTS) $(test_u8_strmbtouc_LDADD) $(LIBS) +unistr/test-u8-strncat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strncat$(EXEEXT): $(test_u8_strncat_OBJECTS) $(test_u8_strncat_DEPENDENCIES) + @rm -f test-u8-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strncat_OBJECTS) $(test_u8_strncat_LDADD) $(LIBS) +unistr/test-u8-strncmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strncmp$(EXEEXT): $(test_u8_strncmp_OBJECTS) $(test_u8_strncmp_DEPENDENCIES) + @rm -f test-u8-strncmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strncmp_OBJECTS) $(test_u8_strncmp_LDADD) $(LIBS) +unistr/test-u8-strncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strncpy$(EXEEXT): $(test_u8_strncpy_OBJECTS) $(test_u8_strncpy_DEPENDENCIES) + @rm -f test-u8-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strncpy_OBJECTS) $(test_u8_strncpy_LDADD) $(LIBS) +unistr/test-u8-strnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strnlen$(EXEEXT): $(test_u8_strnlen_OBJECTS) $(test_u8_strnlen_DEPENDENCIES) + @rm -f test-u8-strnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strnlen_OBJECTS) $(test_u8_strnlen_LDADD) $(LIBS) uniwidth/test-u8-strwidth.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) test-u8-strwidth$(EXEEXT): $(test_u8_strwidth_OBJECTS) $(test_u8_strwidth_DEPENDENCIES) @rm -f test-u8-strwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_strwidth_OBJECTS) $(test_u8_strwidth_LDADD) $(LIBS) +unistr/test-u8-to-u16.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-to-u16$(EXEEXT): $(test_u8_to_u16_OBJECTS) $(test_u8_to_u16_DEPENDENCIES) + @rm -f test-u8-to-u16$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_to_u16_OBJECTS) $(test_u8_to_u16_LDADD) $(LIBS) +unistr/test-u8-to-u32.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-to-u32$(EXEEXT): $(test_u8_to_u32_OBJECTS) $(test_u8_to_u32_DEPENDENCIES) + @rm -f test-u8-to-u32$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_to_u32_OBJECTS) $(test_u8_to_u32_LDADD) $(LIBS) unicase/test-u8-tolower.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u8-tolower$(EXEEXT): $(test_u8_tolower_OBJECTS) $(test_u8_tolower_DEPENDENCIES) @@ -5481,6 +7030,11 @@ unicase/test-u8-toupper.$(OBJEXT): unicase/$(am__dirstamp) \ test-u8-toupper$(EXEEXT): $(test_u8_toupper_OBJECTS) $(test_u8_toupper_DEPENDENCIES) @rm -f test-u8-toupper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_toupper_OBJECTS) $(test_u8_toupper_LDADD) $(LIBS) +unistr/test-u8-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-uctomb$(EXEEXT): $(test_u8_uctomb_OBJECTS) $(test_u8_uctomb_DEPENDENCIES) + @rm -f test-u8-uctomb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_uctomb_OBJECTS) $(test_u8_uctomb_LDADD) $(LIBS) unistdio/test-u8-vasnprintf1.$(OBJEXT): unistdio/$(am__dirstamp) \ unistdio/$(DEPDIR)/$(am__dirstamp) test-u8-vasnprintf1$(EXEEXT): $(test_u8_vasnprintf1_OBJECTS) $(test_u8_vasnprintf1_DEPENDENCIES) @@ -5630,6 +7184,9 @@ test-uninorm-filter-nfc$(EXEEXT): $(test_uninorm_filter_nfc_OBJECTS) $(test_unin test-unistd$(EXEEXT): $(test_unistd_OBJECTS) $(test_unistd_DEPENDENCIES) @rm -f test-unistd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_unistd_OBJECTS) $(test_unistd_LDADD) $(LIBS) +test-unsetenv$(EXEEXT): $(test_unsetenv_OBJECTS) $(test_unsetenv_DEPENDENCIES) + @rm -f test-unsetenv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_unsetenv_OBJECTS) $(test_unsetenv_LDADD) $(LIBS) test-wchar$(EXEEXT): $(test_wchar_OBJECTS) $(test_wchar_DEPENDENCIES) @rm -f test-wchar$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wchar_OBJECTS) $(test_wchar_LDADD) $(LIBS) @@ -5639,9 +7196,13 @@ test-wctype$(EXEEXT): $(test_wctype_OBJECTS) $(test_wctype_DEPENDENCIES) test-wcwidth$(EXEEXT): $(test_wcwidth_OBJECTS) $(test_wcwidth_DEPENDENCIES) @rm -f test-wcwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wcwidth_OBJECTS) $(test_wcwidth_LDADD) $(LIBS) +test-xalloc-die$(EXEEXT): $(test_xalloc_die_OBJECTS) $(test_xalloc_die_DEPENDENCIES) + @rm -f test-xalloc-die$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_xalloc_die_OBJECTS) $(test_xalloc_die_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) + -rm -f glthread/thread.$(OBJEXT) -rm -f unicase/test-cased.$(OBJEXT) -rm -f unicase/test-ignorable.$(OBJEXT) -rm -f unicase/test-locale-language.$(OBJEXT) @@ -5920,6 +7481,102 @@ mostlyclean-compile: -rm -f unistdio/test-ulc-vasprintf1.$(OBJEXT) -rm -f unistdio/test-ulc-vsnprintf1.$(OBJEXT) -rm -f unistdio/test-ulc-vsprintf1.$(OBJEXT) + -rm -f unistr/test-u16-check.$(OBJEXT) + -rm -f unistr/test-u16-chr.$(OBJEXT) + -rm -f unistr/test-u16-cmp.$(OBJEXT) + -rm -f unistr/test-u16-cmp2.$(OBJEXT) + -rm -f unistr/test-u16-cpy-alloc.$(OBJEXT) + -rm -f unistr/test-u16-cpy.$(OBJEXT) + -rm -f unistr/test-u16-mblen.$(OBJEXT) + -rm -f unistr/test-u16-mbsnlen.$(OBJEXT) + -rm -f unistr/test-u16-mbtouc-unsafe.$(OBJEXT) + -rm -f unistr/test-u16-mbtouc.$(OBJEXT) + -rm -f unistr/test-u16-mbtoucr.$(OBJEXT) + -rm -f unistr/test-u16-move.$(OBJEXT) + -rm -f unistr/test-u16-next.$(OBJEXT) + -rm -f unistr/test-u16-prev.$(OBJEXT) + -rm -f unistr/test-u16-set.$(OBJEXT) + -rm -f unistr/test-u16-stpcpy.$(OBJEXT) + -rm -f unistr/test-u16-stpncpy.$(OBJEXT) + -rm -f unistr/test-u16-strcat.$(OBJEXT) + -rm -f unistr/test-u16-strcmp.$(OBJEXT) + -rm -f unistr/test-u16-strcoll.$(OBJEXT) + -rm -f unistr/test-u16-strcpy.$(OBJEXT) + -rm -f unistr/test-u16-strdup.$(OBJEXT) + -rm -f unistr/test-u16-strlen.$(OBJEXT) + -rm -f unistr/test-u16-strmblen.$(OBJEXT) + -rm -f unistr/test-u16-strmbtouc.$(OBJEXT) + -rm -f unistr/test-u16-strncat.$(OBJEXT) + -rm -f unistr/test-u16-strncmp.$(OBJEXT) + -rm -f unistr/test-u16-strncpy.$(OBJEXT) + -rm -f unistr/test-u16-strnlen.$(OBJEXT) + -rm -f unistr/test-u16-to-u32.$(OBJEXT) + -rm -f unistr/test-u16-to-u8.$(OBJEXT) + -rm -f unistr/test-u16-uctomb.$(OBJEXT) + -rm -f unistr/test-u32-check.$(OBJEXT) + -rm -f unistr/test-u32-chr.$(OBJEXT) + -rm -f unistr/test-u32-cmp.$(OBJEXT) + -rm -f unistr/test-u32-cmp2.$(OBJEXT) + -rm -f unistr/test-u32-cpy-alloc.$(OBJEXT) + -rm -f unistr/test-u32-cpy.$(OBJEXT) + -rm -f unistr/test-u32-mblen.$(OBJEXT) + -rm -f unistr/test-u32-mbsnlen.$(OBJEXT) + -rm -f unistr/test-u32-mbtouc-unsafe.$(OBJEXT) + -rm -f unistr/test-u32-mbtouc.$(OBJEXT) + -rm -f unistr/test-u32-mbtoucr.$(OBJEXT) + -rm -f unistr/test-u32-move.$(OBJEXT) + -rm -f unistr/test-u32-next.$(OBJEXT) + -rm -f unistr/test-u32-prev.$(OBJEXT) + -rm -f unistr/test-u32-set.$(OBJEXT) + -rm -f unistr/test-u32-stpcpy.$(OBJEXT) + -rm -f unistr/test-u32-stpncpy.$(OBJEXT) + -rm -f unistr/test-u32-strcat.$(OBJEXT) + -rm -f unistr/test-u32-strcmp.$(OBJEXT) + -rm -f unistr/test-u32-strcoll.$(OBJEXT) + -rm -f unistr/test-u32-strcpy.$(OBJEXT) + -rm -f unistr/test-u32-strdup.$(OBJEXT) + -rm -f unistr/test-u32-strlen.$(OBJEXT) + -rm -f unistr/test-u32-strmblen.$(OBJEXT) + -rm -f unistr/test-u32-strmbtouc.$(OBJEXT) + -rm -f unistr/test-u32-strncat.$(OBJEXT) + -rm -f unistr/test-u32-strncmp.$(OBJEXT) + -rm -f unistr/test-u32-strncpy.$(OBJEXT) + -rm -f unistr/test-u32-strnlen.$(OBJEXT) + -rm -f unistr/test-u32-to-u16.$(OBJEXT) + -rm -f unistr/test-u32-to-u8.$(OBJEXT) + -rm -f unistr/test-u32-uctomb.$(OBJEXT) + -rm -f unistr/test-u8-check.$(OBJEXT) + -rm -f unistr/test-u8-chr.$(OBJEXT) + -rm -f unistr/test-u8-cmp.$(OBJEXT) + -rm -f unistr/test-u8-cmp2.$(OBJEXT) + -rm -f unistr/test-u8-cpy-alloc.$(OBJEXT) + -rm -f unistr/test-u8-cpy.$(OBJEXT) + -rm -f unistr/test-u8-mblen.$(OBJEXT) + -rm -f unistr/test-u8-mbsnlen.$(OBJEXT) + -rm -f unistr/test-u8-mbtouc-unsafe.$(OBJEXT) + -rm -f unistr/test-u8-mbtouc.$(OBJEXT) + -rm -f unistr/test-u8-mbtoucr.$(OBJEXT) + -rm -f unistr/test-u8-move.$(OBJEXT) + -rm -f unistr/test-u8-next.$(OBJEXT) + -rm -f unistr/test-u8-prev.$(OBJEXT) + -rm -f unistr/test-u8-set.$(OBJEXT) + -rm -f unistr/test-u8-stpcpy.$(OBJEXT) + -rm -f unistr/test-u8-stpncpy.$(OBJEXT) + -rm -f unistr/test-u8-strcat.$(OBJEXT) + -rm -f unistr/test-u8-strcmp.$(OBJEXT) + -rm -f unistr/test-u8-strcoll.$(OBJEXT) + -rm -f unistr/test-u8-strcpy.$(OBJEXT) + -rm -f unistr/test-u8-strdup.$(OBJEXT) + -rm -f unistr/test-u8-strlen.$(OBJEXT) + -rm -f unistr/test-u8-strmblen.$(OBJEXT) + -rm -f unistr/test-u8-strmbtouc.$(OBJEXT) + -rm -f unistr/test-u8-strncat.$(OBJEXT) + -rm -f unistr/test-u8-strncmp.$(OBJEXT) + -rm -f unistr/test-u8-strncpy.$(OBJEXT) + -rm -f unistr/test-u8-strnlen.$(OBJEXT) + -rm -f unistr/test-u8-to-u16.$(OBJEXT) + -rm -f unistr/test-u8-to-u32.$(OBJEXT) + -rm -f unistr/test-u8-uctomb.$(OBJEXT) -rm -f uniwbrk/test-u16-wordbreaks.$(OBJEXT) -rm -f uniwbrk/test-u32-wordbreaks.$(OBJEXT) -rm -f uniwbrk/test-u8-wordbreaks.$(OBJEXT) @@ -5938,8 +7595,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getpagesize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/putenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-alloca-opt.Po@am__quote@ @@ -5947,26 +7605,26 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-ctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-strcasecmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-strncasecmp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dup2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-environ.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-errno.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fcntl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-frexpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fseterr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iconv-h.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iconv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnand-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanf-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanl-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-locale.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-localename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-lock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-malloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-math.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbrtowc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsinit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-memchr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-open.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-signbit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdbool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stddef.Po@am__quote@ @@ -5976,14 +7634,18 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-striconveh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-striconveha.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-string.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strncat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unistd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unsetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wchar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wcwidth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xalloc-die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wctob.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/thread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unicase/$(DEPDIR)/test-cased.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unicase/$(DEPDIR)/test-ignorable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unicase/$(DEPDIR)/test-locale-language.Po@am__quote@ @@ -6262,6 +7924,102 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@unistdio/$(DEPDIR)/test-ulc-vasprintf1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unistdio/$(DEPDIR)/test-ulc-vsnprintf1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unistdio/$(DEPDIR)/test-ulc-vsprintf1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-chr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cmp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cpy-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbsnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbtouc-unsafe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbtoucr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-move.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-next.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-prev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-stpncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strmblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strmbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strncat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strncmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-to-u32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-to-u8.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-uctomb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-chr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cmp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cpy-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbsnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbtouc-unsafe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbtoucr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-move.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-next.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-prev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-stpncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strmblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strmbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strncat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strncmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-to-u16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-to-u8.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-uctomb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-chr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cmp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cpy-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbsnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtouc-unsafe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtoucr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-move.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-next.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-prev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-stpncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strmblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strmbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strncat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strncmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-to-u16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-to-u32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-uctomb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@uniwbrk/$(DEPDIR)/test-u16-wordbreaks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@uniwbrk/$(DEPDIR)/test-u32-wordbreaks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@uniwbrk/$(DEPDIR)/test-u8-wordbreaks.Po@am__quote@ @@ -6315,7 +8073,7 @@ clean-libtool: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -6340,7 +8098,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -6625,6 +8383,8 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f glthread/$(DEPDIR)/$(am__dirstamp) + -rm -f glthread/$(am__dirstamp) -rm -f unicase/$(DEPDIR)/$(am__dirstamp) -rm -f unicase/$(am__dirstamp) -rm -f uniconv/$(DEPDIR)/$(am__dirstamp) @@ -6639,6 +8399,8 @@ distclean-generic: -rm -f uninorm/$(am__dirstamp) -rm -f unistdio/$(DEPDIR)/$(am__dirstamp) -rm -f unistdio/$(am__dirstamp) + -rm -f unistr/$(DEPDIR)/$(am__dirstamp) + -rm -f unistr/$(am__dirstamp) -rm -f uniwbrk/$(DEPDIR)/$(am__dirstamp) -rm -f uniwbrk/$(am__dirstamp) -rm -f uniwidth/$(DEPDIR)/$(am__dirstamp) @@ -6657,7 +8419,7 @@ clean-am: clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-recursive - -rm -rf ./$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) + -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) unistr/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -6703,7 +8465,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) + -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) unistr/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -6743,31 +8505,57 @@ uninstall-am: mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am - -# We need the following in order to create <fcntl.h> when the system -# doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h - 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_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ - -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ - < $(srcdir)/fcntl.in.h; \ - } > $@-t +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/arg-nonnull.h, except that it has the copyright header cut off. +arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/c++defs.h \ + > $@-t && \ mv $@-t $@ # We need the following in order to create <locale.h> when the system # doesn't have one that provides all definitions. -locale.h: locale.in.h - rm -f $@-t $@ +locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_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_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ + -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ + -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ + -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ + -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/locale.in.h; \ - } > $@-t + } > $@-t && \ + mv $@-t $@ +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ mv $@-t $@ # Clean up after Solaris cc. diff --git a/tests/error.c b/tests/error.c index af2287b..c79e8d4 100644 --- a/tests/error.c +++ b/tests/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -70,8 +70,8 @@ unsigned int error_message_count; extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, - ...) + unsigned int line_number, const char *message, + ...) __attribute__ ((__format__ (__printf__, 5, 6)));; # define error __error # define error_at_line __error_at_line @@ -86,6 +86,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name, #else /* not _LIBC */ # include <fcntl.h> +# include <unistd.h> # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P # ifndef HAVE_DECL_STRERROR_R @@ -100,8 +101,33 @@ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif /* HAVE_STRERROR_R || defined strerror_r */ -#endif /* not _LIBC */ +# endif /* HAVE_STRERROR_R || defined strerror_r */ +#endif /* not _LIBC */ + +static inline void +flush_stdout (void) +{ +#if !_LIBC && defined F_GETFL + int stdout_fd; + +# if GNULIB_FREOPEN_SAFER + /* Use of gnulib's freopen-safer module normally ensures that + fileno (stdout) == 1 + whenever stdout is open. */ + stdout_fd = STDOUT_FILENO; +# else + /* POSIX states that fileno (stdout) after fclose is unspecified. But in + practice it is not a problem, because stdout is statically allocated and + the fd of a FILE stream is stored as a field in its allocated memory. */ + stdout_fd = fileno (stdout); +# endif + /* POSIX states that fflush (stdout) after fclose is unspecified; it + is safe in glibc, but not on all other platforms. fflush (NULL) + is always defined, but too draconian. */ + if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL)) +#endif + fflush (stdout); +} static void print_errno_message (int errnum) @@ -149,58 +175,58 @@ error_tail (int status, int errnum, const char *message, va_list args) bool use_malloc = false; while (1) - { - if (__libc_use_alloca (len * sizeof (wchar_t))) - wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); - else - { - if (!use_malloc) - wmessage = NULL; - - wchar_t *p = (wchar_t *) realloc (wmessage, - len * sizeof (wchar_t)); - if (p == NULL) - { - free (wmessage); - fputws_unlocked (L"out of memory\n", stderr); - return; - } - wmessage = p; - use_malloc = true; - } - - memset (&st, '\0', sizeof (st)); - tmp = message; - - res = mbsrtowcs (wmessage, &tmp, len, &st); - if (res != len) - break; - - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) - { - /* This really should not happen if everything is fine. */ - res = (size_t) -1; - break; - } - - len *= 2; - } + { + if (__libc_use_alloca (len * sizeof (wchar_t))) + wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); + else + { + if (!use_malloc) + wmessage = NULL; + + wchar_t *p = (wchar_t *) realloc (wmessage, + len * sizeof (wchar_t)); + if (p == NULL) + { + free (wmessage); + fputws_unlocked (L"out of memory\n", stderr); + return; + } + wmessage = p; + use_malloc = true; + } + + memset (&st, '\0', sizeof (st)); + tmp = message; + + res = mbsrtowcs (wmessage, &tmp, len, &st); + if (res != len) + break; + + if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + { + /* This really should not happen if everything is fine. */ + res = (size_t) -1; + break; + } + + len *= 2; + } if (res == (size_t) -1) - { - /* The string cannot be converted. */ - if (use_malloc) - { - free (wmessage); - use_malloc = false; - } - wmessage = (wchar_t *) L"???"; - } + { + /* The string cannot be converted. */ + if (use_malloc) + { + free (wmessage); + use_malloc = false; + } + wmessage = (wchar_t *) L"???"; + } __vfwprintf (stderr, wmessage, args); if (use_malloc) - free (wmessage); + free (wmessage); } else #endif @@ -235,16 +261,10 @@ error (int status, int errnum, const char *message, ...) cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + 0); #endif -#if !_LIBC && defined F_GETFL - /* POSIX states that fflush (stdout) after fclose is unspecified; it - is safe in glibc, but not on all other platforms. fflush (NULL) - is always defined, but too draconian. */ - if (0 <= fcntl (1, F_GETFL)) -#endif - fflush (stdout); + flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif @@ -276,7 +296,7 @@ int error_one_per_line; void error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, ...) + unsigned int line_number, const char *message, ...) { va_list args; @@ -286,10 +306,10 @@ error_at_line (int status, int errnum, const char *file_name, static unsigned int old_line_number; if (old_line_number == line_number - && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) - /* Simply return and print nothing. */ - return; + && (file_name == old_file_name + || strcmp (old_file_name, file_name) == 0)) + /* Simply return and print nothing. */ + return; old_file_name = file_name; old_line_number = line_number; @@ -300,16 +320,10 @@ error_at_line (int status, int errnum, const char *file_name, cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + 0); #endif -#if !_LIBC && defined F_GETFL - /* POSIX states that fflush (stdout) after fclose is unspecified; it - is safe in glibc, but not on all other platforms. fflush (NULL) - is always defined, but too draconian. */ - if (0 <= fcntl (1, F_GETFL)) -#endif - fflush (stdout); + flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif @@ -326,10 +340,10 @@ error_at_line (int status, int errnum, const char *file_name, #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #endif va_start (args, message); diff --git a/tests/error.h b/tests/error.h index 6d49681..9deef02 100644 --- a/tests/error.h +++ b/tests/error.h @@ -1,5 +1,6 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software + Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -19,19 +20,18 @@ #define _ERROR_H 1 #ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -/* The __-protected variants of `format' and `printf' attributes - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The __-protected variants of the attributes 'format' and 'printf' are + accepted by gcc versions 2.6.4 (effectively 2.7) and later. + We enable __attribute__ only if these are supported too, because + gnulib and libintl do '#define printf __printf__' when they override + the 'printf' function. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf +# define __attribute__(Spec) /* empty */ # endif #endif -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -43,7 +43,7 @@ extern void error (int __status, int __errnum, const char *__format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void error_at_line (int __status, int __errnum, const char *__fname, - unsigned int __lineno, const char *__format, ...) + unsigned int __lineno, const char *__format, ...) __attribute__ ((__format__ (__printf__, 5, 6))); /* If NULL, error will flush stdout, then print on stderr the program @@ -58,7 +58,7 @@ extern unsigned int error_message_count; variable controls whether this mode is selected or not. */ extern int error_one_per_line; -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/tests/exitfail.c b/tests/exitfail.c index 6d1fe4a..3b63f8a 100644 --- a/tests/exitfail.c +++ b/tests/exitfail.c @@ -1,6 +1,7 @@ /* Failure exit status - Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009, 2010 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 diff --git a/tests/exitfail.h b/tests/exitfail.h index 713f259..7ffffe5 100644 --- a/tests/exitfail.h +++ b/tests/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2009, 2010 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 diff --git a/tests/fcntl.in.h b/tests/fcntl.in.h deleted file mode 100644 index fd7520e..0000000 --- a/tests/fcntl.in.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Like <fcntl.h>, but with non-working flags defined to 0. - - Copyright (C) 2006-2008 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 <http://www.gnu.org/licenses/>. */ - -/* written by Paul Eggert */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif - -#if defined __need_system_fcntl_h -/* Special invocation convention. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_FCNTL_H - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ - -#ifndef _GL_FCNTL_H -#define _GL_FCNTL_H - - -/* Declare overridden functions. */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if @GNULIB_OPEN@ -# if @REPLACE_OPEN@ -# undef open -# define open rpl_open -extern int open (const char *filename, int flags, ...); -# endif -#endif - -#ifdef FCHDIR_REPLACEMENT -/* gnulib internal function. */ -extern void _gl_register_fd (int fd, const char *filename); -#endif - -#ifdef __cplusplus -} -#endif - - -/* Fix up the O_* macros. */ - -#if !defined O_DIRECT && defined O_DIRECTIO -/* Tru64 spells it `O_DIRECTIO'. */ -# define O_DIRECT O_DIRECTIO -#endif - -#ifndef O_DIRECT -# define O_DIRECT 0 -#endif - -#ifndef O_DIRECTORY -# define O_DIRECTORY 0 -#endif - -#ifndef O_DSYNC -# define O_DSYNC 0 -#endif - -#ifndef O_NDELAY -# define O_NDELAY 0 -#endif - -#ifndef O_NOATIME -# define O_NOATIME 0 -#endif - -#ifndef O_NONBLOCK -# define O_NONBLOCK O_NDELAY -#endif - -#ifndef O_NOCTTY -# define O_NOCTTY 0 -#endif - -#ifndef O_NOFOLLOW -# define O_NOFOLLOW 0 -#endif - -#ifndef O_NOLINKS -# define O_NOLINKS 0 -#endif - -#ifndef O_RSYNC -# define O_RSYNC 0 -#endif - -#ifndef O_SYNC -# define O_SYNC 0 -#endif - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in fcntl.h */ -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif - -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - -#ifndef O_BINARY -# define O_BINARY 0 -# define O_TEXT 0 -#endif - - -#endif /* _GL_FCNTL_H */ -#endif /* _GL_FCNTL_H */ -#endif diff --git a/lib/getpagesize.c b/tests/getpagesize.c index 82238df..cc25268 100644 --- a/lib/getpagesize.c +++ b/tests/getpagesize.c @@ -1,18 +1,18 @@ /* getpagesize emulation for systems where it cannot be done in a C macro. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by + 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 Lesser General Public License for more details. + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public License + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible and Martin Lambers. */ diff --git a/tests/gettext.h b/tests/gettext.h index 8cf2dca..881ae33 100644 --- a/tests/gettext.h +++ b/tests/gettext.h @@ -1,5 +1,6 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 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 @@ -80,7 +81,7 @@ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # undef dcngettext # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) + ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) # undef textdomain # define textdomain(Domainname) ((const char *) (Domainname)) # undef bindtextdomain @@ -140,8 +141,8 @@ inline #endif static const char * pgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - int category) + const char *msg_ctxt_id, const char *msgid, + int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) @@ -159,9 +160,9 @@ inline #endif static const char * npgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); @@ -199,8 +200,8 @@ inline #endif static const char * dcpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - int category) + const char *msgctxt, const char *msgid, + int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; @@ -222,10 +223,10 @@ dcpgettext_expr (const char *domain, translation = dcgettext (domain, msg_ctxt_id, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) - free (msg_ctxt_id); + free (msg_ctxt_id); #endif if (translation != msg_ctxt_id) - return translation; + return translation; } return msgid; } @@ -244,9 +245,9 @@ inline #endif static const char * dcnpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; @@ -268,10 +269,10 @@ dcnpgettext_expr (const char *domain, translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) - free (msg_ctxt_id); + free (msg_ctxt_id); #endif if (!(translation == msg_ctxt_id || translation == msgid_plural)) - return translation; + return translation; } return (n == 1 ? msgid : msgid_plural); } diff --git a/tests/glthread/thread.c b/tests/glthread/thread.c new file mode 100644 index 0000000..5237994 --- /dev/null +++ b/tests/glthread/thread.c @@ -0,0 +1,218 @@ +/* Creating and controlling threads. + Copyright (C) 2005-2010 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, 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 <bruno@clisp.org>, 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, + gthr-win32.h. */ + +#include <config.h> + +/* Specification. */ +#include "glthread/thread.h" + +#include <stdlib.h> +#include "glthread/lock.h" + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +#include <process.h> + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +/* The Thread-Local Storage (TLS) key that allows to access each thread's + 'struct gl_thread_struct *' pointer. */ +static DWORD self_key = (DWORD)-1; + +/* Initializes self_key. This function must only be called once. */ +static void +do_init_self_key (void) +{ + self_key = TlsAlloc (); + /* If this fails, we're hosed. */ + if (self_key == (DWORD)-1) + abort (); +} + +/* Initializes self_key. */ +static void +init_self_key (void) +{ + gl_once_define(static, once) + gl_once (once, do_init_self_key); +} + +/* This structure contains information about a thread. + It is stored in TLS under key self_key. */ +struct gl_thread_struct +{ + /* Fields for managing the handle. */ + HANDLE volatile handle; + CRITICAL_SECTION handle_lock; + /* Fields for managing the exit value. */ + void * volatile result; + /* Fields for managing the thread start. */ + void * (*func) (void *); + void *arg; +}; + +/* Return a real HANDLE object for the current thread. */ +static inline HANDLE +get_current_thread_handle (void) +{ + HANDLE this_handle; + + /* GetCurrentThread() returns a pseudo-handle, i.e. only a symbolic + identifier, not a real handle. */ + if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), + GetCurrentProcess (), &this_handle, + 0, FALSE, DUPLICATE_SAME_ACCESS)) + abort (); + return this_handle; +} + +gl_thread_t +gl_thread_self_func (void) +{ + gl_thread_t thread; + + if (self_key == (DWORD)-1) + init_self_key (); + thread = TlsGetValue (self_key); + if (thread == NULL) + { + /* This happens only in threads that have not been created through + glthread_create(), such as the main thread. */ + for (;;) + { + thread = + (struct gl_thread_struct *) + malloc (sizeof (struct gl_thread_struct)); + if (thread != NULL) + break; + /* Memory allocation failed. There is not much we can do. Have to + busy-loop, waiting for the availability of memory. */ + Sleep (1); + } + + thread->handle = get_current_thread_handle (); + InitializeCriticalSection (&thread->handle_lock); + thread->result = NULL; /* just to be deterministic */ + TlsSetValue (self_key, thread); + } + return thread; +} + +/* The main function of a freshly creating thread. It's a wrapper around + the FUNC and ARG arguments passed to glthread_create_func. */ +static unsigned int WINAPI +wrapper_func (void *varg) +{ + struct gl_thread_struct *thread = (struct gl_thread_struct *)varg; + + EnterCriticalSection (&thread->handle_lock); + /* Create a new handle for the thread only if the parent thread did not yet + fill in the handle. */ + if (thread->handle == NULL) + thread->handle = get_current_thread_handle (); + LeaveCriticalSection (&thread->handle_lock); + + if (self_key == (DWORD)-1) + init_self_key (); + TlsSetValue (self_key, thread); + + /* Run the thread. Store the exit value if the thread was not terminated + otherwise. */ + thread->result = thread->func (thread->arg); + return 0; +} + +int +glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg) +{ + struct gl_thread_struct *thread = + (struct gl_thread_struct *) malloc (sizeof (struct gl_thread_struct)); + if (thread == NULL) + return ENOMEM; + thread->handle = NULL; + InitializeCriticalSection (&thread->handle_lock); + thread->result = NULL; /* just to be deterministic */ + thread->func = func; + thread->arg = arg; + + { + unsigned int thread_id; + HANDLE thread_handle; + + thread_handle = (HANDLE) + _beginthreadex (NULL, 100000, wrapper_func, thread, 0, &thread_id); + /* calls CreateThread with the same arguments */ + if (thread_handle == NULL) + { + DeleteCriticalSection (&thread->handle_lock); + free (thread); + return EAGAIN; + } + + EnterCriticalSection (&thread->handle_lock); + if (thread->handle == NULL) + thread->handle = thread_handle; + else + /* thread->handle was already set by the thread itself. */ + CloseHandle (thread_handle); + LeaveCriticalSection (&thread->handle_lock); + + *threadp = thread; + return 0; + } +} + +int +glthread_join_func (gl_thread_t thread, void **retvalp) +{ + if (thread == NULL) + return EINVAL; + + if (thread == gl_thread_self ()) + return EDEADLK; + + if (WaitForSingleObject (thread->handle, INFINITE) == WAIT_FAILED) + return EINVAL; + + if (retvalp != NULL) + *retvalp = thread->result; + + DeleteCriticalSection (&thread->handle_lock); + CloseHandle (thread->handle); + free (thread); + + return 0; +} + +int +gl_thread_exit_func (void *retval) +{ + gl_thread_t thread = gl_thread_self (); + thread->result = retval; + _endthreadex (0); /* calls ExitThread (0) */ + abort (); +} + +#endif + +/* ========================================================================= */ diff --git a/tests/glthread/thread.h b/tests/glthread/thread.h new file mode 100644 index 0000000..d35be0d --- /dev/null +++ b/tests/glthread/thread.h @@ -0,0 +1,376 @@ +/* Creating and controlling threads. + Copyright (C) 2005-2010 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, 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 <bruno@clisp.org>, 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, + gthr-win32.h. */ + +/* This file contains primitives for creating and controlling threads. + + Thread data type: gl_thread_t. + + Creating a thread: + thread = gl_thread_create (func, arg); + Or with control of error handling: + err = glthread_create (&thread, func, arg); + extern int glthread_create (gl_thread_t *result, + void *(*func) (void *), void *arg); + + Querying and changing the signal mask of a thread (not supported on all + platforms): + gl_thread_sigmask (how, newmask, oldmask); + Or with control of error handling: + err = glthread_sigmask (how, newmask, oldmask); + extern int glthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask); + + Waiting for termination of another thread: + gl_thread_join (thread, &return_value); + Or with control of error handling: + err = glthread_join (thread, &return_value); + extern int glthread_join (gl_thread_t thread, void **return_value_ptr); + + Getting a reference to the current thread: + current = gl_thread_self (); + extern gl_thread_t gl_thread_self (void); + + Terminating the current thread: + gl_thread_exit (return_value); + extern void gl_thread_exit (void *return_value) __attribute__ ((noreturn)); + + Requesting custom code to be executed at fork() time(not supported on all + platforms): + gl_thread_atfork (prepare_func, parent_func, child_func); + Or with control of error handling: + err = glthread_atfork (prepare_func, parent_func, child_func); + extern int glthread_atfork (void (*prepare_func) (void), + void (*parent_func) (void), + void (*child_func) (void)); + Note that even on platforms where this is supported, use of fork() and + threads together is problematic, see + <http://lists.gnu.org/archive/html/bug-gnulib/2008-08/msg00062.html> + */ + + +#ifndef _GLTHREAD_THREAD_H +#define _GLTHREAD_THREAD_H + +#include <errno.h> +#include <stdlib.h> + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include <pthread.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_create +# pragma weak pthread_sigmask +# pragma weak pthread_join +# ifndef pthread_self +# pragma weak pthread_self +# endif +# pragma weak pthread_exit +# if HAVE_PTHREAD_ATFORK +# pragma weak pthread_atfork +# endif + +# if !PTHREAD_IN_USE_DETECTION_HARD +# pragma weak pthread_cancel +# define pthread_in_use() (pthread_cancel != NULL) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +/* This choice of gl_thread_t assumes that + pthread_equal (a, b) is equivalent to ((a) == (b)). + This is the case on all platforms in use in 2008. */ +typedef pthread_t gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + (pthread_in_use () ? pthread_create (THREADP, NULL, FUNC, ARG) : ENOSYS) +# define glthread_sigmask(HOW, SET, OSET) \ + (pthread_in_use () ? pthread_sigmask (HOW, SET, OSET) : 0) +# define glthread_join(THREAD, RETVALP) \ + (pthread_in_use () ? pthread_join (THREAD, RETVALP) : 0) +# define gl_thread_self() \ + (pthread_in_use () ? (void *) pthread_self () : NULL) +# define gl_thread_exit(RETVAL) \ + (pthread_in_use () ? pthread_exit (RETVAL) : 0) + +# if HAVE_PTHREAD_ATFORK +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \ + (pthread_in_use () ? pthread_atfork (PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) : 0) +# else +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 +# endif + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_PTH_THREADS + +/* Use the GNU Pth threads library. */ + +# include <pth.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if USE_PTH_THREADS_WEAK + +/* Use weak references to the GNU Pth threads library. */ + +# pragma weak pth_spawn +# pragma weak pth_sigmask +# pragma weak pth_join +# pragma weak pth_self +# pragma weak pth_exit + +# pragma weak pth_cancel +# define pth_in_use() (pth_cancel != NULL) + +# else + +# define pth_in_use() 1 + +# endif +/* -------------------------- gl_thread_t datatype -------------------------- */ + +typedef pth_t gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + (pth_in_use () ? ((*(THREADP) = pth_spawn (NULL, FUNC, ARG)) ? 0 : errno) : 0) +# define glthread_sigmask(HOW, SET, OSET) \ + (pth_in_use () && !pth_sigmask (HOW, SET, OSET) ? errno : 0) +# define glthread_join(THREAD, RETVALP) \ + (pth_in_use () && !pth_join (THREAD, RETVALP) ? errno : 0) +# define gl_thread_self() \ + (pth_in_use () ? (void *) pth_self () : 0) +# define gl_thread_exit(RETVAL) \ + (pth_in_use () ? pth_exit (RETVAL) : 0) +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* Use the old Solaris threads library. */ + +# include <thread.h> +# include <synch.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if USE_SOLARIS_THREADS_WEAK + +/* Use weak references to the old Solaris threads library. */ + +# pragma weak thr_create +# pragma weak thr_join +# pragma weak thr_self +# pragma weak thr_exit + +# pragma weak thr_suspend +# define thread_in_use() (thr_suspend != NULL) + +# else + +# define thread_in_use() 1 + +# endif + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +typedef thread_t gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + (thread_in_use () ? thr_create (NULL, 0, FUNC, ARG, 0, THREADP) : 0) +# define glthread_sigmask(HOW, SET, OSET) \ + (thread_in_use () ? sigprocmask (HOW, SET, OSET) : 0) +# define glthread_join(THREAD, RETVALP) \ + (thread_in_use () ? thr_join (THREAD, NULL, RETVALP) : 0) +# define gl_thread_self() \ + (thread_in_use () ? (void *) thr_self () : 0) +# define gl_thread_exit(RETVAL) \ + (thread_in_use () ? thr_exit (RETVAL) : 0) +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +# include <windows.h> + +# ifdef __cplusplus +extern "C" { +# endif + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +/* The gl_thread_t is a pointer to a structure in memory. + Why not the thread handle? If it were the thread handle, it would be hard + to implement gl_thread_self() (since GetCurrentThread () returns a pseudo- + handle, DuplicateHandle (GetCurrentThread ()) returns a handle that must be + closed afterwards, and there is no function for quickly retrieving a thread + handle from its id). + Why not the thread id? I tried it. It did not work: Sometimes ids appeared + that did not belong to running threads, and glthread_join failed with ESRCH. + */ +typedef struct gl_thread_struct *gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + glthread_create_func (THREADP, FUNC, ARG) +# define glthread_sigmask(HOW, SET, OSET) \ + /* unsupported */ 0 +# define glthread_join(THREAD, RETVALP) \ + glthread_join_func (THREAD, RETVALP) +# define gl_thread_self() \ + gl_thread_self_func () +# define gl_thread_exit(RETVAL) \ + gl_thread_exit_func (RETVAL) +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 +extern int glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg); +extern int glthread_join_func (gl_thread_t thread, void **retvalp); +extern gl_thread_t gl_thread_self_func (void); +extern int gl_thread_exit_func (void *retval); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +typedef int gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) ENOSYS +# define glthread_sigmask(HOW, SET, OSET) 0 +# define glthread_join(THREAD, RETVALP) 0 +# define gl_thread_self() NULL +# define gl_thread_exit(RETVAL) 0 +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 + +#endif + +/* ========================================================================= */ + +/* Macros with built-in error handling. */ + +#ifdef __cplusplus +extern "C" { +#endif + +static inline gl_thread_t +gl_thread_create (void *(*func) (void *arg), void *arg) +{ + gl_thread_t thread; + int ret; + + ret = glthread_create (&thread, func, arg); + if (ret != 0) + abort (); + return thread; +} +#define gl_thread_sigmask(HOW, SET, OSET) \ + do \ + { \ + if (glthread_sigmask (HOW, SET, OSET)) \ + abort (); \ + } \ + while (0) +#define gl_thread_join(THREAD, RETVAL) \ + do \ + { \ + if (glthread_join (THREAD, RETVAL)) \ + abort (); \ + } \ + while (0) +#define gl_thread_atfork(PREPARE, PARENT, CHILD) \ + do \ + { \ + if (glthread_atfork (PREPARE, PARENT, CHILD)) \ + abort (); \ + } \ + while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _GLTHREAD_THREAD_H */ diff --git a/tests/glthread/yield.h b/tests/glthread/yield.h new file mode 100644 index 0000000..df61ac4 --- /dev/null +++ b/tests/glthread/yield.h @@ -0,0 +1,121 @@ +/* Yielding the processor to other threads and processes. + Copyright (C) 2005-2010 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, 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. */ + +/* This file contains a primitive for yielding the processor to other threads. + extern void gl_thread_yield (void); + */ + +#ifndef _GLTHREAD_YIELD_H +#define _GLTHREAD_YIELD_H + +#include <errno.h> + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include <sched.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + sched_yield () + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_PTH_THREADS + +/* Use the GNU Pth threads library. */ + +# include <pth.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + pth_yield (NULL) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* Use the old Solaris threads library. */ + +# include <thread.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + thr_yield () + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +# include <windows.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + Sleep (0) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +# define gl_thread_yield() 0 + +#endif + +/* ========================================================================= */ + +#endif /* _GLTHREAD_YIELD_H */ diff --git a/tests/init.sh b/tests/init.sh new file mode 100644 index 0000000..512e876 --- /dev/null +++ b/tests/init.sh @@ -0,0 +1,357 @@ +# source this file; set up for tests + +# Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. + +# Using this file in a test +# ========================= +# +# The typical skeleton of a test looks like this: +# +# #!/bin/sh +# : ${srcdir=.} +# . "$srcdir/init.sh"; path_prepend_ . +# Execute some commands. +# Note that these commands are executed in a subdirectory, therefore you +# need to prepend "../" to relative filenames in the build directory. +# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. +# Use the skip_ and fail_ functions to print a diagnostic and then exit +# with the corresponding exit code. +# Exit $? + +# Executing a test that uses this file +# ==================================== +# +# Running a single test: +# $ make check TESTS=test-foo.sh +# +# Running a single test, with verbose output: +# $ make check TESTS=test-foo.sh VERBOSE=yes +# +# Running a single test, with single-stepping: +# 1. Go into a sub-shell: +# $ bash +# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the +# Makefile: +# $ export srcdir=../../tests # this is an example +# 3. Execute the commands from the test, copy&pasting them one by one: +# $ . "$srcdir/init.sh"; path_prepend_ . +# ... +# 4. Finally +# $ exit + +# We require $(...) support unconditionally. +# We require a few additional shell features only when $EXEEXT is nonempty, +# in order to support automatic $EXEEXT emulation: +# - hyphen-containing alias names +# - we prefer to use ${var#...} substitution, rather than having +# to work around lack of support for that feature. +# The following code attempts to find a shell with support for these features +# and re-exec's it. If not, it skips the current test. + +gl_shell_test_script_=' +test $(echo y) = y || exit 1 +test -z "$EXEEXT" && exit 0 +shopt -s expand_aliases +alias a-b="echo zoo" +v=abx + test ${v%x} = ab \ + && test ${v#a} = bx \ + && test $(a-b) = zoo +' + +if test "x$1" = "x--no-reexec"; then + shift +else + for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail + do + test "$re_shell_" = no_shell && continue + test "$re_shell_" = fail && skip_ failed to find an adequate shell + if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then + exec "$re_shell_" "$0" --no-reexec "$@" + echo "$ME_: exec failed" 1>&2 + exit 127 + fi + done +fi + +test -n "$EXEEXT" && shopt -s expand_aliases + +# We use a trap below for cleanup. This requires us to go through +# hoops to get the right exit status transported through the handler. +# So use `Exit STATUS' instead of `exit STATUS' inside of the tests. +# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 +# sh inside this function. +Exit () { set +e; (exit $1); exit $1; } + +# Print warnings (e.g., about skipped and failed tests) to this file number. +# Override by defining to say, 9, in init.cfg, and putting say, +# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition +# of TESTS_ENVIRONMENT in your tests/Makefile.am file. +# This is useful when using automake's parallel tests mode, to print +# the reason for skip/failure to console, rather than to the .log files. +: ${stderr_fileno_=2} + +warn_() { echo "$@" 1>&$stderr_fileno_; } +fail_() { warn_ "$ME_: failed test: $@"; Exit 1; } +skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; } +framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 1; } + +# This is a stub function that is run upon trap (upon regular exit and +# interrupt). Override it with a per-test function, e.g., to unmount +# a partition, or to undo any other global state changes. +cleanup_() { :; } + +if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then + compare() { diff -u "$@"; } +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then + compare() { cmp -s "$@"; } +else + compare() { cmp "$@"; } +fi + +# An arbitrary prefix to help distinguish test directories. +testdir_prefix_() { printf gt; } + +# Run the user-overridable cleanup_ function, remove the temporary +# directory and exit with the incoming value of $?. +remove_tmp_() +{ + __st=$? + cleanup_ + # cd out of the directory we're about to remove + cd "$initial_cwd_" || cd / || cd /tmp + chmod -R u+rwx "$test_dir_" + # If removal fails and exit status was to be 0, then change it to 1. + rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } + exit $__st +} + +# Given a directory name, DIR, if every entry in it that matches *.exe +# contains only the specified bytes (see the case stmt below), then print +# a space-separated list of those names and return 0. Otherwise, don't +# print anything and return 1. Naming constraints apply also to DIR. +find_exe_basenames_() +{ + feb_dir_=$1 + feb_fail_=0 + feb_result_= + feb_sp_= + for feb_file_ in $feb_dir_/*.exe; do + case $feb_file_ in + *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; + *) # Remove leading file name components as well as the .exe suffix. + feb_file_=${feb_file_##*/} + feb_file_=${feb_file_%.exe} + feb_result_="$feb_result_$feb_sp_$feb_file_";; + esac + feb_sp_=' ' + done + test $feb_fail_ = 0 && printf %s "$feb_result_" + return $feb_fail_ +} + +# Consider the files in directory, $1. +# For each file name of the form PROG.exe, create an alias named +# PROG that simply invokes PROG.exe, then return 0. If any selected +# file name or the directory name, $1, contains an unexpected character, +# define no function and return 1. +create_exe_shims_() +{ + case $EXEEXT in + '') return 0 ;; + .exe) ;; + *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; + esac + + base_names_=`find_exe_basenames_ $1` \ + || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } + + if test -n "$base_names_"; then + for base_ in $base_names_; do + alias "$base_"="$base_$EXEEXT" + done + fi + + return 0 +} + +# Use this function to prepend to PATH an absolute name for each +# specified, possibly-$initial_cwd_-relative, directory. +path_prepend_() +{ + while test $# != 0; do + path_dir_=$1 + case $path_dir_ in + '') fail_ "invalid path dir: '$1'";; + /*) abs_path_dir_=$path_dir_;; + *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \ + || fail_ "invalid path dir: $path_dir_";; + esac + case $abs_path_dir_ in + *:*) fail_ "invalid path dir: '$abs_path_dir_'";; + esac + PATH="$abs_path_dir_:$PATH" + + # Create an alias, FOO, for each FOO.exe in this directory. + create_exe_shims_ "$abs_path_dir_" \ + || fail_ "something failed (above): $abs_path_dir_" + shift + done + export PATH +} + +setup_() +{ + test "$VERBOSE" = yes && set -x + + initial_cwd_=$PWD + ME_=`expr "./$0" : '.*/\(.*\)$'` + + pfx_=`testdir_prefix_` + test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ + || fail_ "failed to create temporary directory in $initial_cwd_" + cd "$test_dir_" + + # These trap statements ensure that the temporary directory, $test_dir_, + # is removed upon exit as well as upon receipt of any of the listed signals. + trap remove_tmp_ 0 + for sig_ in 1 2 3 13 15; do + eval "trap 'Exit $(expr $sig_ + 128)' $sig_" + done +} + +# Create a temporary directory, much like mktemp -d does. +# Written by Jim Meyering. +# +# Usage: mktempd_ /tmp phoey.XXXXXXXXXX +# +# First, try to use the mktemp program. +# Failing that, we'll roll our own mktemp-like function: +# - try to get random bytes from /dev/urandom +# - failing that, generate output from a combination of quickly-varying +# sources and gzip. Ignore non-varying gzip header, and extract +# "random" bits from there. +# - given those bits, map to file-name bytes using tr, and try to create +# the desired directory. +# - make only $MAX_TRIES_ attempts + +# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. +rand_bytes_() +{ + n_=$1 + + # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? + # But if they have openssl, they probably have mktemp, too. + + chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + dev_rand_=/dev/urandom + if test -r "$dev_rand_"; then + # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. + dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ + | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ + return + fi + + n_plus_50_=`expr $n_ + 50` + cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n' + data_=` (eval "$cmds_") 2>&1 | gzip ` + + # Ensure that $data_ has length at least 50+$n_ + while :; do + len_=`echo "$data_"|wc -c` + test $n_plus_50_ -le $len_ && break; + data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` + done + + echo "$data_" \ + | dd bs=1 skip=50 count=$n_ 2>/dev/null \ + | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ +} + +mktempd_() +{ + case $# in + 2);; + *) fail_ "Usage: $ME DIR TEMPLATE";; + esac + + destdir_=$1 + template_=$2 + + MAX_TRIES_=4 + + # Disallow any trailing slash on specified destdir: + # it would subvert the post-mktemp "case"-based destdir test. + case $destdir_ in + /) ;; + */) fail_ "invalid destination dir: remove trailing slash(es)";; + esac + + case $template_ in + *XXXX) ;; + *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";; + esac + + fail=0 + + # First, try to use mktemp. + d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \ + || fail=1 + + # The resulting name must be in the specified directory. + case $d in "$destdir_"*);; *) fail=1;; esac + + # It must have created the directory. + test -d "$d" || fail=1 + + # It must have 0700 permissions. Handle sticky "S" bits. + perms=`ls -dgo "$d" 2>/dev/null|tr S -` || fail=1 + case $perms in drwx------*) ;; *) fail=1;; esac + + test $fail = 0 && { + echo "$d" + return + } + + # If we reach this point, we'll have to create a directory manually. + + # Get a copy of the template without its suffix of X's. + base_template_=`echo "$template_"|sed 's/XX*$//'` + + # Calculate how many X's we've just removed. + template_length_=`echo "$template_" | wc -c` + nx_=`echo "$base_template_" | wc -c` + nx_=`expr $template_length_ - $nx_` + + err_= + i_=1 + while :; do + X_=`rand_bytes_ $nx_` + candidate_dir_="$destdir_/$base_template_$X_" + err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ + && { echo "$candidate_dir_"; return; } + test $MAX_TRIES_ -le $i_ && break; + i_=`expr $i_ + 1` + done + fail_ "$err_" +} + +# If you want to override the testdir_prefix_ function, +# or to add more utility functions, use this file. +test -f "$srcdir/init.cfg" \ + && . "$srcdir/init.cfg" + +setup_ "$@" diff --git a/tests/intprops.h b/tests/intprops.h index 002161e..46f4d47 100644 --- a/tests/intprops.h +++ b/tests/intprops.h @@ -1,6 +1,7 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 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 @@ -17,40 +18,43 @@ /* Written by Paul Eggert. */ -#include <limits.h> +#ifndef GL_INTPROPS_H +# define GL_INTPROPS_H + +# include <limits.h> /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ -#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) +# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ -#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) +# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) /* True if the arithmetic type T is signed. */ -#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) /* The maximum and minimum values for the integer type T. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ -#define TYPE_MINIMUM(t) \ +# define TYPE_MINIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -#define TYPE_MAXIMUM(t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +# define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + ? (t) -1 \ + : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) /* Return zero if T can be determined to be an unsigned type. Otherwise, return 1. @@ -58,20 +62,22 @@ tighter bound. Otherwise, it overestimates the true bound by one byte when applied to unsigned types of size 2, 4, 16, ... bytes. The symbol signed_type_or_expr__ is private to this header file. */ -#if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -#else -# define signed_type_or_expr__(t) 1 -#endif +# if __GNUC__ >= 2 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) +# else +# define signed_type_or_expr__(t) 1 +# endif /* Bound on length of the string representing an integer type or expression T. Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; add 1 for integer division truncation; add 1 more for a minus sign if needed. */ -#define INT_STRLEN_BOUND(t) \ +# define INT_STRLEN_BOUND(t) \ ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ + signed_type_or_expr__ (t) + 1) /* Bound on buffer size needed to represent an integer type or expression T, including the terminating null. */ -#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) +# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + +#endif /* GL_INTPROPS_H */ diff --git a/tests/locale.in.h b/tests/locale.in.h index 0557c9f..75b5299 100644 --- a/tests/locale.in.h +++ b/tests/locale.in.h @@ -1,5 +1,5 @@ /* A POSIX <locale.h>. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -29,11 +29,46 @@ /* NetBSD 5.0 mis-defines NULL. */ #include <stddef.h> +/* MacOS X 10.5 defines the locale_t type in <xlocale.h>. */ +#if @HAVE_XLOCALE_H@ +# include <xlocale.h> +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. On systems that don't define it, use the same value as GNU libintl. */ #if !defined LC_MESSAGES # define LC_MESSAGES 1729 #endif +#if @GNULIB_DUPLOCALE@ +# if @REPLACE_DUPLOCALE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef duplocale +# define duplocale rpl_duplocale +# endif +_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); +# else +# if @HAVE_DUPLOCALE@ +_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); +# endif +# endif +# if @HAVE_DUPLOCALE@ +_GL_CXXALIASWARN (duplocale); +# endif +#elif defined GNULIB_POSIXCHECK +# undef duplocale +# if HAVE_RAW_DECL_DUPLOCALE +_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " + "use gnulib module duplocale for portability"); +# endif +#endif + #endif /* _GL_LOCALE_H */ #endif /* _GL_LOCALE_H */ diff --git a/tests/macros.h b/tests/macros.h new file mode 100644 index 0000000..11db5a8 --- /dev/null +++ b/tests/macros.h @@ -0,0 +1,64 @@ +/* Common macros used by gnulib tests. + Copyright (C) 2006-2010 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 <http://www.gnu.org/licenses/>. */ + + +/* This file contains macros that are used by many gnulib tests. + Put here only frequently used macros, say, used by 10 tests or more. */ + +#include <stdio.h> +#include <stdlib.h> + +/* Define ASSERT_STREAM before including this file if ASSERT must + target a stream other than stderr. */ +#ifndef ASSERT_STREAM +# define ASSERT_STREAM stderr +#endif + +/* ASSERT (condition); + verifies that the specified condition is fulfilled. If not, a message + is printed to ASSERT_STREAM if defined (defaulting to stderr if + undefined) and the program is terminated with an error code. + + This macro has the following properties: + - The programmer specifies the expected condition, not the failure + condition. This simplifies thinking. + - The condition is tested always, regardless of compilation flags. + (Unlike the macro from <assert.h>.) + - On Unix platforms, the tester can debug the test program with a + debugger (provided core dumps are enabled: "ulimit -c unlimited"). + - For the sake of platforms where no debugger is available (such as + some mingw systems), an error message is printed on the error + stream that includes the source location of the ASSERT invocation. + */ +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n", \ + __FILE__, __LINE__); \ + fflush (ASSERT_STREAM); \ + abort (); \ + } \ + } \ + while (0) + +/* SIZEOF (array) + returns the number of elements of an array. It works for arrays that are + declared outside functions and for local variables of array type. It does + *not* work for function parameters of array type, because they are actually + parameters of pointer type. */ +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) diff --git a/tests/nan.h b/tests/nan.h index 8aa8bf0..611eed3 100644 --- a/tests/nan.h +++ b/tests/nan.h @@ -1,5 +1,5 @@ /* Macros for not-a-number. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 diff --git a/tests/open.c b/tests/open.c deleted file mode 100644 index 326e6d1..0000000 --- a/tests/open.c +++ /dev/null @@ -1,137 +0,0 @@ -/* Open a descriptor to a file. - Copyright (C) 2007-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 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 <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -/* Get the original definition of open. It might be defined as a macro. */ -#define __need_system_fcntl_h -#include <fcntl.h> -#undef __need_system_fcntl_h -#include <sys/types.h> - -static inline int -orig_open (const char *filename, int flags, mode_t mode) -{ - return open (filename, flags, mode); -} - -/* Specification. */ -#include <fcntl.h> - -#include <errno.h> -#include <stdarg.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> - -int -open (const char *filename, int flags, ...) -{ - mode_t mode; - int fd; - - mode = 0; - if (flags & O_CREAT) - { - va_list arg; - va_start (arg, flags); - - /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 - creates crashing code when 'mode_t' is smaller than 'int'. */ - mode = va_arg (arg, PROMOTED_MODE_T); - - va_end (arg); - } - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - if (strcmp (filename, "/dev/null") == 0) - filename = "NUL"; -#endif - -#if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR - is specified, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." - If the named file already exists as a directory, then - - if O_CREAT is specified, open() must fail because of the semantics - of O_CREAT, - - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX - <http://www.opengroup.org/susv3/functions/open.html> says that it - fails with errno = EISDIR in this case. - If the named file does not exist or does not name a directory, then - - if O_CREAT is specified, open() must fail since open() cannot create - directories, - - if O_WRONLY or O_RDWR is specified, open() must fail because the - file does not contain a '.' directory. */ - if (flags & (O_CREAT | O_WRONLY | O_RDWR)) - { - size_t len = strlen (filename); - if (len > 0 && filename[len - 1] == '/') - { - errno = EISDIR; - return -1; - } - } -#endif - - fd = orig_open (filename, flags, mode); - -#if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and fd does not refer to a directory, - then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." - If the named file without the slash is not a directory, open() must fail - with ENOTDIR. */ - if (fd >= 0) - { - size_t len = strlen (filename); - if (len > 0 && filename[len - 1] == '/') - { - struct stat statbuf; - - if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) - { - close (fd); - errno = ENOTDIR; - return -1; - } - } - } -#endif - -#ifdef FCHDIR_REPLACEMENT - if (fd >= 0) - _gl_register_fd (fd, filename); -#endif - - return fd; -} diff --git a/tests/progname.c b/tests/progname.c index 9854b5e..1415e6a 100644 --- a/tests/progname.c +++ b/tests/progname.c @@ -1,6 +1,6 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. 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 @@ -22,6 +22,9 @@ #undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ #include "progname.h" +#include <errno.h> /* get program_invocation_name declaration */ +#include <stdio.h> +#include <stdlib.h> #include <string.h> @@ -29,7 +32,9 @@ To be initialized by main(). */ const char *program_name = NULL; -/* Set program_name, based on argv[0]. */ +/* Set program_name, based on argv[0]. + argv0 must be a string allocated with indefinite extent, and must not be + modified after this call. */ void set_program_name (const char *argv0) { @@ -41,13 +46,30 @@ set_program_name (const char *argv0) const char *slash; const char *base; + /* Sanity check. POSIX requires the invoking process to pass a non-NULL + argv[0]. */ + if (argv0 == NULL) + { + /* It's a bug in the invoking program. Help diagnosing it. */ + fputs ("A NULL argv[0] was passed through an exec system call.\n", + stderr); + abort (); + } + slash = strrchr (argv0, '/'); base = (slash != NULL ? slash + 1 : argv0); if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0) { argv0 = base; if (strncmp (base, "lt-", 3) == 0) - argv0 = base + 3; + { + argv0 = base + 3; + /* On glibc systems, remove the "lt-" prefix from the variable + program_invocation_short_name. */ +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + program_invocation_short_name = (char *) argv0; +#endif + } } /* But don't strip off a leading <dirname>/ in general, because when the user @@ -60,4 +82,11 @@ set_program_name (const char *argv0) */ program_name = argv0; + + /* On glibc systems, the error() function comes from libc and uses the + variable program_invocation_name, not program_name. So set this variable + as well. */ +#if HAVE_DECL_PROGRAM_INVOCATION_NAME + program_invocation_name = (char *) argv0; +#endif } diff --git a/tests/progname.h b/tests/progname.h index 82615c6..5ba303b 100644 --- a/tests/progname.h +++ b/tests/progname.h @@ -1,6 +1,6 @@ /* Program name management. - Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. 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 @@ -31,7 +31,9 @@ extern "C" { /* String containing name the program is called with. */ extern const char *program_name; -/* Set program_name, based on argv[0]. */ +/* Set program_name, based on argv[0]. + argv0 must be a string allocated with indefinite extent, and must not be + modified after this call. */ extern void set_program_name (const char *argv0); #if ENABLE_RELOCATABLE @@ -39,8 +41,8 @@ extern void set_program_name (const char *argv0); /* Set program_name, based on argv[0], and original installation prefix and directory, for relocatability. */ extern void set_program_name_and_installdir (const char *argv0, - const char *orig_installprefix, - const char *orig_installdir); + const char *orig_installprefix, + const char *orig_installdir); #undef set_program_name #define set_program_name(ARG0) \ set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) diff --git a/tests/putenv.c b/tests/putenv.c new file mode 100644 index 0000000..030f567 --- /dev/null +++ b/tests/putenv.c @@ -0,0 +1,132 @@ +/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2010 Free Software + Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + 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 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <stdlib.h> + +#include <stddef.h> + +/* Include errno.h *after* sys/types.h to work around header problems + on AIX 3.2.5. */ +#include <errno.h> +#ifndef __set_errno +# define __set_errno(ev) ((errno) = (ev)) +#endif + +#include <string.h> +#include <unistd.h> + +#if HAVE_GNU_LD +# define environ __environ +#else +extern char **environ; +#endif + +#if _LIBC +/* This lock protects against simultaneous modifications of `environ'. */ +# include <bits/libc-lock.h> +__libc_lock_define_initialized (static, envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) +#else +# define LOCK +# define UNLOCK +#endif + +static int +_unsetenv (const char *name) +{ + size_t len; + char **ep; + + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + + len = strlen (name); + + LOCK; + + ep = environ; + while (*ep != NULL) + if (!strncmp (*ep, name, len) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + UNLOCK; + + return 0; +} + + +/* Put STRING, which is of the form "NAME=VALUE", in the environment. + If STRING contains no `=', then remove STRING from the environment. */ +int +putenv (char *string) +{ + const char *const name_end = strchr (string, '='); + register size_t size; + register char **ep; + + if (name_end == NULL) + { + /* Remove the variable from the environment. */ + return _unsetenv (string); + } + + size = 0; + for (ep = environ; *ep != NULL; ++ep) + if (!strncmp (*ep, string, name_end - string) && + (*ep)[name_end - string] == '=') + break; + else + ++size; + + if (*ep == NULL) + { + static char **last_environ = NULL; + char **new_environ = (char **) malloc ((size + 2) * sizeof (char *)); + if (new_environ == NULL) + return -1; + (void) memcpy ((void *) new_environ, (void *) environ, + size * sizeof (char *)); + new_environ[size] = (char *) string; + new_environ[size + 1] = NULL; + free (last_environ); + last_environ = new_environ; + environ = new_environ; + } + else + *ep = string; + + return 0; +} diff --git a/tests/setenv.c b/tests/setenv.c index 83b52b8..ee9da0d 100644 --- a/tests/setenv.c +++ b/tests/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1995-1999,2000-2003,2005-2008 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2003, 2005-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -17,6 +17,11 @@ #if !_LIBC # include <config.h> #endif + +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + optimizes away the name == NULL test below. */ +#define _GL_ARG_NONNULL(params) + #include <alloca.h> /* Specification. */ @@ -32,22 +37,22 @@ # include <unistd.h> #endif -#if _LIBC || !HAVE_SETENV - #if !_LIBC # include "malloca.h" #endif +#if _LIBC || !HAVE_SETENV + #if !_LIBC -# define __environ environ +# define __environ environ #endif #if _LIBC /* This lock protects against simultaneous modifications of `environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) -# define LOCK __libc_lock_lock (envlock) -# define UNLOCK __libc_lock_unlock (envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK @@ -66,8 +71,8 @@ __libc_lock_define_initialized (static, envlock) values are from a small set. Outside glibc this will eat up all memory after a while. */ #if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \ - && defined __GNUC__) -# define USE_TSEARCH 1 + && defined __GNUC__) +# define USE_TSEARCH 1 # include <search.h> typedef int (*compar_fn_t) (const void *, const void *); @@ -76,9 +81,9 @@ typedef int (*compar_fn_t) (const void *, const void *); static void *known_values; # define KNOWN_VALUE(Str) \ - ({ \ - void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ - value != NULL ? *(char **) value : NULL; \ + ({ \ + void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ + value != NULL ? *(char **) value : NULL; \ }) # define STORE_VALUE(Str) \ tsearch (Str, &known_values, (compar_fn_t) strcmp) @@ -105,10 +110,10 @@ static char **last_environ; free the strings. */ int __add_to_environ (const char *name, const char *value, const char *combined, - int replace) + int replace) { - register char **ep; - register size_t size; + char **ep; + size_t size; const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; @@ -122,10 +127,10 @@ __add_to_environ (const char *name, const char *value, const char *combined, if (ep != NULL) { for (; *ep != NULL; ++ep) - if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') - break; - else - ++size; + if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + break; + else + ++size; } if (ep == NULL || *ep == NULL) @@ -137,76 +142,76 @@ __add_to_environ (const char *name, const char *value, const char *combined, /* We allocated this space; we can extend it. */ new_environ = - (char **) (last_environ == NULL - ? malloc ((size + 2) * sizeof (char *)) - : realloc (last_environ, (size + 2) * sizeof (char *))); + (char **) (last_environ == NULL + ? malloc ((size + 2) * sizeof (char *)) + : realloc (last_environ, (size + 2) * sizeof (char *))); if (new_environ == NULL) - { - UNLOCK; - return -1; - } + { + UNLOCK; + return -1; + } /* If the whole entry is given add it. */ if (combined != NULL) - /* We must not add the string to the search tree since it belongs - to the user. */ - new_environ[size] = (char *) combined; + /* We must not add the string to the search tree since it belongs + to the user. */ + new_environ[size] = (char *) combined; else - { - /* See whether the value is already known. */ + { + /* See whether the value is already known. */ #ifdef USE_TSEARCH # ifdef _LIBC - new_value = (char *) alloca (namelen + 1 + vallen); - __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), - value, vallen); + new_value = (char *) alloca (namelen + 1 + vallen); + __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), + value, vallen); # else - new_value = (char *) malloca (namelen + 1 + vallen); - if (new_value == NULL) - { - __set_errno (ENOMEM); - UNLOCK; - return -1; - } - memcpy (new_value, name, namelen); - new_value[namelen] = '='; - memcpy (&new_value[namelen + 1], value, vallen); + new_value = (char *) malloca (namelen + 1 + vallen); + if (new_value == NULL) + { + __set_errno (ENOMEM); + UNLOCK; + return -1; + } + memcpy (new_value, name, namelen); + new_value[namelen] = '='; + memcpy (&new_value[namelen + 1], value, vallen); # endif - new_environ[size] = KNOWN_VALUE (new_value); - if (new_environ[size] == NULL) + new_environ[size] = KNOWN_VALUE (new_value); + if (new_environ[size] == NULL) #endif - { - new_environ[size] = (char *) malloc (namelen + 1 + vallen); - if (new_environ[size] == NULL) - { + { + new_environ[size] = (char *) malloc (namelen + 1 + vallen); + if (new_environ[size] == NULL) + { #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - __set_errno (ENOMEM); - UNLOCK; - return -1; - } + __set_errno (ENOMEM); + UNLOCK; + return -1; + } #ifdef USE_TSEARCH - memcpy (new_environ[size], new_value, namelen + 1 + vallen); + memcpy (new_environ[size], new_value, namelen + 1 + vallen); #else - memcpy (new_environ[size], name, namelen); - new_environ[size][namelen] = '='; - memcpy (&new_environ[size][namelen + 1], value, vallen); + memcpy (new_environ[size], name, namelen); + new_environ[size][namelen] = '='; + memcpy (&new_environ[size][namelen + 1], value, vallen); #endif - /* And save the value now. We cannot do this when we remove - the string since then we cannot decide whether it is a - user string or not. */ - STORE_VALUE (new_environ[size]); - } + /* And save the value now. We cannot do this when we remove + the string since then we cannot decide whether it is a + user string or not. */ + STORE_VALUE (new_environ[size]); + } #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - } + } if (__environ != last_environ) - memcpy ((char *) new_environ, (char *) __environ, - size * sizeof (char *)); + memcpy ((char *) new_environ, (char *) __environ, + size * sizeof (char *)); new_environ[size + 1] = NULL; @@ -218,57 +223,57 @@ __add_to_environ (const char *name, const char *value, const char *combined, /* Use the user string if given. */ if (combined != NULL) - np = (char *) combined; + np = (char *) combined; else - { + { #ifdef USE_TSEARCH - char *new_value; + char *new_value; # ifdef _LIBC - new_value = alloca (namelen + 1 + vallen); - __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), - value, vallen); + new_value = alloca (namelen + 1 + vallen); + __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), + value, vallen); # else - new_value = malloca (namelen + 1 + vallen); - if (new_value == NULL) - { - __set_errno (ENOMEM); - UNLOCK; - return -1; - } - memcpy (new_value, name, namelen); - new_value[namelen] = '='; - memcpy (&new_value[namelen + 1], value, vallen); + new_value = malloca (namelen + 1 + vallen); + if (new_value == NULL) + { + __set_errno (ENOMEM); + UNLOCK; + return -1; + } + memcpy (new_value, name, namelen); + new_value[namelen] = '='; + memcpy (&new_value[namelen + 1], value, vallen); # endif - np = KNOWN_VALUE (new_value); - if (np == NULL) + np = KNOWN_VALUE (new_value); + if (np == NULL) #endif - { - np = malloc (namelen + 1 + vallen); - if (np == NULL) - { + { + np = (char *) malloc (namelen + 1 + vallen); + if (np == NULL) + { #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - __set_errno (ENOMEM); - UNLOCK; - return -1; - } + __set_errno (ENOMEM); + UNLOCK; + return -1; + } #ifdef USE_TSEARCH - memcpy (np, new_value, namelen + 1 + vallen); + memcpy (np, new_value, namelen + 1 + vallen); #else - memcpy (np, name, namelen); - np[namelen] = '='; - memcpy (&np[namelen + 1], value, vallen); + memcpy (np, name, namelen); + np[namelen] = '='; + memcpy (&np[namelen + 1], value, vallen); #endif - /* And remember the value. */ - STORE_VALUE (np); - } + /* And remember the value. */ + STORE_VALUE (np); + } #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - } + } *ep = np; } @@ -281,6 +286,12 @@ __add_to_environ (const char *name, const char *value, const char *combined, int setenv (const char *name, const char *value, int replace) { + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + return __add_to_environ (name, value, NULL, replace); } @@ -328,3 +339,45 @@ weak_alias (__clearenv, clearenv) #endif #endif /* _LIBC || !HAVE_SETENV */ + +/* The rest of this file is called into use when replacing an existing + but buggy setenv. Known bugs include failure to diagnose invalid + name, and consuming a leading '=' from value. */ +#if HAVE_SETENV + +# undef setenv +# define STREQ(a, b) (strcmp (a, b) == 0) + +int +rpl_setenv (const char *name, const char *value, int replace) +{ + int result; + if (!name || !*name || strchr (name, '=')) + { + errno = EINVAL; + return -1; + } + /* Call the real setenv even if replace is 0, in case implementation + has underlying data to update, such as when environ changes. */ + result = setenv (name, value, replace); + if (result == 0 && replace && *value == '=') + { + char *tmp = getenv (name); + if (!STREQ (tmp, value)) + { + int saved_errno; + size_t len = strlen (value); + tmp = malloca (len + 2); + /* Since leading '=' is eaten, double it up. */ + *tmp = '='; + memcpy (tmp + 1, value, len + 1); + result = setenv (name, tmp, replace); + saved_errno = errno; + freea (tmp); + errno = saved_errno; + } + } + return result; +} + +#endif /* HAVE_SETENV */ diff --git a/tests/signature.h b/tests/signature.h new file mode 100644 index 0000000..6e15c43 --- /dev/null +++ b/tests/signature.h @@ -0,0 +1,48 @@ +/* Macro for checking that a function declaration is compliant. + Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */ + +#ifndef SIGNATURE_CHECK + +/* Check that the function FN takes the specified arguments ARGS with + a return type of RET. This header is designed to be included after + <config.h> and the one system header that is supposed to contain + the function being checked, but prior to any other system headers + that are necessary for the unit test. Therefore, this file does + not include any system headers, nor reference anything outside of + the macro arguments. For an example, if foo.h should provide: + + extern int foo (char, float); + + then the unit test named test-foo.c would start out with: + + #include <config.h> + #include <foo.h> + #include "signature.h" + SIGNATURE_CHECK (foo, int, (char, float)); + #include <other.h> + ... +*/ +# define SIGNATURE_CHECK(fn, ret, args) \ + SIGNATURE_CHECK1 (fn, ret, args, __LINE__) + +/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test. + Note that the checks must not occupy the same line. */ +# define SIGNATURE_CHECK1(fn, ret, args, id) \ + SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */ +# define SIGNATURE_CHECK2(fn, ret, args, id) \ + static ret (* _GL_UNUSED signature_check ## id) args = fn + +#endif /* SIGNATURE_CHECK */ diff --git a/tests/strerror.c b/tests/strerror.c index dfe6c25..b0df778 100644 --- a/tests/strerror.c +++ b/tests/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -334,10 +334,10 @@ rpl_strerror (int n) if (result == NULL || result[0] == '\0') { - static char const fmt[] = "Unknown error (%d)"; - static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; - sprintf (msg_buf, fmt, n); - return msg_buf; + static char const fmt[] = "Unknown error (%d)"; + static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; + sprintf (msg_buf, fmt, n); + return msg_buf; } return result; diff --git a/tests/test-alloca-opt.c b/tests/test-alloca-opt.c index 68d906d..cfbecaf 100644 --- a/tests/test-alloca-opt.c +++ b/tests/test-alloca-opt.c @@ -1,5 +1,5 @@ /* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009, 2010 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 diff --git a/tests/test-array-mergesort.c b/tests/test-array-mergesort.c index 8a47b67..3f5d082 100644 --- a/tests/test-array-mergesort.c +++ b/tests/test-array-mergesort.c @@ -1,5 +1,5 @@ /* Test of stable-sorting of an array using mergesort. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -24,20 +24,9 @@ struct foo { double x; double index; }; #define STATIC static #include "array-mergesort.h" -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define NMAX 257 static const struct foo data[NMAX] = @@ -305,8 +294,8 @@ static int cmp_double (const void *a, const void *b) { return (*(const double *)a < *(const double *)b ? -1 : - *(const double *)a > *(const double *)b ? 1 : - 0); + *(const double *)a > *(const double *)b ? 1 : + 0); } int @@ -336,15 +325,15 @@ main () /* Verify the result. */ qsort_result = (double *) malloc (n * sizeof (double)); for (i = 0; i < n; i++) - qsort_result[i] = data[i].x; + qsort_result[i] = data[i].x; qsort (qsort_result, n, sizeof (double), cmp_double); for (i = 0; i < n; i++) - ASSERT (dst[i].x == qsort_result[i]); + ASSERT (dst[i].x == qsort_result[i]); /* Verify the stability. */ for (i = 0; i < n; i++) - if (i > 0 && dst[i - 1].x == dst[i].x) - ASSERT (dst[i - 1].index < dst[i].index); + if (i > 0 && dst[i - 1].x == dst[i].x) + ASSERT (dst[i - 1].index < dst[i].index); free (qsort_result); free (tmp); @@ -365,7 +354,7 @@ main () tmp[n].x = 0x587EF149; /* canary */ for (i = 0; i < n; i++) - src[i] = data[i]; + src[i] = data[i]; merge_sort_inplace (src, n, tmp); @@ -376,15 +365,15 @@ main () /* Verify the result. */ qsort_result = (double *) malloc (n * sizeof (double)); for (i = 0; i < n; i++) - qsort_result[i] = data[i].x; + qsort_result[i] = data[i].x; qsort (qsort_result, n, sizeof (double), cmp_double); for (i = 0; i < n; i++) - ASSERT (src[i].x == qsort_result[i]); + ASSERT (src[i].x == qsort_result[i]); /* Verify the stability. */ for (i = 0; i < n; i++) - if (i > 0 && src[i - 1].x == src[i].x) - ASSERT (src[i - 1].index < src[i].index); + if (i > 0 && src[i - 1].x == src[i].x) + ASSERT (src[i - 1].index < src[i].index); free (qsort_result); free (tmp); diff --git a/tests/test-c-ctype.c b/tests/test-c-ctype.c index 6d7fe1b..ebe594d 100644 --- a/tests/test-c-ctype.c +++ b/tests/test-c-ctype.c @@ -1,5 +1,5 @@ /* Test of character handling in C locale. - Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2010 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 @@ -21,20 +21,8 @@ #include "c-ctype.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_all (void) @@ -46,81 +34,81 @@ test_all (void) ASSERT (c_isascii (c) == (c >= 0 && c < 0x80)); switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isalnum (c) == 1); - break; - default: - ASSERT (c_isalnum (c) == 0); - break; - } + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + ASSERT (c_isalnum (c) == 1); + break; + default: + ASSERT (c_isalnum (c) == 0); + break; + } switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_isalpha (c) == 1); - break; - default: - ASSERT (c_isalpha (c) == 0); - break; - } + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + ASSERT (c_isalpha (c) == 1); + break; + default: + ASSERT (c_isalpha (c) == 0); + break; + } switch (c) - { - case '\t': case ' ': - ASSERT (c_isblank (c) == 1); - break; - default: - ASSERT (c_isblank (c) == 0); - break; - } + { + case '\t': case ' ': + ASSERT (c_isblank (c) == 1); + break; + default: + ASSERT (c_isblank (c) == 0); + break; + } ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isdigit (c) == 1); - break; - default: - ASSERT (c_isdigit (c) == 0); - break; - } + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + ASSERT (c_isdigit (c) == 1); + break; + default: + ASSERT (c_isdigit (c) == 0); + break; + } switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_islower (c) == 1); - break; - default: - ASSERT (c_islower (c) == 0); - break; - } + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + ASSERT (c_islower (c) == 1); + break; + default: + ASSERT (c_islower (c) == 0); + break; + } ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); @@ -129,257 +117,257 @@ test_all (void) ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c))); switch (c) - { - case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': - ASSERT (c_isspace (c) == 1); - break; - default: - ASSERT (c_isspace (c) == 0); - break; - } + { + case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': + ASSERT (c_isspace (c) == 1); + break; + default: + ASSERT (c_isspace (c) == 0); + break; + } switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - ASSERT (c_isupper (c) == 1); - break; - default: - ASSERT (c_isupper (c) == 0); - break; - } + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + ASSERT (c_isupper (c) == 1); + break; + default: + ASSERT (c_isupper (c) == 0); + break; + } switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - ASSERT (c_isxdigit (c) == 1); - break; - default: - ASSERT (c_isxdigit (c) == 0); - break; - } + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + ASSERT (c_isxdigit (c) == 1); + break; + default: + ASSERT (c_isxdigit (c) == 0); + break; + } switch (c) - { - case 'A': - ASSERT (c_tolower (c) == 'a'); - ASSERT (c_toupper (c) == c); - break; - case 'B': - ASSERT (c_tolower (c) == 'b'); - ASSERT (c_toupper (c) == c); - break; - case 'C': - ASSERT (c_tolower (c) == 'c'); - ASSERT (c_toupper (c) == c); - break; - case 'D': - ASSERT (c_tolower (c) == 'd'); - ASSERT (c_toupper (c) == c); - break; - case 'E': - ASSERT (c_tolower (c) == 'e'); - ASSERT (c_toupper (c) == c); - break; - case 'F': - ASSERT (c_tolower (c) == 'f'); - ASSERT (c_toupper (c) == c); - break; - case 'G': - ASSERT (c_tolower (c) == 'g'); - ASSERT (c_toupper (c) == c); - break; - case 'H': - ASSERT (c_tolower (c) == 'h'); - ASSERT (c_toupper (c) == c); - break; - case 'I': - ASSERT (c_tolower (c) == 'i'); - ASSERT (c_toupper (c) == c); - break; - case 'J': - ASSERT (c_tolower (c) == 'j'); - ASSERT (c_toupper (c) == c); - break; - case 'K': - ASSERT (c_tolower (c) == 'k'); - ASSERT (c_toupper (c) == c); - break; - case 'L': - ASSERT (c_tolower (c) == 'l'); - ASSERT (c_toupper (c) == c); - break; - case 'M': - ASSERT (c_tolower (c) == 'm'); - ASSERT (c_toupper (c) == c); - break; - case 'N': - ASSERT (c_tolower (c) == 'n'); - ASSERT (c_toupper (c) == c); - break; - case 'O': - ASSERT (c_tolower (c) == 'o'); - ASSERT (c_toupper (c) == c); - break; - case 'P': - ASSERT (c_tolower (c) == 'p'); - ASSERT (c_toupper (c) == c); - break; - case 'Q': - ASSERT (c_tolower (c) == 'q'); - ASSERT (c_toupper (c) == c); - break; - case 'R': - ASSERT (c_tolower (c) == 'r'); - ASSERT (c_toupper (c) == c); - break; - case 'S': - ASSERT (c_tolower (c) == 's'); - ASSERT (c_toupper (c) == c); - break; - case 'T': - ASSERT (c_tolower (c) == 't'); - ASSERT (c_toupper (c) == c); - break; - case 'U': - ASSERT (c_tolower (c) == 'u'); - ASSERT (c_toupper (c) == c); - break; - case 'V': - ASSERT (c_tolower (c) == 'v'); - ASSERT (c_toupper (c) == c); - break; - case 'W': - ASSERT (c_tolower (c) == 'w'); - ASSERT (c_toupper (c) == c); - break; - case 'X': - ASSERT (c_tolower (c) == 'x'); - ASSERT (c_toupper (c) == c); - break; - case 'Y': - ASSERT (c_tolower (c) == 'y'); - ASSERT (c_toupper (c) == c); - break; - case 'Z': - ASSERT (c_tolower (c) == 'z'); - ASSERT (c_toupper (c) == c); - break; - case 'a': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'A'); - break; - case 'b': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'B'); - break; - case 'c': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'C'); - break; - case 'd': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'D'); - break; - case 'e': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'E'); - break; - case 'f': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'F'); - break; - case 'g': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'G'); - break; - case 'h': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'H'); - break; - case 'i': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'I'); - break; - case 'j': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'J'); - break; - case 'k': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'K'); - break; - case 'l': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'L'); - break; - case 'm': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'M'); - break; - case 'n': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'N'); - break; - case 'o': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'O'); - break; - case 'p': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'P'); - break; - case 'q': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Q'); - break; - case 'r': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'R'); - break; - case 's': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'S'); - break; - case 't': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'T'); - break; - case 'u': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'U'); - break; - case 'v': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'V'); - break; - case 'w': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'W'); - break; - case 'x': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'X'); - break; - case 'y': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Y'); - break; - case 'z': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Z'); - break; - default: - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == c); - break; - } + { + case 'A': + ASSERT (c_tolower (c) == 'a'); + ASSERT (c_toupper (c) == c); + break; + case 'B': + ASSERT (c_tolower (c) == 'b'); + ASSERT (c_toupper (c) == c); + break; + case 'C': + ASSERT (c_tolower (c) == 'c'); + ASSERT (c_toupper (c) == c); + break; + case 'D': + ASSERT (c_tolower (c) == 'd'); + ASSERT (c_toupper (c) == c); + break; + case 'E': + ASSERT (c_tolower (c) == 'e'); + ASSERT (c_toupper (c) == c); + break; + case 'F': + ASSERT (c_tolower (c) == 'f'); + ASSERT (c_toupper (c) == c); + break; + case 'G': + ASSERT (c_tolower (c) == 'g'); + ASSERT (c_toupper (c) == c); + break; + case 'H': + ASSERT (c_tolower (c) == 'h'); + ASSERT (c_toupper (c) == c); + break; + case 'I': + ASSERT (c_tolower (c) == 'i'); + ASSERT (c_toupper (c) == c); + break; + case 'J': + ASSERT (c_tolower (c) == 'j'); + ASSERT (c_toupper (c) == c); + break; + case 'K': + ASSERT (c_tolower (c) == 'k'); + ASSERT (c_toupper (c) == c); + break; + case 'L': + ASSERT (c_tolower (c) == 'l'); + ASSERT (c_toupper (c) == c); + break; + case 'M': + ASSERT (c_tolower (c) == 'm'); + ASSERT (c_toupper (c) == c); + break; + case 'N': + ASSERT (c_tolower (c) == 'n'); + ASSERT (c_toupper (c) == c); + break; + case 'O': + ASSERT (c_tolower (c) == 'o'); + ASSERT (c_toupper (c) == c); + break; + case 'P': + ASSERT (c_tolower (c) == 'p'); + ASSERT (c_toupper (c) == c); + break; + case 'Q': + ASSERT (c_tolower (c) == 'q'); + ASSERT (c_toupper (c) == c); + break; + case 'R': + ASSERT (c_tolower (c) == 'r'); + ASSERT (c_toupper (c) == c); + break; + case 'S': + ASSERT (c_tolower (c) == 's'); + ASSERT (c_toupper (c) == c); + break; + case 'T': + ASSERT (c_tolower (c) == 't'); + ASSERT (c_toupper (c) == c); + break; + case 'U': + ASSERT (c_tolower (c) == 'u'); + ASSERT (c_toupper (c) == c); + break; + case 'V': + ASSERT (c_tolower (c) == 'v'); + ASSERT (c_toupper (c) == c); + break; + case 'W': + ASSERT (c_tolower (c) == 'w'); + ASSERT (c_toupper (c) == c); + break; + case 'X': + ASSERT (c_tolower (c) == 'x'); + ASSERT (c_toupper (c) == c); + break; + case 'Y': + ASSERT (c_tolower (c) == 'y'); + ASSERT (c_toupper (c) == c); + break; + case 'Z': + ASSERT (c_tolower (c) == 'z'); + ASSERT (c_toupper (c) == c); + break; + case 'a': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'A'); + break; + case 'b': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'B'); + break; + case 'c': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'C'); + break; + case 'd': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'D'); + break; + case 'e': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'E'); + break; + case 'f': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'F'); + break; + case 'g': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'G'); + break; + case 'h': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'H'); + break; + case 'i': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'I'); + break; + case 'j': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'J'); + break; + case 'k': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'K'); + break; + case 'l': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'L'); + break; + case 'm': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'M'); + break; + case 'n': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'N'); + break; + case 'o': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'O'); + break; + case 'p': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'P'); + break; + case 'q': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Q'); + break; + case 'r': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'R'); + break; + case 's': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'S'); + break; + case 't': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'T'); + break; + case 'u': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'U'); + break; + case 'v': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'V'); + break; + case 'w': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'W'); + break; + case 'x': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'X'); + break; + case 'y': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Y'); + break; + case 'z': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Z'); + break; + default: + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == c); + break; + } } } diff --git a/tests/test-c-strcasecmp.c b/tests/test-c-strcasecmp.c index 16244b9..84ea9b5 100644 --- a/tests/test-c-strcasecmp.c +++ b/tests/test-c-strcasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,21 +21,9 @@ #include "c-strcase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) @@ -44,7 +32,7 @@ main (int argc, char *argv[]) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) - return 1; + return 1; } ASSERT (c_strcasecmp ("paragraph", "Paragraph") == 0); diff --git a/tests/test-c-strncasecmp.c b/tests/test-c-strncasecmp.c index 7d6dbf5..f02cb2d 100644 --- a/tests/test-c-strncasecmp.c +++ b/tests/test-c-strncasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,21 +21,9 @@ #include "c-strcase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) @@ -44,7 +32,7 @@ main (int argc, char *argv[]) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) - return 1; + return 1; } ASSERT (c_strncasecmp ("paragraph", "Paragraph", 1000000) == 0); diff --git a/tests/test-dup2.c b/tests/test-dup2.c deleted file mode 100644 index 2009aaa..0000000 --- a/tests/test-dup2.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Test duplicating file descriptors. - 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 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 <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <unistd.h> - -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Get declarations of the Win32 API functions. */ -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -#endif - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - -/* Return non-zero if FD is open. */ -static int -is_open (int fd) -{ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On Win32, the initial state of unassigned standard file - descriptors is that they are open but point to an - INVALID_HANDLE_VALUE, and there is no fcntl. */ - return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; -#else -# ifndef F_GETFL -# error Please port fcntl to your platform -# endif - return 0 <= fcntl (fd, F_GETFL); -#endif -} - -int -main () -{ - const char *file = "test-dup2.tmp"; - char buffer[1]; - int fd = open (file, O_CREAT | O_RDWR, 0600); - - /* Assume std descriptors were provided by invoker. */ - ASSERT (STDERR_FILENO < fd); - ASSERT (is_open (fd)); - /* Ignore any other fd's leaked into this process. */ - close (fd + 1); - close (fd + 2); - ASSERT (!is_open (fd + 1)); - ASSERT (!is_open (fd + 2)); - - /* Assigning to self must be a no-op. */ - ASSERT (dup2 (fd, fd) == fd); - ASSERT (is_open (fd)); - - /* If the source is not open, then the destination is unaffected. */ - errno = 0; - ASSERT (dup2 (fd + 1, fd + 1) == -1); - ASSERT (errno == EBADF); - ASSERT (!is_open (fd + 1)); - errno = 0; - ASSERT (dup2 (fd + 1, fd) == -1); - ASSERT (errno == EBADF); - ASSERT (is_open (fd)); - - /* The destination must be valid. */ - errno = 0; - ASSERT (dup2 (fd, -2) == -1); - ASSERT (errno == EBADF); - - /* Using dup2 can skip fds. */ - ASSERT (dup2 (fd, fd + 2) == fd + 2); - ASSERT (is_open (fd)); - ASSERT (!is_open (fd + 1)); - ASSERT (is_open (fd + 2)); - - /* Prove that dup2 closes the previous occupant of a fd. */ - ASSERT (open ("/dev/null", O_WRONLY, 0600) == fd + 1); - ASSERT (dup2 (fd + 1, fd) == fd); - ASSERT (close (fd + 1) == 0); - ASSERT (write (fd, "1", 1) == 1); - ASSERT (dup2 (fd + 2, fd) == fd); - ASSERT (write (fd + 2, "2", 1) == 1); - ASSERT (lseek (fd, SEEK_SET, 0) == 0); - ASSERT (read (fd, buffer, 1) == 1); - ASSERT (*buffer == '2'); - - /* Clean up. */ - ASSERT (close (fd + 2) == 0); - ASSERT (close (fd) == 0); - ASSERT (unlink (file) == 0); - - return 0; -} diff --git a/tests/test-environ.c b/tests/test-environ.c index d9501bb..534c4e6 100644 --- a/tests/test-environ.c +++ b/tests/test-environ.c @@ -1,5 +1,5 @@ /* Test of environ variable. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 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 @@ -36,8 +36,8 @@ main () for (; (string = *remaining_variables) != NULL; remaining_variables++) { if (strncmp (string, "PATH=", 5) == 0) - /* Found the PATH environment variable. */ - return 0; + /* Found the PATH environment variable. */ + return 0; } /* Failed to find the PATH environment variable. */ return 1; diff --git a/tests/test-errno.c b/tests/test-errno.c index 4642027..129b236 100644 --- a/tests/test-errno.c +++ b/tests/test-errno.c @@ -1,5 +1,5 @@ /* Test of <errno.h> substitute. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 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 diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index d4babb8..8d9d41d 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,31 +20,21 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (frexpl, long double, (long double, int *)); + #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" +#include "macros.h" /* Avoid some warnings from "gcc -Wshadow". This file doesn't use the exp() function. */ #undef exp #define exp exponent -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' diff --git a/tests/test-fseterr.c b/tests/test-fseterr.c index 475979b..c114f1a 100644 --- a/tests/test-fseterr.c +++ b/tests/test-fseterr.c @@ -1,5 +1,5 @@ /* Test setting the error indicator of a stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 diff --git a/tests/test-iconv-h.c b/tests/test-iconv-h.c new file mode 100644 index 0000000..10a8e3d --- /dev/null +++ b/tests/test-iconv-h.c @@ -0,0 +1,31 @@ +/* Test of <iconv.h> substitute. + Copyright (C) 2007-2010 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#if HAVE_ICONV +# include <iconv.h> + +# ifndef ICONV_CONST +# define ICONV_CONST /* empty */ +# endif +#endif + +int +main () +{ + return 0; +} diff --git a/tests/test-iconv.c b/tests/test-iconv.c index 8bac176..cf00ac8 100644 --- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -1,5 +1,5 @@ /* Test of character set conversion. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,24 +20,23 @@ #if HAVE_ICONV # include <iconv.h> + +# ifndef ICONV_CONST +# define ICONV_CONST /* empty */ +# endif + +#include "signature.h" +SIGNATURE_CHECK (iconv, size_t, (iconv_t, ICONV_CONST char **, size_t *, + char **, size_t *)); +SIGNATURE_CHECK (iconv_close, int, (iconv_t x)); +SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *)); + #endif #include <errno.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -61,8 +60,8 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); ASSERT (memcmp (buf, expected, strlen (expected)) == 0); @@ -77,8 +76,8 @@ main () char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == (size_t)(-1) && errno == E2BIG); ASSERT (inbytesleft == 1); ASSERT (outbytesleft == 1); @@ -96,8 +95,8 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); ASSERT (memcmp (buf, expected, strlen (expected)) == 0); @@ -112,17 +111,17 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); if (res == (size_t)(-1)) { ASSERT (errno == EILSEQ); - ASSERT (inbytesleft == strlen (input) && outptr == buf); + ASSERT (inbytesleft == strlen (input) && outptr == buf); } else { - ASSERT (res == 1); - ASSERT (inbytesleft == 0); + ASSERT (res == 1); + ASSERT (inbytesleft == 0); } } @@ -135,8 +134,8 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == (size_t)(-1) && errno == EINVAL); ASSERT (inbytesleft == 1 && outptr == buf); } diff --git a/tests/test-isnand-nolibm.c b/tests/test-isnand-nolibm.c index fd739ca..b0ac0ba 100644 --- a/tests/test-isnand-nolibm.c +++ b/tests/test-isnand-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 diff --git a/tests/test-isnand.h b/tests/test-isnand.h index 09c5e97..f986621 100644 --- a/tests/test-isnand.h +++ b/tests/test-isnand.h @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -17,22 +17,9 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. So we use -zero instead. */ diff --git a/tests/test-isnanf-nolibm.c b/tests/test-isnanf-nolibm.c index 0105ce9..6ac69e0 100644 --- a/tests/test-isnanf-nolibm.c +++ b/tests/test-isnanf-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 diff --git a/tests/test-isnanf.h b/tests/test-isnanf.h index f3f387c..d071b2c 100644 --- a/tests/test-isnanf.h +++ b/tests/test-isnanf.h @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -17,22 +17,9 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-isnanl-nolibm.c b/tests/test-isnanl-nolibm.c index 70c984d..eeca6d8 100644 --- a/tests/test-isnanl-nolibm.c +++ b/tests/test-isnanl-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index baf04db..1665cf4 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -18,22 +18,9 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-locale.c b/tests/test-locale.c index 625cc43..2e5c4fc 100644 --- a/tests/test-locale.c +++ b/tests/test-locale.c @@ -1,5 +1,5 @@ /* Test of <locale.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -33,6 +33,11 @@ int a[] = LC_TIME }; +#if HAVE_NEWLOCALE +/* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined. */ +locale_t b = LC_GLOBAL_LOCALE; +#endif + /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); diff --git a/tests/test-localename.c b/tests/test-localename.c index 82f786b..8f081b3 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -1,5 +1,5 @@ -/* Test of gl_locale_name function. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. +/* Test of gl_locale_name function and its variants. + Copyright (C) 2007-2010 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 @@ -21,30 +21,61 @@ #include "localename.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" -int -main () + +#if HAVE_NEWLOCALE + +static struct { int cat; int mask; const char *string; } const categories[] = + { + { LC_CTYPE, LC_CTYPE_MASK, "LC_CTYPE" }, + { LC_NUMERIC, LC_NUMERIC_MASK, "LC_NUMERIC" }, + { LC_TIME, LC_TIME_MASK, "LC_TIME" }, + { LC_COLLATE, LC_COLLATE_MASK, "LC_COLLATE" }, + { LC_MONETARY, LC_MONETARY_MASK, "LC_MONETARY" }, + { LC_MESSAGES, LC_MESSAGES_MASK, "LC_MESSAGES" } +# ifdef LC_PAPER + , { LC_PAPER, LC_PAPER_MASK, "LC_PAPER" } +# endif +# ifdef LC_NAME + , { LC_NAME, LC_NAME_MASK, "LC_NAME" } +# endif +# ifdef LC_ADDRESS + , { LC_ADDRESS, LC_ADDRESS_MASK, "LC_ADDRESS" } +# endif +# ifdef LC_TELEPHONE + , { LC_TELEPHONE, LC_TELEPHONE_MASK, "LC_TELEPHONE" } +# endif +# ifdef LC_MEASUREMENT + , { LC_MEASUREMENT, LC_MEASUREMENT_MASK, "LC_MEASUREMENT" } +# endif +# ifdef LC_IDENTIFICATION + , { LC_IDENTIFICATION, LC_IDENTIFICATION_MASK, "LC_IDENTIFICATION" } +# endif + }; + +#endif + +/* Test the gl_locale_name() function. */ +static void +test_locale_name (void) { + const char *name; + /* Check that gl_locale_name returns non-NULL. */ ASSERT (gl_locale_name (LC_MESSAGES, "LC_MESSAGES") != NULL); + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); +#if HAVE_NEWLOCALE + uselocale (LC_GLOBAL_LOCALE); +#endif + /* Check that when all environment variables are unset, - gl_locale_name_posix returns NULL. */ + gl_locale_name returns the default locale. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); @@ -52,9 +83,9 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); ASSERT (strcmp (gl_locale_name (LC_NUMERIC, "LC_NUMERIC"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); /* Check that an empty environment variable is treated like an unset environment variable. */ @@ -65,7 +96,7 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "", 1); @@ -73,7 +104,7 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); @@ -81,7 +112,7 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); @@ -89,7 +120,7 @@ main () setenv ("LANG", "", 1); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); /* Check that LC_ALL overrides the others, and LANG is overridden by the others. */ @@ -99,7 +130,6 @@ main () unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); - ASSERT (strcmp (gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); unsetenv ("LC_ALL"); @@ -107,7 +137,6 @@ main () setenv ("LC_MESSAGES", "C", 1); unsetenv ("LANG"); setlocale (LC_ALL, ""); - ASSERT (strcmp (gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); unsetenv ("LC_ALL"); @@ -115,8 +144,604 @@ main () unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); setlocale (LC_ALL, ""); - ASSERT (strcmp (gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); + /* Check mixed situations. */ + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + setenv ("LANG", "de_DE.UTF-8", 1); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "de_DE.UTF-8") == 0); + name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + unsetenv ("LANG"); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, gl_locale_name_default ()) == 0); + name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name considers the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + uselocale (locale); + name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + } + + /* Check that gl_locale_name distinguishes different categories of the + thread locale, and that the name is the right one for each. */ + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + { + int category_mask = categories[i].mask; + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + locale = newlocale (category_mask, "de_DE.UTF-8", locale); + if (locale != NULL) + { + unsigned int j; + + uselocale (locale); + for (j = 0; j < SIZEOF (categories); j++) + { + const char *name_j = + gl_locale_name (categories[j].cat, categories[j].string); + if (j == i) + ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0); + else + ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0); + } + } + } + } + } +#endif +} + +/* Test the gl_locale_name_thread() function. */ +static void +test_locale_name_thread (void) +{ + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_thread returns NULL when no thread locale is + set. */ + uselocale (LC_GLOBAL_LOCALE); + ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL); + ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL); + + /* Check that gl_locale_name_thread considers the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + const char *name; + + uselocale (locale); + name = gl_locale_name_thread (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + name = gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + } + + /* Check that gl_locale_name_thread distinguishes different categories of the + thread locale, and that the name is the right one for each. */ + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + { + int category_mask = categories[i].mask; + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + locale = newlocale (category_mask, "de_DE.UTF-8", locale); + if (locale != NULL) + { + unsigned int j; + + uselocale (locale); + for (j = 0; j < SIZEOF (categories); j++) + { + const char *name_j = + gl_locale_name_thread (categories[j].cat, + categories[j].string); + if (j == i) + ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0); + else + ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0); + } + } + } + } + } + + /* Check that gl_locale_name_thread returns a string that is allocated with + indefinite extent. */ + { + /* Try many locale names in turn, in order to defeat possible caches. */ + static const char * const choices[] = + { + "C", + "POSIX", + "af_ZA", + "af_ZA.UTF-8", + "am_ET", + "am_ET.UTF-8", + "be_BY", + "be_BY.UTF-8", + "bg_BG", + "bg_BG.UTF-8", + "ca_ES", + "ca_ES.UTF-8", + "cs_CZ", + "cs_CZ.UTF-8", + "da_DK", + "da_DK.UTF-8", + "de_AT", + "de_AT.UTF-8", + "de_CH", + "de_CH.UTF-8", + "de_DE", + "de_DE.UTF-8", + "el_GR", + "el_GR.UTF-8", + "en_AU", + "en_AU.UTF-8", + "en_CA", + "en_CA.UTF-8", + "en_GB", + "en_GB.UTF-8", + "en_IE", + "en_IE.UTF-8", + "en_NZ", + "en_NZ.UTF-8", + "en_US", + "en_US.UTF-8", + "es_ES", + "es_ES.UTF-8", + "et_EE", + "et_EE.UTF-8", + "eu_ES", + "eu_ES.UTF-8", + "fi_FI", + "fi_FI.UTF-8", + "fr_BE", + "fr_BE.UTF-8", + "fr_CA", + "fr_CA.UTF-8", + "fr_CH", + "fr_CH.UTF-8", + "fr_FR", + "fr_FR.UTF-8", + "he_IL", + "he_IL.UTF-8", + "hr_HR", + "hr_HR.UTF-8", + "hu_HU", + "hu_HU.UTF-8", + "hy_AM", + "is_IS", + "is_IS.UTF-8", + "it_CH", + "it_CH.UTF-8", + "it_IT", + "it_IT.UTF-8", + "ja_JP.UTF-8", + "kk_KZ", + "kk_KZ.UTF-8", + "ko_KR.UTF-8", + "lt_LT", + "lt_LT.UTF-8", + "nl_BE", + "nl_BE.UTF-8", + "nl_NL", + "nl_NL.UTF-8", + "no_NO", + "no_NO.UTF-8", + "pl_PL", + "pl_PL.UTF-8", + "pt_BR", + "pt_BR.UTF-8", + "pt_PT", + "pt_PT.UTF-8", + "ro_RO", + "ro_RO.UTF-8", + "ru_RU", + "ru_RU.UTF-8", + "sk_SK", + "sk_SK.UTF-8", + "sl_SI", + "sl_SI.UTF-8", + "sv_SE", + "sv_SE.UTF-8", + "tr_TR", + "tr_TR.UTF-8", + "uk_UA", + "uk_UA.UTF-8", + "zh_CN", + "zh_CN.UTF-8", + "zh_HK", + "zh_HK.UTF-8", + "zh_TW", + "zh_TW.UTF-8" + }; + /* Remember which locales are available. */ + unsigned char /* bool */ available[SIZEOF (choices)]; + /* Array of remembered results of gl_locale_name_thread. */ + const char *unsaved_names[SIZEOF (choices)][SIZEOF (categories)]; + /* Array of remembered results of gl_locale_name_thread, stored in safe + memory. */ + char *saved_names[SIZEOF (choices)][SIZEOF (categories)]; + unsigned int j; + + for (j = 0; j < SIZEOF (choices); j++) + { + locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL); + available[j] = (locale != NULL); + if (locale != NULL) + { + unsigned int i; + + uselocale (locale); + for (i = 0; i < SIZEOF (categories); i++) + { + unsaved_names[j][i] = gl_locale_name_thread (categories[i].cat, categories[i].string); + saved_names[j][i] = strdup (unsaved_names[j][i]); + } + uselocale (LC_GLOBAL_LOCALE); + freelocale (locale); + } + } + /* Verify the unsaved_names are still valid. */ + for (j = 0; j < SIZEOF (choices); j++) + if (available[j]) + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0); + } + /* Allocate many locales, without freeing them. This is an attempt at + overwriting as much of the previously allocated memory as possible. */ + for (j = SIZEOF (choices); j > 0; ) + { + j--; + if (available[j]) + { + locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL); + unsigned int i; + + ASSERT (locale != NULL); + uselocale (locale); + for (i = 0; i < SIZEOF (categories); i++) + { + const char *name = gl_locale_name_thread (categories[i].cat, categories[i].string); + ASSERT (strcmp (unsaved_names[j][i], name) == 0); + } + uselocale (LC_GLOBAL_LOCALE); + } + } + /* Verify the unsaved_names are still valid. */ + for (j = 0; j < SIZEOF (choices); j++) + if (available[j]) + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0); + } + } +#else + /* Check that gl_locale_name_thread always returns NULL. */ + ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL); + ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL); +#endif +} + +/* Test the gl_locale_name_posix() function. */ +static void +test_locale_name_posix (void) +{ + const char *name; + + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); +#if HAVE_NEWLOCALE + uselocale (LC_GLOBAL_LOCALE); +#endif + + /* Check that when all environment variables are unset, + gl_locale_name_posix returns either NULL or the default locale. */ + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LC_NUMERIC"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + name = gl_locale_name_posix (LC_NUMERIC, "LC_NUMERIC"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + /* Check that an empty environment variable is treated like an unset + environment variable. */ + + setenv ("LC_ALL", "", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "", 1); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "", 1); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "", 1); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + /* Check that LC_ALL overrides the others, and LANG is overridden by the + others. */ + + setenv ("LC_ALL", "C", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "C", 1); + setenv ("LC_MESSAGES", "C", 1); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + /* Check mixed situations. */ + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + setenv ("LANG", "de_DE.UTF-8", 1); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "de_DE.UTF-8") == 0); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + unsetenv ("LANG"); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_posix ignores the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + setlocale (LC_ALL, ""); + uselocale (locale); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + } + } +#endif +} + +/* Test the gl_locale_name_environ() function. */ +static void +test_locale_name_environ (void) +{ + const char *name; + + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); +#if HAVE_NEWLOCALE + uselocale (LC_GLOBAL_LOCALE); +#endif + + /* Check that when all environment variables are unset, + gl_locale_name_environ returns NULL. */ + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LC_NUMERIC"); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + ASSERT (gl_locale_name_environ (LC_NUMERIC, "LC_NUMERIC") == NULL); + + /* Check that an empty environment variable is treated like an unset + environment variable. */ + + setenv ("LC_ALL", "", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "", 1); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "", 1); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "", 1); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + /* Check that LC_ALL overrides the others, and LANG is overridden by the + others. */ + + setenv ("LC_ALL", "C", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "C", 1); + setenv ("LC_MESSAGES", "C", 1); + unsetenv ("LANG"); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + /* Check mixed situations. */ + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + setenv ("LANG", "de_DE.UTF-8", 1); + name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "de_DE.UTF-8") == 0); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + unsetenv ("LANG"); + name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE"); + ASSERT (name == NULL); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_environ ignores the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + setlocale (LC_ALL, ""); + uselocale (locale); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + } + } +#endif +} + +/* Test the gl_locale_name_default() function. */ +static void +test_locale_name_default (void) +{ + const char *name = gl_locale_name_default (); + + ASSERT (name != NULL); + + /* Only MacOS X and Windows have a facility for the user to set the default + locale. */ +#if !((defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __WIN32__ || defined __CYGWIN__)) + ASSERT (strcmp (name, "C") == 0); +#endif + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_default ignores the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + uselocale (locale); + ASSERT (strcmp (gl_locale_name_default (), name) == 0); + } + } +#endif +} + +int +main () +{ + test_locale_name (); + test_locale_name_thread (); + test_locale_name_posix (); + test_locale_name_environ (); + test_locale_name_default (); + return 0; } diff --git a/tests/test-lock.c b/tests/test-lock.c new file mode 100644 index 0000000..7792dca --- /dev/null +++ b/tests/test-lock.c @@ -0,0 +1,601 @@ +/* Test of locking in multithreaded situations. + Copyright (C) 2005, 2008-2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. */ + +#include <config.h> + +#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || USE_WIN32_THREADS + +#if USE_POSIX_THREADS +# define TEST_POSIX_THREADS 1 +#endif +#if USE_SOLARIS_THREADS +# define TEST_SOLARIS_THREADS 1 +#endif +#if USE_PTH_THREADS +# define TEST_PTH_THREADS 1 +#endif +#if USE_WIN32_THREADS +# define TEST_WIN32_THREADS 1 +#endif + +/* Whether to enable locking. + Uncomment this to get a test program without locking, to verify that + it crashes. */ +#define ENABLE_LOCKING 1 + +/* Which tests to perform. + Uncomment some of these, to verify that all tests crash if no locking + is enabled. */ +#define DO_TEST_LOCK 1 +#define DO_TEST_RWLOCK 1 +#define DO_TEST_RECURSIVE_LOCK 1 +#define DO_TEST_ONCE 1 + +/* Whether to help the scheduler through explicit yield(). + Uncomment this to see if the operating system has a fair scheduler. */ +#define EXPLICIT_YIELD 1 + +/* Whether to print debugging messages. */ +#define ENABLE_DEBUGGING 0 + +/* Number of simultaneous threads. */ +#define THREAD_COUNT 10 + +/* Number of operations performed in each thread. + This is quite high, because with a smaller count, say 5000, we often get + an "OK" result even without ENABLE_LOCKING (on Linux/x86). */ +#define REPEAT_COUNT 50000 + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#if !ENABLE_LOCKING +# undef USE_POSIX_THREADS +# undef USE_SOLARIS_THREADS +# undef USE_PTH_THREADS +# undef USE_WIN32_THREADS +#endif +#include "glthread/lock.h" + +#if !ENABLE_LOCKING +# if TEST_POSIX_THREADS +# define USE_POSIX_THREADS 1 +# endif +# if TEST_SOLARIS_THREADS +# define USE_SOLARIS_THREADS 1 +# endif +# if TEST_PTH_THREADS +# define USE_PTH_THREADS 1 +# endif +# if TEST_WIN32_THREADS +# define USE_WIN32_THREADS 1 +# endif +#endif + +#include "glthread/thread.h" +#include "glthread/yield.h" + +#if ENABLE_DEBUGGING +# define dbgprintf printf +#else +# define dbgprintf if (0) printf +#endif + +#if EXPLICIT_YIELD +# define yield() gl_thread_yield () +#else +# define yield() +#endif + +#define ACCOUNT_COUNT 4 + +static int account[ACCOUNT_COUNT]; + +static int +random_account (void) +{ + return ((unsigned int) rand () >> 3) % ACCOUNT_COUNT; +} + +static void +check_accounts (void) +{ + int i, sum; + + sum = 0; + for (i = 0; i < ACCOUNT_COUNT; i++) + sum += account[i]; + if (sum != ACCOUNT_COUNT * 1000) + abort (); +} + + +/* ------------------- Test normal (non-recursive) locks ------------------- */ + +/* Test normal locks by having several bank accounts and several threads + which shuffle around money between the accounts and another thread + checking that all the money is still there. */ + +gl_lock_define_initialized(static, my_lock) + +static void * +lock_mutator_thread (void *arg) +{ + int repeat; + + for (repeat = REPEAT_COUNT; repeat > 0; repeat--) + { + int i1, i2, value; + + dbgprintf ("Mutator %p before lock\n", gl_thread_self ()); + gl_lock_lock (my_lock); + dbgprintf ("Mutator %p after lock\n", gl_thread_self ()); + + i1 = random_account (); + i2 = random_account (); + value = ((unsigned int) rand () >> 3) % 10; + account[i1] += value; + account[i2] -= value; + + dbgprintf ("Mutator %p before unlock\n", gl_thread_self ()); + gl_lock_unlock (my_lock); + dbgprintf ("Mutator %p after unlock\n", gl_thread_self ()); + + dbgprintf ("Mutator %p before check lock\n", gl_thread_self ()); + gl_lock_lock (my_lock); + check_accounts (); + gl_lock_unlock (my_lock); + dbgprintf ("Mutator %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Mutator %p dying.\n", gl_thread_self ()); + return NULL; +} + +static volatile int lock_checker_done; + +static void * +lock_checker_thread (void *arg) +{ + while (!lock_checker_done) + { + dbgprintf ("Checker %p before check lock\n", gl_thread_self ()); + gl_lock_lock (my_lock); + check_accounts (); + gl_lock_unlock (my_lock); + dbgprintf ("Checker %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Checker %p dying.\n", gl_thread_self ()); + return NULL; +} + +static void +test_lock (void) +{ + int i; + gl_thread_t checkerthread; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialization. */ + for (i = 0; i < ACCOUNT_COUNT; i++) + account[i] = 1000; + lock_checker_done = 0; + + /* Spawn the threads. */ + checkerthread = gl_thread_create (lock_checker_thread, NULL); + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (lock_mutator_thread, NULL); + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); + lock_checker_done = 1; + gl_thread_join (checkerthread, NULL); + check_accounts (); +} + + +/* ----------------- Test read-write (non-recursive) locks ----------------- */ + +/* Test read-write locks by having several bank accounts and several threads + which shuffle around money between the accounts and several other threads + that check that all the money is still there. */ + +gl_rwlock_define_initialized(static, my_rwlock) + +static void * +rwlock_mutator_thread (void *arg) +{ + int repeat; + + for (repeat = REPEAT_COUNT; repeat > 0; repeat--) + { + int i1, i2, value; + + dbgprintf ("Mutator %p before wrlock\n", gl_thread_self ()); + gl_rwlock_wrlock (my_rwlock); + dbgprintf ("Mutator %p after wrlock\n", gl_thread_self ()); + + i1 = random_account (); + i2 = random_account (); + value = ((unsigned int) rand () >> 3) % 10; + account[i1] += value; + account[i2] -= value; + + dbgprintf ("Mutator %p before unlock\n", gl_thread_self ()); + gl_rwlock_unlock (my_rwlock); + dbgprintf ("Mutator %p after unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Mutator %p dying.\n", gl_thread_self ()); + return NULL; +} + +static volatile int rwlock_checker_done; + +static void * +rwlock_checker_thread (void *arg) +{ + while (!rwlock_checker_done) + { + dbgprintf ("Checker %p before check rdlock\n", gl_thread_self ()); + gl_rwlock_rdlock (my_rwlock); + check_accounts (); + gl_rwlock_unlock (my_rwlock); + dbgprintf ("Checker %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Checker %p dying.\n", gl_thread_self ()); + return NULL; +} + +static void +test_rwlock (void) +{ + int i; + gl_thread_t checkerthreads[THREAD_COUNT]; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialization. */ + for (i = 0; i < ACCOUNT_COUNT; i++) + account[i] = 1000; + rwlock_checker_done = 0; + + /* Spawn the threads. */ + for (i = 0; i < THREAD_COUNT; i++) + checkerthreads[i] = gl_thread_create (rwlock_checker_thread, NULL); + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (rwlock_mutator_thread, NULL); + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); + rwlock_checker_done = 1; + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (checkerthreads[i], NULL); + check_accounts (); +} + + +/* -------------------------- Test recursive locks -------------------------- */ + +/* Test recursive locks by having several bank accounts and several threads + which shuffle around money between the accounts (recursively) and another + thread checking that all the money is still there. */ + +gl_recursive_lock_define_initialized(static, my_reclock) + +static void +recshuffle (void) +{ + int i1, i2, value; + + dbgprintf ("Mutator %p before lock\n", gl_thread_self ()); + gl_recursive_lock_lock (my_reclock); + dbgprintf ("Mutator %p after lock\n", gl_thread_self ()); + + i1 = random_account (); + i2 = random_account (); + value = ((unsigned int) rand () >> 3) % 10; + account[i1] += value; + account[i2] -= value; + + /* Recursive with probability 0.5. */ + if (((unsigned int) rand () >> 3) % 2) + recshuffle (); + + dbgprintf ("Mutator %p before unlock\n", gl_thread_self ()); + gl_recursive_lock_unlock (my_reclock); + dbgprintf ("Mutator %p after unlock\n", gl_thread_self ()); +} + +static void * +reclock_mutator_thread (void *arg) +{ + int repeat; + + for (repeat = REPEAT_COUNT; repeat > 0; repeat--) + { + recshuffle (); + + dbgprintf ("Mutator %p before check lock\n", gl_thread_self ()); + gl_recursive_lock_lock (my_reclock); + check_accounts (); + gl_recursive_lock_unlock (my_reclock); + dbgprintf ("Mutator %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Mutator %p dying.\n", gl_thread_self ()); + return NULL; +} + +static volatile int reclock_checker_done; + +static void * +reclock_checker_thread (void *arg) +{ + while (!reclock_checker_done) + { + dbgprintf ("Checker %p before check lock\n", gl_thread_self ()); + gl_recursive_lock_lock (my_reclock); + check_accounts (); + gl_recursive_lock_unlock (my_reclock); + dbgprintf ("Checker %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Checker %p dying.\n", gl_thread_self ()); + return NULL; +} + +static void +test_recursive_lock (void) +{ + int i; + gl_thread_t checkerthread; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialization. */ + for (i = 0; i < ACCOUNT_COUNT; i++) + account[i] = 1000; + reclock_checker_done = 0; + + /* Spawn the threads. */ + checkerthread = gl_thread_create (reclock_checker_thread, NULL); + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (reclock_mutator_thread, NULL); + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); + reclock_checker_done = 1; + gl_thread_join (checkerthread, NULL); + check_accounts (); +} + + +/* ------------------------ Test once-only execution ------------------------ */ + +/* Test once-only execution by having several threads attempt to grab a + once-only task simultaneously (triggered by releasing a read-write lock). */ + +gl_once_define(static, fresh_once) +static int ready[THREAD_COUNT]; +static gl_lock_t ready_lock[THREAD_COUNT]; +#if ENABLE_LOCKING +static gl_rwlock_t fire_signal[REPEAT_COUNT]; +#else +static volatile int fire_signal_state; +#endif +static gl_once_t once_control; +static int performed; +gl_lock_define_initialized(static, performed_lock) + +static void +once_execute (void) +{ + gl_lock_lock (performed_lock); + performed++; + gl_lock_unlock (performed_lock); +} + +static void * +once_contender_thread (void *arg) +{ + int id = (int) (long) arg; + int repeat; + + for (repeat = 0; repeat <= REPEAT_COUNT; repeat++) + { + /* Tell the main thread that we're ready. */ + gl_lock_lock (ready_lock[id]); + ready[id] = 1; + gl_lock_unlock (ready_lock[id]); + + if (repeat == REPEAT_COUNT) + break; + + dbgprintf ("Contender %p waiting for signal for round %d\n", + gl_thread_self (), repeat); +#if ENABLE_LOCKING + /* Wait for the signal to go. */ + gl_rwlock_rdlock (fire_signal[repeat]); + /* And don't hinder the others (if the scheduler is unfair). */ + gl_rwlock_unlock (fire_signal[repeat]); +#else + /* Wait for the signal to go. */ + while (fire_signal_state <= repeat) + yield (); +#endif + dbgprintf ("Contender %p got the signal for round %d\n", + gl_thread_self (), repeat); + + /* Contend for execution. */ + gl_once (once_control, once_execute); + } + + return NULL; +} + +static void +test_once (void) +{ + int i, repeat; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialize all variables. */ + for (i = 0; i < THREAD_COUNT; i++) + { + ready[i] = 0; + gl_lock_init (ready_lock[i]); + } +#if ENABLE_LOCKING + for (i = 0; i < REPEAT_COUNT; i++) + gl_rwlock_init (fire_signal[i]); +#else + fire_signal_state = 0; +#endif + + /* Block all fire_signals. */ + for (i = REPEAT_COUNT-1; i >= 0; i--) + gl_rwlock_wrlock (fire_signal[i]); + + /* Spawn the threads. */ + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (once_contender_thread, (void *) (long) i); + + for (repeat = 0; repeat <= REPEAT_COUNT; repeat++) + { + /* Wait until every thread is ready. */ + dbgprintf ("Main thread before synchonizing for round %d\n", repeat); + for (;;) + { + int ready_count = 0; + for (i = 0; i < THREAD_COUNT; i++) + { + gl_lock_lock (ready_lock[i]); + ready_count += ready[i]; + gl_lock_unlock (ready_lock[i]); + } + if (ready_count == THREAD_COUNT) + break; + yield (); + } + dbgprintf ("Main thread after synchonizing for round %d\n", repeat); + + if (repeat > 0) + { + /* Check that exactly one thread executed the once_execute() + function. */ + if (performed != 1) + abort (); + } + + if (repeat == REPEAT_COUNT) + break; + + /* Preparation for the next round: Initialize once_control. */ + memcpy (&once_control, &fresh_once, sizeof (gl_once_t)); + + /* Preparation for the next round: Reset the performed counter. */ + performed = 0; + + /* Preparation for the next round: Reset the ready flags. */ + for (i = 0; i < THREAD_COUNT; i++) + { + gl_lock_lock (ready_lock[i]); + ready[i] = 0; + gl_lock_unlock (ready_lock[i]); + } + + /* Signal all threads simultaneously. */ + dbgprintf ("Main thread giving signal for round %d\n", repeat); +#if ENABLE_LOCKING + gl_rwlock_unlock (fire_signal[repeat]); +#else + fire_signal_state = repeat + 1; +#endif + } + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); +} + + +/* -------------------------------------------------------------------------- */ + +int +main () +{ +#if TEST_PTH_THREADS + if (!pth_init ()) + abort (); +#endif + +#if DO_TEST_LOCK + printf ("Starting test_lock ..."); fflush (stdout); + test_lock (); + printf (" OK\n"); fflush (stdout); +#endif +#if DO_TEST_RWLOCK + printf ("Starting test_rwlock ..."); fflush (stdout); + test_rwlock (); + printf (" OK\n"); fflush (stdout); +#endif +#if DO_TEST_RECURSIVE_LOCK + printf ("Starting test_recursive_lock ..."); fflush (stdout); + test_recursive_lock (); + printf (" OK\n"); fflush (stdout); +#endif +#if DO_TEST_ONCE + printf ("Starting test_once ..."); fflush (stdout); + test_once (); + printf (" OK\n"); fflush (stdout); +#endif + + return 0; +} + +#else + +/* No multithreading available. */ + +#include <stdio.h> + +int +main () +{ + fputs ("Skipping test: multithreading not enabled\n", stderr); + return 77; +} + +#endif diff --git a/tests/test-malloca.c b/tests/test-malloca.c index 7de6c68..14ef3a9 100644 --- a/tests/test-malloca.c +++ b/tests/test-malloca.c @@ -1,5 +1,5 @@ /* Test of safe automatic memory allocation. - Copyright (C) 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009, 2010 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 diff --git a/tests/test-math.c b/tests/test-math.c index aa51f85..f940a24 100644 --- a/tests/test-math.c +++ b/tests/test-math.c @@ -1,5 +1,5 @@ /* Test of <math.h> substitute. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 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 @@ -40,7 +40,7 @@ numeric_equal (double x, double y) } int -main () +main (void) { double d = NAN; double zero = 0.0; diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 8f1f1be..5477677 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to wide character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 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 @@ -20,22 +20,15 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbrtowc, size_t, (wchar_t *, char const *, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) @@ -81,40 +74,40 @@ main (int argc, char *argv[]) memset (&state, '\0', sizeof (mbstate_t)); for (c = 0; c < 0x100; c++) switch (c) - { - case '\t': case '\v': case '\f': - case ' ': case '!': case '"': case '#': case '%': - case '&': case '\'': case '(': case ')': case '*': - case '+': case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': - case '?': - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': case 'J': - case 'K': case 'L': case 'M': case 'N': case 'O': - case 'P': case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': case 'Y': - case 'Z': - case '[': case '\\': case ']': case '^': case '_': - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'o': - case 'p': case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': case 'y': - case 'z': case '{': case '|': case '}': case '~': - /* c is in the ISO C "basic character set". */ - buf[0] = c; - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, buf, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == c); - ASSERT (mbsinit (&state)); - ret = mbrtowc (NULL, buf, 1, &state); - ASSERT (ret == 1); - ASSERT (mbsinit (&state)); - break; - } + { + case '\t': case '\v': case '\f': + case ' ': case '!': case '"': case '#': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + /* c is in the ISO C "basic character set". */ + buf[0] = c; + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, buf, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == c); + ASSERT (mbsinit (&state)); + ret = mbrtowc (NULL, buf, 1, &state); + ASSERT (ret == 1); + ASSERT (mbsinit (&state)); + break; + } } /* Test special calling convention, passing a NULL pointer. */ @@ -131,199 +124,199 @@ main (int argc, char *argv[]) switch (argv[1][0]) { case '1': - /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ - { - char input[] = "B\374\337er"; /* "Büßer" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'B'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 1, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == (unsigned char) '\374'); - ASSERT (mbsinit (&state)); - input[1] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 2, 3, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == (unsigned char) '\337'); - ASSERT (mbsinit (&state)); - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 2, &state); - ASSERT (ret == 1); - ASSERT (wc == 'e'); - ASSERT (mbsinit (&state)); - input[3] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 4, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'r'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + { + char input[] = "B\374\337er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'B'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == (unsigned char) '\374'); + ASSERT (mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 3, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == (unsigned char) '\337'); + ASSERT (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 2, &state); + ASSERT (ret == 1); + ASSERT (wc == 'e'); + ASSERT (mbsinit (&state)); + input[3] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 4, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'r'); + ASSERT (mbsinit (&state)); + } + return 0; case '2': - /* Locale encoding is UTF-8. */ - { - char input[] = "B\303\274\303\237er"; /* "Büßer" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'B'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 1, &state); - ASSERT (ret == (size_t)(-2)); - ASSERT (wc == (wchar_t) 0xBADFACE); - ASSERT (!mbsinit (&state)); - input[1] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 2, 5, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 4, &state); - ASSERT (ret == 2); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[3] = '\0'; - input[4] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 5, 2, &state); - ASSERT (ret == 1); - ASSERT (wc == 'e'); - ASSERT (mbsinit (&state)); - input[5] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 6, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'r'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is UTF-8. */ + { + char input[] = "B\303\274\303\237er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'B'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + ASSERT (ret == (size_t)(-2)); + ASSERT (wc == (wchar_t) 0xBADFACE); + ASSERT (!mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 5, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 4, &state); + ASSERT (ret == 2); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[3] = '\0'; + input[4] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 5, 2, &state); + ASSERT (ret == 1); + ASSERT (wc == 'e'); + ASSERT (mbsinit (&state)); + input[5] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 6, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'r'); + ASSERT (mbsinit (&state)); + } + return 0; case '3': - /* Locale encoding is EUC-JP. */ - { - char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == '<'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 2, &state); - ASSERT (ret == 2); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[1] = '\0'; - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 1, &state); - ASSERT (ret == (size_t)(-2)); - ASSERT (wc == (wchar_t) 0xBADFACE); - ASSERT (!mbsinit (&state)); - input[3] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 4, 4, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[4] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 5, 3, &state); - ASSERT (ret == 2); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[5] = '\0'; - input[6] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 7, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == '>'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is EUC-JP. */ + { + char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == '<'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 2, &state); + ASSERT (ret == 2); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[1] = '\0'; + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 1, &state); + ASSERT (ret == (size_t)(-2)); + ASSERT (wc == (wchar_t) 0xBADFACE); + ASSERT (!mbsinit (&state)); + input[3] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 4, 4, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[4] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 5, 3, &state); + ASSERT (ret == 2); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[5] = '\0'; + input[6] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 7, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == '>'); + ASSERT (mbsinit (&state)); + } + return 0; case '4': - /* Locale encoding is GB18030. */ - { - char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'B'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 1, &state); - ASSERT (ret == (size_t)(-2)); - ASSERT (wc == (wchar_t) 0xBADFACE); - ASSERT (!mbsinit (&state)); - input[1] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 2, 7, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 6, &state); - ASSERT (ret == 4); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[3] = '\0'; - input[4] = '\0'; - input[5] = '\0'; - input[6] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 7, 2, &state); - ASSERT (ret == 1); - ASSERT (wc == 'e'); - ASSERT (mbsinit (&state)); - input[5] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 8, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'r'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is GB18030. */ + { + char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'B'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + ASSERT (ret == (size_t)(-2)); + ASSERT (wc == (wchar_t) 0xBADFACE); + ASSERT (!mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 7, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 6, &state); + ASSERT (ret == 4); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[3] = '\0'; + input[4] = '\0'; + input[5] = '\0'; + input[6] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 7, 2, &state); + ASSERT (ret == 1); + ASSERT (wc == 'e'); + ASSERT (mbsinit (&state)); + input[5] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 8, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'r'); + ASSERT (mbsinit (&state)); + } + return 0; } return 1; diff --git a/tests/test-mbsinit.c b/tests/test-mbsinit.c index 5d4c9c3..4ca0fc3 100644 --- a/tests/test-mbsinit.c +++ b/tests/test-mbsinit.c @@ -1,5 +1,5 @@ /* Test of test for initial conversion state. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 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 @@ -20,21 +20,12 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbsinit, int, (const mbstate_t *)); + #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main (int argc, char *argv[]) @@ -51,7 +42,7 @@ main (int argc, char *argv[]) /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) - return 1; + return 1; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == (size_t)(-2)); diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 1124f8b..a801614 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Free Software Foundation + * Copyright (C) 2008-2010 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * This program is free software: you can redistribute it and/or modify @@ -19,29 +19,20 @@ #include <string.h> -#include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); + #include <stdlib.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ #define MEMCHR (char *) memchr int -main () +main (void) { size_t n = 0x100000; char *input = malloc (n); @@ -76,7 +67,7 @@ main () size_t repeat = 10000; for (; repeat > 0; repeat--) { - ASSERT (MEMCHR (input, 'c', n) == input + 2); + ASSERT (MEMCHR (input, 'c', n) == input + 2); } } @@ -85,12 +76,12 @@ main () int i, j; for (i = 0; i < 32; i++) { - for (j = 0; j < 256; j++) - input[i + j] = j; - for (j = 0; j < 256; j++) - { - ASSERT (MEMCHR (input + i, j, 256) == input + i + j); - } + for (j = 0; j < 256; j++) + input[i + j] = j; + for (j = 0; j < 256; j++) + { + ASSERT (MEMCHR (input + i, j, 256) == input + i + j); + } } } @@ -102,25 +93,23 @@ main () if (page_boundary != NULL) { - int n; - - for (n = 1; n <= 500; n++) - { - char *mem = page_boundary - n; - memset (mem, 'X', n); - ASSERT (MEMCHR (mem, 'U', n) == NULL); - - { - int i; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - ASSERT (MEMCHR (mem, 'U', 4000) == mem + i); - mem[i] = 'X'; - } - } - } + for (n = 1; n <= 500; n++) + { + char *mem = page_boundary - n; + memset (mem, 'X', n); + ASSERT (MEMCHR (mem, 'U', n) == NULL); + + { + size_t i; + + for (i = 0; i < n; i++) + { + mem[i] = 'U'; + ASSERT (MEMCHR (mem, 'U', 4000) == mem + i); + mem[i] = 'X'; + } + } + } } } diff --git a/tests/test-printf-frexp.c b/tests/test-printf-frexp.c index 8ba9348..13e1c30 100644 --- a/tests/test-printf-frexp.c +++ b/tests/test-printf-frexp.c @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,20 +21,8 @@ #include "printf-frexp.h" #include <float.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static double my_ldexp (double x, int d) diff --git a/tests/test-printf-frexpl.c b/tests/test-printf-frexpl.c index c4c156a..6f7e4f7 100644 --- a/tests/test-printf-frexpl.c +++ b/tests/test-printf-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,22 +21,9 @@ #include "printf-frexpl.h" #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, diff --git a/tests/test-setenv.c b/tests/test-setenv.c new file mode 100644 index 0000000..de589c1 --- /dev/null +++ b/tests/test-setenv.c @@ -0,0 +1,56 @@ +/* Tests of setenv. + Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Eric Blake <ebb9@byu.net>, 2009. */ + +#include <config.h> + +#include <stdlib.h> + +#include "signature.h" +SIGNATURE_CHECK (setenv, int, (char const *, char const *, int)); + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include "macros.h" + +int +main (void) +{ + /* Test overwriting. */ + ASSERT (setenv ("a", "==", -1) == 0); + ASSERT (setenv ("a", "2", 0) == 0); + ASSERT (strcmp (getenv ("a"), "==") == 0); + + /* Required to fail with EINVAL. */ + errno = 0; + ASSERT (setenv ("", "", 1) == -1); + ASSERT (errno == EINVAL); + errno = 0; + ASSERT (setenv ("a=b", "", 0) == -1); + ASSERT (errno == EINVAL); +#if 0 + /* glibc and gnulib's implementation guarantee this, but POSIX no + longer requires it: http://austingroupbugs.net/view.php?id=185 */ + errno = 0; + ASSERT (setenv (NULL, "", 0) == -1); + ASSERT (errno == EINVAL); +#endif + + return 0; +} diff --git a/tests/test-signbit.c b/tests/test-signbit.c index 97f68e6..9581190 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -1,5 +1,5 @@ /* Test of signbit() substitute. - Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 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 @@ -20,22 +20,15 @@ #include <math.h> +/* signbit must be a macro. */ +#ifndef signbit +# error missing declaration +#endif + #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" float zerof = 0.0f; double zerod = 0.0; diff --git a/tests/test-stdbool.c b/tests/test-stdbool.c index 30d5321..fcb534d 100644 --- a/tests/test-stdbool.c +++ b/tests/test-stdbool.c @@ -1,5 +1,5 @@ /* Test of <stdbool.h> substitute. - Copyright (C) 2002-2007 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2010 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 @@ -46,11 +46,12 @@ struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */ +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, at least, +not for all compilers. */ char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; -#endif char f[(_Bool) 0.0 == false ? 1 : -1]; +#endif char g[true]; char h[sizeof (_Bool)]; #if 0 /* See above. */ diff --git a/tests/test-stddef.c b/tests/test-stddef.c index f848498..d047e57 100644 --- a/tests/test-stddef.c +++ b/tests/test-stddef.c @@ -1,5 +1,5 @@ /* Test of <stddef.h> substitute. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -32,7 +32,7 @@ size_t c = 2; verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { return 0; } diff --git a/tests/test-stdint.c b/tests/test-stdint.c index a2bf42a..d64057a 100644 --- a/tests/test-stdint.c +++ b/tests/test-stdint.c @@ -1,5 +1,5 @@ /* Test of <stdint.h> substitute. - Copyright (C) 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2006-2010 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 @@ -22,6 +22,7 @@ #define DO_PEDANTIC 0 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* likewise */ #include <stdint.h> #include "verify.h" @@ -354,7 +355,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); int -main () +main (void) { return 0; } diff --git a/tests/test-stdlib.c b/tests/test-stdlib.c index ae46ba1..4bd8715 100644 --- a/tests/test-stdlib.c +++ b/tests/test-stdlib.c @@ -1,5 +1,5 @@ /* Test of <stdlib.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -29,7 +29,7 @@ int exitcode; verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { /* Check that some macros are defined and different integer constants. */ switch (exitcode) diff --git a/tests/test-strerror.c b/tests/test-strerror.c index 3d9814d..11ab7e3 100644 --- a/tests/test-strerror.c +++ b/tests/test-strerror.c @@ -1,5 +1,5 @@ /* Test of strerror() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -19,25 +19,17 @@ #include <config.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "signature.h" +SIGNATURE_CHECK (strerror, char *, (int)); + +#include <errno.h> + +#include "macros.h" int -main (int argc, char **argv) +main (void) { char *str; diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c index 16a16f4..679bb0e 100644 --- a/tests/test-striconveh.c +++ b/tests/test-striconveh.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -25,22 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -58,6 +46,7 @@ main () { static enum iconv_ilseq_handler handlers[] = { iconveh_error, iconveh_question_mark, iconveh_escape_sequence }; + size_t indirect; size_t h; size_t o; size_t i; @@ -65,111 +54,211 @@ main () #if HAVE_ICONV /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1, ISO-8859-2, and UTF-8. */ + iconv_t cd_ascii_to_88591 = iconv_open ("ISO-8859-1", "ASCII"); iconv_t cd_88591_to_88592 = iconv_open ("ISO-8859-2", "ISO-8859-1"); iconv_t cd_88592_to_88591 = iconv_open ("ISO-8859-1", "ISO-8859-2"); + iconv_t cd_ascii_to_utf8 = iconv_open ("UTF-8", "ASCII"); iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); iconv_t cd_88592_to_utf8 = iconv_open ("UTF-8", "ISO-8859-2"); iconv_t cd_utf8_to_88592 = iconv_open ("ISO-8859-2", "UTF-8"); iconv_t cd_utf7_to_utf8 = iconv_open ("UTF-8", "UTF-7"); + iconveh_t cdeh_ascii_to_88591; + iconveh_t cdeh_ascii_to_88591_indirectly; + iconveh_t cdeh_88592_to_88591; + iconveh_t cdeh_88592_to_88591_indirectly; + iconveh_t cdeh_ascii_to_utf8; + iconveh_t cdeh_88591_to_utf8; + iconveh_t cdeh_utf8_to_88591; + iconveh_t cdeh_utf7_to_utf8; + ASSERT (cd_ascii_to_utf8 != (iconv_t)(-1)); ASSERT (cd_88591_to_utf8 != (iconv_t)(-1)); ASSERT (cd_utf8_to_88591 != (iconv_t)(-1)); ASSERT (cd_88592_to_utf8 != (iconv_t)(-1)); ASSERT (cd_utf8_to_88592 != (iconv_t)(-1)); + cdeh_ascii_to_88591.cd = cd_ascii_to_88591; + cdeh_ascii_to_88591.cd1 = cd_ascii_to_utf8; + cdeh_ascii_to_88591.cd2 = cd_utf8_to_88591; + + cdeh_ascii_to_88591_indirectly.cd = (iconv_t)(-1); + cdeh_ascii_to_88591_indirectly.cd1 = cd_ascii_to_utf8; + cdeh_ascii_to_88591_indirectly.cd2 = cd_utf8_to_88591; + + cdeh_88592_to_88591.cd = cd_88592_to_88591; + cdeh_88592_to_88591.cd1 = cd_88592_to_utf8; + cdeh_88592_to_88591.cd2 = cd_utf8_to_88591; + + cdeh_88592_to_88591_indirectly.cd = (iconv_t)(-1); + cdeh_88592_to_88591_indirectly.cd1 = cd_88592_to_utf8; + cdeh_88592_to_88591_indirectly.cd2 = cd_utf8_to_88591; + + cdeh_ascii_to_utf8.cd = cd_ascii_to_utf8; + cdeh_ascii_to_utf8.cd1 = cd_ascii_to_utf8; + cdeh_ascii_to_utf8.cd2 = (iconv_t)(-1); + + cdeh_88591_to_utf8.cd = cd_88591_to_utf8; + cdeh_88591_to_utf8.cd1 = cd_88591_to_utf8; + cdeh_88591_to_utf8.cd2 = (iconv_t)(-1); + + cdeh_utf8_to_88591.cd = cd_utf8_to_88591; + cdeh_utf8_to_88591.cd1 = (iconv_t)(-1); + cdeh_utf8_to_88591.cd2 = cd_utf8_to_88591; + + cdeh_utf7_to_utf8.cd = cd_utf7_to_utf8; + cdeh_utf7_to_utf8.cd1 = cd_utf7_to_utf8; + cdeh_utf7_to_utf8.cd2 = (iconv_t)(-1); + /* ------------------------ Test mem_cd_iconveh() ------------------------ */ /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } + } + } + + /* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ). */ + for (indirect = 0; indirect <= 1; indirect++) + { + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + (indirect + ? &cdeh_ascii_to_88591_indirectly + : &cdeh_ascii_to_88591), + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ - for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -179,31 +268,30 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_88591_to_utf8, - cd_88591_to_utf8, (iconv_t)(-1), - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_88591_to_utf8, + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ @@ -213,35 +301,78 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - (size_t)(-1))); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf8_to_88591, + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + (size_t)(-1))); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } + } + + /* Test conversion from ASCII to UTF-8 with invalid input (EILSEQ). */ + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_ascii_to_utf8, + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -250,62 +381,61 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf8_to_88591, + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -314,159 +444,194 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == 0); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf8_to_88591, + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == 0); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } if (cd_utf7_to_utf8 != (iconv_t)(-1)) { /* Disabled on Solaris, because Solaris 9 iconv() is buggy: it returns - -1 / EILSEQ when converting the 7th byte of the input "+VDLYP9hA". */ + -1 / EILSEQ when converting the 7th byte of the input "+VDLYP9hA". */ # if !(defined __sun && !defined _LIBICONV_VERSION) /* Test conversion from UTF-7 to UTF-8 with EINVAL. */ for (h = 0; h < SIZEOF (handlers); h++) - { - enum iconv_ilseq_handler handler = handlers[h]; - /* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40. It would - convert to U+5432 U+D83F U+D840 but these are Unicode surrogates. */ - static const char input[] = "+VDLYP9hA"; - static const char expected1[] = "\345\220\262"; /* 吲 glibc */ - static const char expected2[] = ""; /* libiconv */ - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, 7, - cd_utf7_to_utf8, - cd_utf7_to_utf8, (iconv_t)(-1), - handler, - NULL, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected1) || length == strlen (expected2)); - ASSERT (result != NULL); - if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); - else - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); - free (result); - } + { + enum iconv_ilseq_handler handler = handlers[h]; + /* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40. It would + convert to U+5432 U+D83F U+D840 but these are Unicode surrogates. */ + static const char input[] = "+VDLYP9hA"; + static const char expected1[] = "\345\220\262"; /* 吲 glibc */ + static const char expected2[] = ""; /* libiconv */ + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, 7, + &cdeh_utf7_to_utf8, + handler, + NULL, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected1) || length == strlen (expected2)); + ASSERT (result != NULL); + if (length == strlen (expected1)) + ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + else + ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + free (result); + } /* Test conversion from UTF-7 to UTF-8 with EILSEQ. */ for (h = 0; h < SIZEOF (handlers); h++) - { - enum iconv_ilseq_handler handler = handlers[h]; - /* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41. It would - convert to U+D83F U+D840 U+D841 but these are Unicode surrogates. */ - static const char input[] = "+2D/YQNhB"; - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf7_to_utf8, - cd_utf7_to_utf8, (iconv_t)(-1), - handler, - NULL, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - break; - case iconveh_question_mark: - case iconveh_escape_sequence: - { - /* glibc result */ - static const char expected1[] = "?????"; - /* libiconv <= 1.12 result */ - static const char expected2[] = "?2D/YQNhB"; - /* libiconv behaviour changed in version 1.13: the result is - '?' U+0FF6 U+1036; this is U+D83F U+D840 U+D841 shifted left - by 6 bits. */ - static const char expected3[] = "?\340\277\266\341\200\266"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected1) - || length == strlen (expected2) - || length == strlen (expected3)); - ASSERT (result != NULL); - if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); - else if (length == strlen (expected2)) - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); - else - ASSERT (memcmp (result, expected3, strlen (expected3)) == 0); - free (result); - } - break; - } - } + { + enum iconv_ilseq_handler handler = handlers[h]; + /* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41. It would + convert to U+D83F U+D840 U+D841 but these are Unicode surrogates. */ + static const char input[] = "+2D/YQNhB"; + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf7_to_utf8, + handler, + NULL, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + /* glibc result */ + static const char expected1[] = "?????"; + /* libiconv <= 1.12 result */ + static const char expected2[] = "?2D/YQNhB"; + /* libiconv behaviour changed in version 1.13: the result is + '?' U+0FF6 U+1036; this is U+D83F U+D840 U+D841 shifted left + by 6 bits. */ + static const char expected3[] = "?\340\277\266\341\200\266"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected1) + || length == strlen (expected2) + || length == strlen (expected3)); + ASSERT (result != NULL); + if (length == strlen (expected1)) + ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + else if (length == strlen (expected2)) + ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + else + ASSERT (memcmp (result, expected3, strlen (expected3)) == 0); + free (result); + } + break; + } + } # endif } /* ------------------------ Test str_cd_iconveh() ------------------------ */ /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - char *result = str_cd_iconveh (input, - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler); - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char *result = str_cd_iconveh (input, + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler); + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + } + + /* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ). */ + for (indirect = 0; indirect <= 1; indirect++) + { + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + char *result = str_cd_iconveh (input, + (indirect + ? &cdeh_ascii_to_88591_indirectly + : &cdeh_ascii_to_88591), + handler); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ - char *result = str_cd_iconveh (input, - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ + char *result = str_cd_iconveh (input, + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -476,9 +641,8 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; char *result = str_cd_iconveh (input, - cd_88591_to_utf8, - cd_88591_to_utf8, (iconv_t)(-1), - handler); + &cdeh_88591_to_utf8, + handler); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); @@ -491,45 +655,68 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = str_cd_iconveh (input, - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler); + &cdeh_utf8_to_88591, + handler); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); } + /* Test conversion from ASCII to UTF-8 with invalid input (EILSEQ). */ + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + char *result = str_cd_iconveh (input, + &cdeh_ascii_to_utf8, + handler); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } + } + /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_cd_iconveh (input, - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler); + &cdeh_utf8_to_88591, + handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Costs: 27 ?"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Costs: 27 \\u20AC"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Costs: 27 ?"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Costs: 27 \\u20AC"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -538,9 +725,8 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; char *result = str_cd_iconveh (input, - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler); + &cdeh_utf8_to_88591, + handler); ASSERT (result != NULL); ASSERT (strcmp (result, "") == 0); free (result); @@ -564,27 +750,27 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ @@ -593,58 +779,58 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -654,30 +840,30 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "ISO-8859-1", "UTF-8", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "ISO-8859-1", "UTF-8", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ @@ -687,34 +873,34 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "UTF-8", "ISO-8859-1", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - (size_t)(-1))); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "UTF-8", "ISO-8859-1", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + (size_t)(-1))); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -723,61 +909,61 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "UTF-8", "ISO-8859-1", - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "UTF-8", "ISO-8859-1", + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -786,25 +972,25 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "UTF-8", "ISO-8859-1", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == 0); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "UTF-8", "ISO-8859-1", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == 0); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } /* ------------------------- Test str_iconveh() ------------------------- */ @@ -828,27 +1014,27 @@ main () static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ char *result = str_iconveh (input, "ISO-8859-2", "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -882,27 +1068,27 @@ main () static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_iconveh (input, "UTF-8", "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Costs: 27 ?"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Costs: 27 \\u20AC"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Costs: 27 ?"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Costs: 27 \\u20AC"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c index 47e9a46..1da674e 100644 --- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling and autodetection. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -25,22 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -75,27 +63,27 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ @@ -104,58 +92,58 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -165,30 +153,30 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "ISO-8859-1", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "ISO-8859-1", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ @@ -198,34 +186,34 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - (size_t)(-1))); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + (size_t)(-1))); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -234,61 +222,61 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -297,25 +285,25 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == 0); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == 0); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -327,27 +315,27 @@ main () static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "autodetect_jp", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "autodetect_jp", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -355,27 +343,27 @@ main () static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "autodetect_jp", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "autodetect_jp", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -383,33 +371,33 @@ main () static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "autodetect_jp", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 3 : - i == 7 ? 6 : - i == 9 ? 9 : - i == 11 ? 12 : - i == 13 ? 15 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "autodetect_jp", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 3 : + i == 7 ? 6 : + i == 9 ? 9 : + i == 11 ? 12 : + i == 13 ? 15 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif @@ -421,27 +409,27 @@ main () static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ static const char expected[] = "Costs: 27 EUR"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - true, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 13; i++) - ASSERT (offsets[i] == (i < 11 ? i : (size_t)(-1))); - ASSERT (offsets[13] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + true, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 13; i++) + ASSERT (offsets[i] == (i < 11 ? i : (size_t)(-1))); + ASSERT (offsets[13] == MAGIC); + free (offsets); + } + free (result); + } } # endif @@ -466,27 +454,27 @@ main () static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ char *result = str_iconveha (input, "ISO-8859-2", "ISO-8859-1", false, handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -520,27 +508,27 @@ main () static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_iconveha (input, "UTF-8", "ISO-8859-1", false, handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Costs: 27 ?"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Costs: 27 \\u20AC"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Costs: 27 ?"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Costs: 27 \\u20AC"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ diff --git a/tests/test-string.c b/tests/test-string.c index fe53cd9..019a817 100644 --- a/tests/test-string.c +++ b/tests/test-string.c @@ -1,5 +1,5 @@ /* Test of <string.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -27,7 +27,7 @@ verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { return 0; } diff --git a/tests/test-strncat.c b/tests/test-strncat.c new file mode 100644 index 0000000..49cf396 --- /dev/null +++ b/tests/test-strncat.c @@ -0,0 +1,62 @@ +/* Test of strncat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include <string.h> + +#include "signature.h" +SIGNATURE_CHECK (strncat, char *, (char *, const char *, size_t)); + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT char +#define U_STRNCAT strncat +#define MAGIC ((char) 0xBA) +#include "unistr/test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" + in UTF-8 encoding. */ + static const char input[] = + { 'G', 'r', (char) 0xC3, (char) 0xBC, (char) 0xC3, (char) 0x9F, ' ', + 'G', 'o', 't', 't', '.', ' ', (char) 0xD0, (char) 0x97, (char) 0xD0, + (char) 0xB4, (char) 0xD1, (char) 0x80, (char) 0xD0, (char) 0xB0, + (char) 0xD0, (char) 0xB2, (char) 0xD1, (char) 0x81, (char) 0xD1, + (char) 0x82, (char) 0xD0, (char) 0xB2, (char) 0xD1, (char) 0x83, + (char) 0xD0, (char) 0xB9, (char) 0xD1, (char) 0x82, (char) 0xD0, + (char) 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', (char) 0xC2, + (char) 0xB1, 's', 'q', 'r', 't', '(', 'b', (char) 0xC2, (char) 0xB2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + (char) 0xE6, (char) 0x97, (char) 0xA5, (char) 0xE6, (char) 0x9C, + (char) 0xAC, (char) 0xE8, (char) 0xAA, (char) 0x9E, ',', (char) 0xE4, + (char) 0xB8, (char) 0xAD, (char) 0xE6, (char) 0x96, (char) 0x87, ',', + (char) 0xED, (char) 0x95, (char) 0x9C, (char) 0xEA, (char) 0xB8, + (char) 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/test-unistd.c b/tests/test-unistd.c index 129367b..ec02eee 100644 --- a/tests/test-unistd.c +++ b/tests/test-unistd.c @@ -1,5 +1,5 @@ /* Test of <unistd.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -50,7 +50,7 @@ intptr_t t8; #endif int -main () +main (void) { return 0; } diff --git a/tests/test-unsetenv.c b/tests/test-unsetenv.c new file mode 100644 index 0000000..7b92ff3 --- /dev/null +++ b/tests/test-unsetenv.c @@ -0,0 +1,61 @@ +/* Tests of unsetenv. + Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Eric Blake <ebb9@byu.net>, 2009. */ + +#include <config.h> + +#include <stdlib.h> + +#include "signature.h" +SIGNATURE_CHECK (unsetenv, int, (char const *)); + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include "macros.h" + +int +main (void) +{ + char entry[] = "b=2"; + + /* Test removal when multiple entries present. */ + ASSERT (putenv ((char *) "a=1") == 0); + ASSERT (putenv (entry) == 0); + entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point. */ + ASSERT (unsetenv ("a") == 0); /* Both entries will be removed. */ + ASSERT (getenv ("a") == NULL); + ASSERT (unsetenv ("a") == 0); + + /* Required to fail with EINVAL. */ + errno = 0; + ASSERT (unsetenv ("") == -1); + ASSERT (errno == EINVAL); + errno = 0; + ASSERT (unsetenv ("a=b") == -1); + ASSERT (errno == EINVAL); +#if 0 + /* glibc and gnulib's implementation guarantee this, but POSIX no + longer requires it: http://austingroupbugs.net/view.php?id=185 */ + errno = 0; + ASSERT (unsetenv (NULL) == -1); + ASSERT (errno == EINVAL); +#endif + + return 0; +} diff --git a/tests/test-wchar.c b/tests/test-wchar.c index 2866068..2a03d6b 100644 --- a/tests/test-wchar.c +++ b/tests/test-wchar.c @@ -1,5 +1,5 @@ /* Test of <wchar.h> substitute. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -31,7 +31,7 @@ wint_t b = 'x'; verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { return 0; } diff --git a/tests/test-wctype.c b/tests/test-wctype.c index c2d8601..5db215e 100644 --- a/tests/test-wctype.c +++ b/tests/test-wctype.c @@ -1,5 +1,5 @@ /* Test of <wctype.h> substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,18 +20,20 @@ #include <wctype.h> +#include "macros.h" + /* Check that the type wint_t is defined. */ wint_t a = 'x'; +/* Check that WEOF is defined. */ +wint_t e = WEOF; int -main () +main (void) { /* Check that the isw* functions exist as functions or as macros. */ (void) iswalnum (0); (void) iswalpha (0); -#if 0 /* not portable: missing on mingw */ (void) iswblank (0); -#endif (void) iswcntrl (0); (void) iswdigit (0); (void) iswgraph (0); @@ -42,5 +44,27 @@ main () (void) iswupper (0); (void) iswxdigit (0); + /* Check that the isw* functions map WEOF to 0. */ + ASSERT (!iswalnum (e)); + ASSERT (!iswalpha (e)); + ASSERT (!iswblank (e)); + ASSERT (!iswcntrl (e)); + ASSERT (!iswdigit (e)); + ASSERT (!iswgraph (e)); + ASSERT (!iswlower (e)); + ASSERT (!iswprint (e)); + ASSERT (!iswpunct (e)); + ASSERT (!iswspace (e)); + ASSERT (!iswupper (e)); + ASSERT (!iswxdigit (e)); + + /* Check that the tow* functions exist as functions or as macros. */ + (void) towlower (0); + (void) towupper (0); + + /* Check that the tow* functions map WEOF to WEOF. */ + ASSERT (towlower (e) == e); + ASSERT (towupper (e) == e); + return 0; } diff --git a/tests/test-wcwidth.c b/tests/test-wcwidth.c index 582a8aa..f6f9792 100644 --- a/tests/test-wcwidth.c +++ b/tests/test-wcwidth.c @@ -1,5 +1,5 @@ /* Test of wcwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,24 +20,14 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (wcwidth, int, (wchar_t)); + #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> #include "localcharset.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -51,15 +41,15 @@ main () /* Switch to an UTF-8 locale. */ if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL /* Check whether it's really an UTF-8 locale. - On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE - category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the - LC_CTYPE category is effectively set to an ASCII LC_CTYPE category; - in particular, locale_charset() returns "ASCII". */ + On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE + category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the + LC_CTYPE category is effectively set to an ASCII LC_CTYPE category; + in particular, locale_charset() returns "ASCII". */ && strcmp (locale_charset (), "UTF-8") == 0) { /* Test width of ASCII characters. */ for (wc = 0x20; wc < 0x7F; wc++) - ASSERT (wcwidth (wc) == 1); + ASSERT (wcwidth (wc) == 1); /* Test width of some non-spacing characters. */ ASSERT (wcwidth (0x0301) == 0); diff --git a/tests/test-xalloc-die.c b/tests/test-xalloc-die.c new file mode 100644 index 0000000..67edd92 --- /dev/null +++ b/tests/test-xalloc-die.c @@ -0,0 +1,30 @@ +/* Test of xalloc_die() function. + Copyright (C) 2009, 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */ + +#include <config.h> + +#include "xalloc.h" +#include "progname.h" + +int +main (int argc _GL_UNUSED, char **argv) +{ + set_program_name (argv[0]); + xalloc_die (); + return 0; +} diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh new file mode 100755 index 0000000..80d6208 --- /dev/null +++ b/tests/test-xalloc-die.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Test suite for xalloc_die. +# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# This file is part of the GNUlib Library. +# +# 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 <http://www.gnu.org/licenses/>. + +. "${srcdir=.}/init.sh"; path_prepend_ . + +test-xalloc-die${EXEEXT} 2> err > out +case $? in + 1) ;; + *) Exit 1;; +esac + +tr -d '\015' < err \ + | sed 's,.*test-xalloc-die[.ex]*:,test-xalloc-die:,' > err2 || Exit 1 + +compare - err2 <<\EOF || Exit 1 +test-xalloc-die: memory exhausted +EOF + +test -s out && Exit 1 + +Exit $fail diff --git a/tests/unicase/test-casecmp.h b/tests/unicase/test-casecmp.h index d057f89..eb06113 100644 --- a/tests/unicase/test-casecmp.h +++ b/tests/unicase/test-casecmp.h @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ static void test_ascii (int (*my_casecmp) (const UNIT *, size_t, const UNIT *, size_t, const char *, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/unicase/test-cased.c b/tests/unicase/test-cased.c index 37af3d2..d9cc432 100644 --- a/tests/unicase/test-cased.c +++ b/tests/unicase/test-cased.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character type functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 diff --git a/tests/unicase/test-ignorable.c b/tests/unicase/test-ignorable.c index 94f809e..90f7b8e 100644 --- a/tests/unicase/test-ignorable.c +++ b/tests/unicase/test-ignorable.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character type functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 diff --git a/tests/unicase/test-is-cased.h b/tests/unicase/test-is-cased.h index 474b8a4..a00b8b8 100644 --- a/tests/unicase/test-is-cased.h +++ b/tests/unicase/test-is-cased.h @@ -1,5 +1,5 @@ /* Test of test whether case matters for a Unicode string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-is-casefolded.h b/tests/unicase/test-is-casefolded.h index 99638c6..9a1f3d8 100644 --- a/tests/unicase/test-is-casefolded.h +++ b/tests/unicase/test-is-casefolded.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-is-lowercase.h b/tests/unicase/test-is-lowercase.h index cc37471..b780fcd 100644 --- a/tests/unicase/test-is-lowercase.h +++ b/tests/unicase/test-is-lowercase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-is-titlecase.h b/tests/unicase/test-is-titlecase.h index b36abab..edfc60b 100644 --- a/tests/unicase/test-is-titlecase.h +++ b/tests/unicase/test-is-titlecase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-is-uppercase.h b/tests/unicase/test-is-uppercase.h index d1b7ca1..6134d9d 100644 --- a/tests/unicase/test-is-uppercase.h +++ b/tests/unicase/test-is-uppercase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-locale-language.c b/tests/unicase/test-locale-language.c index e8fe181..4a62261 100644 --- a/tests/unicase/test-locale-language.c +++ b/tests/unicase/test-locale-language.c @@ -1,5 +1,5 @@ /* Test of language code determination. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,21 +21,9 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/unicase/test-mapping-part1.h b/tests/unicase/test-mapping-part1.h index 4b7ac8e..dbb93db 100644 --- a/tests/unicase/test-mapping-part1.h +++ b/tests/unicase/test-mapping-part1.h @@ -1,5 +1,5 @@ /* Test of single character case mapping functions. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -18,23 +18,9 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Pair of Unicode characters. */ typedef struct { ucs4_t ch; ucs4_t value; } pair_t; diff --git a/tests/unicase/test-mapping-part2.h b/tests/unicase/test-mapping-part2.h index ef43cdd..15c24c4 100644 --- a/tests/unicase/test-mapping-part2.h +++ b/tests/unicase/test-mapping-part2.h @@ -1,5 +1,5 @@ /* Test of single character case mapping functions. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -26,7 +26,7 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - ASSERT (MAP (c) == c); + ASSERT (MAP (c) == c); ASSERT (MAP (c) == mapping[i].value); c++; } diff --git a/tests/unicase/test-predicate-part1.h b/tests/unicase/test-predicate-part1.h index 76d804e..8aca7a8 100644 --- a/tests/unicase/test-predicate-part1.h +++ b/tests/unicase/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -18,23 +18,9 @@ #include "unicase/caseprop.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Interval of Unicode characters. */ typedef struct { ucs4_t start; ucs4_t end; } interval_t; diff --git a/tests/unicase/test-predicate-part2.h b/tests/unicase/test-predicate-part2.h index 60b7c24..ac95ba2 100644 --- a/tests/unicase/test-predicate-part2.h +++ b/tests/unicase/test-predicate-part2.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -26,9 +26,9 @@ main () for (i = 0; i < SIZEOF (set); i++) { for (; c < set[i].start; c++) - ASSERT (!PREDICATE (c)); + ASSERT (!PREDICATE (c)); for (; c <= set[i].end; c++) - ASSERT (PREDICATE (c)); + ASSERT (PREDICATE (c)); } for (; c < 0x110000; c++) ASSERT (!PREDICATE (c)); diff --git a/tests/unicase/test-u16-casecmp.c b/tests/unicase/test-u16-casecmp.c index f079bbf..d70b356 100644 --- a/tests/unicase/test-u16-casecmp.c +++ b/tests/unicase/test-u16-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-casecmp.h" @@ -127,27 +112,27 @@ test_nonascii (int (*my_casecmp) (const uint16_t *, size_t, const uint16_t *, si { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input1[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t input2[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t input3[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; int cmp; @@ -277,21 +262,21 @@ test_nonascii (int (*my_casecmp) (const uint16_t *, size_t, const uint16_t *, si { /* "περισσότερες πληροφορίες" */ static const uint16_t input1[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t input2[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; static const uint16_t input3[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; int cmp; diff --git a/tests/unicase/test-u16-casecoll.c b/tests/unicase/test-u16-casecoll.c index 5428cf0..253aadc 100644 --- a/tests/unicase/test-u16-casecoll.c +++ b/tests/unicase/test-u16-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u16-casefold.c b/tests/unicase/test-u16-casefold.c index 3f4f633..1c188e4 100644 --- a/tests/unicase/test-u16-casefold.c +++ b/tests/unicase/test-u16-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_casefold (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casefolded[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } @@ -186,15 +173,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint16_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t casefolded[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } diff --git a/tests/unicase/test-u16-is-cased.c b/tests/unicase/test-u16-is-cased.c index a4b9dc3..801d4ee 100644 --- a/tests/unicase/test-u16-is-cased.c +++ b/tests/unicase/test-u16-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-16 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u16-is-casefolded.c b/tests/unicase/test-u16-is-casefolded.c index 8c0122d..cd242f6 100644 --- a/tests/unicase/test-u16-is-casefolded.c +++ b/tests/unicase/test-u16-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u16-is-lowercase.c b/tests/unicase/test-u16-is-lowercase.c index f7bea49..9f17439 100644 --- a/tests/unicase/test-u16-is-lowercase.c +++ b/tests/unicase/test-u16-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u16-is-titlecase.c b/tests/unicase/test-u16-is-titlecase.c index 6b1c6d1..e7000db 100644 --- a/tests/unicase/test-u16-is-titlecase.c +++ b/tests/unicase/test-u16-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u16-is-uppercase.c b/tests/unicase/test-u16-is-uppercase.c index 1acf705..9844846 100644 --- a/tests/unicase/test-u16-is-uppercase.c +++ b/tests/unicase/test-u16-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u16-tolower.c b/tests/unicase/test-u16-tolower.c index 5ec764c..af5f9d2 100644 --- a/tests/unicase/test-u16-tolower.c +++ b/tests/unicase/test-u16-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_tolower (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casemapped[] = { 'g', 'r', 0x00FC, 0x00DF, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -173,15 +160,15 @@ main () { /* "ΠΕΡΙΣΣΌΤΕΡΕΣ ΠΛΗΡΟΦΟΡΊΕΣ" */ static const uint16_t input[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; static const uint16_t casemapped[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u16-totitle.c b/tests/unicase/test-u16-totitle.c index 3839c90..e08b82e 100644 --- a/tests/unicase/test-u16-totitle.c +++ b/tests/unicase/test-u16-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_totitle (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "GRÜß GOTT. ЗДРАВСТВУЙТЕ! X=(-B±SQRT(B²-4AC))/(2A) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'R', 0x00DC, 0x00DF, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casemapped[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, - '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, + '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint16_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t casemapped[] = { - 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u16-toupper.c b/tests/unicase/test-u16-toupper.c index ed9fd6b..ec87fc7 100644 --- a/tests/unicase/test-u16-toupper.c +++ b/tests/unicase/test-u16-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_toupper (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casemapped[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint16_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t casemapped[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u32-casecmp.c b/tests/unicase/test-u32-casecmp.c index 8d58bc7..97f6277 100644 --- a/tests/unicase/test-u32-casecmp.c +++ b/tests/unicase/test-u32-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-casecmp.h" @@ -127,27 +112,27 @@ test_nonascii (int (*my_casecmp) (const uint32_t *, size_t, const uint32_t *, si { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input1[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t input2[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t input3[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; int cmp; @@ -277,21 +262,21 @@ test_nonascii (int (*my_casecmp) (const uint32_t *, size_t, const uint32_t *, si { /* "περισσότερες πληροφορίες" */ static const uint32_t input1[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t input2[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; static const uint32_t input3[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; int cmp; diff --git a/tests/unicase/test-u32-casecoll.c b/tests/unicase/test-u32-casecoll.c index 23edfbd..65e2aed 100644 --- a/tests/unicase/test-u32-casecoll.c +++ b/tests/unicase/test-u32-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u32-casefold.c b/tests/unicase/test-u32-casefold.c index d48e8dc..77b037d 100644 --- a/tests/unicase/test-u32-casefold.c +++ b/tests/unicase/test-u32-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_casefold (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casefolded[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } @@ -186,15 +173,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint32_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t casefolded[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } diff --git a/tests/unicase/test-u32-is-cased.c b/tests/unicase/test-u32-is-cased.c index d8353fc..6f0f535 100644 --- a/tests/unicase/test-u32-is-cased.c +++ b/tests/unicase/test-u32-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-32 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u32-is-casefolded.c b/tests/unicase/test-u32-is-casefolded.c index d79241d..440c8d3 100644 --- a/tests/unicase/test-u32-is-casefolded.c +++ b/tests/unicase/test-u32-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u32-is-lowercase.c b/tests/unicase/test-u32-is-lowercase.c index 2cff392..a4b9511 100644 --- a/tests/unicase/test-u32-is-lowercase.c +++ b/tests/unicase/test-u32-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u32-is-titlecase.c b/tests/unicase/test-u32-is-titlecase.c index 2c287e9..0ce2498 100644 --- a/tests/unicase/test-u32-is-titlecase.c +++ b/tests/unicase/test-u32-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u32-is-uppercase.c b/tests/unicase/test-u32-is-uppercase.c index 0044ec1..b1b8320 100644 --- a/tests/unicase/test-u32-is-uppercase.c +++ b/tests/unicase/test-u32-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u32-tolower.c b/tests/unicase/test-u32-tolower.c index 7f348da..530f0e7 100644 --- a/tests/unicase/test-u32-tolower.c +++ b/tests/unicase/test-u32-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_tolower (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casemapped[] = { 'g', 'r', 0x00FC, 0x00DF, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -173,15 +160,15 @@ main () { /* "ΠΕΡΙΣΣΌΤΕΡΕΣ ΠΛΗΡΟΦΟΡΊΕΣ" */ static const uint32_t input[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; static const uint32_t casemapped[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u32-totitle.c b/tests/unicase/test-u32-totitle.c index 82c4b0f..9e1b3e6 100644 --- a/tests/unicase/test-u32-totitle.c +++ b/tests/unicase/test-u32-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_totitle (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "GRÜß GOTT. ЗДРАВСТВУЙТЕ! X=(-B±SQRT(B²-4AC))/(2A) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'R', 0x00DC, 0x00DF, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casemapped[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, - '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, + '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint32_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t casemapped[] = { - 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u32-toupper.c b/tests/unicase/test-u32-toupper.c index dbc1619..17ce1fe 100644 --- a/tests/unicase/test-u32-toupper.c +++ b/tests/unicase/test-u32-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_toupper (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casemapped[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint32_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t casemapped[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u8-casecmp.c b/tests/unicase/test-u8-casecmp.c index dbcc9d7..cb854eb 100644 --- a/tests/unicase/test-u8-casecmp.c +++ b/tests/unicase/test-u8-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-casecmp.h" @@ -127,33 +112,33 @@ test_nonascii (int (*my_casecmp) (const uint8_t *, size_t, const uint8_t *, size { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input1[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t input2[] = { 'g', 'r', 0xC3, 0xBC, 0x73, 0x73, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t input3[] = { 'G', 'R', 0xC3, 0x9C, 0x53, 0x53, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; int cmp; @@ -283,24 +268,24 @@ test_nonascii (int (*my_casecmp) (const uint8_t *, size_t, const uint8_t *, size { /* "περισσότερες πληροφορίες" */ static const uint8_t input1[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t input2[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 }; static const uint8_t input3[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; int cmp; diff --git a/tests/unicase/test-u8-casecoll.c b/tests/unicase/test-u8-casecoll.c index e1b0c57..861ee2c 100644 --- a/tests/unicase/test-u8-casecoll.c +++ b/tests/unicase/test-u8-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u8-casefold.c b/tests/unicase/test-u8-casefold.c index 225b997..b110d5c 100644 --- a/tests/unicase/test-u8-casefold.c +++ b/tests/unicase/test-u8-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_casefold (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casefolded[] = { 'g', 'r', 0xC3, 0xBC, 0x73, 0x73, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } @@ -190,17 +177,17 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint8_t input[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t casefolded[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } diff --git a/tests/unicase/test-u8-is-cased.c b/tests/unicase/test-u8-is-cased.c index 984f81b..15109ba 100644 --- a/tests/unicase/test-u8-is-cased.c +++ b/tests/unicase/test-u8-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-8 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u8-is-casefolded.c b/tests/unicase/test-u8-is-casefolded.c index b727f6b..fc421ab 100644 --- a/tests/unicase/test-u8-is-casefolded.c +++ b/tests/unicase/test-u8-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u8-is-lowercase.c b/tests/unicase/test-u8-is-lowercase.c index 230e77c..2b0800f 100644 --- a/tests/unicase/test-u8-is-lowercase.c +++ b/tests/unicase/test-u8-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u8-is-titlecase.c b/tests/unicase/test-u8-is-titlecase.c index fb803ea..40716a1 100644 --- a/tests/unicase/test-u8-is-titlecase.c +++ b/tests/unicase/test-u8-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u8-is-uppercase.c b/tests/unicase/test-u8-is-uppercase.c index c66bf39..a6be37e 100644 --- a/tests/unicase/test-u8-is-uppercase.c +++ b/tests/unicase/test-u8-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u8-tolower.c b/tests/unicase/test-u8-tolower.c index 6c0a5df..8c625e8 100644 --- a/tests/unicase/test-u8-tolower.c +++ b/tests/unicase/test-u8-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_tolower (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casemapped[] = { 'g', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -177,17 +164,17 @@ main () { /* "ΠΕΡΙΣΣΌΤΕΡΕΣ ΠΛΗΡΟΦΟΡΊΕΣ" */ static const uint8_t input[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; static const uint8_t casemapped[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u8-totitle.c b/tests/unicase/test-u8-totitle.c index c2506ac..93284c0 100644 --- a/tests/unicase/test-u8-totitle.c +++ b/tests/unicase/test-u8-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_totitle (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "GRÜß GOTT. ЗДРАВСТВУЙТЕ! X=(-B±SQRT(B²-4AC))/(2A) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'R', 0xC3, 0x9C, 0xC3, 0x9F, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casemapped[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'q', 'r', 't', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'q', 'r', 't', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -189,17 +176,17 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint8_t input[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t casemapped[] = { - 0xCE, 0xA0, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCE, 0xA0, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCE, 0xA0, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCE, 0xA0, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u8-toupper.c b/tests/unicase/test-u8-toupper.c index 41e536b..23e418f 100644 --- a/tests/unicase/test-u8-toupper.c +++ b/tests/unicase/test-u8-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_toupper (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casemapped[] = { 'G', 'R', 0xC3, 0x9C, 0x53, 0x53, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -189,17 +176,17 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint8_t input[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t casemapped[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-uc_tolower.c b/tests/unicase/test-uc_tolower.c index 302e26b..6ed3fde 100644 --- a/tests/unicase/test-uc_tolower.c +++ b/tests/unicase/test-uc_tolower.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character mapping functions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-uc_totitle.c b/tests/unicase/test-uc_totitle.c index 9064a41..e187bd4 100644 --- a/tests/unicase/test-uc_totitle.c +++ b/tests/unicase/test-uc_totitle.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character mapping functions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-uc_toupper.c b/tests/unicase/test-uc_toupper.c index ed242a0..481e9f0 100644 --- a/tests/unicase/test-uc_toupper.c +++ b/tests/unicase/test-uc_toupper.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character mapping functions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/unicase/test-ulc-casecmp.c b/tests/unicase/test-ulc-casecmp.c index 5450ef3..fd86613 100644 --- a/tests/unicase/test-ulc-casecmp.c +++ b/tests/unicase/test-ulc-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,21 +21,7 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT char #include "test-casecmp.h" @@ -173,33 +159,33 @@ test_utf_8 (int (*my_casecmp) (const char *, size_t, const char *, size_t, const { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const char input1[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const char input2[] = { 'g', 'r', 0xC3, 0xBC, 0x73, 0x73, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const char input3[] = { 'G', 'R', 0xC3, 0x9C, 0x53, 0x53, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; int cmp; @@ -329,24 +315,24 @@ test_utf_8 (int (*my_casecmp) (const char *, size_t, const char *, size_t, const { /* "περισσότερες πληροφορίες" */ static const char input1[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const char input2[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 }; static const char input3[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; int cmp; @@ -394,14 +380,14 @@ main (int argc, char *argv[]) switch (argv[1][0]) { case '1': - /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ - test_iso_8859_1 (ulc_casecmp); - return 0; + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + test_iso_8859_1 (ulc_casecmp); + return 0; case '2': - /* Locale encoding is UTF-8. */ - test_utf_8 (ulc_casecmp); - return 0; + /* Locale encoding is UTF-8. */ + test_utf_8 (ulc_casecmp); + return 0; } return 1; diff --git a/tests/unicase/test-ulc-casecoll.c b/tests/unicase/test-ulc-casecoll.c index a0875f4..d3b759c 100644 --- a/tests/unicase/test-ulc-casecoll.c +++ b/tests/unicase/test-ulc-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -22,23 +22,9 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT char #include "test-casecmp.h" diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c index 1d1594e..05e8b24 100644 --- a/tests/uniconv/test-u16-conv-from-enc.c +++ b/tests/uniconv/test-u16-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-16 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,24 +20,11 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -69,31 +56,31 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint16_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("ISO-8859-1", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("ISO-8859-1", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to UTF-16 with no errors. */ @@ -102,30 +89,30 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint16_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("ISO-8859-2", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("ISO-8859-2", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -136,93 +123,93 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 1 : - i == 7 ? 2 : - i == 9 ? 3 : - i == 11 ? 4 : - i == 13 ? 5 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 1 : + i == 7 ? 2 : + i == 9 ? 3 : + i == 11 ? 4 : + i == 13 ? 5 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c index a2dc3c6..27b2b44 100644 --- a/tests/uniconv/test-u16-conv-to-enc.c +++ b/tests/uniconv/test-u16-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -67,32 +55,32 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length; - char *result = u16_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length; + char *result = u16_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-16 to ISO-8859-1 with EILSEQ. */ @@ -100,61 +88,61 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length = 0xdead; - char *result = u16_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL); - ASSERT (errno == EILSEQ); - ASSERT (length == 0xdead); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length = 0xdead; + char *result = u16_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + ASSERT (length == 0xdead); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0 + || memcmp (result, expected_translit, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-16 to ISO-8859-1 with EINVAL. */ @@ -163,23 +151,23 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = { 0xD845 }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length; - char *result = u16_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen ("")); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length; + char *result = u16_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen ("")); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } #endif diff --git a/tests/uniconv/test-u16-strconv-from-enc.c b/tests/uniconv/test-u16-strconv-from-enc.c index 492898d..fb6696a 100644 --- a/tests/uniconv/test-u16-strconv-from-enc.c +++ b/tests/uniconv/test-u16-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-16 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -55,11 +42,11 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint16_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -72,10 +59,10 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint16_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "ISO-8859-2", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -90,9 +77,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -103,9 +90,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -116,9 +103,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c index 95a7206..819a993 100644 --- a/tests/uniconv/test-u16-strconv-to-enc.c +++ b/tests/uniconv/test-u16-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -54,11 +42,11 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = u16_strconv_to_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); @@ -71,35 +59,35 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; char *result = u16_strconv_to_encoding (input, "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0 - || strcmp (result, expected_translit) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + || strcmp (result, expected_translit) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } # if 0 diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c index 3464084..6dcb615 100644 --- a/tests/uniconv/test-u32-conv-from-enc.c +++ b/tests/uniconv/test-u32-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-32 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,24 +20,11 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -69,31 +56,31 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint32_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("ISO-8859-1", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("ISO-8859-1", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to UTF-16 with no errors. */ @@ -102,30 +89,30 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint32_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("ISO-8859-2", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("ISO-8859-2", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -136,93 +123,93 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 1 : - i == 7 ? 2 : - i == 9 ? 3 : - i == 11 ? 4 : - i == 13 ? 5 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 1 : + i == 7 ? 2 : + i == 9 ? 3 : + i == 11 ? 4 : + i == 13 ? 5 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c index 585b737..24cb72a 100644 --- a/tests/uniconv/test-u32-conv-to-enc.c +++ b/tests/uniconv/test-u32-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -67,32 +55,32 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length; - char *result = u32_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length; + char *result = u32_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-32 to ISO-8859-1 with EILSEQ. */ @@ -100,61 +88,61 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length = 0xdead; - char *result = u32_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL); - ASSERT (errno == EILSEQ); - ASSERT (length == 0xdead); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length = 0xdead; + char *result = u32_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + ASSERT (length == 0xdead); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0 + || memcmp (result, expected_translit, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } #endif diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c index 2c0e04b..e1a46f5 100644 --- a/tests/uniconv/test-u32-strconv-from-enc.c +++ b/tests/uniconv/test-u32-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-32 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -55,11 +42,11 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint32_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -72,10 +59,10 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint32_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "ISO-8859-2", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -90,9 +77,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -103,9 +90,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -116,9 +103,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c index eef3d04..2ce125c 100644 --- a/tests/uniconv/test-u32-strconv-to-enc.c +++ b/tests/uniconv/test-u32-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,22 +21,9 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -54,11 +41,11 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = u32_strconv_to_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); @@ -71,35 +58,35 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; char *result = u32_strconv_to_encoding (input, "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0 - || strcmp (result, expected_translit) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + || strcmp (result, expected_translit) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } #endif diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c index ec8703c..9655c75 100644 --- a/tests/uniconv/test-u8-conv-from-enc.c +++ b/tests/uniconv/test-u8-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-8 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,24 +20,11 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -70,28 +57,28 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint8_t expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("ISO-8859-1", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("ISO-8859-1", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to UTF-8 with no errors. */ @@ -101,26 +88,26 @@ main () static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint8_t expected[] = "Rafa\305\202 Maszkowski"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("ISO-8859-2", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 1)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("ISO-8859-2", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 1)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -132,25 +119,25 @@ main () static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -158,25 +145,25 @@ main () static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -184,31 +171,31 @@ main () static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 3 : - i == 7 ? 6 : - i == 9 ? 9 : - i == 11 ? 12 : - i == 13 ? 15 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 3 : + i == 7 ? 6 : + i == 9 ? 9 : + i == 11 ? 12 : + i == 13 ? 15 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c index 271fb05..d758e9b 100644 --- a/tests/uniconv/test-u8-conv-to-enc.c +++ b/tests/uniconv/test-u8-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,24 +21,11 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -71,33 +58,33 @@ main () static const uint8_t input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); - size_t length; - char *result = u8_conv_to_encoding ("ISO-8859-1", handler, - input, u8_strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - i == 40 ? (size_t)(-1) : - i - 4)); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); + size_t length; + char *result = u8_conv_to_encoding ("ISO-8859-1", handler, + input, u8_strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + i == 40 ? (size_t)(-1) : + i - 4)); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -106,60 +93,60 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); - size_t length = 0xdead; - char *result = u8_conv_to_encoding ("ISO-8859-1", handler, - input, u8_strlen (input), - offsets, - NULL, &length); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL); - ASSERT (errno == EILSEQ); - ASSERT (length == 0xdead); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); + size_t length = 0xdead; + char *result = u8_conv_to_encoding ("ISO-8859-1", handler, + input, u8_strlen (input), + offsets, + NULL, &length); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + ASSERT (length == 0xdead); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0 + || memcmp (result, expected_translit, length) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -168,23 +155,23 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); - size_t length; - char *result = u8_conv_to_encoding ("ISO-8859-1", handler, - input, u8_strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen ("")); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); + size_t length; + char *result = u8_conv_to_encoding ("ISO-8859-1", handler, + input, u8_strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen ("")); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } #endif diff --git a/tests/uniconv/test-u8-strconv-from-enc.c b/tests/uniconv/test-u8-strconv-from-enc.c index 8c32ee6..30ebe76 100644 --- a/tests/uniconv/test-u8-strconv-from-enc.c +++ b/tests/uniconv/test-u8-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-8 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c index 73085b5..bbdb6d8 100644 --- a/tests/uniconv/test-u8-strconv-to-enc.c +++ b/tests/uniconv/test-u8-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -68,29 +56,29 @@ main () static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ char *result = u8_strconv_to_encoding (input, "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0 - || strcmp (result, expected_translit) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + || strcmp (result, expected_translit) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } # if 0 diff --git a/tests/unictype/test-bidi_byname.c b/tests/unictype/test-bidi_byname.c index 5b1cfec..9139131 100644 --- a/tests/unictype/test-bidi_byname.c +++ b/tests/unictype/test-bidi_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -18,27 +18,34 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () { + ASSERT (uc_bidi_category_byname ("L") == UC_BIDI_L); + ASSERT (uc_bidi_category_byname ("LRE") == UC_BIDI_LRE); + ASSERT (uc_bidi_category_byname ("LRO") == UC_BIDI_LRO); + ASSERT (uc_bidi_category_byname ("R") == UC_BIDI_R); + ASSERT (uc_bidi_category_byname ("AL") == UC_BIDI_AL); + ASSERT (uc_bidi_category_byname ("RLE") == UC_BIDI_RLE); + ASSERT (uc_bidi_category_byname ("RLO") == UC_BIDI_RLO); + ASSERT (uc_bidi_category_byname ("PDF") == UC_BIDI_PDF); + ASSERT (uc_bidi_category_byname ("EN") == UC_BIDI_EN); + ASSERT (uc_bidi_category_byname ("ES") == UC_BIDI_ES); + ASSERT (uc_bidi_category_byname ("ET") == UC_BIDI_ET); + ASSERT (uc_bidi_category_byname ("AN") == UC_BIDI_AN); + ASSERT (uc_bidi_category_byname ("CS") == UC_BIDI_CS); ASSERT (uc_bidi_category_byname ("NSM") == UC_BIDI_NSM); + ASSERT (uc_bidi_category_byname ("BN") == UC_BIDI_BN); + ASSERT (uc_bidi_category_byname ("B") == UC_BIDI_B); + ASSERT (uc_bidi_category_byname ("S") == UC_BIDI_S); + ASSERT (uc_bidi_category_byname ("WS") == UC_BIDI_WS); + ASSERT (uc_bidi_category_byname ("ON") == UC_BIDI_ON); ASSERT (uc_bidi_category_byname ("X") < 0); + ASSERT (uc_bidi_category_byname ("") < 0); return 0; } diff --git a/tests/unictype/test-bidi_name.c b/tests/unictype/test-bidi_name.c index a444ec0..1a4ef0b 100644 --- a/tests/unictype/test-bidi_name.c +++ b/tests/unictype/test-bidi_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_of.c b/tests/unictype/test-bidi_of.c index 720e9f9..91fda15 100644 --- a/tests/unictype/test-bidi_of.c +++ b/tests/unictype/test-bidi_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_test.c b/tests/unictype/test-bidi_test.c index 3404e72..c9e7b39 100644 --- a/tests/unictype/test-bidi_test.c +++ b/tests/unictype/test-bidi_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-block_list.c b/tests/unictype/test-block_list.c index 140b573..d475546 100644 --- a/tests/unictype/test-block_list.c +++ b/tests/unictype/test-block_list.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -49,10 +37,10 @@ main () for (i = 0; i < nblocks; i++) { - if (strcmp (blocks[i].name, "Latin") == 0) - latin_block = &blocks[i]; - if (strcmp (blocks[i].name, "Hebrew") == 0) - hebrew_block = &blocks[i]; + if (strcmp (blocks[i].name, "Latin") == 0) + latin_block = &blocks[i]; + if (strcmp (blocks[i].name, "Hebrew") == 0) + hebrew_block = &blocks[i]; } ASSERT (latin_block == NULL); ASSERT (hebrew_block != NULL); diff --git a/tests/unictype/test-block_of.c b/tests/unictype/test-block_of.c index 9460cde..230fa87 100644 --- a/tests/unictype/test-block_of.c +++ b/tests/unictype/test-block_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -45,8 +33,8 @@ main () for (c = 0; c < 0x110000; c++) { - const uc_block_t *block = uc_block (c); - ASSERT (block == NULL || uc_is_block (c, block)); + const uc_block_t *block = uc_block (c); + ASSERT (block == NULL || uc_is_block (c, block)); } } @@ -59,19 +47,19 @@ main () for (i = 0; i < nblocks; i++) { - if (strcmp (blocks[i].name, "Hebrew") == 0) - { - ASSERT (uc_block (0x05DE) == &blocks[i]); - ASSERT (uc_is_block (0x05DE, &blocks[i])); - } + if (strcmp (blocks[i].name, "Hebrew") == 0) + { + ASSERT (uc_block (0x05DE) == &blocks[i]); + ASSERT (uc_is_block (0x05DE, &blocks[i])); + } } for (i = 0; i < nblocks; i++) { - unsigned int c; + unsigned int c; - for (c = blocks[i].start; c <= blocks[i].end; c++) - ASSERT (uc_block (c) == &blocks[i]); + for (c = blocks[i].start; c <= blocks[i].end; c++) + ASSERT (uc_block (c) == &blocks[i]); } } diff --git a/tests/unictype/test-block_test.c b/tests/unictype/test-block_test.c index b086cde..8971a39 100644 --- a/tests/unictype/test-block_test.c +++ b/tests/unictype/test-block_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_and.c b/tests/unictype/test-categ_and.c index 5531ff4..70d28cc 100644 --- a/tests/unictype/test-categ_and.c +++ b/tests/unictype/test-categ_and.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_and_not.c b/tests/unictype/test-categ_and_not.c index 90b40f8..72afe83 100644 --- a/tests/unictype/test-categ_and_not.c +++ b/tests/unictype/test-categ_and_not.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_byname.c b/tests/unictype/test-categ_byname.c index 3bb44e9..0da1625 100644 --- a/tests/unictype/test-categ_byname.c +++ b/tests/unictype/test-categ_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -18,26 +18,63 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> +#include <stdbool.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" + +static bool +category_equals (uc_general_category_t category1, + uc_general_category_t category2) +{ + return (category1.bitmask == category2.bitmask + && category1.generic == category2.generic + && (category1.generic + ? category1.lookup.lookup_fn == category2.lookup.lookup_fn + : category1.lookup.table == category2.lookup.table)); +} int main () { - uc_general_category_byname ("L"); + ASSERT (category_equals (uc_general_category_byname ("L"), UC_CATEGORY_L)); + ASSERT (category_equals (uc_general_category_byname ("Lu"), UC_CATEGORY_Lu)); + ASSERT (category_equals (uc_general_category_byname ("Ll"), UC_CATEGORY_Ll)); + ASSERT (category_equals (uc_general_category_byname ("Lt"), UC_CATEGORY_Lt)); + ASSERT (category_equals (uc_general_category_byname ("Lm"), UC_CATEGORY_Lm)); + ASSERT (category_equals (uc_general_category_byname ("Lo"), UC_CATEGORY_Lo)); + ASSERT (category_equals (uc_general_category_byname ("M"), UC_CATEGORY_M)); + ASSERT (category_equals (uc_general_category_byname ("Mn"), UC_CATEGORY_Mn)); + ASSERT (category_equals (uc_general_category_byname ("Mc"), UC_CATEGORY_Mc)); + ASSERT (category_equals (uc_general_category_byname ("Me"), UC_CATEGORY_Me)); + ASSERT (category_equals (uc_general_category_byname ("N"), UC_CATEGORY_N)); + ASSERT (category_equals (uc_general_category_byname ("Nd"), UC_CATEGORY_Nd)); + ASSERT (category_equals (uc_general_category_byname ("Nl"), UC_CATEGORY_Nl)); + ASSERT (category_equals (uc_general_category_byname ("No"), UC_CATEGORY_No)); + ASSERT (category_equals (uc_general_category_byname ("P"), UC_CATEGORY_P)); + ASSERT (category_equals (uc_general_category_byname ("Pc"), UC_CATEGORY_Pc)); + ASSERT (category_equals (uc_general_category_byname ("Pd"), UC_CATEGORY_Pd)); + ASSERT (category_equals (uc_general_category_byname ("Ps"), UC_CATEGORY_Ps)); + ASSERT (category_equals (uc_general_category_byname ("Pe"), UC_CATEGORY_Pe)); + ASSERT (category_equals (uc_general_category_byname ("Pi"), UC_CATEGORY_Pi)); + ASSERT (category_equals (uc_general_category_byname ("Pf"), UC_CATEGORY_Pf)); + ASSERT (category_equals (uc_general_category_byname ("Po"), UC_CATEGORY_Po)); + ASSERT (category_equals (uc_general_category_byname ("S"), UC_CATEGORY_S)); + ASSERT (category_equals (uc_general_category_byname ("Sm"), UC_CATEGORY_Sm)); + ASSERT (category_equals (uc_general_category_byname ("Sc"), UC_CATEGORY_Sc)); + ASSERT (category_equals (uc_general_category_byname ("Sk"), UC_CATEGORY_Sk)); + ASSERT (category_equals (uc_general_category_byname ("So"), UC_CATEGORY_So)); + ASSERT (category_equals (uc_general_category_byname ("Z"), UC_CATEGORY_Z)); + ASSERT (category_equals (uc_general_category_byname ("Zs"), UC_CATEGORY_Zs)); + ASSERT (category_equals (uc_general_category_byname ("Zl"), UC_CATEGORY_Zl)); + ASSERT (category_equals (uc_general_category_byname ("Zp"), UC_CATEGORY_Zp)); + ASSERT (category_equals (uc_general_category_byname ("C"), UC_CATEGORY_C)); + ASSERT (category_equals (uc_general_category_byname ("Cc"), UC_CATEGORY_Cc)); + ASSERT (category_equals (uc_general_category_byname ("Cf"), UC_CATEGORY_Cf)); + ASSERT (category_equals (uc_general_category_byname ("Cs"), UC_CATEGORY_Cs)); + ASSERT (category_equals (uc_general_category_byname ("Co"), UC_CATEGORY_Co)); + ASSERT (category_equals (uc_general_category_byname ("Cn"), UC_CATEGORY_Cn)); + uc_general_category_byname ("Nl"); { diff --git a/tests/unictype/test-categ_name.c b/tests/unictype/test-categ_name.c index b5c3f75..bef6600 100644 --- a/tests/unictype/test-categ_name.c +++ b/tests/unictype/test-categ_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_none.c b/tests/unictype/test-categ_none.c index f800241..bc0a9a7 100644 --- a/tests/unictype/test-categ_none.c +++ b/tests/unictype/test-categ_none.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_of.c b/tests/unictype/test-categ_of.c index 28ee663..26d0463 100644 --- a/tests/unictype/test-categ_of.c +++ b/tests/unictype/test-categ_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_or.c b/tests/unictype/test-categ_or.c index 6b07de5..7973eb0 100644 --- a/tests/unictype/test-categ_or.c +++ b/tests/unictype/test-categ_or.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_test_withtable.c b/tests/unictype/test-categ_test_withtable.c index b735132..8e52a37 100644 --- a/tests/unictype/test-categ_test_withtable.c +++ b/tests/unictype/test-categ_test_withtable.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-combining.c b/tests/unictype/test-combining.c index 3e66a9b..d890f1d 100644 --- a/tests/unictype/test-combining.c +++ b/tests/unictype/test-combining.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-decdigit.c b/tests/unictype/test-decdigit.c index 3d91690..f94605e 100644 --- a/tests/unictype/test-decdigit.c +++ b/tests/unictype/test-decdigit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int value; } mapping[] = { @@ -50,7 +37,7 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - ASSERT (uc_decimal_value (c) == -1); + ASSERT (uc_decimal_value (c) == -1); /* Here c = mapping[i].ch. */ ASSERT (uc_decimal_value (c) == mapping[i].value); c++; diff --git a/tests/unictype/test-digit.c b/tests/unictype/test-digit.c index efecaab..e87f3f7 100644 --- a/tests/unictype/test-digit.c +++ b/tests/unictype/test-digit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int value; } mapping[] = { @@ -50,7 +37,7 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - ASSERT (uc_digit_value (c) == -1); + ASSERT (uc_digit_value (c) == -1); /* Here c = mapping[i].ch. */ ASSERT (uc_digit_value (c) == mapping[i].value); c++; diff --git a/tests/unictype/test-mirror.c b/tests/unictype/test-mirror.c index fb4402f..457c502 100644 --- a/tests/unictype/test-mirror.c +++ b/tests/unictype/test-mirror.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-numeric.c b/tests/unictype/test-numeric.c index 5bca363..d602383 100644 --- a/tests/unictype/test-numeric.c +++ b/tests/unictype/test-numeric.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int numerator; int denominator; } mapping[] = @@ -52,14 +39,14 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - { - value = uc_numeric_value (c); - ASSERT (value.numerator == 0 && value.denominator == 0); - } + { + value = uc_numeric_value (c); + ASSERT (value.numerator == 0 && value.denominator == 0); + } /* Here c = mapping[i].ch. */ value = uc_numeric_value (c); ASSERT (value.numerator == mapping[i].numerator - && value.denominator == mapping[i].denominator); + && value.denominator == mapping[i].denominator); c++; } for (; c < 0x110000; c++) diff --git a/tests/unictype/test-pr_byname.c b/tests/unictype/test-pr_byname.c index 770d4c8..aa2676f 100644 --- a/tests/unictype/test-pr_byname.c +++ b/tests/unictype/test-pr_byname.c @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-pr_test.c b/tests/unictype/test-pr_test.c index 388ae00..6bacc07 100644 --- a/tests/unictype/test-pr_test.c +++ b/tests/unictype/test-pr_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-predicate-part1.h b/tests/unictype/test-predicate-part1.h index e81de47..1031856 100644 --- a/tests/unictype/test-predicate-part1.h +++ b/tests/unictype/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,23 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Interval of Unicode characters. */ typedef struct { ucs4_t start; ucs4_t end; } interval_t; diff --git a/tests/unictype/test-predicate-part2.h b/tests/unictype/test-predicate-part2.h index 60b7c24..eeeb934 100644 --- a/tests/unictype/test-predicate-part2.h +++ b/tests/unictype/test-predicate-part2.h @@ -26,9 +26,9 @@ main () for (i = 0; i < SIZEOF (set); i++) { for (; c < set[i].start; c++) - ASSERT (!PREDICATE (c)); + ASSERT (!PREDICATE (c)); for (; c <= set[i].end; c++) - ASSERT (PREDICATE (c)); + ASSERT (PREDICATE (c)); } for (; c < 0x110000; c++) ASSERT (!PREDICATE (c)); diff --git a/tests/unictype/test-scripts.c b/tests/unictype/test-scripts.c index 4b4b0f9..610b473 100644 --- a/tests/unictype/test-scripts.c +++ b/tests/unictype/test-scripts.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -57,9 +45,9 @@ main () for (c = 0; c < 0x110000; c++) { - const uc_script_t *script = uc_script (c); - if (script != NULL) - ASSERT (uc_is_script (c, script)); + const uc_script_t *script = uc_script (c); + if (script != NULL) + ASSERT (uc_is_script (c, script)); } } @@ -75,9 +63,9 @@ main () found = false; for (i = 0; i < nscripts; i++) { - ASSERT (scripts[i].name != NULL); - if (strcmp (scripts[i].name, "Hebrew") == 0) - found = true; + ASSERT (scripts[i].name != NULL); + if (strcmp (scripts[i].name, "Hebrew") == 0) + found = true; } ASSERT (found); } diff --git a/tests/unictype/test-sy_c_ident.c b/tests/unictype/test-sy_c_ident.c index 00688e1..026db18 100644 --- a/tests/unictype/test-sy_c_ident.c +++ b/tests/unictype/test-sy_c_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-sy_java_ident.c b/tests/unictype/test-sy_java_ident.c index 0a4eb0a..ed9ddeb 100644 --- a/tests/unictype/test-sy_java_ident.c +++ b/tests/unictype/test-sy_java_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u16-possible-linebreaks.c b/tests/unilbrk/test-u16-possible-linebreaks.c index 4e0ef34..cdfa75c 100644 --- a/tests/unilbrk/test-u16-possible-linebreaks.c +++ b/tests/unilbrk/test-u16-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint16_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,16 +47,16 @@ main () u16_possible_linebreaks (input, SIZEOF (input), "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -78,16 +66,16 @@ main () u16_possible_linebreaks (input, SIZEOF (input), "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 37 || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 37 || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u16-width-linebreaks.c b/tests/unilbrk/test-u16-width-linebreaks.c index b62d596..2523afb 100644 --- a/tests/unilbrk/test-u16-width-linebreaks.c +++ b/tests/unilbrk/test-u16-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint16_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,11 +47,11 @@ main () u16_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -73,11 +61,11 @@ main () u16_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u32-possible-linebreaks.c b/tests/unilbrk/test-u32-possible-linebreaks.c index 94e276a..d775ebc 100644 --- a/tests/unilbrk/test-u32-possible-linebreaks.c +++ b/tests/unilbrk/test-u32-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint32_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,16 +47,16 @@ main () u32_possible_linebreaks (input, SIZEOF (input), "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -78,16 +66,16 @@ main () u32_possible_linebreaks (input, SIZEOF (input), "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 37 || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 37 || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u32-width-linebreaks.c b/tests/unilbrk/test-u32-width-linebreaks.c index f684dee..050c219 100644 --- a/tests/unilbrk/test-u32-width-linebreaks.c +++ b/tests/unilbrk/test-u32-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint32_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,11 +47,11 @@ main () u32_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -73,11 +61,11 @@ main () u32_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u8-possible-linebreaks.c b/tests/unilbrk/test-u8-possible-linebreaks.c index c3a091d..555acf6 100644 --- a/tests/unilbrk/test-u8-possible-linebreaks.c +++ b/tests/unilbrk/test-u8-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,16 +41,16 @@ main () u8_possible_linebreaks (input, SIZEOF (input), "GB18030", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 7 - || i == 13 || i == 39 - || i == 41 || i == 43 || i == 44 || i == 50 - || i == 61 || i == 67 - || i == 70 || i == 73 || i == 77 || i == 80 - || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 7 + || i == 13 || i == 39 + || i == 41 || i == 43 || i == 44 || i == 50 + || i == 61 || i == 67 + || i == 70 || i == 73 || i == 77 || i == 80 + || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -72,16 +60,16 @@ main () u8_possible_linebreaks (input, SIZEOF (input), "GB2312", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 7 - || i == 13 || i == 39 - || i == 41 || i == 43 || i == 44 || i == 50 - || i == 52 || i == 61 || i == 67 - || i == 70 || i == 73 || i == 77 || i == 80 - || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 7 + || i == 13 || i == 39 + || i == 41 || i == 43 || i == 44 || i == 50 + || i == 52 || i == 61 || i == 67 + || i == 70 || i == 73 || i == 77 || i == 80 + || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u8-width-linebreaks.c b/tests/unilbrk/test-u8-width-linebreaks.c index 6c176f1..e78b075 100644 --- a/tests/unilbrk/test-u8-width-linebreaks.c +++ b/tests/unilbrk/test-u8-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,11 +41,11 @@ main () u8_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 39 || i == 61 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 39 || i == 61 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -67,11 +55,11 @@ main () u8_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 13 || i == 39 || i == 61 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 13 || i == 39 || i == 61 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-ulc-possible-linebreaks.c b/tests/unilbrk/test-ulc-possible-linebreaks.c index fdd73be..c64fade 100644 --- a/tests/unilbrk/test-ulc-possible-linebreaks.c +++ b/tests/unilbrk/test-ulc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,10 +41,10 @@ main () ulc_possible_linebreaks (input, SIZEOF (input), "ISO-8859-1", p); for (i = 0; i < 36; i++) { - ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : - i == 5 || i == 11 || i == 13 || i == 15 || i == 16 - || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); + ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : + i == 5 || i == 11 || i == 13 || i == 15 || i == 16 + || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); } free (p); } diff --git a/tests/unilbrk/test-ulc-width-linebreaks.c b/tests/unilbrk/test-ulc-width-linebreaks.c index c0b2301..875554a 100644 --- a/tests/unilbrk/test-ulc-width-linebreaks.c +++ b/tests/unilbrk/test-ulc-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,9 +41,9 @@ main () ulc_width_linebreaks (input, SIZEOF (input), 12, 0, 0, NULL, "ISO-8859-1", p); for (i = 0; i < 36; i++) { - ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : - i == 11 || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); + ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : + i == 11 || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); } free (p); } diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c index 1408434..2116351 100644 --- a/tests/uniname/test-uninames.c +++ b/tests/uniname/test-uninames.c @@ -1,5 +1,6 @@ /* Test the Unicode character name functions. - Copyright (C) 2000-2003, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2005, 2007, 2009-2010 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 @@ -44,10 +45,10 @@ getfield (FILE *stream, char *buffer, int delim) { /* Put c into the buffer. */ if (++count >= FIELDLEN - 1) - { - fprintf (stderr, "field too long\n"); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "field too long\n"); + exit (EXIT_FAILURE); + } *buffer++ = c; } @@ -88,21 +89,21 @@ fill_names (const char *unicodedata_filename) n = getfield (stream, field0, ';'); n += getfield (stream, field1, ';'); if (n == 0) - break; + break; if (n != 2) - { - fprintf (stderr, "short line in '%s':%d\n", - unicodedata_filename, lineno); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "short line in '%s':%d\n", + unicodedata_filename, lineno); + exit (EXIT_FAILURE); + } for (; (c = getc (stream)), (c != EOF && c != '\n'); ) - ; + ; i = strtoul (field0, NULL, 16); if (i >= 0x110000) - { - fprintf (stderr, "index too large\n"); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "index too large\n"); + exit (EXIT_FAILURE); + } unicode_names[i] = xstrdup (field1); } if (ferror (stream) || fclose (stream)) @@ -125,28 +126,28 @@ test_name_lookup () char *result = unicode_character_name (i, buf); if (unicode_names[i] != NULL) - { - if (result == NULL) - { - fprintf (stderr, "\\u%04X name lookup failed!\n", i); - error = 1; - } - else if (strcmp (result, unicode_names[i]) != 0) - { - fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", - i, result); - error = 1; - } - } + { + if (result == NULL) + { + fprintf (stderr, "\\u%04X name lookup failed!\n", i); + error = 1; + } + else if (strcmp (result, unicode_names[i]) != 0) + { + fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", + i, result); + error = 1; + } + } else - { - if (result != NULL) - { - fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", - i, result); - error = 1; - } - } + { + if (result != NULL) + { + fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", + i, result); + error = 1; + } + } } for (i = 0x110000; i < 0x1000000; i++) @@ -154,11 +155,11 @@ test_name_lookup () char *result = unicode_character_name (i, buf); if (result != NULL) - { - fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", - i, result); - error = 1; - } + { + fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", + i, result); + error = 1; + } } return error; @@ -175,18 +176,18 @@ test_inverse_lookup () for (i = 0; i < 0x110000; i++) if (unicode_names[i] != NULL) { - unsigned int result = unicode_name_character (unicode_names[i]); - if (result != i) - { - if (result == UNINAME_INVALID) - fprintf (stderr, "inverse name lookup of \"%s\" failed\n", - unicode_names[i]); - else - fprintf (stderr, - "inverse name lookup of \"%s\" returned 0x%04X\n", - unicode_names[i], result); - error = 1; - } + unsigned int result = unicode_name_character (unicode_names[i]); + if (result != i) + { + if (result == UNINAME_INVALID) + fprintf (stderr, "inverse name lookup of \"%s\" failed\n", + unicode_names[i]); + else + fprintf (stderr, + "inverse name lookup of \"%s\" returned 0x%04X\n", + unicode_names[i], result); + error = 1; + } } /* Second, generate random but likely names and verify they are not @@ -201,13 +202,13 @@ test_inverse_lookup () unsigned int result; do i1 = ((rand () % 0x11) << 16) - + ((rand () & 0xff) << 8) - + (rand () & 0xff); + + ((rand () & 0xff) << 8) + + (rand () & 0xff); while (unicode_names[i1] == NULL); do i2 = ((rand () % 0x11) << 16) - + ((rand () & 0xff) << 8) - + (rand () & 0xff); + + ((rand () & 0xff) << 8) + + (rand () & 0xff); while (unicode_names[i2] == NULL); s1 = unicode_names[i1]; @@ -217,25 +218,25 @@ test_inverse_lookup () /* Concatenate a starting piece of s1 with an ending piece of s2. */ for (j1 = 1; j1 <= l1; j1++) - if (j1 == l1 || s1[j1] == ' ') - for (j2 = 0; j2 < l2; j2++) - if (j2 == 0 || s2[j2-1] == ' ') - { - memcpy (buf, s1, j1); - buf[j1] = ' '; - memcpy (buf + j1 + 1, s2 + j2, l2 - j2 + 1); - - result = unicode_name_character (buf); - if (result != UNINAME_INVALID - && !(unicode_names[result] != NULL - && strcmp (unicode_names[result], buf) == 0)) - { - fprintf (stderr, - "inverse name lookup of \"%s\" returned 0x%04X\n", - unicode_names[i], result); - error = 1; - } - } + if (j1 == l1 || s1[j1] == ' ') + for (j2 = 0; j2 < l2; j2++) + if (j2 == 0 || s2[j2-1] == ' ') + { + memcpy (buf, s1, j1); + buf[j1] = ' '; + memcpy (buf + j1 + 1, s2 + j2, l2 - j2 + 1); + + result = unicode_name_character (buf); + if (result != UNINAME_INVALID + && !(unicode_names[result] != NULL + && strcmp (unicode_names[result], buf) == 0)) + { + fprintf (stderr, + "inverse name lookup of \"%s\" returned 0x%04X\n", + unicode_names[i], result); + error = 1; + } + } } /* Third, some extreme case that used to loop. */ diff --git a/tests/uninorm/test-canonical-decomposition.c b/tests/uninorm/test-canonical-decomposition.c index 040011b..f97bc44 100644 --- a/tests/uninorm/test-canonical-decomposition.c +++ b/tests/uninorm/test-canonical-decomposition.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-compat-decomposition.c b/tests/uninorm/test-compat-decomposition.c index 49a2b09..eeda95b 100644 --- a/tests/uninorm/test-compat-decomposition.c +++ b/tests/uninorm/test-compat-decomposition.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,22 +20,8 @@ #include "uninorm/decompose-internal.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-composition.c b/tests/uninorm/test-composition.c index dbadbba..bd089e6 100644 --- a/tests/uninorm/test-composition.c +++ b/tests/uninorm/test-composition.c @@ -1,5 +1,5 @@ /* Test of canonical composition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-decomposing-form.c b/tests/uninorm/test-decomposing-form.c index 3802c3f..6a1b7c4 100644 --- a/tests/uninorm/test-decomposing-form.c +++ b/tests/uninorm/test-decomposing-form.c @@ -1,5 +1,5 @@ /* Test of decomposing variant of a normalization form. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-decomposition.c b/tests/uninorm/test-decomposition.c index 684dee4..3cef393 100644 --- a/tests/uninorm/test-decomposition.c +++ b/tests/uninorm/test-decomposition.c @@ -1,5 +1,5 @@ /* Test of decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-nfc.c b/tests/uninorm/test-nfc.c index ca95710..6fd86d8 100644 --- a/tests/uninorm/test-nfc.c +++ b/tests/uninorm/test-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/uninorm/test-nfd.c b/tests/uninorm/test-nfd.c index 2a7e55b..d89ba77 100644 --- a/tests/uninorm/test-nfd.c +++ b/tests/uninorm/test-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/uninorm/test-nfkc.c b/tests/uninorm/test-nfkc.c index 2e57a15..68474a8 100644 --- a/tests/uninorm/test-nfkc.c +++ b/tests/uninorm/test-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/uninorm/test-nfkd.c b/tests/uninorm/test-nfkd.c index 8e330fe..cb8a2df 100644 --- a/tests/uninorm/test-nfkd.c +++ b/tests/uninorm/test-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 diff --git a/tests/uninorm/test-u16-nfc.c b/tests/uninorm/test-u16-nfc.c index 1bf9a94..b595500 100644 --- a/tests/uninorm/test-u16-nfc.c +++ b/tests/uninorm/test-u16-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -241,20 +228,20 @@ test_u16_nfc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); @@ -272,65 +259,65 @@ test_u16_nfc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-nfd.c b/tests/uninorm/test-u16-nfd.c index 34789b8..0e084c9 100644 --- a/tests/uninorm/test-u16-nfd.c +++ b/tests/uninorm/test-u16-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,20 +216,20 @@ test_u16_nfd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -259,62 +246,62 @@ test_u16_nfd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-nfkc.c b/tests/uninorm/test-u16-nfkc.c index 4ac8f7e..7fcec7c 100644 --- a/tests/uninorm/test-u16-nfkc.c +++ b/tests/uninorm/test-u16-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFKC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -257,7 +244,7 @@ test_u16_nfkc (void) static const uint16_t input[] = { 0xFDFA }; static const uint16_t decomposed[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), decomposed, SIZEOF (decomposed)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), decomposed, SIZEOF (decomposed)) == 0); @@ -280,28 +267,28 @@ test_u16_nfkc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; static const uint16_t expected[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), expected, SIZEOF (expected)) == 0); @@ -320,65 +307,65 @@ test_u16_nfkc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-nfkd.c b/tests/uninorm/test-u16-nfkd.c index 6dfa39f..4395d01 100644 --- a/tests/uninorm/test-u16-nfkd.c +++ b/tests/uninorm/test-u16-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFKD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,7 +216,7 @@ test_u16_nfkd (void) static const uint16_t input[] = { 0xFDFA }; static const uint16_t expected[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -249,20 +236,20 @@ test_u16_nfkd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -279,62 +266,62 @@ test_u16_nfkd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-normcmp.c b/tests/uninorm/test-u16-normcmp.c index 3cf947a..7adcda6 100644 --- a/tests/uninorm/test-u16-normcmp.c +++ b/tests/uninorm/test-u16-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-normcmp.h" diff --git a/tests/uninorm/test-u16-normcmp.h b/tests/uninorm/test-u16-normcmp.h index ea7def8..85cbf00 100644 --- a/tests/uninorm/test-u16-normcmp.h +++ b/tests/uninorm/test-u16-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ static void test_ascii (int (*my_normcmp) (const uint16_t *, size_t, const uint16_t *, size_t, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/uninorm/test-u16-normcoll.c b/tests/uninorm/test-u16-normcoll.c index d83799d..ead1561 100644 --- a/tests/uninorm/test-u16-normcoll.c +++ b/tests/uninorm/test-u16-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-normcmp.h" int diff --git a/tests/uninorm/test-u32-nfc-big.c b/tests/uninorm/test-u32-nfc-big.c index 2a1b611..dee5806 100644 --- a/tests/uninorm/test-u32-nfc-big.c +++ b/tests/uninorm/test-u32-nfc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -45,8 +45,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c2_length - && u32_cmp (result, c2, c2_length) == 0)) + && length == c2_length + && u32_cmp (result, c2, c2_length) == 0)) return 1; free (result); } @@ -56,8 +56,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c2_length - && u32_cmp (result, c2, c2_length) == 0)) + && length == c2_length + && u32_cmp (result, c2, c2_length) == 0)) return 2; free (result); } @@ -67,8 +67,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c2_length - && u32_cmp (result, c2, c2_length) == 0)) + && length == c2_length + && u32_cmp (result, c2, c2_length) == 0)) return 3; free (result); } @@ -78,8 +78,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 4; free (result); } @@ -89,8 +89,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfc.c b/tests/uninorm/test-u32-nfc.c index 0d8311c..b154c8b 100644 --- a/tests/uninorm/test-u32-nfc.c +++ b/tests/uninorm/test-u32-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -241,20 +228,20 @@ test_u32_nfc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); @@ -272,65 +259,65 @@ test_u32_nfc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-nfd-big.c b/tests/uninorm/test-u32-nfd-big.c index 9bfd0d8..ccc1291 100644 --- a/tests/uninorm/test-u32-nfd-big.c +++ b/tests/uninorm/test-u32-nfd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -45,8 +45,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c3_length - && u32_cmp (result, c3, c3_length) == 0)) + && length == c3_length + && u32_cmp (result, c3, c3_length) == 0)) return 1; free (result); } @@ -56,8 +56,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c3_length - && u32_cmp (result, c3, c3_length) == 0)) + && length == c3_length + && u32_cmp (result, c3, c3_length) == 0)) return 2; free (result); } @@ -67,8 +67,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c3_length - && u32_cmp (result, c3, c3_length) == 0)) + && length == c3_length + && u32_cmp (result, c3, c3_length) == 0)) return 3; free (result); } @@ -78,8 +78,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 4; free (result); } @@ -89,8 +89,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfd.c b/tests/uninorm/test-u32-nfd.c index f7b2d8d..58c97b2 100644 --- a/tests/uninorm/test-u32-nfd.c +++ b/tests/uninorm/test-u32-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,20 +216,20 @@ test_u32_nfd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -259,62 +246,62 @@ test_u32_nfd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-nfkc-big.c b/tests/uninorm/test-u32-nfkc-big.c index 340fe65..7827d33 100644 --- a/tests/uninorm/test-u32-nfkc-big.c +++ b/tests/uninorm/test-u32-nfkc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -42,8 +42,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 1; free (result); } @@ -53,8 +53,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 2; free (result); } @@ -64,8 +64,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 3; free (result); } @@ -75,8 +75,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 4; free (result); } @@ -86,8 +86,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfkc.c b/tests/uninorm/test-u32-nfkc.c index 75f7e82..eb4d3ce 100644 --- a/tests/uninorm/test-u32-nfkc.c +++ b/tests/uninorm/test-u32-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFKC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -257,7 +244,7 @@ test_u32_nfkc (void) static const uint32_t input[] = { 0xFDFA }; static const uint32_t decomposed[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), decomposed, SIZEOF (decomposed)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), decomposed, SIZEOF (decomposed)) == 0); @@ -280,28 +267,28 @@ test_u32_nfkc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; static const uint32_t expected[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), expected, SIZEOF (expected)) == 0); @@ -320,65 +307,65 @@ test_u32_nfkc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-nfkd-big.c b/tests/uninorm/test-u32-nfkd-big.c index e7c1b4f..14232c5 100644 --- a/tests/uninorm/test-u32-nfkd-big.c +++ b/tests/uninorm/test-u32-nfkd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -42,8 +42,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 1; free (result); } @@ -53,8 +53,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 2; free (result); } @@ -64,8 +64,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 3; free (result); } @@ -75,8 +75,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 4; free (result); } @@ -86,8 +86,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfkd.c b/tests/uninorm/test-u32-nfkd.c index d3de7f7..b98f651 100644 --- a/tests/uninorm/test-u32-nfkd.c +++ b/tests/uninorm/test-u32-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFKD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,7 +216,7 @@ test_u32_nfkd (void) static const uint32_t input[] = { 0xFDFA }; static const uint32_t expected[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -249,20 +236,20 @@ test_u32_nfkd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -279,62 +266,62 @@ test_u32_nfkd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-normalize-big.c b/tests/uninorm/test-u32-normalize-big.c index 96781ab..6c63786 100644 --- a/tests/uninorm/test-u32-normalize-big.c +++ b/tests/uninorm/test-u32-normalize-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,37 +21,26 @@ /* Specification. */ #include "test-u32-normalize-big.h" -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include <stdio.h> #include <stdlib.h> #include "xalloc.h" #include "unistr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define ASSERT_WITH_LINE(expr, file, line) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for %s:%u\n", \ - __FILE__, __LINE__, file, line); \ - fflush (stderr); \ - abort (); \ - } \ - } \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed for %s:%u\n", \ + __FILE__, __LINE__, file, line); \ + fflush (stderr); \ + abort (); \ + } \ + } \ while (0) static int @@ -64,7 +53,7 @@ cmp_ucs4_t (const void *a, const void *b) void read_normalization_test_file (const char *filename, - struct normalization_test_file *file) + struct normalization_test_file *file) { FILE *stream; unsigned int lineno; @@ -106,103 +95,103 @@ read_normalization_test_file (const char *filename, /* Read a line. */ ptr = buf; do - { - c = getc (stream); - if (c == EOF || c == '\n') - break; - *ptr++ = c; - } + { + c = getc (stream); + if (c == EOF || c == '\n') + break; + *ptr++ = c; + } while (ptr < buf + 1000); *ptr = '\0'; if (c == EOF) - break; + break; /* Ignore empty lines and comment lines. */ if (buf[0] == '\0' || buf[0] == '#') - continue; + continue; /* Handle lines that introduce a new part. */ if (buf[0] == '@') - { - /* Switch to the next part. */ - if (part_index >= 0) - { - lines = - (struct normalization_test_line *) - xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); - file->parts[part_index].lines = lines; - file->parts[part_index].lines_length = lines_length; - } - part_index++; - lines = NULL; - lines_length = 0; - lines_allocated = 0; - continue; - } + { + /* Switch to the next part. */ + if (part_index >= 0) + { + lines = + (struct normalization_test_line *) + xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); + file->parts[part_index].lines = lines; + file->parts[part_index].lines_length = lines_length; + } + part_index++; + lines = NULL; + lines_length = 0; + lines_allocated = 0; + continue; + } /* It's a line containing 5 sequences of Unicode characters. - Parse it and append it to the current part. */ + Parse it and append it to the current part. */ if (!(part_index >= 0 && part_index < 4)) - { - fprintf (stderr, "unexpected structure of '%s'\n", filename); - exit (1); - } + { + fprintf (stderr, "unexpected structure of '%s'\n", filename); + exit (1); + } ptr = buf; line.lineno = lineno; for (sequence_index = 0; sequence_index < 5; sequence_index++) - line.sequences[sequence_index] = NULL; + line.sequences[sequence_index] = NULL; for (sequence_index = 0; sequence_index < 5; sequence_index++) - { - uint32_t *sequence = XNMALLOC (1, uint32_t); - size_t sequence_length = 0; - - for (;;) - { - char *endptr; - unsigned int uc; - - uc = strtoul (ptr, &endptr, 16); - if (endptr == ptr) - break; - ptr = endptr; - - /* Append uc to the sequence. */ - sequence = - (uint32_t *) - xnrealloc (sequence, sequence_length + 2, sizeof (uint32_t)); - sequence[sequence_length] = uc; - sequence_length++; - - if (*ptr == ' ') - ptr++; - } - if (sequence_length == 0) - { - fprintf (stderr, "empty character sequence in '%s'\n", filename); - exit (1); - } - sequence[sequence_length] = 0; /* terminator */ - - line.sequences[sequence_index] = sequence; - - if (*ptr != ';') - { - fprintf (stderr, "error parsing '%s'\n", filename); - exit (1); - } - ptr++; - } + { + uint32_t *sequence = XNMALLOC (1, uint32_t); + size_t sequence_length = 0; + + for (;;) + { + char *endptr; + unsigned int uc; + + uc = strtoul (ptr, &endptr, 16); + if (endptr == ptr) + break; + ptr = endptr; + + /* Append uc to the sequence. */ + sequence = + (uint32_t *) + xnrealloc (sequence, sequence_length + 2, sizeof (uint32_t)); + sequence[sequence_length] = uc; + sequence_length++; + + if (*ptr == ' ') + ptr++; + } + if (sequence_length == 0) + { + fprintf (stderr, "empty character sequence in '%s'\n", filename); + exit (1); + } + sequence[sequence_length] = 0; /* terminator */ + + line.sequences[sequence_index] = sequence; + + if (*ptr != ';') + { + fprintf (stderr, "error parsing '%s'\n", filename); + exit (1); + } + ptr++; + } /* Append the line to the current part. */ if (lines_length == lines_allocated) - { - lines_allocated = 2 * lines_allocated; - if (lines_allocated < 7) - lines_allocated = 7; - lines = - (struct normalization_test_line *) - xnrealloc (lines, lines_allocated, sizeof (struct normalization_test_line)); - } + { + lines_allocated = 2 * lines_allocated; + if (lines_allocated < 7) + lines_allocated = 7; + lines = + (struct normalization_test_line *) + xnrealloc (lines, lines_allocated, sizeof (struct normalization_test_line)); + } lines[lines_length] = line; lines_length++; } @@ -210,8 +199,8 @@ read_normalization_test_file (const char *filename, if (part_index >= 0) { lines = - (struct normalization_test_line *) - xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); + (struct normalization_test_line *) + xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); file->parts[part_index].lines = lines; file->parts[part_index].lines_length = lines_length; } @@ -224,11 +213,11 @@ read_normalization_test_file (const char *filename, for (line_index = 0; line_index < p->lines_length; line_index++) { - const uint32_t *sequence = p->lines[line_index].sequences[0]; - /* In part 1, every sequences[0] consists of a single character. */ - if (!(sequence[0] != 0 && sequence[1] == 0)) - abort (); - c1_array[line_index] = sequence[0]; + const uint32_t *sequence = p->lines[line_index].sequences[0]; + /* In part 1, every sequences[0] consists of a single character. */ + if (!(sequence[0] != 0 && sequence[1] == 0)) + abort (); + c1_array[line_index] = sequence[0]; } /* Sort this array. */ @@ -251,11 +240,11 @@ read_normalization_test_file (const char *filename, void test_specific (const struct normalization_test_file *file, - int (*check) (const uint32_t *c1, size_t c1_length, - const uint32_t *c2, size_t c2_length, - const uint32_t *c3, size_t c3_length, - const uint32_t *c4, size_t c4_length, - const uint32_t *c5, size_t c5_length)) + int (*check) (const uint32_t *c1, size_t c1_length, + const uint32_t *c2, size_t c2_length, + const uint32_t *c3, size_t c3_length, + const uint32_t *c4, size_t c4_length, + const uint32_t *c5, size_t c5_length)) { size_t part_index; @@ -265,17 +254,17 @@ test_specific (const struct normalization_test_file *file, size_t line_index; for (line_index = 0; line_index < p->lines_length; line_index++) - { - const struct normalization_test_line *l = &p->lines[line_index]; - - ASSERT_WITH_LINE (check (l->sequences[0], u32_strlen (l->sequences[0]), - l->sequences[1], u32_strlen (l->sequences[1]), - l->sequences[2], u32_strlen (l->sequences[2]), - l->sequences[3], u32_strlen (l->sequences[3]), - l->sequences[4], u32_strlen (l->sequences[4])) - == 0, - file->filename, l->lineno); - } + { + const struct normalization_test_line *l = &p->lines[line_index]; + + ASSERT_WITH_LINE (check (l->sequences[0], u32_strlen (l->sequences[0]), + l->sequences[1], u32_strlen (l->sequences[1]), + l->sequences[2], u32_strlen (l->sequences[2]), + l->sequences[3], u32_strlen (l->sequences[3]), + l->sequences[4], u32_strlen (l->sequences[4])) + == 0, + file->filename, l->lineno); + } } } @@ -291,24 +280,24 @@ test_other (const struct normalization_test_file *file, uninorm_t nf) for (uc = 0; uc < 0x110000; uc++) { if (uc >= 0xD800 && uc < 0xE000) - { - /* A surrogate, not a character. Skip uc. */ - } + { + /* A surrogate, not a character. Skip uc. */ + } else if (uc == *p) - { - /* Skip uc. */ - p++; - } + { + /* Skip uc. */ + p++; + } else - { - uint32_t input[1]; - size_t length; - uint32_t *result; - - input[0] = uc; - result = u32_normalize (nf, input, 1, NULL, &length); - ASSERT (result != NULL && length == 1 && result[0] == uc); - } + { + uint32_t input[1]; + size_t length; + uint32_t *result; + + input[0] = uc; + result = u32_normalize (nf, input, 1, NULL, &length); + ASSERT (result != NULL && length == 1 && result[0] == uc); + } } } diff --git a/tests/uninorm/test-u32-normalize-big.h b/tests/uninorm/test-u32-normalize-big.h index f154daa..2482a34 100644 --- a/tests/uninorm/test-u32-normalize-big.h +++ b/tests/uninorm/test-u32-normalize-big.h @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -54,16 +54,16 @@ struct normalization_test_file /* Read the NormalizationTest.txt file and return its contents. */ extern void read_normalization_test_file (const char *filename, - struct normalization_test_file *file); + struct normalization_test_file *file); /* Perform the first compliance test. */ extern void test_specific (const struct normalization_test_file *file, - int (*check) (const uint32_t *c1, size_t c1_length, - const uint32_t *c2, size_t c2_length, - const uint32_t *c3, size_t c3_length, - const uint32_t *c4, size_t c4_length, - const uint32_t *c5, size_t c5_length)); + int (*check) (const uint32_t *c1, size_t c1_length, + const uint32_t *c2, size_t c2_length, + const uint32_t *c3, size_t c3_length, + const uint32_t *c4, size_t c4_length, + const uint32_t *c5, size_t c5_length)); /* Perform the second compliance test. */ extern void diff --git a/tests/uninorm/test-u32-normcmp.c b/tests/uninorm/test-u32-normcmp.c index 846300a..e48ceeb 100644 --- a/tests/uninorm/test-u32-normcmp.c +++ b/tests/uninorm/test-u32-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-normcmp.h" diff --git a/tests/uninorm/test-u32-normcmp.h b/tests/uninorm/test-u32-normcmp.h index 06d5fad..56d4cdb 100644 --- a/tests/uninorm/test-u32-normcmp.h +++ b/tests/uninorm/test-u32-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ static void test_ascii (int (*my_normcmp) (const uint32_t *, size_t, const uint32_t *, size_t, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/uninorm/test-u32-normcoll.c b/tests/uninorm/test-u32-normcoll.c index 916d433..08777ee 100644 --- a/tests/uninorm/test-u32-normcoll.c +++ b/tests/uninorm/test-u32-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-normcmp.h" int diff --git a/tests/uninorm/test-u8-nfc.c b/tests/uninorm/test-u8-nfc.c index 52baa68..1a7745c 100644 --- a/tests/uninorm/test-u8-nfc.c +++ b/tests/uninorm/test-u8-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -242,25 +229,25 @@ test_u8_nfc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t decomposed[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); @@ -278,89 +265,89 @@ test_u8_nfc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0xC3; - expected[1] = 0x80; - p = expected + 2; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2 - 1; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); - ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0xC3; + expected[1] = 0x80; + p = expected + 2; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2 - 1; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); + ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-nfd.c b/tests/uninorm/test-u8-nfd.c index d1d840a..082ded4 100644 --- a/tests/uninorm/test-u8-nfd.c +++ b/tests/uninorm/test-u8-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -230,25 +217,25 @@ test_u8_nfd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t expected[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -265,85 +252,85 @@ test_u8_nfd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0x41; - p = expected + 1; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0x41; + p = expected + 1; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-nfkc.c b/tests/uninorm/test-u8-nfkc.c index 0ea4636..1ca1413 100644 --- a/tests/uninorm/test-u8-nfkc.c +++ b/tests/uninorm/test-u8-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFKC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -257,8 +244,8 @@ test_u8_nfkc (void) static const uint8_t input[] = { 0xEF, 0xB7, 0xBA }; static const uint8_t decomposed[] = { 0xD8, 0xB5, 0xD9, 0x84, 0xD9, 0x89, 0x20, 0xD8, 0xA7, 0xD9, 0x84, 0xD9, - 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, - 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 + 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, + 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 }; ASSERT (check (input, SIZEOF (input), decomposed, SIZEOF (decomposed)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), decomposed, SIZEOF (decomposed)) == 0); @@ -282,36 +269,36 @@ test_u8_nfkc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t decomposed[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; static const uint8_t expected[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), expected, SIZEOF (expected)) == 0); @@ -330,89 +317,89 @@ test_u8_nfkc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0xC3; - expected[1] = 0x80; - p = expected + 2; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2 - 1; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); - ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0xC3; + expected[1] = 0x80; + p = expected + 2; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2 - 1; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); + ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-nfkd.c b/tests/uninorm/test-u8-nfkd.c index 2d883a0..2e29539 100644 --- a/tests/uninorm/test-u8-nfkd.c +++ b/tests/uninorm/test-u8-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFKD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,8 +216,8 @@ test_u8_nfkd (void) static const uint8_t input[] = { 0xEF, 0xB7, 0xBA }; static const uint8_t expected[] = { 0xD8, 0xB5, 0xD9, 0x84, 0xD9, 0x89, 0x20, 0xD8, 0xA7, 0xD9, 0x84, 0xD9, - 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, - 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 + 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, + 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -251,25 +238,25 @@ test_u8_nfkd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t expected[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -286,85 +273,85 @@ test_u8_nfkd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0x41; - p = expected + 1; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0x41; + p = expected + 1; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-normcmp.c b/tests/uninorm/test-u8-normcmp.c index ec47947..4f09118 100644 --- a/tests/uninorm/test-u8-normcmp.c +++ b/tests/uninorm/test-u8-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-normcmp.h" diff --git a/tests/uninorm/test-u8-normcmp.h b/tests/uninorm/test-u8-normcmp.h index 78c887d..790e3ae 100644 --- a/tests/uninorm/test-u8-normcmp.h +++ b/tests/uninorm/test-u8-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -18,7 +18,7 @@ static void test_ascii (int (*my_normcmp) (const uint8_t *, size_t, const uint8_t *, size_t, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/uninorm/test-u8-normcoll.c b/tests/uninorm/test-u8-normcoll.c index edf9172..d205f28 100644 --- a/tests/uninorm/test-u8-normcoll.c +++ b/tests/uninorm/test-u8-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-normcmp.h" int diff --git a/tests/uninorm/test-uninorm-filter-nfc.c b/tests/uninorm/test-uninorm-filter-nfc.c index 32b77ef..65bf8a9 100644 --- a/tests/uninorm/test-uninorm-filter-nfc.c +++ b/tests/uninorm/test-uninorm-filter-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of streams. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,23 +20,10 @@ #include "uninorm.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* A stream of Unicode characters that simply accumulates the contents. */ @@ -99,20 +86,20 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); diff --git a/tests/unistdio/test-u16-asnprintf1.c b/tests/unistdio/test-u16-asnprintf1.c index 53fedf3..3d4897c 100644 --- a/tests/unistdio/test-u16-asnprintf1.c +++ b/tests/unistdio/test-u16-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-asnprintf1.h" diff --git a/tests/unistdio/test-u16-asnprintf1.h b/tests/unistdio/test-u16-asnprintf1.h index 34d4f82..9d557ba 100644 --- a/tests/unistdio/test-u16-asnprintf1.h +++ b/tests/unistdio/test-u16-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u16_[v]asnprintf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -29,7 +29,7 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . size_t length = size; uint16_t *result = my_asnprintf (NULL, &length, "%d", 12345); static const uint16_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == 5); @@ -39,9 +39,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . for (size = 0; size <= 8; size++) { static const uint16_t initializer[] = - { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; + { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; static const uint16_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; size_t length; uint16_t *result; @@ -52,9 +52,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (u16_cmp (buf + size, initializer + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-u16-printf1.h b/tests/unistdio/test-u16-printf1.h index 199ece9..1965ce9 100644 --- a/tests/unistdio/test-u16-printf1.h +++ b/tests/unistdio/test-u16-printf1.h @@ -1,5 +1,5 @@ /* Test of u16_v[a]s[n]printf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -67,36 +67,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint16_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -107,36 +107,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint16_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -147,36 +147,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint16_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -190,8 +190,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', - 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -203,8 +203,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %20s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -216,8 +216,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', - ' ', ' ', ' ', ' ', ' ', '3', '3', 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', + ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -229,8 +229,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %020s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -253,9 +253,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -272,9 +272,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -283,29 +283,29 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -314,45 +314,45 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -361,25 +361,25 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', '9', '2', '2', 'p', '+', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '2', '4', '4', 'p', '+', '0', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected3[] = { '0', 'x', '6', '.', '4', '8', '8', 'p', '-', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected4[] = { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', - '3', '3', 0 + '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -396,9 +396,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -407,29 +407,29 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -438,45 +438,45 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -591,15 +591,15 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); static const uint16_t expected1[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; static const uint16_t expected2[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '0', '1', ' ', '3', '3', 0 + '0', '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -608,15 +608,15 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; static const uint16_t expected2[] = { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', - 'e', '+', '0', '0', '0', ' ', '3', '3', 0 + 'e', '+', '0', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -629,7 +629,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -638,7 +638,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%Le %d", 12.75L, 33, 44, 55); static const uint16_t expected[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -650,7 +650,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15Le %d", 1.75L, 33, 44, 55); static const uint16_t expected[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -698,7 +698,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -774,47 +774,47 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint16_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -824,52 +824,52 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint16_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -879,52 +879,52 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint16_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); diff --git a/tests/unistdio/test-u16-vasnprintf1.c b/tests/unistdio/test-u16-vasnprintf1.c index b236e3f..268b32c 100644 --- a/tests/unistdio/test-u16-vasnprintf1.c +++ b/tests/unistdio/test-u16-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-asnprintf1.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vasnprintf2.c b/tests/unistdio/test-u16-vasnprintf2.c index 6f7b7cf..c43967c 100644 --- a/tests/unistdio/test-u16-vasnprintf2.c +++ b/tests/unistdio/test-u16-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* Width. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); diff --git a/tests/unistdio/test-u16-vasnprintf3.c b/tests/unistdio/test-u16-vasnprintf3.c index 1402181..6e741c9 100644 --- a/tests/unistdio/test-u16-vasnprintf3.c +++ b/tests/unistdio/test-u16-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* Width. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); diff --git a/tests/unistdio/test-u16-vasprintf1.c b/tests/unistdio/test-u16-vasprintf1.c index 8b96126..5b60248 100644 --- a/tests/unistdio/test-u16-vasprintf1.c +++ b/tests/unistdio/test-u16-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vsnprintf1.c b/tests/unistdio/test-u16-vsnprintf1.c index 886e95b..5c2d86c 100644 --- a/tests/unistdio/test-u16-vsnprintf1.c +++ b/tests/unistdio/test-u16-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vsprintf1.c b/tests/unistdio/test-u16-vsprintf1.c index e6b6eab..ad42e07 100644 --- a/tests/unistdio/test-u16-vsprintf1.c +++ b/tests/unistdio/test-u16-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u32-asnprintf1.c b/tests/unistdio/test-u32-asnprintf1.c index 252e919..c17fcc6 100644 --- a/tests/unistdio/test-u32-asnprintf1.c +++ b/tests/unistdio/test-u32-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-asnprintf1.h" diff --git a/tests/unistdio/test-u32-asnprintf1.h b/tests/unistdio/test-u32-asnprintf1.h index dfaed98..9f73116 100644 --- a/tests/unistdio/test-u32-asnprintf1.h +++ b/tests/unistdio/test-u32-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u32_[v]asnprintf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -29,7 +29,7 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . size_t length = size; uint32_t *result = my_asnprintf (NULL, &length, "%d", 12345); static const uint32_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == 5); @@ -39,9 +39,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . for (size = 0; size <= 8; size++) { static const uint32_t initializer[] = - { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; + { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; static const uint32_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; size_t length; uint32_t *result; @@ -52,9 +52,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (u32_cmp (buf + size, initializer + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-u32-printf1.h b/tests/unistdio/test-u32-printf1.h index 240232f..00b9a60 100644 --- a/tests/unistdio/test-u32-printf1.h +++ b/tests/unistdio/test-u32-printf1.h @@ -1,5 +1,5 @@ /* Test of u32_v[a]s[n]printf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -67,36 +67,36 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint32_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -107,36 +107,36 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint32_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -147,36 +147,36 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint32_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -190,8 +190,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', - 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -203,8 +203,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %20s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -216,8 +216,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', - ' ', ' ', ' ', ' ', ' ', '3', '3', 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', + ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -229,8 +229,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %020s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -253,9 +253,9 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -272,9 +272,9 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -283,29 +283,29 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -314,45 +314,45 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -361,25 +361,25 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', '9', '2', '2', 'p', '+', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '2', '4', '4', 'p', '+', '0', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint32_t expected3[] = { '0', 'x', '6', '.', '4', '8', '8', 'p', '-', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint32_t expected4[] = { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', - '3', '3', 0 + '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -396,9 +396,9 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -407,29 +407,29 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -438,45 +438,45 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -591,15 +591,15 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); static const uint32_t expected1[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; static const uint32_t expected2[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '0', '1', ' ', '3', '3', 0 + '0', '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -608,15 +608,15 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); static const uint32_t expected1[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; static const uint32_t expected2[] = { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', - 'e', '+', '0', '0', '0', ' ', '3', '3', 0 + 'e', '+', '0', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -629,7 +629,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -638,7 +638,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%Le %d", 12.75L, 33, 44, 55); static const uint32_t expected[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -650,7 +650,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15Le %d", 1.75L, 33, 44, 55); static const uint32_t expected[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -698,7 +698,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -774,47 +774,47 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint32_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -824,52 +824,52 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint32_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -879,52 +879,52 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint32_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); diff --git a/tests/unistdio/test-u32-vasnprintf1.c b/tests/unistdio/test-u32-vasnprintf1.c index 959bdab..d2aa879 100644 --- a/tests/unistdio/test-u32-vasnprintf1.c +++ b/tests/unistdio/test-u32-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-asnprintf1.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vasnprintf2.c b/tests/unistdio/test-u32-vasnprintf2.c index 9d8ab00..c418e0a 100644 --- a/tests/unistdio/test-u32-vasnprintf2.c +++ b/tests/unistdio/test-u32-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* Width. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); diff --git a/tests/unistdio/test-u32-vasnprintf3.c b/tests/unistdio/test-u32-vasnprintf3.c index 73f7c6c..f4b92d7 100644 --- a/tests/unistdio/test-u32-vasnprintf3.c +++ b/tests/unistdio/test-u32-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* Width. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); diff --git a/tests/unistdio/test-u32-vasprintf1.c b/tests/unistdio/test-u32-vasprintf1.c index 39e68d2..41c3057 100644 --- a/tests/unistdio/test-u32-vasprintf1.c +++ b/tests/unistdio/test-u32-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vsnprintf1.c b/tests/unistdio/test-u32-vsnprintf1.c index d772708..53317cf 100644 --- a/tests/unistdio/test-u32-vsnprintf1.c +++ b/tests/unistdio/test-u32-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vsprintf1.c b/tests/unistdio/test-u32-vsprintf1.c index 8398b27..c9512e8 100644 --- a/tests/unistdio/test-u32-vsprintf1.c +++ b/tests/unistdio/test-u32-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u8-asnprintf1.c b/tests/unistdio/test-u8-asnprintf1.c index 852d76b..983cddf 100644 --- a/tests/unistdio/test-u8-asnprintf1.c +++ b/tests/unistdio/test-u8-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-asnprintf1.h" diff --git a/tests/unistdio/test-u8-asnprintf1.h b/tests/unistdio/test-u8-asnprintf1.h index 063f145..d4df3a3 100644 --- a/tests/unistdio/test-u8-asnprintf1.h +++ b/tests/unistdio/test-u8-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u8_[v]asnprintf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -49,9 +49,9 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... ASSERT (u8_strcmp (result, expected) == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (u8_cmp (buf + size, initializer + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-u8-printf1.h b/tests/unistdio/test-u8-printf1.h index 4ac6573..23dc5a6 100644 --- a/tests/unistdio/test-u8-printf1.h +++ b/tests/unistdio/test-u8-printf1.h @@ -1,5 +1,5 @@ /* Test of u8_v[a]s[n]printf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -63,7 +63,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint8_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -71,7 +71,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -79,7 +79,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -87,7 +87,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -99,7 +99,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint8_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -107,7 +107,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -115,7 +115,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -123,7 +123,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -135,7 +135,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint8_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -143,7 +143,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -151,7 +151,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -159,7 +159,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -217,9 +217,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xc.91p-2 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -232,9 +232,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = " 0xep-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -247,9 +247,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.0000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -262,9 +262,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.00000000000000000000000000000000000000000000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -277,9 +277,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xc.91p-2 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -292,9 +292,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = " 0xep-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -307,9 +307,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.0000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -322,9 +322,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.00000000000000000000000000000000000000000000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -431,7 +431,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1.275000e+001 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -442,7 +442,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = " 1.750000e+000 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -453,7 +453,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1e+003 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -511,7 +511,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1e+003 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -582,7 +582,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint8_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -590,7 +590,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -598,7 +598,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -606,7 +606,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -617,12 +617,12 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint8_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -630,7 +630,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -638,7 +638,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -646,7 +646,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -657,12 +657,12 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint8_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -670,7 +670,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -678,7 +678,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -686,7 +686,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); diff --git a/tests/unistdio/test-u8-vasnprintf1.c b/tests/unistdio/test-u8-vasnprintf1.c index 3329df4..03c73a0 100644 --- a/tests/unistdio/test-u8-vasnprintf1.c +++ b/tests/unistdio/test-u8-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-asnprintf1.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vasnprintf2.c b/tests/unistdio/test-u8-vasnprintf2.c index 4283be6..d801ee6 100644 --- a/tests/unistdio/test-u8-vasnprintf2.c +++ b/tests/unistdio/test-u8-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...)) @@ -52,7 +39,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -62,7 +49,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* Width. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -72,7 +59,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_LEFT. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -82,7 +69,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_ZERO: no effect. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); diff --git a/tests/unistdio/test-u8-vasnprintf3.c b/tests/unistdio/test-u8-vasnprintf3.c index fc645bc..752c4c5 100644 --- a/tests/unistdio/test-u8-vasnprintf3.c +++ b/tests/unistdio/test-u8-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...)) @@ -52,7 +39,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -62,7 +49,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* Width. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -72,7 +59,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_LEFT. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -82,7 +69,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_ZERO: no effect. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); diff --git a/tests/unistdio/test-u8-vasprintf1.c b/tests/unistdio/test-u8-vasprintf1.c index 8a2caae..4076db5 100644 --- a/tests/unistdio/test-u8-vasprintf1.c +++ b/tests/unistdio/test-u8-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vsnprintf1.c b/tests/unistdio/test-u8-vsnprintf1.c index 6dd7439..1ae5876 100644 --- a/tests/unistdio/test-u8-vsnprintf1.c +++ b/tests/unistdio/test-u8-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vsprintf1.c b/tests/unistdio/test-u8-vsprintf1.c index 9559df0..3e13fec 100644 --- a/tests/unistdio/test-u8-vsprintf1.c +++ b/tests/unistdio/test-u8-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-ulc-asnprintf1.c b/tests/unistdio/test-ulc-asnprintf1.c index 591ae26..b9bd2ef 100644 --- a/tests/unistdio/test-ulc-asnprintf1.c +++ b/tests/unistdio/test-ulc-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-asnprintf1.h" diff --git a/tests/unistdio/test-ulc-asnprintf1.h b/tests/unistdio/test-ulc-asnprintf1.h index 285a406..eb68248 100644 --- a/tests/unistdio/test-ulc-asnprintf1.h +++ b/tests/unistdio/test-ulc-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of ulc_[v]asnprintf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -46,9 +46,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-ulc-printf1.h b/tests/unistdio/test-ulc-printf1.h index 77516d6..12149a4 100644 --- a/tests/unistdio/test-ulc-printf1.h +++ b/tests/unistdio/test-ulc-printf1.h @@ -1,5 +1,5 @@ /* Test of ulc_v[a]s[n]printf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -59,28 +59,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { char *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -91,28 +91,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { char *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -123,28 +123,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { char *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -193,9 +193,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%a %d", 3.1416015625, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.922p+1 33") == 0 - || strcmp (result, "0x3.244p+0 33") == 0 - || strcmp (result, "0x6.488p-1 33") == 0 - || strcmp (result, "0xc.91p-2 33") == 0); + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); free (result); } @@ -204,9 +204,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%10a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 - || strcmp (result, " 0x3.8p-1 33") == 0 - || strcmp (result, " 0x7p-2 33") == 0 - || strcmp (result, " 0xep-3 33") == 0); + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); free (result); } @@ -215,9 +215,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 - || strcmp (result, "0x3.8000000000p-1 33") == 0 - || strcmp (result, "0x7.0000000000p-2 33") == 0 - || strcmp (result, "0xe.0000000000p-3 33") == 0); + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); free (result); } @@ -226,9 +226,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 - || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 - || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 - || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); free (result); } @@ -237,9 +237,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.922p+1 33") == 0 - || strcmp (result, "0x3.244p+0 33") == 0 - || strcmp (result, "0x6.488p-1 33") == 0 - || strcmp (result, "0xc.91p-2 33") == 0); + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); free (result); } @@ -248,9 +248,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%10La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 - || strcmp (result, " 0x3.8p-1 33") == 0 - || strcmp (result, " 0x7p-2 33") == 0 - || strcmp (result, " 0xep-3 33") == 0); + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); free (result); } @@ -259,9 +259,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 - || strcmp (result, "0x3.8000000000p-1 33") == 0 - || strcmp (result, "0x7.0000000000p-2 33") == 0 - || strcmp (result, "0xe.0000000000p-3 33") == 0); + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); free (result); } @@ -270,9 +270,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 - || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 - || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 - || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); free (result); } @@ -367,7 +367,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1.275000e+01 33") == 0 - || strcmp (result, "1.275000e+001 33") == 0); + || strcmp (result, "1.275000e+001 33") == 0); free (result); } @@ -376,7 +376,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 1.750000e+00 33") == 0 - || strcmp (result, " 1.750000e+000 33") == 0); + || strcmp (result, " 1.750000e+000 33") == 0); free (result); } @@ -385,7 +385,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.e %d", 1234.0, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1e+03 33") == 0 - || strcmp (result, "1e+003 33") == 0); + || strcmp (result, "1e+003 33") == 0); free (result); } @@ -436,7 +436,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.g %d", 1234.0, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1e+03 33") == 0 - || strcmp (result, "1e+003 33") == 0); + || strcmp (result, "1e+003 33") == 0); free (result); } diff --git a/tests/unistdio/test-ulc-vasnprintf1.c b/tests/unistdio/test-ulc-vasnprintf1.c index e2f8be6..fa4a2c9 100644 --- a/tests/unistdio/test-ulc-vasnprintf1.c +++ b/tests/unistdio/test-ulc-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-asnprintf1.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vasnprintf2.c b/tests/unistdio/test-ulc-vasnprintf2.c index 9022975..d61c1cf 100644 --- a/tests/unistdio/test-ulc-vasnprintf2.c +++ b/tests/unistdio/test-ulc-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,23 +22,11 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) @@ -50,40 +38,40 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -92,46 +80,46 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -140,46 +128,46 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -192,7 +180,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\304rger 33") == 0); ASSERT (length == strlen (result)); @@ -201,7 +189,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \304rger 33") == 0); ASSERT (length == strlen (result)); @@ -210,7 +198,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\304rger 33") == 0); ASSERT (length == strlen (result)); @@ -219,7 +207,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \304rger 33") == 0); ASSERT (length == strlen (result)); diff --git a/tests/unistdio/test-ulc-vasnprintf3.c b/tests/unistdio/test-ulc-vasnprintf3.c index 1fbd925..5a3cd0d 100644 --- a/tests/unistdio/test-ulc-vasnprintf3.c +++ b/tests/unistdio/test-ulc-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,23 +22,11 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) @@ -50,7 +38,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -59,7 +47,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -68,7 +56,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -77,7 +65,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -88,13 +76,13 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -103,7 +91,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -112,7 +100,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -121,7 +109,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -132,13 +120,13 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -147,7 +135,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -156,7 +144,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -165,7 +153,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -180,7 +168,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\303\204rger 33") == 0); ASSERT (length == strlen (result)); @@ -189,7 +177,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \303\204rger 33") == 0); ASSERT (length == strlen (result)); @@ -198,7 +186,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\303\204rger 33") == 0); ASSERT (length == strlen (result)); @@ -207,7 +195,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \303\204rger 33") == 0); ASSERT (length == strlen (result)); diff --git a/tests/unistdio/test-ulc-vasprintf1.c b/tests/unistdio/test-ulc-vasprintf1.c index d8ed67c..0db01c9 100644 --- a/tests/unistdio/test-ulc-vasprintf1.c +++ b/tests/unistdio/test-ulc-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vsnprintf1.c b/tests/unistdio/test-ulc-vsnprintf1.c index 7701c21..7b6de1c 100644 --- a/tests/unistdio/test-ulc-vsnprintf1.c +++ b/tests/unistdio/test-ulc-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,26 +22,13 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vsprintf1.c b/tests/unistdio/test-ulc-vsprintf1.c index 76b85b2..51ea024 100644 --- a/tests/unistdio/test-ulc-vsprintf1.c +++ b/tests/unistdio/test-ulc-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -22,26 +22,13 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h new file mode 100644 index 0000000..5a021c2 --- /dev/null +++ b/tests/unistr/test-chr.h @@ -0,0 +1,103 @@ +/* Test of uN_chr() functions. + Copyright (C) 2008-2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Eric Blake and Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main (void) +{ + size_t n = 0x100000; + UNIT *input = (UNIT *) malloc (n * sizeof (UNIT)); + ASSERT (input); + + input[0] = 'a'; + input[1] = 'b'; + U_SET (input + 2, 'c', 1024); + U_SET (input + 1026, 'd', n - 1028); + input[n - 2] = 'e'; + input[n - 1] = 'a'; + + /* Basic behavior tests. */ + ASSERT (U_CHR (input, n, 'a') == input); + + ASSERT (U_CHR (input, 0, 'a') == NULL); + ASSERT (U_CHR (zerosize_ptr (), 0, 'a') == NULL); + + ASSERT (U_CHR (input, n, 'b') == input + 1); + ASSERT (U_CHR (input, n, 'c') == input + 2); + ASSERT (U_CHR (input, n, 'd') == input + 1026); + + ASSERT (U_CHR (input + 1, n - 1, 'a') == input + n - 1); + ASSERT (U_CHR (input + 1, n - 1, 'e') == input + n - 2); + + ASSERT (U_CHR (input, n, 'f') == NULL); + ASSERT (U_CHR (input, n, '\0') == NULL); + + /* Check that a very long haystack is handled quickly if the byte is + found near the beginning. */ + { + size_t repeat = 10000; + for (; repeat > 0; repeat--) + { + ASSERT (U_CHR (input, n, 'c') == input + 2); + } + } + + /* Alignment tests. */ + { + int i, j; + for (i = 0; i < 32; i++) + { + for (j = 0; j < 128; j++) + input[i + j] = j; + for (j = 0; j < 128; j++) + { + ASSERT (U_CHR (input + i, 128, j) == input + i + j); + } + } + } + + /* Check that uN_chr() does not read past the first occurrence of the + byte being searched. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 1; n <= 500 / sizeof (UNIT); n++) + { + UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT)); + U_SET (mem, 'X', n); + ASSERT (U_CHR (mem, n, 'U') == NULL); + + { + size_t i; + + for (i = 0; i < n; i++) + { + mem[i] = 'U'; + ASSERT (U_CHR (mem, 4000, 'U') == mem + i); + mem[i] = 'X'; + } + } + } + } + } + + free (input); + + return 0; +} diff --git a/tests/unistr/test-cmp.h b/tests/unistr/test-cmp.h new file mode 100644 index 0000000..e536f48 --- /dev/null +++ b/tests/unistr/test-cmp.h @@ -0,0 +1,97 @@ +/* Test of uN_cmp() functions. + Copyright (C) 2008-2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson and Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_cmp (void) +{ + /* Test equal / not equal distinction. */ + ASSERT (U_CMP (zerosize_ptr (), zerosize_ptr (), 0) == 0); + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_CMP (input1, input2, 2) == 0); + ASSERT (U_CMP (input1, input2, 3) == 0); + ASSERT (U_CMP (input1, input2, 4) != 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'b', 'a', 'r', 0 }; + ASSERT (U_CMP (input1, input2, 1) != 0); + ASSERT (U_CMP (input1, input2, 3) != 0); + } + + /* Test less / equal / greater distinction. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'm', 'o', 'o', 0 }; + ASSERT (U_CMP (input1, input2, 4) < 0); + ASSERT (U_CMP (input2, input1, 4) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 }; + static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 }; + ASSERT (U_CMP (input1, input2, 3) < 0); + ASSERT (U_CMP (input2, input1, 3) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_CMP (input1, input2, 4) < 0); + ASSERT (U_CMP (input2, input1, 4) > 0); + } + + /* Some old versions of memcmp were not 8-bit clean. */ + { + static const UNIT input1[] = { 0x40 }; + static const UNIT input2[] = { 0xC2 }; + ASSERT (U_CMP (input1, input2, 1) < 0); + ASSERT (U_CMP (input2, input1, 1) > 0); + } + { + static const UNIT input1[] = { 0xC2 }; + static const UNIT input2[] = { 0xC3 }; + ASSERT (U_CMP (input1, input2, 1) < 0); + ASSERT (U_CMP (input2, input1, 1) > 0); + } + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + UNIT foo[21]; + UNIT bar[21]; + int i; + for (i = 0; i < 4; i++) + { + UNIT *a = foo + i; + UNIT *b = bar + i; + int j; + for (j = 0; j < 8; j++) + a[j] = '-'; + a[8] = '0'; + for (j = 9; j < 16; j++) + a[j] = '1'; + for (j = 0; j < 8; j++) + b[j] = '-'; + b[8] = '1'; + for (j = 9; j < 16; j++) + b[j] = '0'; + ASSERT (U_CMP (a, b, 16) < 0); + } + } +} diff --git a/tests/unistr/test-cmp2.h b/tests/unistr/test-cmp2.h new file mode 100644 index 0000000..261fe36 --- /dev/null +++ b/tests/unistr/test-cmp2.h @@ -0,0 +1,56 @@ +/* Test of uN_cmp2() functions. + Copyright (C) 2008-2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson and Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + { + static const UNIT input1[] = { 'a' }; + static const UNIT input2[] = { 'b' }; + ASSERT (U_CMP2 (input1, 0, input2, 0) == 0); + ASSERT (U_CMP2 (input1, 1, input2, 0) > 0); + ASSERT (U_CMP2 (input1, 0, input2, 1) < 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_CMP2 (input1, 3, input2, 3) == 0); + ASSERT (U_CMP2 (input1, 4, input2, 3) > 0); + ASSERT (U_CMP2 (input2, 3, input1, 4) < 0); + ASSERT (U_CMP2 (input1, 3, input2, 4) < 0); + ASSERT (U_CMP2 (input2, 4, input1, 3) > 0); + ASSERT (U_CMP2 (input1, 4, input2, 4) < 0); + ASSERT (U_CMP2 (input2, 4, input1, 4) > 0); + ASSERT (U_CMP2 (input1, 3, input2, 7) < 0); + ASSERT (U_CMP2 (input2, 7, input1, 3) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o' }; + static const UNIT input2[] = { 'm', 'o', 'o' }; + ASSERT (U_CMP2 (input1, 3, input2, 3) < 0); + ASSERT (U_CMP2 (input2, 3, input1, 3) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h' }; + static const UNIT input2[] = { 'o', 'o', 'p', 's' }; + ASSERT (U_CMP2 (input1, 5, input2, 4) < 0); + ASSERT (U_CMP2 (input2, 4, input1, 5) > 0); + } + + return 0; +} diff --git a/tests/unistr/test-cpy-alloc.h b/tests/unistr/test-cpy-alloc.h new file mode 100644 index 0000000..795e0b7 --- /dev/null +++ b/tests/unistr/test-cpy-alloc.h @@ -0,0 +1,41 @@ +/* Test of uN_cpy_alloc() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT *result = U_CPY_ALLOC (src, n); + size_t i; + + ASSERT (result != NULL); + for (i = 0; i < n; i++) + ASSERT (result[i] == src[i]); + + free (result); + } + } + + return 0; +} diff --git a/tests/unistr/test-cpy.h b/tests/unistr/test-cpy.h new file mode 100644 index 0000000..b62fd14 --- /dev/null +++ b/tests/unistr/test-cpy.h @@ -0,0 +1,44 @@ +/* Test of uN_cpy() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + size_t i; + + ret = U_CPY (dest + 1, src, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-move.h b/tests/unistr/test-move.h new file mode 100644 index 0000000..2462367 --- /dev/null +++ b/tests/unistr/test-move.h @@ -0,0 +1,152 @@ +/* Test of uN_move() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test copying operations with disjoint source and destination. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + size_t i; + + ret = U_MOVE (dest + 1, src, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + /* Test copying operations with overlap, in-place. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1]; + UNIT *ret; + size_t i; + + dest[0] = MAGIC; + for (i = 0; i < n; i++) + dest[1 + i] = src[i]; + dest[1 + n] = MAGIC; + + ret = U_MOVE (dest + 1, dest + 1, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + /* Test copying operations with overlap, moving downward. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' }; + size_t d; + + ASSERT (SIZEOF (src) == SIZEOF (src2)); + for (d = 0; d <= SIZEOF (src); d++) + { + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + 2 * SIZEOF (src) + 1]; + UNIT *ret; + size_t i; + + dest[0] = MAGIC; + for (i = 0; i < SIZEOF (src2); i++) + dest[1 + i] = src2[i]; + for (i = 0; i < SIZEOF (src); i++) + dest[1 + SIZEOF (src) + i] = src[i]; + dest[1 + 2 * SIZEOF (src)] = MAGIC; + + ret = + U_MOVE (dest + 1 + SIZEOF (src) - d, dest + 1 + SIZEOF (src), n); + ASSERT (ret == dest + 1 + SIZEOF (src) - d); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < SIZEOF (src) - d; i++) + ASSERT (dest[1 + i] == src2[i]); + for (i = 0; i < n; i++) + ASSERT (dest[1 + SIZEOF (src) - d + i] == src[i]); + for (i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++) + ASSERT (dest[1 + i] == src2[i]); + for (i = (n >= d ? n - d : 0); i < SIZEOF (src); i++) + ASSERT (dest[1 + SIZEOF (src) + i] == src[i]); + ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC); + } + } + } + + /* Test copying operations with overlap, moving upward. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' }; + size_t d; + + ASSERT (SIZEOF (src) == SIZEOF (src2)); + for (d = 0; d <= SIZEOF (src); d++) + { + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + 2 * SIZEOF (src) + 1]; + UNIT *ret; + size_t i; + + dest[0] = MAGIC; + for (i = 0; i < SIZEOF (src); i++) + dest[1 + i] = src[i]; + for (i = 0; i < SIZEOF (src2); i++) + dest[1 + SIZEOF (src) + i] = src2[i]; + dest[1 + 2 * SIZEOF (src)] = MAGIC; + + ret = U_MOVE (dest + 1 + d, dest + 1, n); + ASSERT (ret == dest + 1 + d); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < d; i++) + ASSERT (dest[1 + i] == src[i]); + for (i = 0; i < n; i++) + ASSERT (dest[1 + d + i] == src[i]); + for (i = d + n; i < SIZEOF (src); i++) + ASSERT (dest[1 + i] == src[i]); + for (i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0); + i < SIZEOF (src2); + i++) + ASSERT (dest[1 + SIZEOF (src) + i] == src2[i]); + ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/unistr/test-set.h b/tests/unistr/test-set.h new file mode 100644 index 0000000..56924dc --- /dev/null +++ b/tests/unistr/test-set.h @@ -0,0 +1,44 @@ +/* Test of uN_set() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + { +#define NMAX 7 + size_t n; + + for (n = 0; n <= NMAX; n++) + { + UNIT dest[1 + NMAX + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + size_t i; + + ret = U_SET (dest + 1, VALUE, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == VALUE); + ASSERT (dest[1 + n] == MAGIC); + } +#undef NMAX + } + + return 0; +} diff --git a/tests/unistr/test-stpcpy.h b/tests/unistr/test-stpcpy.h new file mode 100644 index 0000000..76065dc --- /dev/null +++ b/tests/unistr/test-stpcpy.h @@ -0,0 +1,47 @@ +/* Test of uN_stpcpy() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t n; + + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, + MAGIC + }; + UNIT *result; + size_t i; + + result = U_STPCPY (dest + 1, src + SIZEOF (src) - n); + ASSERT (result == dest + n); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-stpncpy.h b/tests/unistr/test-stpncpy.h new file mode 100644 index 0000000..bb81ff0 --- /dev/null +++ b/tests/unistr/test-stpncpy.h @@ -0,0 +1,79 @@ +/* Test of uN_stpncpy() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + UNIT *dest; + UNIT *result; + size_t i; + + dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT)); + ASSERT (dest != NULL); + + for (i = 0; i < 1 + n + 1; i++) + dest[i] = MAGIC; + + result = U_STPNCPY (dest + 1, input, n); + ASSERT (result == dest + 1 + (n <= length ? n : length)); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < (n <= length ? n : length + 1); i++) + ASSERT (dest[1 + i] == input[i]); + for (; i < n; i++) + ASSERT (dest[1 + i] == 0); + ASSERT (dest[1 + n] == MAGIC); + + free (dest); +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STPNCPY (D, S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-strcat.h b/tests/unistr/test-strcat.h new file mode 100644 index 0000000..6c1f90d --- /dev/null +++ b/tests/unistr/test-strcat.h @@ -0,0 +1,56 @@ +/* Test of uN_strcat() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 }; + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t m; + size_t n; + + for (m = 0; m < SIZEOF (base); m++) + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT dest[1 + (SIZEOF (base) - 1) + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, + MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC + }; + UNIT *result; + size_t i; + + for (i = 0; i < m; i++) + dest[1 + i] = base[i]; + dest[1 + m] = 0; + + result = U_STRCAT (dest + 1, src + SIZEOF (src) - n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < m; i++) + ASSERT (dest[1 + i] == base[i]); + for (i = 0; i < n; i++) + ASSERT (dest[1 + m + i] == src[SIZEOF (src) - n + i]); + ASSERT (dest[1 + m + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-strcmp.h b/tests/unistr/test-strcmp.h new file mode 100644 index 0000000..485b6f9 --- /dev/null +++ b/tests/unistr/test-strcmp.h @@ -0,0 +1,56 @@ +/* Test of uN_strcmp() and uN_strcoll() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_strcmp (void) +{ + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 0 }; + ASSERT (U_STRCMP (input1, input2) == 0); + } + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRCMP (input1, input2) == 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'b', 'a', 'r', 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 }; + static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } +} diff --git a/tests/unistr/test-strcpy.h b/tests/unistr/test-strcpy.h new file mode 100644 index 0000000..f8fe5ef --- /dev/null +++ b/tests/unistr/test-strcpy.h @@ -0,0 +1,47 @@ +/* Test of uN_strcpy() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t n; + + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, + MAGIC + }; + UNIT *result; + size_t i; + + result = U_STRCPY (dest + 1, src + SIZEOF (src) - n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-strdup.h b/tests/unistr/test-strdup.h new file mode 100644 index 0000000..1684b39 --- /dev/null +++ b/tests/unistr/test-strdup.h @@ -0,0 +1,41 @@ +/* Test of uN_strdup() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t n; + + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT *result = U_STRDUP (src + SIZEOF (src) - n); + size_t i; + + ASSERT (result != NULL); + for (i = 0; i < n; i++) + ASSERT (result[i] == src[SIZEOF (src) - n + i]); + + free (result); + } + } + + return 0; +} diff --git a/tests/unistr/test-strncat.h b/tests/unistr/test-strncat.h new file mode 100644 index 0000000..0445b6d --- /dev/null +++ b/tests/unistr/test-strncat.h @@ -0,0 +1,90 @@ +/* Test of uN_strncat() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 }; + size_t m; + + for (m = 0; m < SIZEOF (base); m++) + { + UNIT *dest; + UNIT *result; + size_t i; + + dest = (UNIT *) malloc ((1 + m + n + 2) * sizeof (UNIT)); + ASSERT (dest != NULL); + + dest[0] = MAGIC; + for (i = 0; i < m; i++) + dest[1 + i] = base[i]; + dest[1 + m] = 0; + for (i = 1; i < n + 2; i++) + dest[1 + m + i] = MAGIC; + + result = U_STRNCAT (dest + 1, input, n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < m; i++) + ASSERT (dest[1 + i] == base[i]); + for (i = 0; i < (n <= length ? n : length); i++) + ASSERT (dest[1 + m + i] == input[i]); + ASSERT (dest[1 + m + i] == 0); + ASSERT (dest[1 + m + i + 1] == MAGIC); + + free (dest); + } +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STRNCAT (D, S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-strncmp.h b/tests/unistr/test-strncmp.h new file mode 100644 index 0000000..628db94 --- /dev/null +++ b/tests/unistr/test-strncmp.h @@ -0,0 +1,92 @@ +/* Test of uN_strncmp() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_strncmp (void) +{ + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) == 0); + } + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) < 0); + ASSERT (U_STRNCMP (input2, input1, 1) > 0); + ASSERT (U_STRNCMP (input1, input2, 3) < 0); + ASSERT (U_STRNCMP (input2, input1, 3) > 0); + ASSERT (U_STRNCMP (input1, input2, 4) < 0); + ASSERT (U_STRNCMP (input2, input1, 4) > 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) < 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 2) == 0); + ASSERT (U_STRNCMP (input1, input2, 3) == 0); + ASSERT (U_STRNCMP (input1, input2, 4) == 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) == 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'b', 'a', 'r', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 2) == 0); + ASSERT (U_STRNCMP (input1, input2, 3) == 0); + ASSERT (U_STRNCMP (input1, input2, 4) < 0); + ASSERT (U_STRNCMP (input2, input1, 4) > 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) < 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 }; + static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 2) == 0); + ASSERT (U_STRNCMP (input1, input2, 3) < 0); + ASSERT (U_STRNCMP (input2, input1, 3) > 0); + ASSERT (U_STRNCMP (input1, input2, 4) < 0); + ASSERT (U_STRNCMP (input2, input1, 4) > 0); + ASSERT (U_STRNCMP (input1, input2, 5) < 0); + ASSERT (U_STRNCMP (input2, input1, 5) > 0); + ASSERT (U_STRNCMP (input1, input2, 6) < 0); + ASSERT (U_STRNCMP (input2, input1, 6) > 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) < 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) > 0); + } +} diff --git a/tests/unistr/test-strncpy.h b/tests/unistr/test-strncpy.h new file mode 100644 index 0000000..6fa0d12 --- /dev/null +++ b/tests/unistr/test-strncpy.h @@ -0,0 +1,79 @@ +/* Test of uN_strncpy() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + UNIT *dest; + UNIT *result; + size_t i; + + dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT)); + ASSERT (dest != NULL); + + for (i = 0; i < 1 + n + 1; i++) + dest[i] = MAGIC; + + result = U_STRNCPY (dest + 1, input, n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < (n <= length ? n : length + 1); i++) + ASSERT (dest[1 + i] == input[i]); + for (; i < n; i++) + ASSERT (dest[1 + i] == 0); + ASSERT (dest[1 + n] == MAGIC); + + free (dest); +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STRNCPY (D, S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-strnlen.h b/tests/unistr/test-strnlen.h new file mode 100644 index 0000000..1199126 --- /dev/null +++ b/tests/unistr/test-strnlen.h @@ -0,0 +1,60 @@ +/* Test of uN_strnlen() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + size_t result = U_STRNLEN (input, n); + ASSERT (result == (n <= length ? n : length)); +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STRNLEN (S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-u16-check.c b/tests/unistr/test-u16-check.c new file mode 100644 index 0000000..b7a9c10 --- /dev/null +++ b/tests/unistr/test-u16-check.c @@ -0,0 +1,66 @@ +/* Test of u16_check() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint16_t input[] = { 0 }; + ASSERT (u16_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint16_t input[] = /* "Данило Шеган" */ + { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D }; + ASSERT (u16_check (input, SIZEOF (input)) == NULL); + } + + /* Test out-of-range character with 2 units: U+110000. */ + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xE000 }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + + /* Test surrogate codepoints. */ + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF }; + ASSERT (u16_check (input, SIZEOF (input)) == NULL); + } + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + + return 0; +} diff --git a/tests/unistr/test-u16-chr.c b/tests/unistr/test-u16-chr.c new file mode 100644 index 0000000..d71755c --- /dev/null +++ b/tests/unistr/test-u16-chr.c @@ -0,0 +1,31 @@ +/* Test of u16_chr() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_CHR u16_chr +#define U_SET u16_set +#include "test-chr.h" diff --git a/tests/test-open.c b/tests/unistr/test-u16-cmp.c index f7bb543..1ab9019 100644 --- a/tests/test-open.c +++ b/tests/unistr/test-u16-cmp.c @@ -1,5 +1,5 @@ -/* Test of opening a file descriptor. - Copyright (C) 2007-2009 Free Software Foundation, Inc. +/* Test of u16_cmp() function. + Copyright (C) 2010 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 @@ -14,34 +14,34 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> -#include <fcntl.h> +#include "unistr.h" -#include <stdio.h> -#include <stdlib.h> +#include "zerosize-ptr.h" +#include "macros.h" -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#define UNIT uint16_t +#define U_CMP u16_cmp +#define MAGIC 0xBADE +#include "test-cmp.h" int main () { - ASSERT (open ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) < 0); - ASSERT (open ("/dev/null/", O_RDONLY) < 0); - - ASSERT (open ("/dev/null", O_RDONLY) >= 0); + test_cmp (); + + /* Test comparison with non-BMP characters, split into surrogates. */ + { + static const UNIT input1[] = { 0xD835, 0xDD1E }; + static const UNIT input2[] = { 0xFEFF, 0xFFE5 }; + ASSERT (U_CMP (input1, input2, 2) > 0); + ASSERT (U_CMP (input2, input1, 2) < 0); + ASSERT (U_CMP (input1, input2, 1) > 0); + ASSERT (U_CMP (input2, input1, 1) < 0); + } return 0; } diff --git a/tests/unistr/test-u16-cmp2.c b/tests/unistr/test-u16-cmp2.c new file mode 100644 index 0000000..3993dcd --- /dev/null +++ b/tests/unistr/test-u16-cmp2.c @@ -0,0 +1,28 @@ +/* Test of u16_cmp2() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_CMP2 u16_cmp2 +#define MAGIC 0xBADE +#include "test-cmp2.h" diff --git a/tests/unistr/test-u16-cpy-alloc.c b/tests/unistr/test-u16-cpy-alloc.c new file mode 100644 index 0000000..d1aa211 --- /dev/null +++ b/tests/unistr/test-u16-cpy-alloc.c @@ -0,0 +1,29 @@ +/* Test of u16_cpy_alloc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "macros.h" + +#define UNIT uint16_t +#define U_CPY_ALLOC u16_cpy_alloc +#include "test-cpy-alloc.h" diff --git a/tests/unistr/test-u16-cpy.c b/tests/unistr/test-u16-cpy.c new file mode 100644 index 0000000..168a459 --- /dev/null +++ b/tests/unistr/test-u16-cpy.c @@ -0,0 +1,28 @@ +/* Test of u16_cpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_CPY u16_cpy +#define MAGIC 0xBADE +#include "test-cpy.h" diff --git a/tests/unistr/test-u16-mblen.c b/tests/unistr/test-u16-mblen.c new file mode 100644 index 0000000..13186f3 --- /dev/null +++ b/tests/unistr/test-u16-mblen.c @@ -0,0 +1,84 @@ +/* Test of u16_mblen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test zero-length input. */ + { + static const uint16_t input[] = { 0 }; + ret = u16_mblen (input, 0); + ASSERT (ret == -1); + } + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + ret = u16_mblen (input, 1); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + ret = u16_mblen (buf, 1); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + ret = u16_mblen (input, 1); + ASSERT (ret == 1); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + ret = u16_mblen (input, 2); + ASSERT (ret == 2); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + ret = u16_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint16_t input[] = { 0xDD1F }; + ret = u16_mblen (input, 1); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u16-mbsnlen.c b/tests/unistr/test-u16-mbsnlen.c new file mode 100644 index 0000000..a2d8b10 --- /dev/null +++ b/tests/unistr/test-u16-mbsnlen.c @@ -0,0 +1,68 @@ +/* Test of u16_mbsnlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u16_mbsnlen (input, n); + ASSERT (len == n); + } + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + static const size_t expected[SIZEOF (input) + 1] = + { 0, + 1, 2, 3, 3, 4, 5, 5, 6, 7, + 8, 8, 9, 10, 10 + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u16_mbsnlen (input, n); + ASSERT (len == expected[n]); + } + } + + return 0; +} diff --git a/tests/test-fcntl.c b/tests/unistr/test-u16-mbtouc-unsafe.c index 449984c..a1d1214 100644 --- a/tests/test-fcntl.c +++ b/tests/unistr/test-u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ -/* Test of <fcntl.h> substitute. - Copyright (C) 2007 Free Software Foundation, Inc. +/* Test of u16_mbtouc_unsafe() function. + Copyright (C) 2010 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 @@ -14,22 +14,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> -#include <fcntl.h> +#include "unistr.h" -/* Check that the various O_* macros are defined. */ -int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK - | O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC - | O_BINARY | O_TEXT; +#include "macros.h" -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; +#include "test-u16-mbtouc.h" int main () { + test_function (u16_mbtouc_unsafe); + return 0; } diff --git a/tests/unistr/test-u16-mbtouc.c b/tests/unistr/test-u16-mbtouc.c new file mode 100644 index 0000000..4545add --- /dev/null +++ b/tests/unistr/test-u16-mbtouc.c @@ -0,0 +1,33 @@ +/* Test of u16_mbtouc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u16-mbtouc.h" + +int +main () +{ + test_function (u16_mbtouc); + + return 0; +} diff --git a/tests/unistr/test-u16-mbtouc.h b/tests/unistr/test-u16-mbtouc.h new file mode 100644 index 0000000..ef0fb68 --- /dev/null +++ b/tests/unistr/test-u16-mbtouc.h @@ -0,0 +1,82 @@ +/* Test of u16_mbtouc() and u16_mbtouc_unsafe() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_function (int (*my_u16_mbtouc) (ucs4_t *, const uint16_t *, size_t)) +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint16_t input[] = { 0xDD1F }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } +} diff --git a/tests/unistr/test-u16-mbtoucr.c b/tests/unistr/test-u16-mbtoucr.c new file mode 100644 index 0000000..fb1264d --- /dev/null +++ b/tests/unistr/test-u16-mbtoucr.c @@ -0,0 +1,90 @@ +/* Test of u16_mbtoucr() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint16_t input[] = { 0xDD1F }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u16-move.c b/tests/unistr/test-u16-move.c new file mode 100644 index 0000000..ff1e6e3 --- /dev/null +++ b/tests/unistr/test-u16-move.c @@ -0,0 +1,28 @@ +/* Test of u16_move() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_MOVE u16_move +#define MAGIC 0xBADE +#include "test-move.h" diff --git a/tests/unistr/test-u16-next.c b/tests/unistr/test-u16-next.c new file mode 100644 index 0000000..d9ac6e9 --- /dev/null +++ b/tests/unistr/test-u16-next.c @@ -0,0 +1,91 @@ +/* Test of u16_next() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + const uint16_t *ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u16_next (&uc, buf); + ASSERT (ret == buf + 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == input + 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == input + 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint16_t input[] = { 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u16-prev.c b/tests/unistr/test-u16-prev.c new file mode 100644 index 0000000..90e8341 --- /dev/null +++ b/tests/unistr/test-u16-prev.c @@ -0,0 +1,175 @@ +/* Test of u16_prev() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +static int +check (const uint16_t *input, size_t input_length, ucs4_t *puc) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + if (u16_prev (&uc, input + input_length, input) != input) + return 1; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0x2102; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u16_prev (&uc1, ptr + input_length, buf) != ptr) + return 2; + if (uc1 != uc) + return 3; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xD835; + *ptr++ = 0xDD1E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u16_prev (&uc1, ptr + input_length, buf) != ptr) + return 4; + if (uc1 != uc) + return 5; + } + + *puc = uc; + return 0; +} + +static int +check_invalid (const uint16_t *input, size_t input_length) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + uc = 0xBADFACE; + if (u16_prev (&uc, input + input_length, input) != NULL) + return 1; + if (uc != 0xBADFACE) + return 2; + +#if CONFIG_UNICODE_SAFETY + /* Test recognition when preceded by a 1-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0x2102; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u16_prev (&uc, ptr + input_length, buf) != NULL) + return 3; + if (uc != 0xBADFACE) + return 4; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xD835; + *ptr++ = 0xDD1E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u16_prev (&uc, ptr + input_length, buf) != NULL) + return 5; + if (uc != 0xBADFACE) + return 6; + } +#endif + + return 0; +} + +int +main () +{ + ucs4_t uc; + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ASSERT (check (buf, 1, &uc) == 0); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint16_t input[] = { 0xDD1F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + return 0; +} diff --git a/tests/unistr/test-u16-set.c b/tests/unistr/test-u16-set.c new file mode 100644 index 0000000..f3e6305 --- /dev/null +++ b/tests/unistr/test-u16-set.c @@ -0,0 +1,29 @@ +/* Test of u16_set() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_SET u16_set +#define MAGIC 0xBADE +#define VALUE 0x2102 +#include "test-set.h" diff --git a/tests/unistr/test-u16-stpcpy.c b/tests/unistr/test-u16-stpcpy.c new file mode 100644 index 0000000..6bf3ecb --- /dev/null +++ b/tests/unistr/test-u16-stpcpy.c @@ -0,0 +1,28 @@ +/* Test of u16_stpcpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STPCPY u16_stpcpy +#define MAGIC 0xBADE +#include "test-stpcpy.h" diff --git a/tests/unistr/test-u16-stpncpy.c b/tests/unistr/test-u16-stpncpy.c new file mode 100644 index 0000000..e53ce6b --- /dev/null +++ b/tests/unistr/test-u16-stpncpy.c @@ -0,0 +1,59 @@ +/* Test of u16_stpncpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STPNCPY u16_stpncpy +#define MAGIC 0xBADE +#include "test-stpncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strcat.c b/tests/unistr/test-u16-strcat.c new file mode 100644 index 0000000..9d6032e --- /dev/null +++ b/tests/unistr/test-u16-strcat.c @@ -0,0 +1,28 @@ +/* Test of u16_strcat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRCAT u16_strcat +#define MAGIC 0xBADE +#include "test-strcat.h" diff --git a/tests/unistr/test-u16-strcmp.c b/tests/unistr/test-u16-strcmp.c new file mode 100644 index 0000000..5fc4777 --- /dev/null +++ b/tests/unistr/test-u16-strcmp.c @@ -0,0 +1,34 @@ +/* Test of u16_strcmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u16_strcmp +#include "test-u16-strcmp.h" + +int +main () +{ + test_u16_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u16-strcmp.h b/tests/unistr/test-u16-strcmp.h new file mode 100644 index 0000000..ad54a43 --- /dev/null +++ b/tests/unistr/test-u16-strcmp.h @@ -0,0 +1,42 @@ +/* Test of u16_strcmp() and u16_strcoll() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#define UNIT uint16_t +#include "test-strcmp.h" + +static void +test_u16_strcmp (void) +{ + test_strcmp (); + + /* Test comparison between ASCII and non-ASCII characters. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 0x2022, 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + + /* Test comparison with non-BMP characters, split into surrogates. */ + { + static const UNIT input1[] = { 0xD835, 0xDD1E, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } +} diff --git a/tests/unistr/test-u16-strcoll.c b/tests/unistr/test-u16-strcoll.c new file mode 100644 index 0000000..e24814a --- /dev/null +++ b/tests/unistr/test-u16-strcoll.c @@ -0,0 +1,41 @@ +/* Test of u16_strcoll() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u16_strcoll +#include "test-u16-strcmp.h" + +int +main () +{ + /* This test relies on three facts: + - setlocale is not being called, therefore the locale is the "C" locale. + - In the "C" locale, strcoll is equivalent to strcmp. + - In the u16_strcoll implementation, Unicode strings that are not + convertible to the locale encoding are sorted higher than convertible + strings and compared according to u16_strcmp. */ + + test_u16_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u16-strcpy.c b/tests/unistr/test-u16-strcpy.c new file mode 100644 index 0000000..e017a11 --- /dev/null +++ b/tests/unistr/test-u16-strcpy.c @@ -0,0 +1,28 @@ +/* Test of u16_strcpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRCPY u16_strcpy +#define MAGIC 0xBADE +#include "test-strcpy.h" diff --git a/tests/unistr/test-u16-strdup.c b/tests/unistr/test-u16-strdup.c new file mode 100644 index 0000000..f0266d1 --- /dev/null +++ b/tests/unistr/test-u16-strdup.c @@ -0,0 +1,27 @@ +/* Test of u16_strdup() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRDUP u16_strdup +#include "test-strdup.h" diff --git a/tests/unistr/test-u16-strlen.c b/tests/unistr/test-u16-strlen.c new file mode 100644 index 0000000..7b8690b --- /dev/null +++ b/tests/unistr/test-u16-strlen.c @@ -0,0 +1,57 @@ +/* Test of u16_strlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Empty string. */ + { + static const uint16_t input[] = { 0 }; + ASSERT (u16_strlen (input) == 0); + } + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + ASSERT (u16_strlen (input) == SIZEOF (input) - 1); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + ASSERT (u16_strlen (input) == SIZEOF (input) - 1); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strmblen.c b/tests/unistr/test-u16-strmblen.c new file mode 100644 index 0000000..80371b0 --- /dev/null +++ b/tests/unistr/test-u16-strmblen.c @@ -0,0 +1,78 @@ +/* Test of u16_strmblen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + ret = u16_strmblen (input); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + ret = u16_strmblen (buf); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == 1); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == 2); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint16_t input[] = { 0xDD1F, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strmbtouc.c b/tests/unistr/test-u16-strmbtouc.c new file mode 100644 index 0000000..ceeaf2c --- /dev/null +++ b/tests/unistr/test-u16-strmbtouc.c @@ -0,0 +1,91 @@ +/* Test of u16_strmbtouc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == 0); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, buf); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint16_t input[] = { 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strncat.c b/tests/unistr/test-u16-strncat.c new file mode 100644 index 0000000..c875cfc --- /dev/null +++ b/tests/unistr/test-u16-strncat.c @@ -0,0 +1,59 @@ +/* Test of u16_strncat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNCAT u16_strncat +#define MAGIC 0xBADE +#include "test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strncmp.c b/tests/unistr/test-u16-strncmp.c new file mode 100644 index 0000000..b04431b --- /dev/null +++ b/tests/unistr/test-u16-strncmp.c @@ -0,0 +1,47 @@ +/* Test of u16_strncmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNCMP u16_strncmp +#include "test-strncmp.h" + +int +main () +{ + test_strncmp (); + + /* Test comparison with non-BMP characters, split into surrogates. */ + { + static const UNIT input1[] = { 0xD835, 0xDD1E, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strncpy.c b/tests/unistr/test-u16-strncpy.c new file mode 100644 index 0000000..102f653 --- /dev/null +++ b/tests/unistr/test-u16-strncpy.c @@ -0,0 +1,59 @@ +/* Test of u16_strncpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNCPY u16_strncpy +#define MAGIC 0xBADE +#include "test-strncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strnlen.c b/tests/unistr/test-u16-strnlen.c new file mode 100644 index 0000000..beeba64 --- /dev/null +++ b/tests/unistr/test-u16-strnlen.c @@ -0,0 +1,56 @@ +/* Test of u16_strnlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNLEN u16_strnlen +#include "test-strnlen.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-to-u32.c b/tests/unistr/test-u16-to-u32.c new file mode 100644 index 0000000..5b382b2 --- /dev/null +++ b/tests/unistr/test-u16-to-u32.c @@ -0,0 +1,156 @@ +/* Test of u16_to_u32() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint16_t *input, size_t input_length, + const uint32_t *expected, size_t expected_length) +{ + size_t length; + uint32_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u32 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint32_t *preallocated; + + length = expected_length - 1; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u16_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint32_t *preallocated; + + length = expected_length; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u16_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint32_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + static const uint32_t expected[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint16_t input[] = { 'x', 0xDD1E, 0xD835, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint32_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint32_t *result; + uint32_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u32 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u16_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u16_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u16-to-u8.c b/tests/unistr/test-u16-to-u8.c new file mode 100644 index 0000000..4ef9b9b --- /dev/null +++ b/tests/unistr/test-u16-to-u8.c @@ -0,0 +1,159 @@ +/* Test of u16_to_u8() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint16_t *input, size_t input_length, + const uint8_t *expected, size_t expected_length) +{ + size_t length; + uint8_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u8 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint8_t *preallocated; + + length = expected_length - 1; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u16_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint8_t *preallocated; + + length = expected_length; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u16_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint8_t expected[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + static const uint8_t expected[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint16_t input[] = { 'x', 0xDD1E, 0xD835, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint8_t expected[] = + { 'x', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint8_t *result; + uint8_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u8 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u16_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u16_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u16-uctomb.c b/tests/unistr/test-u16-uctomb.c new file mode 100644 index 0000000..ba50225 --- /dev/null +++ b/tests/unistr/test-u16-uctomb.c @@ -0,0 +1,110 @@ +/* Test of u16_uctomb() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define MAGIC 0xBADE + +int +main () +{ + /* Test ISO 646 character, in particular the NUL character. */ + { + ucs4_t uc; + + for (uc = 0; uc < 0x80; uc++) + { + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + } + + /* Test BMP character. */ + { + ucs4_t uc = 0x20AC; + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + + /* Test non-BMP character. */ + { + ucs4_t uc = 0x10FFFD; + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 2); + ASSERT (ret == 2); + ASSERT (buf[0] == 0xDBFF); + ASSERT (buf[1] == 0xDFFD); + ASSERT (buf[2] == MAGIC); + } + + /* Test invalid characters. */ + { + ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + size_t i; + + for (i = 0; i < SIZEOF (invalid); i++) + { + ucs4_t uc = invalid[i]; + int n; + + for (n = 0; n <= 2; n++) + { + int ret = u16_uctomb (buf, uc, n); + ASSERT (ret == -1); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + ASSERT (buf[2] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/unistr/test-u32-check.c b/tests/unistr/test-u32-check.c new file mode 100644 index 0000000..fdd64df --- /dev/null +++ b/tests/unistr/test-u32-check.c @@ -0,0 +1,66 @@ +/* Test of u32_check() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint32_t input[] = { 0 }; + ASSERT (u32_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint32_t input[] = /* "Данило Шеган" */ + { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D }; + ASSERT (u32_check (input, SIZEOF (input)) == NULL); + } + + /* Test out-of-range character with 1 unit: U+110000. */ + { + static const uint32_t input[] = { 0x0414, 0x0430, 0x110000 }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + + /* Test surrogate codepoints. */ + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDBFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDFFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + + return 0; +} diff --git a/tests/unistr/test-u32-chr.c b/tests/unistr/test-u32-chr.c new file mode 100644 index 0000000..f23aa08 --- /dev/null +++ b/tests/unistr/test-u32-chr.c @@ -0,0 +1,31 @@ +/* Test of u32_chr() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_CHR u32_chr +#define U_SET u32_set +#include "test-chr.h" diff --git a/tests/unistr/test-u32-cmp.c b/tests/unistr/test-u32-cmp.c new file mode 100644 index 0000000..ab41b31 --- /dev/null +++ b/tests/unistr/test-u32-cmp.c @@ -0,0 +1,45 @@ +/* Test of u32_cmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_CMP u32_cmp +#define MAGIC 0xBADFACE +#include "test-cmp.h" + +int +main () +{ + test_cmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0x1D51F }; + static const UNIT input2[] = { 0xFEFF }; + ASSERT (U_CMP (input1, input2, 1) > 0); + ASSERT (U_CMP (input2, input1, 1) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u32-cmp2.c b/tests/unistr/test-u32-cmp2.c new file mode 100644 index 0000000..84450b5 --- /dev/null +++ b/tests/unistr/test-u32-cmp2.c @@ -0,0 +1,28 @@ +/* Test of u32_cmp2() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_CMP2 u32_cmp2 +#define MAGIC 0xBADFACE +#include "test-cmp2.h" diff --git a/tests/unistr/test-u32-cpy-alloc.c b/tests/unistr/test-u32-cpy-alloc.c new file mode 100644 index 0000000..d3675dd --- /dev/null +++ b/tests/unistr/test-u32-cpy-alloc.c @@ -0,0 +1,29 @@ +/* Test of u32_cpy_alloc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "macros.h" + +#define UNIT uint32_t +#define U_CPY_ALLOC u32_cpy_alloc +#include "test-cpy-alloc.h" diff --git a/tests/unistr/test-u32-cpy.c b/tests/unistr/test-u32-cpy.c new file mode 100644 index 0000000..49fc995 --- /dev/null +++ b/tests/unistr/test-u32-cpy.c @@ -0,0 +1,28 @@ +/* Test of u32_cpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_CPY u32_cpy +#define MAGIC 0xBADFACE +#include "test-cpy.h" diff --git a/tests/unistr/test-u32-mblen.c b/tests/unistr/test-u32-mblen.c new file mode 100644 index 0000000..1ebd93e --- /dev/null +++ b/tests/unistr/test-u32-mblen.c @@ -0,0 +1,81 @@ +/* Test of u32_mblen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test zero-length input. */ + { + static const uint32_t input[] = { 0 }; + ret = u32_mblen (input, 0); + ASSERT (ret == -1); + } + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + ret = u32_mblen (input, 1); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + ret = u32_mblen (buf, 1); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + ret = u32_mblen (input, 1); + ASSERT (ret == 1); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + ret = u32_mblen (input, 1); + ASSERT (ret == 1); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + ret = u32_mblen (input, 1); + ASSERT (ret == -1); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-mbsnlen.c b/tests/unistr/test-u32-mbsnlen.c new file mode 100644 index 0000000..d9e066b --- /dev/null +++ b/tests/unistr/test-u32-mbsnlen.c @@ -0,0 +1,63 @@ +/* Test of u32_mbsnlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u32_mbsnlen (input, n); + ASSERT (len == n); + } + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u32_mbsnlen (input, n); + ASSERT (len == n); + } + } + return 0; +} diff --git a/tests/unistr/test-u32-mbtouc-unsafe.c b/tests/unistr/test-u32-mbtouc-unsafe.c new file mode 100644 index 0000000..cb3052c --- /dev/null +++ b/tests/unistr/test-u32-mbtouc-unsafe.c @@ -0,0 +1,33 @@ +/* Test of u32_mbtouc_unsafe() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u32-mbtouc.h" + +int +main () +{ + test_function (u32_mbtouc_unsafe); + + return 0; +} diff --git a/tests/unistr/test-u32-mbtouc.c b/tests/unistr/test-u32-mbtouc.c new file mode 100644 index 0000000..7c981b5 --- /dev/null +++ b/tests/unistr/test-u32-mbtouc.c @@ -0,0 +1,36 @@ +/* Test of u32_mbtouc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +/* Enable all tests that may be skipped when testing u32_mbtouc_unsafe. */ +#define FULL_SAFETY 1 + +#include "test-u32-mbtouc.h" + +int +main () +{ + test_function (u32_mbtouc); + + return 0; +} diff --git a/tests/unistr/test-u32-mbtouc.h b/tests/unistr/test-u32-mbtouc.h new file mode 100644 index 0000000..7d70133 --- /dev/null +++ b/tests/unistr/test-u32-mbtouc.h @@ -0,0 +1,77 @@ +/* Test of u32_mbtouc() and u32_mbtouc_unsafe() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_function (int (*my_u32_mbtouc) (ucs4_t *, const uint32_t *, size_t)) +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x1D51F); + } + +#if FULL_SAFETY || CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } +#endif +} diff --git a/tests/unistr/test-u32-mbtoucr.c b/tests/unistr/test-u32-mbtoucr.c new file mode 100644 index 0000000..7b1034c --- /dev/null +++ b/tests/unistr/test-u32-mbtoucr.c @@ -0,0 +1,83 @@ +/* Test of u32_mbtoucr() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u32-move.c b/tests/unistr/test-u32-move.c new file mode 100644 index 0000000..44f95c0 --- /dev/null +++ b/tests/unistr/test-u32-move.c @@ -0,0 +1,28 @@ +/* Test of u32_move() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_MOVE u32_move +#define MAGIC 0xBADFACE +#include "test-move.h" diff --git a/tests/unistr/test-u32-next.c b/tests/unistr/test-u32-next.c new file mode 100644 index 0000000..a5852e2 --- /dev/null +++ b/tests/unistr/test-u32-next.c @@ -0,0 +1,86 @@ +/* Test of u32_next() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + const uint32_t *ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u32_next (&uc, buf); + ASSERT (ret == buf + 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == input + 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F, 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == input + 1); + ASSERT (uc == 0x1D51F); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000, 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-prev.c b/tests/unistr/test-u32-prev.c new file mode 100644 index 0000000..95187af --- /dev/null +++ b/tests/unistr/test-u32-prev.c @@ -0,0 +1,133 @@ +/* Test of u32_prev() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +static int +check (const uint32_t *input, size_t input_length, ucs4_t *puc) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + if (u32_prev (&uc, input + input_length, input) != input) + return 1; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint32_t buf[100]; + uint32_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0x1D51E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u32_prev (&uc1, ptr + input_length, buf) != ptr) + return 2; + if (uc1 != uc) + return 3; + } + + *puc = uc; + return 0; +} + +static int +check_invalid (const uint32_t *input, size_t input_length) +{ +#if CONFIG_UNICODE_SAFETY + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + uc = 0xBADFACE; + if (u32_prev (&uc, input + input_length, input) != NULL) + return 1; + if (uc != 0xBADFACE) + return 2; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint32_t buf[100]; + uint32_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0x1D51E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u32_prev (&uc, ptr + input_length, buf) != NULL) + return 3; + if (uc != 0xBADFACE) + return 4; + } +#endif + + return 0; +} + +int +main () +{ + ucs4_t uc; + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ASSERT (check (buf, 1, &uc) == 0); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + return 0; +} diff --git a/tests/unistr/test-u32-set.c b/tests/unistr/test-u32-set.c new file mode 100644 index 0000000..120804f --- /dev/null +++ b/tests/unistr/test-u32-set.c @@ -0,0 +1,29 @@ +/* Test of u32_set() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_SET u32_set +#define MAGIC 0xBADFACE +#define VALUE 0x1D51E +#include "test-set.h" diff --git a/tests/unistr/test-u32-stpcpy.c b/tests/unistr/test-u32-stpcpy.c new file mode 100644 index 0000000..9c99c52 --- /dev/null +++ b/tests/unistr/test-u32-stpcpy.c @@ -0,0 +1,28 @@ +/* Test of u32_stpcpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STPCPY u32_stpcpy +#define MAGIC 0xBADFACE +#include "test-stpcpy.h" diff --git a/tests/unistr/test-u32-stpncpy.c b/tests/unistr/test-u32-stpncpy.c new file mode 100644 index 0000000..e29683b --- /dev/null +++ b/tests/unistr/test-u32-stpncpy.c @@ -0,0 +1,59 @@ +/* Test of u32_stpncpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STPNCPY u32_stpncpy +#define MAGIC 0xBADFACE +#include "test-stpncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strcat.c b/tests/unistr/test-u32-strcat.c new file mode 100644 index 0000000..66e7c85 --- /dev/null +++ b/tests/unistr/test-u32-strcat.c @@ -0,0 +1,28 @@ +/* Test of u32_strcat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRCAT u32_strcat +#define MAGIC 0xBADFACE +#include "test-strcat.h" diff --git a/tests/unistr/test-u32-strcmp.c b/tests/unistr/test-u32-strcmp.c new file mode 100644 index 0000000..8364a41 --- /dev/null +++ b/tests/unistr/test-u32-strcmp.c @@ -0,0 +1,34 @@ +/* Test of u32_strcmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u32_strcmp +#include "test-u32-strcmp.h" + +int +main () +{ + test_u32_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u32-strcmp.h b/tests/unistr/test-u32-strcmp.h new file mode 100644 index 0000000..6d24132 --- /dev/null +++ b/tests/unistr/test-u32-strcmp.h @@ -0,0 +1,42 @@ +/* Test of u32_strcmp() and u32_strcoll() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#define UNIT uint32_t +#include "test-strcmp.h" + +static void +test_u32_strcmp (void) +{ + test_strcmp (); + + /* Test comparison between ASCII and non-ASCII characters. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 0x2022, 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0x1D51F, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } +} diff --git a/tests/unistr/test-u32-strcoll.c b/tests/unistr/test-u32-strcoll.c new file mode 100644 index 0000000..36954e7 --- /dev/null +++ b/tests/unistr/test-u32-strcoll.c @@ -0,0 +1,41 @@ +/* Test of u32_strcoll() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u32_strcoll +#include "test-u32-strcmp.h" + +int +main () +{ + /* This test relies on three facts: + - setlocale is not being called, therefore the locale is the "C" locale. + - In the "C" locale, strcoll is equivalent to strcmp. + - In the u32_strcoll implementation, Unicode strings that are not + convertible to the locale encoding are sorted higher than convertible + strings and compared according to u32_strcmp. */ + + test_u32_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u32-strcpy.c b/tests/unistr/test-u32-strcpy.c new file mode 100644 index 0000000..2e22aad --- /dev/null +++ b/tests/unistr/test-u32-strcpy.c @@ -0,0 +1,28 @@ +/* Test of u32_strcpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRCPY u32_strcpy +#define MAGIC 0xBADFACE +#include "test-strcpy.h" diff --git a/tests/unistr/test-u32-strdup.c b/tests/unistr/test-u32-strdup.c new file mode 100644 index 0000000..ede8e54 --- /dev/null +++ b/tests/unistr/test-u32-strdup.c @@ -0,0 +1,27 @@ +/* Test of u32_strdup() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRDUP u32_strdup +#include "test-strdup.h" diff --git a/tests/unistr/test-u32-strlen.c b/tests/unistr/test-u32-strlen.c new file mode 100644 index 0000000..a349be7 --- /dev/null +++ b/tests/unistr/test-u32-strlen.c @@ -0,0 +1,57 @@ +/* Test of u32_strlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Empty string. */ + { + static const uint32_t input[] = { 0 }; + ASSERT (u32_strlen (input) == 0); + } + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + ASSERT (u32_strlen (input) == SIZEOF (input) - 1); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + ASSERT (u32_strlen (input) == SIZEOF (input) - 1); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strmblen.c b/tests/unistr/test-u32-strmblen.c new file mode 100644 index 0000000..733f8fc --- /dev/null +++ b/tests/unistr/test-u32-strmblen.c @@ -0,0 +1,75 @@ +/* Test of u32_strmblen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + ret = u32_strmblen (input); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + ret = u32_strmblen (buf); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC, 0 }; + ret = u32_strmblen (input); + ASSERT (ret == 1); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F, 0 }; + ret = u32_strmblen (input); + ASSERT (ret == 1); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000, 0 }; + ret = u32_strmblen (input); + ASSERT (ret == -1); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-strmbtouc.c b/tests/unistr/test-u32-strmbtouc.c new file mode 100644 index 0000000..79c222e --- /dev/null +++ b/tests/unistr/test-u32-strmbtouc.c @@ -0,0 +1,86 @@ +/* Test of u32_strmbtouc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == 0); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, buf); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F, 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == 1); + ASSERT (uc == 0x1D51F); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000, 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-strncat.c b/tests/unistr/test-u32-strncat.c new file mode 100644 index 0000000..346bafb --- /dev/null +++ b/tests/unistr/test-u32-strncat.c @@ -0,0 +1,59 @@ +/* Test of u32_strncat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNCAT u32_strncat +#define MAGIC 0xBADFACE +#include "test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strncmp.c b/tests/unistr/test-u32-strncmp.c new file mode 100644 index 0000000..d69913d --- /dev/null +++ b/tests/unistr/test-u32-strncmp.c @@ -0,0 +1,47 @@ +/* Test of u32_strncmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNCMP u32_strncmp +#include "test-strncmp.h" + +int +main () +{ + test_strncmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0x1D51F, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strncpy.c b/tests/unistr/test-u32-strncpy.c new file mode 100644 index 0000000..9309c0e --- /dev/null +++ b/tests/unistr/test-u32-strncpy.c @@ -0,0 +1,59 @@ +/* Test of u32_strncpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNCPY u32_strncpy +#define MAGIC 0xBADFACE +#include "test-strncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strnlen.c b/tests/unistr/test-u32-strnlen.c new file mode 100644 index 0000000..6929914 --- /dev/null +++ b/tests/unistr/test-u32-strnlen.c @@ -0,0 +1,56 @@ +/* Test of u32_strnlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNLEN u32_strnlen +#include "test-strnlen.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-to-u16.c b/tests/unistr/test-u32-to-u16.c new file mode 100644 index 0000000..6faf537 --- /dev/null +++ b/tests/unistr/test-u32-to-u16.c @@ -0,0 +1,156 @@ +/* Test of u32_to_u16() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint32_t *input, size_t input_length, + const uint16_t *expected, size_t expected_length) +{ + size_t length; + uint16_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u16 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint16_t *preallocated; + + length = expected_length - 1; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u32_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint16_t *preallocated; + + length = expected_length; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u32_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint16_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + static const uint16_t expected[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint32_t input[] = { 'x', 0x340000, 0x50000000, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint16_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint16_t *result; + uint16_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u16 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u32_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u32_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u32-to-u8.c b/tests/unistr/test-u32-to-u8.c new file mode 100644 index 0000000..933fba0 --- /dev/null +++ b/tests/unistr/test-u32-to-u8.c @@ -0,0 +1,159 @@ +/* Test of u32_to_u8() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint32_t *input, size_t input_length, + const uint8_t *expected, size_t expected_length) +{ + size_t length; + uint8_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u8 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint8_t *preallocated; + + length = expected_length - 1; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u32_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint8_t *preallocated; + + length = expected_length; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u32_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint8_t expected[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + static const uint8_t expected[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint32_t input[] = { 'x', 0x340000, 0x50000000, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint8_t expected[] = + { 'x', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint8_t *result; + uint8_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u8 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u32_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u32_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u32-uctomb.c b/tests/unistr/test-u32-uctomb.c new file mode 100644 index 0000000..0a25177 --- /dev/null +++ b/tests/unistr/test-u32-uctomb.c @@ -0,0 +1,104 @@ +/* Test of u32_uctomb() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define MAGIC 0xBADFACE + +int +main () +{ + /* Test ISO 646 character, in particular the NUL character. */ + { + ucs4_t uc; + + for (uc = 0; uc < 0x80; uc++) + { + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; + + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + } + + /* Test BMP character. */ + { + ucs4_t uc = 0x20AC; + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; + + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + + /* Test non-BMP character. */ + { + ucs4_t uc = 0x10FFFD; + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; + + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + + /* Test invalid characters. */ + { + ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; + uint32_t buf[2] = { MAGIC, MAGIC }; + size_t i; + + for (i = 0; i < SIZEOF (invalid); i++) + { + ucs4_t uc = invalid[i]; + int n; + + for (n = 0; n <= 2; n++) + { + int ret = u32_uctomb (buf, uc, n); + ASSERT (ret == -1); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/unistr/test-u8-check.c b/tests/unistr/test-u8-check.c new file mode 100644 index 0000000..a32d385 --- /dev/null +++ b/tests/unistr/test-u8-check.c @@ -0,0 +1,188 @@ +/* Test of u8_check() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint8_t input[] = ""; + ASSERT (u8_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint8_t input[] = /* "Данило Шеган" */ + "\320\224\320\260\320\275\320\270\320\273\320\276 \320\250\320\265\320\263\320\260\320\275"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + + /* Test out-of-range character with 4 bytes: U+110000. */ + { + static const uint8_t input[] = "\320\224\320\260\364\220\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test out-of-range character with 5 bytes: U+200000. */ + { + static const uint8_t input[] = "\320\224\320\260\370\210\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test out-of-range character with 6 bytes: U+4000000. */ + { + static const uint8_t input[] = "\320\224\320\260\374\204\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid lead byte. */ + { + static const uint8_t input[] = "\320\224\320\260\376\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\377\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\301\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\340\200\277"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\360\200\277\277"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\302\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\302\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\302\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\342\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\342\100\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\300\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\200\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\200\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\362\100\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\300\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\100\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\300\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\302"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\342\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\362\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test missing lead byte. */ + { + static const uint8_t input[] = "\320\224\320\260\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test surrogate codepoints. */ + { + static const uint8_t input[] = "\320\224\320\260\355\240\200\355\260\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\355\260\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + return 0; +} diff --git a/tests/unistr/test-u8-chr.c b/tests/unistr/test-u8-chr.c new file mode 100644 index 0000000..7c4b999 --- /dev/null +++ b/tests/unistr/test-u8-chr.c @@ -0,0 +1,31 @@ +/* Test of u8_chr() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_CHR u8_chr +#define U_SET u8_set +#include "test-chr.h" diff --git a/tests/unistr/test-u8-cmp.c b/tests/unistr/test-u8-cmp.c new file mode 100644 index 0000000..73778c7 --- /dev/null +++ b/tests/unistr/test-u8-cmp.c @@ -0,0 +1,45 @@ +/* Test of u8_cmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_CMP u8_cmp +#define MAGIC 0xBA +#include "test-cmp.h" + +int +main () +{ + test_cmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E }; + static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0x00 }; + ASSERT (U_CMP (input1, input2, 4) > 0); + ASSERT (U_CMP (input2, input1, 4) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u8-cmp2.c b/tests/unistr/test-u8-cmp2.c new file mode 100644 index 0000000..8a7848e --- /dev/null +++ b/tests/unistr/test-u8-cmp2.c @@ -0,0 +1,28 @@ +/* Test of u8_cmp2() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_CMP2 u8_cmp2 +#define MAGIC 0xBA +#include "test-cmp2.h" diff --git a/tests/unistr/test-u8-cpy-alloc.c b/tests/unistr/test-u8-cpy-alloc.c new file mode 100644 index 0000000..2d35b8f --- /dev/null +++ b/tests/unistr/test-u8-cpy-alloc.c @@ -0,0 +1,29 @@ +/* Test of u8_cpy_alloc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "macros.h" + +#define UNIT uint8_t +#define U_CPY_ALLOC u8_cpy_alloc +#include "test-cpy-alloc.h" diff --git a/tests/unistr/test-u8-cpy.c b/tests/unistr/test-u8-cpy.c new file mode 100644 index 0000000..8d1152d --- /dev/null +++ b/tests/unistr/test-u8-cpy.c @@ -0,0 +1,28 @@ +/* Test of u8_cpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_CPY u8_cpy +#define MAGIC 0xBA +#include "test-cpy.h" diff --git a/tests/unistr/test-u8-mblen.c b/tests/unistr/test-u8-mblen.c new file mode 100644 index 0000000..75e92d6 --- /dev/null +++ b/tests/unistr/test-u8-mblen.c @@ -0,0 +1,155 @@ +/* Test of u8_mblen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test zero-length input. */ + { + static const uint8_t input[] = ""; + ret = u8_mblen (input, 0); + ASSERT (ret == -1); + } + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + ret = u8_mblen (input, 1); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + ret = u8_mblen (buf, 1); + ASSERT (ret == 1); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + ret = u8_mblen (input, 2); + ASSERT (ret == 2); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + ret = u8_mblen (input, 3); + ASSERT (ret == 3); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + ret = u8_mblen (input, 4); + ASSERT (ret == 4); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xC3 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF4 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xFE }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + ret = u8_mblen (input, 3); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; + ret = u8_mblen (input, 3); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + ret = u8_mblen (input, 3); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u8-mbsnlen.c b/tests/unistr/test-u8-mbsnlen.c new file mode 100644 index 0000000..8e68550 --- /dev/null +++ b/tests/unistr/test-u8-mbsnlen.c @@ -0,0 +1,61 @@ +/* Test of u8_mbsnlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + static const size_t expected[SIZEOF (input) + 1] = + { 0, + 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, + 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, + 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, + 56, 56, 56, 57, 57, 57, 58, + 59, 59, 59, 60, 60, 60, 61 + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u8_mbsnlen (input, n); + ASSERT (len == expected[n]); + } + } + + return 0; +} diff --git a/tests/unistr/test-u8-mbtouc-unsafe.c b/tests/unistr/test-u8-mbtouc-unsafe.c new file mode 100644 index 0000000..b093aa8 --- /dev/null +++ b/tests/unistr/test-u8-mbtouc-unsafe.c @@ -0,0 +1,33 @@ +/* Test of u8_mbtouc_unsafe() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u8-mbtouc.h" + +int +main () +{ + test_function (u8_mbtouc_unsafe); + + return 0; +} diff --git a/tests/unistr/test-u8-mbtouc.c b/tests/unistr/test-u8-mbtouc.c new file mode 100644 index 0000000..f6960a6 --- /dev/null +++ b/tests/unistr/test-u8-mbtouc.c @@ -0,0 +1,33 @@ +/* Test of u8_mbtouc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u8-mbtouc.h" + +int +main () +{ + test_function (u8_mbtouc); + + return 0; +} diff --git a/tests/unistr/test-u8-mbtouc.h b/tests/unistr/test-u8-mbtouc.h new file mode 100644 index 0000000..bcafb05 --- /dev/null +++ b/tests/unistr/test-u8-mbtouc.h @@ -0,0 +1,179 @@ +/* Test of u8_mbtouc() and u8_mbtouc_unsafe() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t)) +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 4); + ASSERT (ret == 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xC3 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF4 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xFE }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 3); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 1 || ret == 3); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 1 || ret == 3); + ASSERT (uc == 0xFFFD); + } +} diff --git a/tests/unistr/test-u8-mbtoucr.c b/tests/unistr/test-u8-mbtoucr.c new file mode 100644 index 0000000..88e08d3 --- /dev/null +++ b/tests/unistr/test-u8-mbtoucr.c @@ -0,0 +1,187 @@ +/* Test of u8_mbtoucr() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 4); + ASSERT (ret == 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xC3 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF4 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xFE }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u8-move.c b/tests/unistr/test-u8-move.c new file mode 100644 index 0000000..d18d8dd --- /dev/null +++ b/tests/unistr/test-u8-move.c @@ -0,0 +1,28 @@ +/* Test of u8_move() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_MOVE u8_move +#define MAGIC 0xBA +#include "test-move.h" diff --git a/tests/unistr/test-u8-next.c b/tests/unistr/test-u8-next.c new file mode 100644 index 0000000..c4e06b5 --- /dev/null +++ b/tests/unistr/test-u8-next.c @@ -0,0 +1,188 @@ +/* Test of u8_next() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + const uint8_t *ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u8_next (&uc, buf); + ASSERT (ret == buf + 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == input + 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == input + 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == input + 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xC3, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF4, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xFE, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0x82, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF0, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u8-prev.c b/tests/unistr/test-u8-prev.c new file mode 100644 index 0000000..61f47ef --- /dev/null +++ b/tests/unistr/test-u8-prev.c @@ -0,0 +1,315 @@ +/* Test of u8_prev() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +static int +check (const uint8_t *input, size_t input_length, ucs4_t *puc) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + if (u8_prev (&uc, input + input_length, input) != input) + return 1; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 'x'; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 2; + if (uc1 != uc) + return 3; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xC3; + *ptr++ = 0x97; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 4; + if (uc1 != uc) + return 5; + } + + /* Test recognition when preceded by a 3-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xE2; + *ptr++ = 0x84; + *ptr++ = 0x82; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 6; + if (uc1 != uc) + return 7; + } + + /* Test recognition when preceded by a 4-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xF0; + *ptr++ = 0x9D; + *ptr++ = 0x94; + *ptr++ = 0x9E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 8; + if (uc1 != uc) + return 9; + } + + *puc = uc; + return 0; +} + +static int +check_invalid (const uint8_t *input, size_t input_length) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + uc = 0xBADFACE; + if (u8_prev (&uc, input + input_length, input) != NULL) + return 1; + if (uc != 0xBADFACE) + return 2; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 'x'; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 3; + if (uc != 0xBADFACE) + return 4; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xC3; + *ptr++ = 0x97; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 5; + if (uc != 0xBADFACE) + return 6; + } + + /* Test recognition when preceded by a 3-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xE2; + *ptr++ = 0x84; + *ptr++ = 0x82; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 7; + if (uc != 0xBADFACE) + return 8; + } + + /* Test recognition when preceded by a 4-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xF0; + *ptr++ = 0x9D; + *ptr++ = 0x94; + *ptr++ = 0x9E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 9; + if (uc != 0xBADFACE) + return 10; + } + + return 0; +} + +int +main () +{ + ucs4_t uc; + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ASSERT (check (buf, 1, &uc) == 0); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xC3 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xE2 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF4 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xFE }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0xE4, 0xBF }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + return 0; +} diff --git a/tests/unistr/test-u8-set.c b/tests/unistr/test-u8-set.c new file mode 100644 index 0000000..e778fed --- /dev/null +++ b/tests/unistr/test-u8-set.c @@ -0,0 +1,29 @@ +/* Test of u8_set() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_SET u8_set +#define MAGIC 0xBA +#define VALUE 'x' +#include "test-set.h" diff --git a/tests/unistr/test-u8-stpcpy.c b/tests/unistr/test-u8-stpcpy.c new file mode 100644 index 0000000..94c0471 --- /dev/null +++ b/tests/unistr/test-u8-stpcpy.c @@ -0,0 +1,28 @@ +/* Test of u8_stpcpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STPCPY u8_stpcpy +#define MAGIC 0xBA +#include "test-stpcpy.h" diff --git a/tests/unistr/test-u8-stpncpy.c b/tests/unistr/test-u8-stpncpy.c new file mode 100644 index 0000000..4809626 --- /dev/null +++ b/tests/unistr/test-u8-stpncpy.c @@ -0,0 +1,52 @@ +/* Test of u8_stpncpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STPNCPY u8_stpncpy +#define MAGIC 0xBA +#include "test-stpncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strcat.c b/tests/unistr/test-u8-strcat.c new file mode 100644 index 0000000..7fa9e84 --- /dev/null +++ b/tests/unistr/test-u8-strcat.c @@ -0,0 +1,28 @@ +/* Test of u8_strcat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRCAT u8_strcat +#define MAGIC 0xBA +#include "test-strcat.h" diff --git a/tests/unistr/test-u8-strcmp.c b/tests/unistr/test-u8-strcmp.c new file mode 100644 index 0000000..313cd11 --- /dev/null +++ b/tests/unistr/test-u8-strcmp.c @@ -0,0 +1,34 @@ +/* Test of u8_strcmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u8_strcmp +#include "test-u8-strcmp.h" + +int +main () +{ + test_u8_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u8-strcmp.h b/tests/unistr/test-u8-strcmp.h new file mode 100644 index 0000000..9c25dac --- /dev/null +++ b/tests/unistr/test-u8-strcmp.h @@ -0,0 +1,42 @@ +/* Test of u8_strcmp() and u8_strcoll() functions. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#define UNIT uint8_t +#include "test-strcmp.h" + +static void +test_u8_strcmp (void) +{ + test_strcmp (); + + /* Test comparison between ASCII and non-ASCII characters. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 0xE2, 0x80, 0xA2, 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E, 0 }; + static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } +} diff --git a/tests/unistr/test-u8-strcoll.c b/tests/unistr/test-u8-strcoll.c new file mode 100644 index 0000000..ae5c9a4 --- /dev/null +++ b/tests/unistr/test-u8-strcoll.c @@ -0,0 +1,41 @@ +/* Test of u8_strcoll() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u8_strcoll +#include "test-u8-strcmp.h" + +int +main () +{ + /* This test relies on three facts: + - setlocale is not being called, therefore the locale is the "C" locale. + - In the "C" locale, strcoll is equivalent to strcmp. + - In the u8_strcoll implementation, Unicode strings that are not + convertible to the locale encoding are sorted higher than convertible + strings and compared according to u8_strcmp. */ + + test_u8_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u8-strcpy.c b/tests/unistr/test-u8-strcpy.c new file mode 100644 index 0000000..810f975 --- /dev/null +++ b/tests/unistr/test-u8-strcpy.c @@ -0,0 +1,28 @@ +/* Test of u8_strcpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRCPY u8_strcpy +#define MAGIC 0xBA +#include "test-strcpy.h" diff --git a/tests/unistr/test-u8-strdup.c b/tests/unistr/test-u8-strdup.c new file mode 100644 index 0000000..6da2151 --- /dev/null +++ b/tests/unistr/test-u8-strdup.c @@ -0,0 +1,27 @@ +/* Test of u8_strdup() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRDUP u8_strdup +#include "test-strdup.h" diff --git a/tests/unistr/test-u8-strlen.c b/tests/unistr/test-u8-strlen.c new file mode 100644 index 0000000..3dfa1b0 --- /dev/null +++ b/tests/unistr/test-u8-strlen.c @@ -0,0 +1,50 @@ +/* Test of u8_strlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Empty string. */ + { + static const uint8_t input[] = { 0 }; + ASSERT (u8_strlen (input) == 0); + } + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + ASSERT (u8_strlen (input) == SIZEOF (input) - 1); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strmblen.c b/tests/unistr/test-u8-strmblen.c new file mode 100644 index 0000000..bde3000 --- /dev/null +++ b/tests/unistr/test-u8-strmblen.c @@ -0,0 +1,149 @@ +/* Test of u8_strmblen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + ret = u8_strmblen (input); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + ret = u8_strmblen (buf); + ASSERT (ret == 1); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == 2); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == 3); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == 4); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xC3, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF4, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xFE, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0x82, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0xD0, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF0, 0x8F, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strmbtouc.c b/tests/unistr/test-u8-strmbtouc.c new file mode 100644 index 0000000..5591357 --- /dev/null +++ b/tests/unistr/test-u8-strmbtouc.c @@ -0,0 +1,188 @@ +/* Test of u8_strmbtouc() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 0); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, buf); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xC3, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xE2, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF4, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xFE, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xE2, 0x82, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xE2, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF0, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strncat.c b/tests/unistr/test-u8-strncat.c new file mode 100644 index 0000000..bb90041 --- /dev/null +++ b/tests/unistr/test-u8-strncat.c @@ -0,0 +1,52 @@ +/* Test of u8_strncat() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNCAT u8_strncat +#define MAGIC 0xBA +#include "test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strncmp.c b/tests/unistr/test-u8-strncmp.c new file mode 100644 index 0000000..f63cdaa --- /dev/null +++ b/tests/unistr/test-u8-strncmp.c @@ -0,0 +1,53 @@ +/* Test of u8_strncmp() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNCMP u8_strncmp +#include "test-strncmp.h" + +int +main () +{ + test_strncmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E, 0 }; + static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0 }; + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 3) > 0); + ASSERT (U_STRNCMP (input2, input1, 3) < 0); + ASSERT (U_STRNCMP (input1, input2, 4) > 0); + ASSERT (U_STRNCMP (input2, input1, 4) < 0); + ASSERT (U_STRNCMP (input1, input2, 5) > 0); + ASSERT (U_STRNCMP (input2, input1, 5) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strncpy.c b/tests/unistr/test-u8-strncpy.c new file mode 100644 index 0000000..64cabdc --- /dev/null +++ b/tests/unistr/test-u8-strncpy.c @@ -0,0 +1,52 @@ +/* Test of u8_strncpy() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNCPY u8_strncpy +#define MAGIC 0xBA +#include "test-strncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strnlen.c b/tests/unistr/test-u8-strnlen.c new file mode 100644 index 0000000..98de797 --- /dev/null +++ b/tests/unistr/test-u8-strnlen.c @@ -0,0 +1,49 @@ +/* Test of u8_strnlen() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNLEN u8_strnlen +#include "test-strnlen.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-to-u16.c b/tests/unistr/test-u8-to-u16.c new file mode 100644 index 0000000..02ef44f --- /dev/null +++ b/tests/unistr/test-u8-to-u16.c @@ -0,0 +1,158 @@ +/* Test of u8_to_u16() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint8_t *input, size_t input_length, + const uint16_t *expected, size_t expected_length) +{ + size_t length; + uint16_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u16 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint16_t *preallocated; + + length = expected_length - 1; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u8_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint16_t *preallocated; + + length = expected_length; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u8_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + static const uint16_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint8_t input[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + static const uint16_t expected[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint8_t input[] = { 'x', 0xC2, 0xC3, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint16_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint16_t *result; + uint16_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u16 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u8_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u8_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u8-to-u32.c b/tests/unistr/test-u8-to-u32.c new file mode 100644 index 0000000..d148e62 --- /dev/null +++ b/tests/unistr/test-u8-to-u32.c @@ -0,0 +1,158 @@ +/* Test of u8_to_u32() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint8_t *input, size_t input_length, + const uint32_t *expected, size_t expected_length) +{ + size_t length; + uint32_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u32 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint32_t *preallocated; + + length = expected_length - 1; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u8_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint32_t *preallocated; + + length = expected_length; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u8_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + static const uint32_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint8_t input[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + static const uint32_t expected[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint8_t input[] = { 'x', 0xC2, 0xC3, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint32_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint32_t *result; + uint32_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u32 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u8_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u8_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c new file mode 100644 index 0000000..8fbdc42 --- /dev/null +++ b/tests/unistr/test-u8-uctomb.c @@ -0,0 +1,157 @@ +/* Test of u8_uctomb() function. + Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define MAGIC 0xBA + +int +main () +{ + /* Test ISO 646 character, in particular the NUL character. */ + { + ucs4_t uc; + + for (uc = 0; uc < 0x80; uc++) + { + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + } + + /* Test 2-byte character. */ + { + ucs4_t uc = 0x00D7; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 2); + ASSERT (ret == 2); + ASSERT (buf[0] == 0xC3); + ASSERT (buf[1] == 0x97); + ASSERT (buf[2] == MAGIC); + } + + /* Test 3-byte character. */ + { + ucs4_t uc = 0x20AC; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 2); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + + ret = u8_uctomb (buf, uc, 3); + ASSERT (ret == 3); + ASSERT (buf[0] == 0xE2); + ASSERT (buf[1] == 0x82); + ASSERT (buf[2] == 0xAC); + ASSERT (buf[3] == MAGIC); + } + + /* Test 4-byte character. */ + { + ucs4_t uc = 0x10FFFD; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 2); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + + ret = u8_uctomb (buf, uc, 3); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + ASSERT (buf[2] == MAGIC); + + ret = u8_uctomb (buf, uc, 4); + ASSERT (ret == 4); + ASSERT (buf[0] == 0xF4); + ASSERT (buf[1] == 0x8F); + ASSERT (buf[2] == 0xBF); + ASSERT (buf[3] == 0xBD); + ASSERT (buf[4] == MAGIC); + } + + /* Test invalid characters. */ + { + ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + size_t i; + + for (i = 0; i < SIZEOF (invalid); i++) + { + ucs4_t uc = invalid[i]; + int n; + + for (n = 0; n <= 4; n++) + { + int ret = u8_uctomb (buf, uc, n); + ASSERT (ret == -1); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + ASSERT (buf[2] == MAGIC); + ASSERT (buf[3] == MAGIC); + ASSERT (buf[4] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/uniwbrk/test-u16-wordbreaks.c b/tests/uniwbrk/test-u16-wordbreaks.c index b5eb26c..c9a4f2a 100644 --- a/tests/uniwbrk/test-u16-wordbreaks.c +++ b/tests/uniwbrk/test-u16-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint16_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -59,14 +47,14 @@ main () for (i = 0; i < 61; i++) { - ASSERT (p[i] == ((i >= 4 && i <= 5) - || (i >= 9 && i <= 11) - || (i >= 23 && i <= 31) - || (i >= 35 && i <= 39) - || (i >= 42 && i <= 46) - || (i >= 48 && i <= 58) - || i == 60 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 4 && i <= 5) + || (i >= 9 && i <= 11) + || (i >= 23 && i <= 31) + || (i >= 35 && i <= 39) + || (i >= 42 && i <= 46) + || (i >= 48 && i <= 58) + || i == 60 + ? 1 : 0)); } free (p); } @@ -76,12 +64,12 @@ main () static const uint16_t input[67] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -90,14 +78,14 @@ main () for (i = 0; i < 67; i++) { - ASSERT (p[i] == ((i >= 5 && i <= 6) - || (i >= 10 && i <= 12) - || (i >= 25 && i <= 33) - || (i >= 37 && i <= 41) - || (i >= 44 && i <= 48) - || (i >= 50 && i <= 60) - || i == 66 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 5 && i <= 6) + || (i >= 10 && i <= 12) + || (i >= 25 && i <= 33) + || (i >= 37 && i <= 41) + || (i >= 44 && i <= 48) + || (i >= 50 && i <= 60) + || i == 66 + ? 1 : 0)); } free (p); } diff --git a/tests/uniwbrk/test-u32-wordbreaks.c b/tests/uniwbrk/test-u32-wordbreaks.c index c6feb84..4bb3232 100644 --- a/tests/uniwbrk/test-u32-wordbreaks.c +++ b/tests/uniwbrk/test-u32-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint32_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -59,14 +47,14 @@ main () for (i = 0; i < 61; i++) { - ASSERT (p[i] == ((i >= 4 && i <= 5) - || (i >= 9 && i <= 11) - || (i >= 23 && i <= 31) - || (i >= 35 && i <= 39) - || (i >= 42 && i <= 46) - || (i >= 48 && i <= 58) - || i == 60 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 4 && i <= 5) + || (i >= 9 && i <= 11) + || (i >= 23 && i <= 31) + || (i >= 35 && i <= 39) + || (i >= 42 && i <= 46) + || (i >= 48 && i <= 58) + || i == 60 + ? 1 : 0)); } free (p); } @@ -76,12 +64,12 @@ main () static const uint32_t input[67] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -90,14 +78,14 @@ main () for (i = 0; i < 67; i++) { - ASSERT (p[i] == ((i >= 5 && i <= 6) - || (i >= 10 && i <= 12) - || (i >= 25 && i <= 33) - || (i >= 37 && i <= 41) - || (i >= 44 && i <= 48) - || (i >= 50 && i <= 60) - || i == 66 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 5 && i <= 6) + || (i >= 10 && i <= 12) + || (i >= 25 && i <= 33) + || (i >= 37 && i <= 41) + || (i >= 44 && i <= 48) + || (i >= 50 && i <= 60) + || i == 66 + ? 1 : 0)); } free (p); } diff --git a/tests/uniwbrk/test-u8-wordbreaks.c b/tests/uniwbrk/test-u8-wordbreaks.c index c263302..a87ea19 100644 --- a/tests/uniwbrk/test-u8-wordbreaks.c +++ b/tests/uniwbrk/test-u8-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,16 +41,16 @@ main () for (i = 0; i < 91; i++) { - ASSERT (p[i] == ((i >= 6 && i <= 7) - || (i >= 11 && i <= 13) - || (i >= 37 && i <= 44) - || i == 46 || (i >= 50 && i <= 52) - || (i >= 54 && i <= 55) - || (i >= 58 && i <= 62) || (i >= 64 && i <= 67) - || i == 70 || i == 73 || i == 76 - || i == 77 || i == 80 || i == 83 - || i == 84 || i == 90 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 6 && i <= 7) + || (i >= 11 && i <= 13) + || (i >= 37 && i <= 44) + || i == 46 || (i >= 50 && i <= 52) + || (i >= 54 && i <= 55) + || (i >= 58 && i <= 62) || (i >= 64 && i <= 67) + || i == 70 || i == 73 || i == 76 + || i == 77 || i == 80 || i == 83 + || i == 84 || i == 90 + ? 1 : 0)); } free (p); } @@ -79,16 +67,16 @@ main () for (i = 0; i < 106; i++) { - ASSERT (p[i] == ((i >= 7 && i <= 8) - || (i >= 12 && i <= 14) - || (i >= 40 && i <= 47) - || i == 49 || (i >= 53 && i <= 55) - || (i >= 57 && i <= 58) - || (i >= 61 && i <= 65) || (i >= 67 && i <= 70) - || i == 73 || i == 76 || i == 79 - || i == 80 || i == 83 || i == 86 - || i == 87 || i == 105 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 7 && i <= 8) + || (i >= 12 && i <= 14) + || (i >= 40 && i <= 47) + || i == 49 || (i >= 53 && i <= 55) + || (i >= 57 && i <= 58) + || (i >= 61 && i <= 65) || (i >= 67 && i <= 70) + || i == 73 || i == 76 || i == 79 + || i == 80 || i == 83 || i == 86 + || i == 87 || i == 105 + ? 1 : 0)); } free (p); } diff --git a/tests/uniwbrk/test-ulc-wordbreaks.c b/tests/uniwbrk/test-ulc-wordbreaks.c index 80284ab..732a412 100644 --- a/tests/uniwbrk/test-ulc-wordbreaks.c +++ b/tests/uniwbrk/test-ulc-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -21,21 +21,9 @@ #include "uniwbrk.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -59,12 +47,12 @@ main () for (i = 0; i < 36; i++) { - ASSERT (p[i] == ((i >= 4 && i <= 5) - || (i >= 9 && i <= 17) - || (i >= 21 && i <= 25) - || (i >= 28 && i <= 32) - || (i >= 34 && i <= 35) - ? 1 : 0)); + ASSERT (p[i] == ((i >= 4 && i <= 5) + || (i >= 9 && i <= 17) + || (i >= 21 && i <= 25) + || (i >= 28 && i <= 32) + || (i >= 34 && i <= 35) + ? 1 : 0)); } free (p); } diff --git a/tests/uniwidth/test-u16-strwidth.c b/tests/uniwidth/test-u16-strwidth.c index 7365426..1d7750c 100644 --- a/tests/uniwidth/test-u16-strwidth.c +++ b/tests/uniwidth/test-u16-strwidth.c @@ -1,5 +1,5 @@ /* Test of u16_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,8 +40,8 @@ main () { static const uint16_t input[] = /* "Данило Шеган" */ { - 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', - 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 + 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', + 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 }; ASSERT (u16_strwidth (input, "UTF-8") == 12); ASSERT (u16_strwidth (input, "EUC-JP") == 23); diff --git a/tests/uniwidth/test-u16-width.c b/tests/uniwidth/test-u16-width.c index b3e2b59..2d10c6c 100644 --- a/tests/uniwidth/test-u16-width.c +++ b/tests/uniwidth/test-u16-width.c @@ -1,5 +1,5 @@ /* Test of u16_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u32-strwidth.c b/tests/uniwidth/test-u32-strwidth.c index 3976daa..47ae8e9 100644 --- a/tests/uniwidth/test-u32-strwidth.c +++ b/tests/uniwidth/test-u32-strwidth.c @@ -1,5 +1,5 @@ /* Test of u32_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,8 +40,8 @@ main () { static const uint32_t input[] = /* "Данило Шеган" */ { - 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', - 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 + 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', + 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 }; ASSERT (u32_strwidth (input, "UTF-8") == 12); ASSERT (u32_strwidth (input, "EUC-JP") == 23); diff --git a/tests/uniwidth/test-u32-width.c b/tests/uniwidth/test-u32-width.c index 05fd856..ffb649f 100644 --- a/tests/uniwidth/test-u32-width.c +++ b/tests/uniwidth/test-u32-width.c @@ -1,5 +1,5 @@ /* Test of u32_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u8-strwidth.c b/tests/uniwidth/test-u8-strwidth.c index 3fbb39e..bb739a5 100644 --- a/tests/uniwidth/test-u8-strwidth.c +++ b/tests/uniwidth/test-u8-strwidth.c @@ -1,5 +1,5 @@ /* Test of u8_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u8-width.c b/tests/uniwidth/test-u8-width.c index b253289..c100d6f 100644 --- a/tests/uniwidth/test-u8-width.c +++ b/tests/uniwidth/test-u8-width.c @@ -1,5 +1,5 @@ /* Test of u8_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-uc_width.c b/tests/uniwidth/test-uc_width.c index d7335cf..7cfab61 100644 --- a/tests/uniwidth/test-uc_width.c +++ b/tests/uniwidth/test-uc_width.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-uc_width2.c b/tests/uniwidth/test-uc_width2.c index 2bf143c..3126d4c 100644 --- a/tests/uniwidth/test-uc_width2.c +++ b/tests/uniwidth/test-uc_width2.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 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 @@ -21,19 +21,8 @@ #include "uniwidth.h" #include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* One of 0, '0', '1', 'A', '2'. */ static char current_width; @@ -47,10 +36,10 @@ finish_interval (void) if (current_width != 0) { if (current_start == current_end) - printf ("%04X\t\t%c\n", (unsigned) current_start, current_width); + printf ("%04X\t\t%c\n", (unsigned) current_start, current_width); else - printf ("%04X..%04X\t%c\n", (unsigned) current_start, - (unsigned) current_end, current_width); + printf ("%04X..%04X\t%c\n", (unsigned) current_start, + (unsigned) current_end, current_width); current_width = 0; } } @@ -78,18 +67,18 @@ main () int w1 = uc_width (uc, "UTF-8"); int w2 = uc_width (uc, "GBK"); char width = - (w1 == 0 && w2 == 0 ? '0' : - w1 == 1 && w2 == 1 ? '1' : - w1 == 1 && w2 == 2 ? 'A' : - w1 == 2 && w2 == 2 ? '2' : - 0); + (w1 == 0 && w2 == 0 ? '0' : + w1 == 1 && w2 == 1 ? '1' : + w1 == 1 && w2 == 2 ? 'A' : + w1 == 2 && w2 == 2 ? '2' : + 0); if (width == 0) - { - /* uc must be a control character. */ - ASSERT (w1 < 0 && w2 < 0); - } + { + /* uc must be a control character. */ + ASSERT (w1 < 0 && w2 < 0); + } else - add_to_interval (uc, width); + add_to_interval (uc, width); } finish_interval (); diff --git a/tests/unsetenv.c b/tests/unsetenv.c index 73ea878..65a19cc 100644 --- a/tests/unsetenv.c +++ b/tests/unsetenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1995-1999,2000-2002,2005-2008 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2002, 2005-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -16,6 +16,10 @@ #include <config.h> +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + optimizes away the name == NULL test below. */ +#define _GL_ARG_NONNULL(params) + /* Specification. */ #include <stdlib.h> @@ -28,15 +32,15 @@ #include <unistd.h> #if !_LIBC -# define __environ environ +# define __environ environ #endif #if _LIBC /* This lock protects against simultaneous modifications of `environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) -# define LOCK __libc_lock_lock (envlock) -# define UNLOCK __libc_lock_unlock (envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK @@ -47,6 +51,7 @@ __libc_lock_define_initialized (static, envlock) # define unsetenv __unsetenv #endif +#if _LIBC || !HAVE_UNSETENV int unsetenv (const char *name) @@ -68,13 +73,13 @@ unsetenv (const char *name) while (*ep != NULL) if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { - /* Found it. Remove this pointer by moving later ones back. */ - char **dp = ep; + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; - do - dp[0] = dp[1]; - while (*dp++); - /* Continue the loop in case NAME appears again. */ + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ } else ++ep; @@ -88,3 +93,28 @@ unsetenv (const char *name) # undef unsetenv weak_alias (__unsetenv, unsetenv) #endif + +#else /* HAVE_UNSETENV */ + +# undef unsetenv + +/* Call the underlying unsetenv, in case there is hidden bookkeeping + that needs updating beyond just modifying environ. */ +int +rpl_unsetenv (const char *name) +{ + int result = 0; + if (!name || !*name || strchr (name, '=')) + { + errno = EINVAL; + return -1; + } + while (getenv (name)) +# if !VOID_UNSETENV + result = +# endif + unsetenv (name); + return result; +} + +#endif /* HAVE_UNSETENV */ diff --git a/tests/wctob.c b/tests/wctob.c index 4fa71b0..1d1cc7b 100644 --- a/tests/wctob.c +++ b/tests/wctob.c @@ -1,5 +1,5 @@ /* Convert wide character to unibyte character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify diff --git a/tests/xalloc-die.c b/tests/xalloc-die.c index 0a0694f..4b22040 100644 --- a/tests/xalloc-die.c +++ b/tests/xalloc-die.c @@ -1,7 +1,7 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free - Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2009, 2010 + 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 diff --git a/tests/xalloc.h b/tests/xalloc.h index 57a13e0..6122cc5 100644 --- a/tests/xalloc.h +++ b/tests/xalloc.h @@ -1,7 +1,8 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2003, 2004, 2006, 2007, 2008, 2009, 2010 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 @@ -105,10 +106,10 @@ char *xstrdup (char const *str) ATTRIBUTE_MALLOC; # if HAVE_INLINE # define static_inline static inline # else - void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; - void *xnrealloc (void *p, size_t n, size_t s); - void *x2nrealloc (void *p, size_t *pn, size_t s); - char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; +void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; +void *xnrealloc (void *p, size_t n, size_t s); +void *x2nrealloc (void *p, size_t *pn, size_t s); +char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; # endif # ifdef static_inline @@ -161,9 +162,9 @@ xnrealloc (void *p, size_t n, size_t s) void append_int (int value) { - if (used == allocated) - p = x2nrealloc (p, &allocated, sizeof *p); - p[used++] = value; + if (used == allocated) + p = x2nrealloc (p, &allocated, sizeof *p); + p[used++] = value; } This causes x2nrealloc to allocate a block of some nonzero size the @@ -181,12 +182,12 @@ xnrealloc (void *p, size_t n, size_t s) void append_int (int value) { - if (used == allocated) - { - p = x2nrealloc (p, &allocated1, sizeof *p); - allocated = allocated1; - } - p[used++] = value; + if (used == allocated) + { + p = x2nrealloc (p, &allocated1, sizeof *p); + allocated = allocated1; + } + p[used++] = value; } */ @@ -199,25 +200,25 @@ x2nrealloc (void *p, size_t *pn, size_t s) if (! p) { if (! n) - { - /* The approximate size to use for initial small allocation - requests, when the invoking code specifies an old size of - zero. 64 bytes is the largest "small" request for the - GNU C library malloc. */ - enum { DEFAULT_MXFAST = 64 }; - - n = DEFAULT_MXFAST / s; - n += !n; - } + { + /* The approximate size to use for initial small allocation + requests, when the invoking code specifies an old size of + zero. 64 bytes is the largest "small" request for the + GNU C library malloc. */ + enum { DEFAULT_MXFAST = 64 }; + + n = DEFAULT_MXFAST / s; + n += !n; + } } else { /* Set N = ceil (1.5 * N) so that progress is made if N == 1. - Check for overflow, so that N * S stays in size_t range. - The check is slightly conservative, but an exact check isn't - worth the trouble. */ + Check for overflow, so that N * S stays in size_t range. + The check is slightly conservative, but an exact check isn't + worth the trouble. */ if ((size_t) -1 / 3 * 2 / s <= n) - xalloc_die (); + xalloc_die (); n += (n + 1) / 2; } diff --git a/tests/xmalloc.c b/tests/xmalloc.c index 585fb4b..ecce529 100644 --- a/tests/xmalloc.c +++ b/tests/xmalloc.c @@ -1,8 +1,8 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008-2009 Free Software Foundation, - Inc. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 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 diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h index a38a2cf..cfab200 100644 --- a/tests/zerosize-ptr.h +++ b/tests/zerosize-ptr.h @@ -1,5 +1,5 @@ /* Return a pointer to a zero-size object in memory. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 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 @@ -57,11 +57,11 @@ zerosize_ptr (void) { int pagesize = getpagesize (); char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - return two_pages + pagesize; + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + return two_pages + pagesize; } #endif return NULL; @@ -1,6 +1,6 @@ # Version number and release date. -VERSION_NUMBER=0.9.1.1 -RELEASE_DATE=2009-08-17 # in "date +%Y-%m-%d" format +VERSION_NUMBER=0.9.3 +RELEASE_DATE=2010-05-02 # in "date +%Y-%m-%d" format # Version of gnulib that was used in this release. -GNULIB_GIT_COMMIT=077d9afeabe70728bec79f7ea9eff0264a7fccdc +GNULIB_GIT_COMMIT=28f3679a51f29cdaa8cb6c8211fa6ecaad3a852c diff --git a/woe32dll/export.h b/woe32dll/export.h index 3e8a21f..6404832 100644 --- a/woe32dll/export.h +++ b/woe32dll/export.h @@ -95,12 +95,12 @@ /* Ensure that the variable x is exported from the library, and that a pseudo-variable IMP(x) is available. */ #define VARIABLE(x) \ - /* Export x without redefining x. This code was found by compiling a \ - snippet: \ - extern __declspec(dllexport) int x; int x = 42; */ \ - asm (".section .drectve\n"); \ - asm (".ascii \" -export:" #x ",data\"\n"); \ - asm (".data\n"); \ - /* Allocate a pseudo-variable IMP(x). */ \ - extern int x; \ + /* Export x without redefining x. This code was found by compiling a \ + snippet: \ + extern __declspec(dllexport) int x; int x = 42; */ \ + asm (".section .drectve\n"); \ + asm (".ascii \" -export:" #x ",data\"\n"); \ + asm (".data\n"); \ + /* Allocate a pseudo-variable IMP(x). */ \ + extern int x; \ void * IMP(x) = &x; |